Creates the String value for this vfs file value element.<p>

@param cms the cms context

@return the String value for this vfs file value element
321053
private String createStringValue(CmsObject cms) {

        Attribute enabled = m_element.attribute(CmsXmlPage.ATTRIBUTE_ENABLED);

        String content = "";
        if ((enabled == null) || Boolean.valueOf(enabled.getText()).booleanValue()) {
            CmsLink link = getLink(cms);
            if (link != null) {
                content = link.getUri();
                if (cms != null) {
                    content = cms.getRequestContext().removeSiteRoot(link.getUri());
                }
            }
        }
        return content;
    }
85591
public static CmsPathValue getPathValue(CmsClientProperty property, Mode mode) {

        if (property != null) {
            return property.getPathValue(mode);
        }
        switch (mode) {
            case resource:
                return new CmsPathValue("", PATH_RESOURCE_VALUE);
            case structure:
                return new CmsPathValue("", PATH_STRUCTURE_VALUE);
            case effective:
                return new CmsPathValue("", PATH_STRUCTURE_VALUE);
            default:
                throw new IllegalArgumentException();
        }
    }
701568
public String createToken(CmsObject cms) throws CmsException {

        CmsUser user = cms.getRequestContext().getCurrentUser();
        String key = RandomStringUtils.randomAlphanumeric(16);
        Token tokenObj = new Token(user.getName(), key);
        String token = tokenObj.encode();
        String addInfoKey = tokenObj.getAdditionalInfoKey();
        String value = "" + (System.currentTimeMillis() + m_lifetime);
        user.getAdditionalInfo().put(addInfoKey, value);
        removeExpiredTokens(user, System.currentTimeMillis());
        LOG.info("Generated token for user " + user.getName() + " using key " + key);
        m_adminCms.writeUser(user);

        return token;
    }
1047755
public static String getFileExplorerLink(CmsObject cms, String siteRoot) {

        return CmsVaadinUtils.getWorkplaceLink()
            + "#!"
            + CmsFileExplorerConfiguration.APP_ID
            + "/"
            + cms.getRequestContext().getCurrentProject().getUuid()
            + "!!"
            + siteRoot
            + "!!";
    }
1265537
protected static String getResourceName(CmsObject cms, I_CmsResourceContainer contentContainer) {

        if ((contentContainer != null) && (contentContainer.getResourceName() != null)) {
            return contentContainer.getResourceName();
        } else if (cms != null) {
            return cms.getRequestContext().getUri();
        } else {
            return null;
        }
    }
980189
public static CmsSearchFieldMappingType valueOf(String value) {

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) {
            return null;
        }
        value = value.trim().toLowerCase();
        if (STR_CONTENT.equals(value)) {
            return CONTENT;
        } else if (STR_PROPERTY.equals(value)) {
            return PROPERTY;
        } else if (STR_PROPERTY_SEARCH.equals(value)) {
            return PROPERTY_SEARCH;
        } else if (STR_ITEM.equals(value)) {
            return ITEM;
        } else if (STR_DYNAMIC.equals(value)) {
            return DYNAMIC;
        } else if (STR_ATTRIBUTE.equals(value)) {
            return ATTRIBUTE;
        }
        return null;
    }
1077074
private String getString(I_CmsXmlContentLocation val, String path, String defaultValue) {

        if ((val != null)) {
            I_CmsXmlContentValueLocation subVal = val.getSubValue(path);
            if ((subVal != null) && (subVal.getValue() != null)) {
                return subVal.getValue().getStringValue(m_cms);
            }
        }
        return defaultValue;
    }
309835
public CmsXmlContentErrorHandler saveContent(Map<String, String> contentValues) throws CmsUgcException {

        checkNotFinished();
        try {
            CmsFile file = m_cms.readFile(m_editResource);
            CmsXmlContent content = addContentValues(file, contentValues);
            CmsXmlContentErrorHandler errorHandler = content.validate(m_cms);
            if (!errorHandler.hasErrors()) {
                file.setContents(content.marshal());
                // the file content might have been modified during the write operation
                file = m_cms.writeFile(file);
            }

            return errorHandler;
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
            throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage());
        }

    }
226724
public CmsObject createRootCms(CmsObject cms) throws CmsException {

        CmsObject rootCms = OpenCms.initCmsObject(cms);
        Object logEntry = cms.getRequestContext().getAttribute(CmsLogEntry.ATTR_LOG_ENTRY);
        if (logEntry != null) {
            rootCms.getRequestContext().setAttribute(CmsLogEntry.ATTR_LOG_ENTRY, logEntry);
        }
        rootCms.getRequestContext().setSiteRoot("/");
        return rootCms;
    }
