Get name of image in the VFS.<p>

@param cms CmsObject
@param oName Name of cached image file
@return vfs resource name (root path)
481608
String getVFSName(CmsObject cms, String oName) {

        oName = CmsStringUtil.substitute(oName, "\\", "/");
        if (!oName.startsWith("/")) {
            oName = "/" + oName;
        }

        if (PATH_TO_VFS_NAME.containsKey(oName)) {
            return PATH_TO_VFS_NAME.get(oName);
        }

        String imgName = oName;
        CmsResource res = null;
        boolean found = false;
        while (!found) {
            String path = CmsResource.getParentFolder(imgName);
            String name = imgName.substring(path.length());
            String ext = CmsFileUtil.getExtension(imgName);
            String nameWoExt = name.substring(0, name.length() - ext.length());
            int pos = nameWoExt.lastIndexOf("_");
            String newName = path;
            found = (pos < 0);
            if (!found) {
                newName += nameWoExt.substring(0, pos);
            } else {
                newName += nameWoExt;
            }
            newName += ext;
            try {
                res = cms.readResource(newName, CmsResourceFilter.ALL);
                found = true;
            } catch (Exception e) {
                // it could be a variation
            }
            imgName = newName;
        }

        if (res != null) {
            PATH_TO_VFS_NAME.put(oName, res.getRootPath());
            return res.getRootPath();
        }
        return "";
    }
177245
public String getRepositoryBaseFolderName(CmsObject cms) {

        String value = "";
        try {
            value = cms.readPropertyObject(
                CmsCategoryService.CENTRALIZED_REPOSITORY,
                CmsPropertyDefinition.PROPERTY_DEFAULT_FILE,
                false).getValue();
        } catch (CmsException e) {
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) {
            value = OpenCms.getWorkplaceManager().getCategoryFolder();
        }
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) {
            value = REPOSITORY_BASE_FOLDER;
        }
        if (!value.endsWith("/")) {
            value += "/";
        }
        if (!value.startsWith("/")) {
            value = "/" + value;
        }
        return value;
    }
1333917
private void getImageInfo(final String resourcePath, final I_CmsSimpleCallback<CmsImageInfoBean> callback) {

        CmsRpcAction<CmsImageInfoBean> action = new CmsRpcAction<CmsImageInfoBean>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                start(0, true);
                A_CmsResourcePreview.getService().getImageInfo(resourcePath, getLocale(), this);

            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(CmsImageInfoBean result) {

                stop(false);
                callback.execute(result);
            }
        };
        action.execute();
    }
808415
private String getCommonAncestorPath(Collection<CmsResource> resources) {

        if (resources.isEmpty()) {
            return "/";
        }
        String commonPath = null;
        for (CmsResource resource : resources) {
            commonPath = getCommonAncestorPath(commonPath, resource.getRootPath());
        }
        return commonPath;
    }
368660
public String getUserCreatedName(CmsObject cms) {

        try {
            return CmsPrincipal.readPrincipalIncludingHistory(cms, getUserCreated()).getName();
        } catch (CmsException e) {
            return getUserCreated().toString();
        }
    }
1057445
public static String getResourceName(Resource resource) {
        String result = null;
        if (resource != null) {
            String name = resource.getName();
            if (ResourceUtil.CONTENT_NODE.equals(name)) {
                result = getResourceName(resource.getParent());
            } else {
                result = name;
            }
        }
        return result;
    }
1113364
protected CmsObject getCms() {

        if (m_cms == null) {
            try {
                m_cms = OpenCms.initCmsObject(A_CmsUI.getCmsObject());
                m_cms.getRequestContext().setSiteRoot("");
            } catch (CmsException e) {
                return null;
            }
        }
        return m_cms;
    }
905742
public String getName() {

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_path)) {
            return "";
        }
        String result = CmsResource.getName(m_path);
        // remove trailing slash as categories are not displayed like folders
        if (CmsResource.isFolder(result)) {
            result = result.substring(0, result.length() - 1);
        }
        return result;
    }
62543
protected List<String> getResourceNamesFromParam(Map<String, String> params) {

        String resourcesParam = "/";
        if (params.containsKey(I_CmsListResourceCollector.PARAM_RESOURCES)) {
            resourcesParam = params.get(I_CmsListResourceCollector.PARAM_RESOURCES);
        }
        if (resourcesParam.length() == 0) {
            return Collections.emptyList();
        }
        return CmsStringUtil.splitAsList(resourcesParam, "#");
    }
