Sets the OpenCms workplace site.<p>

@param newSite the OpenCms workplace site
427376
public void setWorkplaceSite(String newSite) {

        String oldSite = getWorkplaceSite();
        // get the site list
        String siteList = getExtProperty("site.root.list");
        // replace old site URL in site list with new site URL
        siteList = CmsStringUtil.substitute(siteList, oldSite, newSite);
        setExtProperty("site.root.list", siteList);
        setExtProperty("site.workplace", newSite);
    }
1346754
public void updateSite(CmsObject cms, CmsSite oldSite, CmsSite newSite) throws CmsException {

        if (oldSite != null) {
            // remove the old site
            removeSite(cms, oldSite);
        }

        if (newSite != null) {
            // add the new site
            addSite(cms, newSite);
        }
    }
536069
private void setServerLayout(final List<CmsSite> sites) {

        m_workplaceServerGroup = new CmsEditableGroup(m_serverLayout, new Supplier<Component>() {

            public Component get() {

                CmsWorkplaceServerWidget row = new CmsWorkplaceServerWidget(sites, null);
                return row;
            }
        }, "Add");

        for (String server : OpenCms.getSiteManager().getWorkplaceServers()) {
            CmsWorkplaceServerWidget row = new CmsWorkplaceServerWidget(sites, server);
            m_workplaceServerGroup.addRow(row);
        }
    }
326547
public void updateSitePath(String sitePath) {

        String oldPath = getSitePath();
        getListItemWidget().setSubtitleLabel(sitePath);
        for (Widget child : getChildren()) {
            ((CmsGalleryTreeItem)child).updateParentPath(sitePath, oldPath);
        }
    }
185629
public void setBuildHost( final CharSequence host) {
		if ( host != null) format.getHeader().createEntry( BUILDHOST, host);
	}
256361
public void addSharedSite() {

        String shared = OpenCms.getSiteManager().getSharedFolder();
        if (shared.endsWith("/")) {
            // IMPORTANT: remove last "/".
            // Otherwise the version without slash will be added as well when you are in the shared folder currently.
            shared = shared.substring(0, shared.length() - 1);
        }
        if ((shared != null) && m_cms.existsResource(shared, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
            addOption(
                Type.shared,
                shared,
                org.opencms.workplace.Messages.get().getBundle(
                    OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms)).key(
                        org.opencms.workplace.Messages.GUI_SHARED_TITLE_0));
        }
    }
804401
private void initSite() {

        Object o = null;
        if (CmsStringUtil.isEmpty(getParamAction()) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) {
            // this is the initial dialog call
            if (CmsStringUtil.isNotEmpty(m_paramSites)) {
                // edit an existing site, get it from manager
                o = OpenCms.getSiteManager().getSiteForSiteRoot(m_paramSites);
            }
        } else {
            // this is not the initial call, get site from session
            o = getDialogObject();
        }
        if (o instanceof CmsSite) {
            // reuse site stored in session
            m_site = new CmsSiteBean((CmsSite)o);
        } else if (o instanceof CmsSiteBean) {
            // create a new site
            m_site = (CmsSiteBean)o;
        } else if (DIALOG_NEW.equals(getParamEditaction())) {
            m_site = new CmsSiteBean();
        } else {
            try {
                getToolManager().jspForwardTool(this, "/sites", new HashMap<String, String[]>());
            } catch (Exception e) {
                // noop
            }
        }

        if (!m_site.hasSecureServer()) {
            m_site.setSecureUrl("");
        }
        try {
            CmsObject clone = OpenCms.initCmsObject(getCms());
            clone.getRequestContext().setSiteRoot("");
            String iconPath = m_site.getSiteRoot() + "/" + CmsSiteFaviconDialog.ICON_NAME;
            if (clone.existsResource(iconPath)) {
                m_site.setFavicon(iconPath);
            }
        } catch (Throwable t) {
            // noop
        }

        if (m_site.getSiteRoot() != null) {
            setSitename(CmsResource.getName(m_site.getSiteRoot()));
        }

        CmsModule module = OpenCms.getModuleManager().getModule(MODULE_NAME);
        m_createou = Boolean.valueOf(module.getParameter(PARAM_CREATE_OU, Boolean.FALSE.toString())).booleanValue();
        m_ouDescription = module.getParameter(PARAM_OU_DESCRIPTION, "OU for: %(site)");
        setDialogObject(m_site);
    }