1001463
public CmsContainerPageBean getContainerPage(CmsObject cms) {

        Locale masterLocale = CmsLocaleManager.MASTER_LOCALE;
        Locale localeToLoad = null;
        // always use master locale if possible, otherwise use the first locale.
        // this is important for 'legacy' container pages which were created before container pages became locale independent
        if (m_cntPages.containsKey(masterLocale)) {
            localeToLoad = masterLocale;
        } else if (!m_cntPages.isEmpty()) {
            localeToLoad = m_cntPages.keySet().iterator().next();
        }
        if (localeToLoad == null) {
            return null;
        } else {
            CmsContainerPageBean result = m_cntPages.get(localeToLoad);
            return result;
        }
    }
97152
protected String getConfigValue(String key) {

        if (m_localizationContent != null) {
            try {
                return m_localizationContent.getStringValue(null, m_pathPrefix + key, m_locale);
            } catch (NullPointerException e) {
                // a cms object is needed, log this error
                if (LOG.isErrorEnabled()) {
                    LOG.error(Messages.get().getBundle().key(Messages.ERR_NULL_CMSOBJECT_0));
                }
            }
        }
        return null;
    }
138174
private String getNoEditReason(CmsObject cms, CmsResource containerPage) throws CmsException {

        return new CmsResourceUtil(cms, containerPage).getNoEditReason(
            OpenCms.getWorkplaceManager().getWorkplaceLocale(cms));
    }
365043
public static List<String> getAttachmentLocales(CmsObject cms, CmsResource content) {

        List<CmsResource> detailOnlyResources = CmsDetailOnlyContainerUtil.getDetailOnlyResources(cms, content);
        Set<String> validLocaleNames = Sets.newHashSet();
        List<String> result = Lists.newArrayList();
        for (Locale locale : OpenCms.getLocaleManager().getAvailableLocales()) {
            validLocaleNames.add(locale.toString());
        }
        validLocaleNames.add(CmsDetailOnlyContainerUtil.LOCALE_ALL);
        for (CmsResource resource : detailOnlyResources) {
            String parent = CmsResource.getParentFolder(resource.getRootPath());
            String parentName = CmsResource.getName(parent);
            parentName = CmsFileUtil.removeTrailingSeparator(parentName);
            if (validLocaleNames.contains(parentName)) {
                result.add(parentName);
            }
        }
        return result;

    }
656458
public CmsPathValue getPathValue(Mode mode) {

        switch (mode) {
            case resource:
                return new CmsPathValue(m_resourceValue, PATH_RESOURCE_VALUE);
            case structure:
                return new CmsPathValue(m_structureValue, PATH_STRUCTURE_VALUE);
            case effective:
            default:
                return getPathValue();
        }
    }
694499
public String getDescription(CmsObject cms) {

        if (m_description == null) {
            if (m_element.element(PARAM_DESCRIPTION) != null) {
                m_description = m_element.element(PARAM_DESCRIPTION).getText();
            }
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_description)) {
                m_description = getParameterValue(cms, PARAM_DESCRIPTION);
                m_description = CmsEncoder.unescape(m_description, CmsEncoder.ENCODING_UTF_8);
            }
        }
        return m_description;
    }
156712
public static Map<String, String> readProperties(CmsObject cms, I_CmsXmlContentLocation baseLocation) {

        Map<String, String> result = new HashMap<String, String>();
        String elementName = CmsXmlContentProperty.XmlNode.Properties.name();
        String nameElementName = CmsXmlContentProperty.XmlNode.Name.name();
        List<I_CmsXmlContentValueLocation> propertyLocations = baseLocation.getSubValues(elementName);
        for (I_CmsXmlContentValueLocation propertyLocation : propertyLocations) {
            I_CmsXmlContentValueLocation nameLocation = propertyLocation.getSubValue(nameElementName);
            String name = nameLocation.asString(cms).trim();
            String value = null;
            I_CmsXmlContentValueLocation valueLocation = propertyLocation.getSubValue(
                CmsXmlContentProperty.XmlNode.Value.name());
            I_CmsXmlContentValueLocation stringLocation = valueLocation.getSubValue(
                CmsXmlContentProperty.XmlNode.String.name());
            I_CmsXmlContentValueLocation fileListLocation = valueLocation.getSubValue(
                CmsXmlContentProperty.XmlNode.FileList.name());
            if (stringLocation != null) {
                value = stringLocation.asString(cms).trim();
            } else if (fileListLocation != null) {
                List<CmsUUID> idList = new ArrayList<CmsUUID>();
                List<I_CmsXmlContentValueLocation> fileLocations = fileListLocation.getSubValues(
                    CmsXmlContentProperty.XmlNode.Uri.name());
                for (I_CmsXmlContentValueLocation fileLocation : fileLocations) {
                    CmsUUID structureId = fileLocation.asId(cms);
                    idList.add(structureId);
                }
                value = CmsStringUtil.listAsString(idList, CmsXmlContentProperty.PROP_SEPARATOR);
            }
            if (value != null) {
                result.put(name, value);
            }
        }
        return result;
    }
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();
        }
    }