Sets the current cms context.<p>

@param cms the current cms context to set
19042
public synchronized void setCms(CmsObject cms) {

        if (m_perThreadCmsObject == null) {
            m_perThreadCmsObject = new ThreadLocal<CmsObject>();
        }
        m_perThreadCmsObject.set(cms);
    }
1365598
public void setPosition(CmsPositionBean position) {

        setPosition(position.getHeight(), position.getWidth(), position.getLeft(), position.getTop());
    }
84283
public void setScaleOptions(CmsObject cms, String scaleOptions) {

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(scaleOptions)) {
            m_scaleOptions = "";
            if (m_element.element(NODE_SCALE) != null) {
                m_element.remove(m_element.element(NODE_SCALE));
            }
        } else {
            m_scaleOptions = scaleOptions;
        }
        setParameterValue(cms, CmsImageScaler.PARAM_SCALE, scaleOptions);
    }
162610
public void setAdminCms(CmsObject cms) {

        if (m_adminCms != null) {
            LOG.error("Can not set admin CmsObject of configuration manager because it is already set.");
            return;
        }
        for (I_CmsXmlConfiguration config : m_configurations) {
            if (config instanceof I_CmsXmlConfigurationWithUpdateHandler) {
                ((I_CmsXmlConfigurationWithUpdateHandler)config).setCmsObject(cms);
            }
        }
        m_adminCms = cms;
    }
1308770
public void setLocale(Locale locale) throws CmsException {

        CmsUserSettings settings = getSettings();
        if (settings != null) {
            settings.setLocale(locale);
            settings.save(m_cms);
            m_messages = Messages.get().getBundle(locale);
        }
    }
206668
public void addSetting(String value, CmsXmlContentProperty config, boolean basic) {

        m_values.put(config.getName(), value);
        m_settingConfiguration.put(config.getName(), config);
        if (basic) {
            m_basicOptions.add(config.getName());
        }
    }
71600
public void updateCmsObject(CmsObject cms) {

        try {
            m_cms = OpenCms.initCmsObject(cms);
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
            m_cms = cms;
        }
    }
497500
protected void setParameters(CmsObject cms, String resourcePath) {

        try {
            CmsProperty prop = cms.readPropertyObject(resourcePath, ARGS_PROPERTY_DEFINITION, false);
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(prop.getValue())) {
                Map<String, String> argsMap = new HashMap<String, String>();
                Iterator<String> itArgs = CmsStringUtil.splitAsList(prop.getValue(), ARGUMENT_SEPARATOR).iterator();
                while (itArgs.hasNext()) {
                    String arg = "";
                    try {
                        arg = itArgs.next();
                        int pos = arg.indexOf(VALUE_SEPARATOR);
                        argsMap.put(arg.substring(0, pos), arg.substring(pos + 1));
                    } catch (StringIndexOutOfBoundsException e) {
                        LOG.error("sep: " + VALUE_SEPARATOR + "arg: " + arg);
                        throw e;
                    }
                }
                if (argsMap.get(ARG_PATH_NAME) != null) {
                    setPath(argsMap.get(ARG_PATH_NAME));
                }
                if (argsMap.get(ARG_CONFIRMATION_NAME) != null) {
                    setConfirmationMessage(argsMap.get(ARG_CONFIRMATION_NAME));
                }
                if (argsMap.get(ARG_PARAM_NAME) != null) {
                    setParameterString(argsMap.get(ARG_PARAM_NAME));
                }
            }
        } catch (CmsException e) {
            // should never happen
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
    }
356342
protected void setTemplateField() {

        try {
            CmsProperty template = m_clonedCms.readPropertyObject(
                getSiteRoot(),
                CmsPropertyDefinition.PROPERTY_TEMPLATE,
                false);
            if (template.isNullProperty()) {
                m_simpleFieldTemplate.setValue(null);
            } else {
                m_simpleFieldTemplate.setValue(template.getStructureValue());
            }
        } catch (CmsException e) {
            m_simpleFieldTemplate.setValue(null);
        }
    }
11883
public void setContextProperties(Map<String, String> contextProperties)
   {
      if (contextProperties != null) {
         this.contextProperties = new HashMap<String, String>(4);
         this.contextProperties.putAll(contextProperties);
      }
   }
296943
public void setContextInfo(CmsContextInfo contextInfo) {

        checkFrozen();
        if (contextInfo == null) {
            throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_BAD_CONTEXT_INFO_0));
        }
        m_context = contextInfo;
    }
691165
public static CmsWorkplaceSettings initSiteAndProject(CmsObject cms) {

        CmsWorkplaceSettings workplaceSettings = CmsWorkplace.initWorkplaceSettings(cms, null, false);
        String startSite = CmsWorkplace.getStartSiteRoot(cms, workplaceSettings);
        // switch to the preferred site
        workplaceSettings.setSite(startSite);
        cms.getRequestContext().setSiteRoot(startSite);
        // store the workplace settings
        CmsUserSettings settings = workplaceSettings.getUserSettings();
        // get the direct edit path

        try {
            CmsProject project = cms.readProject(settings.getStartProject());
            if (OpenCms.getOrgUnitManager().getAllAccessibleProjects(cms, project.getOuFqn(), false).contains(
                project)) {
                // user has access to the project, set this as current project
                workplaceSettings.setProject(project.getUuid());
                cms.getRequestContext().setCurrentProject(project);
            }
        } catch (CmsException e) {
            // unable to set the startup project, bad but not critical
            LOG.warn(
                Messages.get().getBundle().key(
                    Messages.LOG_LOGIN_NO_STARTUP_PROJECT_2,
                    cms.getRequestContext().getCurrentUser().getName(),
                    settings.getStartProject()),
                e);
        }
        return workplaceSettings;
    }
759786
public void initialize(CmsObject cms) throws CmsException {

        List<CmsOrganizationalUnit> ous = getOrganizationalUnits(cms, "", true);
        for (CmsOrganizationalUnit ou : ous) {
            try {
                m_securityManager.initializeOrgUnit(cms.getRequestContext(), ou);
            } catch (CmsInitException e) {
                LOG.error("Error while initializing OU " + ou.getName() + ": " + e.getLocalizedMessage(), e);
            }
        }
    }
345117
protected void setResource(CmsObject cms, CmsResource resource) {

        m_resource = CmsJspResourceWrapper.wrap(cms, resource);
    }
288696
public void setContent(final WComponent content) {
		WComponent oldContent = getContent();

		if (oldContent != null) {
			remove(oldContent);
		}

		if (content != null) {
			add(content);
		}
	}
40328
public boolean isShowInContext(String currentContext) {

        if ((m_settings == null)
            || !m_settings.containsKey(CmsTemplateContextInfo.SETTING)
            || CmsStringUtil.isEmptyOrWhitespaceOnly(m_settings.get(CmsTemplateContextInfo.SETTING))) {
            return true;
        }
        return CmsStringUtil.splitAsList(m_settings.get(CmsTemplateContextInfo.SETTING), "|").contains(currentContext);
    }
845955
public void setText(String text) {

        m_text = text;
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(text)) {
            setQuery(createTextQuery(text));
        }
    }