651807
public void setSiteManager(CmsSiteManagerImpl siteManager) {

        m_siteManager = siteManager;
        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_SITE_CONFIG_FINISHED_0));
        }
    }
936772
public void init(CmsObject cms, Locale locale, I_CmsXmlDocument content, CmsResource resource) {

        m_cms = cms;
        m_requestedLocale = locale;
        m_content = content;
        m_resource = resource;
    }
1290722
public function createSite(
        Site $newSite
    ) {
        $newSite = $this->prepareNewSite($newSite);

        $entityManager = $this->getEntityManager();

        /** @var \Rcm\Repository\Page $pageRepo */
        $pageRepo = $entityManager->getRepository(\Rcm\Entity\Page::class);

        $user = $this->getCurrentUserTracking();

        $entityManager->persist($newSite);
        $entityManager->flush($newSite);

        $this->siteVersionRepo->publish(
            new SiteLocator($newSite->getDomainName()),
            $this->siteToImmutableSiteContent($newSite),
            $this->getCurrentUserTracking()->getId(),
            __CLASS__ . '::' . __FUNCTION__,
            $newSite->getSiteId()
        );

        foreach ($this->getDefaultSitePageSettings($user) as $name => $pageData) {
            $createdPage = $this->pageMutationService->createNewPage(
                $user,
                $newSite->getSiteId(),
                $pageData['name'],
                $pageData['pageType'],
                //Axosoft ticket #22776 was created to fix this @TODO. it is a pretty low priority issue
                $pageData //@TODO this is probably not in the correct format for plugins/blocks/pluginWrapper data
            );
            $this->pageMutationService->publishPageRevision(
                $user,
                $newSite->getSiteId(),
                $pageData['name'],
                $pageData['pageType'],
                $createdPage->getStagedRevision()->getRevisionId(),
                function ($pageName, $pageType = PageTypes::NORMAL, $pageRevision = null) {
                    if ($pageType !== PageTypes::NORMAL || $pageRevision !== null) {
                        throw new \Exception('Unsupported Case');

                        return '/' . $pageName;
                    }
                }
            );
        }

        return $newSite;
    }
174561
void openSitemapEditor() {

        CmsObject cms = A_CmsUI.getCmsObject();
        String siteRoot = cms.getRequestContext().getSiteRoot();
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(siteRoot)) {
            String path = getPath(cms, A_CmsUI.get().getHttpSession());
            if (path != null) {
                try {
                    CmsAppWorkplaceUi ui = CmsAppWorkplaceUi.get();
                    if (ui.beforeViewChange(
                        new ViewChangeEvent(ui.getNavigator(), ui.getCurrentView(), null, APP_ID, null))) {
                        CmsResource res = cms.readResource(CmsADEManager.PATH_SITEMAP_EDITOR_JSP);
                        String link = OpenCms.getLinkManager().substituteLink(cms, res);
                        A_CmsUI.get().getPage().setLocation(link + "?path=" + path);
                    }
                    return;
                } catch (CmsException e) {
                    LOG.debug("Unable to open sitemap editor.", e);
                }
            }
        }
        Notification.show(CmsVaadinUtils.getMessageText(Messages.GUI_SITEMAP_NOT_AVAILABLE_0), Type.WARNING_MESSAGE);
    }