627793
private String getTemplateName(CmsObject cms, CmsResource resource) throws CmsException {

        String templateName = (String)(m_templateNameCache.getCachedObject(cms, resource.getRootPath()));
        if (templateName == null) {
            CmsProperty nameProperty = cms.readPropertyObject(
                resource,
                CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
                false);
            String nameFromProperty = "";
            if (!nameProperty.isNullProperty()) {
                nameFromProperty = nameProperty.getValue();
            }
            m_templateNameCache.putCachedObject(cms, resource.getRootPath(), nameFromProperty);
            return nameFromProperty;
        } else {
            return templateName;
        }
    }
1323327
public static String getStaticResourceUri(String resourceName, String versionInfo) {

        resourceName = CmsStaticResourceHandler.removeStaticResourcePrefix(resourceName);
        String uri = CmsStringUtil.joinPaths(OpenCms.getSystemInfo().getStaticResourceContext(), resourceName);
        if (versionInfo != null) {
            uri += "?v=" + versionInfo;
        }
        return uri;
    }
1075005
public static int getDialogAction(CmsObject cms) {

        String fileName = CmsResource.getName(cms.getRequestContext().getUri());
        if (fileName == null) {
            // file name could not be determined, return "see locked subresources" action
            return TYPE_LOCKS;
        } else if (fileName.equalsIgnoreCase("lock.jsp")) {
            // a "lock" action is requested
            return TYPE_LOCK;
        } else if (fileName.indexOf("change") != -1) {
            // a "steal lock" action is requested
            return TYPE_LOCKCHANGE;
        } else if (fileName.indexOf("unlock") != -1) {
            // an "unlock" action is requested
            return TYPE_UNLOCK;
        } else {
            // an "see locked subresources" action is requested
            return TYPE_LOCKS;
        }
    }
692064
private String getPath(CmsObject cms, HttpSession session) {

        CmsQuickLaunchLocationCache locationCache = CmsQuickLaunchLocationCache.getLocationCache(session);
        String page = locationCache.getPageEditorLocation(cms.getRequestContext().getSiteRoot());
        if (page == null) {
            try {
                CmsResource mainDefaultFile = cms.readDefaultFile("/");
                if (mainDefaultFile != null) {
                    page = cms.getSitePath(mainDefaultFile);
                }
            } catch (CmsException e) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        return page;
    }
336477
protected String getFileEncoding(CmsObject cms, String filename) {

        try {
            return cms.readPropertyObject(filename, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true).getValue(
                OpenCms.getSystemInfo().getDefaultEncoding());
        } catch (CmsException e) {
            return OpenCms.getSystemInfo().getDefaultEncoding();
        }
    }
370665
public static String getResourceName(String keyName) {

        if (keyName.endsWith(CmsFlexCache.CACHE_OFFLINESUFFIX) | keyName.endsWith(CmsFlexCache.CACHE_ONLINESUFFIX)) {
            return keyName.split(" ")[0];
        } else {
            return "";
        }
    }
581697
public CmsSitemapTreeNodeData getData(CmsResource resource) {

        try {
            CmsVfsSitemapService svc = new CmsVfsSitemapService();
            CmsObject cms = OpenCms.initCmsObject(A_CmsUI.getCmsObject());
            cms.getRequestContext().setSiteRoot("");
            svc.setCms(cms);

            CmsClientSitemapEntry ent = svc.getChildren(resource.getRootPath(), resource.getStructureId(), 0);
            CmsSitemapTreeNodeData data = new CmsSitemapTreeNodeData(
                m_localeContext.getRootLocale(),
                m_localeContext.getComparisonLocale());
            data.setClientEntry(ent);
            data.initialize(cms);
            return data;
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
            return null;
        }

    }
1115078
public static String getOuAwareName(CmsObject cms, String name) {

        String ou = CmsOrganizationalUnit.getParentFqn(name);
        if (ou.equals(cms.getRequestContext().getCurrentUser().getOuFqn())) {
            return CmsOrganizationalUnit.getSimpleName(name);
        }
        return CmsOrganizationalUnit.SEPARATOR + name;
    }