690891
private void addServer(CmsSiteMatcher matcher, CmsSite site) {

        Map<CmsSiteMatcher, CmsSite> siteMatcherSites = new HashMap<CmsSiteMatcher, CmsSite>(m_siteMatcherSites);
        siteMatcherSites.put(matcher, site);
        setSiteMatcherSites(siteMatcherSites);
    }
902987
public void setSite(String value) {

        if ((value != null) && !value.equals(m_currentSite)) {
            m_currentSite = value;
            m_treeType = new HashMap<String, String>();
        }
    }
146341
protected void updateRoot(CmsObject rootCms, CmsResource siteRootResource) {

        m_root = siteRootResource;
        m_currentCms = rootCms;
        updateView();
    }
911902
public void init(CmsObject cms) {

        m_cms = cms;
        m_result = null;
        m_lastException = null;
        m_pageCount = 0;
        m_nextUrl = null;
        m_prevUrl = null;
    }
901454
@Override
    public void init(String webAppRfsPath, String servletMapping, String defaultWebApplication) {

        try {
            super.init(webAppRfsPath, servletMapping, defaultWebApplication);
            CmsUpdateInfo.INSTANCE.setAdeModuleVersion(getInstalledModules().get("org.opencms.ade.containerpage"));

            if (m_workplaceUpdateThread != null) {
                if (m_workplaceUpdateThread.isAlive()) {
                    m_workplaceUpdateThread.kill();
                }
                m_workplaceUpdateThread = null;
            }
            if (m_dbUpdateThread != null) {
                if (m_dbUpdateThread.isAlive()) {
                    m_dbUpdateThread.kill();
                }
                m_dbUpdateThread = null;
                m_newLoggingOffset = 0;
                m_oldLoggingOffset = 0;
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
98150
public void addNormalSites(boolean includeRoot, String startFolder) {

        CmsSiteManagerImpl siteManager = OpenCms.getSiteManager();
        List<CmsSite> sites = siteManager.getAvailableSites(m_cms, true, false, m_cms.getRequestContext().getOuFqn());
        try {
            CmsObject rootCms = OpenCms.initCmsObject(m_cms);
            rootCms.getRequestContext().setSiteRoot("/");
            if (sites.isEmpty()) {
                String siteRoot = m_cms.getRequestContext().getSiteRoot();
                if (!rootCms.existsResource(siteRoot, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
                    if (startFolder != null) {
                        siteRoot = CmsStringUtil.joinPaths(siteRoot, startFolder);
                    }
                    if ((startFolder == null)
                        || !rootCms.existsResource(siteRoot, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
                        siteRoot = null;
                    }
                }
                if (siteRoot != null) {
                    Type type = Type.site;
                    String message = siteRoot;
                    addOption(type, siteRoot, message);
                }
            }
            for (CmsSite site : sites) {
                // Do not add the shared site - it will be among sites if you are on the shared site at the moment.
                if (site.isSharedSite()) {
                    continue;
                }
                String siteRoot = site.getSiteRoot();
                if (!rootCms.existsResource(siteRoot, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
                    if (startFolder != null) {
                        siteRoot = CmsStringUtil.joinPaths(siteRoot, startFolder);
                    }
                    if ((startFolder == null)
                        || !rootCms.existsResource(siteRoot, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
                        siteRoot = null;
                    }
                }
                if (siteRoot != null) {
                    Type type = Type.site;
                    String message = null;
                    String title = site.getTitle();
                    if (!CmsStringUtil.isEmptyOrWhitespaceOnly(title)) {
                        message = title;
                    } else {
                        message = siteRoot;
                    }
                    if (siteRoot.equals("")) {
                        type = Type.root;
                        Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms);
                        message = Messages.get().getBundle(locale).key(Messages.GUI_ROOT_SITE_0);
                        if (!includeRoot) {
                            continue;
                        }
                    }
                    addOption(type, siteRoot, message);
                }
            }
        } catch (CmsException e) {
            LOG.error(e);
        }
    }