Gets CmsObject.<p>

@return cmsobject
174575
private CmsObject getCmsObject() {

        CmsObject cms;
        try {
            cms = OpenCms.initCmsObject(A_CmsUI.getCmsObject());
            //m_cms.getRequestContext().setSiteRoot("");
        } catch (CmsException e) {
            cms = A_CmsUI.getCmsObject();
        }
        return cms;
    }
350268
private CmsResource getContainerpage(CmsObject cms) throws CmsException {

        String currentUri = cms.getRequestContext().getUri();
        CmsResource containerPage = cms.readResource(currentUri);
        if (!CmsResourceTypeXmlContainerPage.isContainerPage(containerPage)) {
            // container page is used as template
            String cntPagePath = cms.readPropertyObject(
                containerPage,
                CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
                true).getValue("");
            try {
                containerPage = cms.readResource(cntPagePath);
            } catch (CmsException e) {
                if (!LOG.isDebugEnabled()) {
                    LOG.warn(e.getLocalizedMessage());
                }
                LOG.debug(e.getLocalizedMessage(), e);
            }
        }
        return containerPage;
    }
590963
public CmsProject getReferenceProject() {

        if (m_referenceProject == null) {
            if (m_request != null) {
                m_referenceProject = m_request.getCurrentProject();
            }
        }
        return m_referenceProject;
    }
898031
public CmsResource getOrCreateFolder(CmsObject cms) throws CmsException {

        CmsResource result = getFolder(cms);
        if (result != null) {
            return result;
        }
        return createFolder(cms);
    }
1250967
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                TreeDropdownField::create(
                    'SourceComponentID',
                    $this->fieldLabel('SourceComponentID'),
                    SiteTree::class
                )->setDisableFunction(function ($node) {
                    return (!($node instanceof BaseComponent) || $node->ID === $this->ID);
                })
            ]
        );
        
        // Create Option Fields:
        
        $fields->fieldByName('Root.Options.TitleOptions')->push(
            CheckboxField::create(
                'UseSourceTitle',
                $this->fieldLabel('UseSourceTitle')
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
1011215
CmsObject getRootCms() {

        try {
            if (m_rootCms == null) {

                m_rootCms = OpenCms.initCmsObject(A_CmsUI.getCmsObject());
                m_rootCms.getRequestContext().setSiteRoot("");
            }
        } catch (CmsException e) {
            //
        }
        return m_rootCms;

    }
1050141
public I_CmsWidget getWidgetObject() {

        if (getWidget() == null) {
            if (m_params == null) {
                return new CmsInputWidget();
            } else {
                return new CmsInputWidget(m_params);
            }
        }
        try {
            if (m_params == null) {
                return (I_CmsWidget)Class.forName(getWidget()).newInstance();
            }
            Class<?> clazz = Class.forName(getWidget());
            Constructor<?> ctor = clazz.getConstructor(new Class[] {String.class});
            return (I_CmsWidget)ctor.newInstance(new Object[] {m_params});
        } catch (Exception e) {
            return new CmsInputWidget();
        }
    }
182033
public static CmsShell getTopShell() {

        ArrayList<CmsShell> shells = SHELL_STACK.get();
        if (shells.isEmpty()) {
            return null;
        }
        return shells.get(shells.size() - 1);

    }
1374368
protected CmsObject getSearchCms(CmsGallerySearchBean searchObj) throws CmsException {

        CmsObject searchCms = getCmsObject();
        if (searchObj.isIncludeExpired()) {
            searchCms = OpenCms.initCmsObject(getCmsObject());
            searchCms.getRequestContext().setRequestTime(CmsResource.DATE_RELEASED_EXPIRED_IGNORE);
        }
        return searchCms;
    }
1192372
public CmsSolrQuery getQuery(CmsObject cms) {

        final CmsSolrQuery query = new CmsSolrQuery();

        // set categories
        query.setCategories(m_categories);

        // set container types
        if (null != m_containerTypes) {
            query.addFilterQuery(CmsSearchField.FIELD_CONTAINER_TYPES, m_containerTypes, false, false);
        }

        // Set date created time filter
        query.addFilterQuery(
            CmsSearchUtil.getDateCreatedTimeRangeFilterQuery(
                CmsSearchField.FIELD_DATE_CREATED,
                getDateCreatedRange().m_startTime,
                getDateCreatedRange().m_endTime));

        // Set date last modified time filter
        query.addFilterQuery(
            CmsSearchUtil.getDateCreatedTimeRangeFilterQuery(
                CmsSearchField.FIELD_DATE_LASTMODIFIED,
                getDateLastModifiedRange().m_startTime,
                getDateLastModifiedRange().m_endTime));

        // set scope / folders to search in
        m_foldersToSearchIn = new ArrayList<String>();
        addFoldersToSearchIn(m_folders);
        addFoldersToSearchIn(m_galleries);
        setSearchFolders(cms);
        query.addFilterQuery(
            CmsSearchField.FIELD_PARENT_FOLDERS,
            new ArrayList<String>(m_foldersToSearchIn),
            false,
            true);

        if (!m_ignoreSearchExclude) {
            // Reference for the values: CmsGallerySearchIndex.java, field EXCLUDE_PROPERTY_VALUES
            query.addFilterQuery(
                "-" + CmsSearchField.FIELD_SEARCH_EXCLUDE,
                Arrays.asList(
                    new String[] {
                        A_CmsSearchIndex.PROPERTY_SEARCH_EXCLUDE_VALUE_ALL,
                        A_CmsSearchIndex.PROPERTY_SEARCH_EXCLUDE_VALUE_GALLERY}),
                false,
                true);
        }

        // set matches per page
        query.setRows(new Integer(m_matchesPerPage));

        // set resource types
        if (null != m_resourceTypes) {
            List<String> resourceTypes = new ArrayList<>(m_resourceTypes);
            if (m_resourceTypes.contains(CmsResourceTypeFunctionConfig.TYPE_NAME)
                && !m_resourceTypes.contains(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION)) {
                resourceTypes.add(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION);
            }
            query.setResourceTypes(resourceTypes);
        }

        // set result page
        query.setStart(new Integer((m_resultPage - 1) * m_matchesPerPage));

        // set search locale
        if (null != m_locale) {
            query.setLocales(CmsLocaleManager.getLocale(m_locale));
        }

        // set search words
        if (null != m_words) {
            query.setQuery(m_words);
        }

        // set sort order
        query.setSort(getSort().getFirst(), getSort().getSecond());

        // set result collapsing by id
        query.addFilterQuery("{!collapse field=id}");

        query.setFields(CmsGallerySearchResult.getRequiredSolrFields());

        if ((m_allowedFunctions != null) && !m_allowedFunctions.isEmpty()) {
            String functionFilter = "((-type:("
                + CmsXmlDynamicFunctionHandler.TYPE_FUNCTION
                + " OR "
                + CmsResourceTypeFunctionConfig.TYPE_NAME
                + ")) OR (id:(";
            Iterator<CmsUUID> it = m_allowedFunctions.iterator();
            while (it.hasNext()) {
                CmsUUID id = it.next();
                functionFilter += id.toString();
                if (it.hasNext()) {
                    functionFilter += " OR ";
                }
            }
            functionFilter += ")))";
            query.addFilterQuery(functionFilter);
        }

        return query;
    }
1244081
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                FieldSection::create(
                    'EmailSection',
                    $this->fieldLabel('Email'),
                    [
                        TextField::create(
                            'EmailSubject',
                            $this->fieldLabel('EmailSubject')
                        )->setRightTitle(
                            _t(
                                __CLASS__ . '.EMAILSUBJECTRIGHTTITLE',
                                'Uses the title of the current page if blank.'
                            )
                        ),
                        TextField::create(
                            'EmailMessage',
                            $this->fieldLabel('EmailMessage')
                        )->setRightTitle(
                            _t(
                                __CLASS__ . '.EMAILMESSAGERIGHTTITLE',
                                'Included in the body of the email before the shared link.'
                            )
                        )
                    ]
                )
            ]
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
531235
void getBroadcast() {

        CmsCoreProvider.getService().getBroadcast(new AsyncCallback<List<CmsBroadcastMessage>>() {

            public void onFailure(Throwable caught) {

                // in case of a status code exception abort, indicates the session is no longer valid
                if ((caught instanceof StatusCodeException) && (((StatusCodeException)caught).getStatusCode() == 500)) {
                    CmsBroadcastTimer.abort();
                }
            }

            public void onSuccess(List<CmsBroadcastMessage> result) {

                if (result != null) {
                    for (CmsBroadcastMessage message : result) {
                        CmsNotification.get().sendAlert(Type.WARNING, createMessageHtml(message));
                    }
                }
            }
        });
    }
849368
public static CmsCoreProvider get() {

        if (INSTANCE == null) {
            try {
                INSTANCE = new CmsCoreProvider();
            } catch (SerializationException e) {
                CmsErrorDialog.handleException(
                    new Exception(
                        "Deserialization of core data failed. This may be caused by expired java-script resources, please clear your browser cache and try again.",
                        e));
            }
        }
        return INSTANCE;
    }
641681
public CmsFile getFile() {

        if ((m_file == null) && !isFolder()) {
            try {
                m_file = m_cms.readFile(this);
            } catch (CmsException e) {
                // this should not happen since we are updating from a resource object
            }
        }
        return m_file;
    }
431792
public CmsObject getOfflineCmsObject(CmsObject cms) {

        CmsObject res = null;
        try {
            if (!cms.getRequestContext().getCurrentProject().isOnlineProject()) {
                return OpenCms.initCmsObject(cms);
            }
            res = OpenCms.initCmsObject(cms);
            List<CmsProject> projects = OpenCms.getOrgUnitManager().getAllAccessibleProjects(res, "/", true);
            Iterator<CmsProject> projIterator = projects.iterator();
            boolean offFound = false;
            while (projIterator.hasNext() & !offFound) {
                CmsProject offP = projIterator.next();
                if (!offP.isOnlineProject()) {
                    res.getRequestContext().setCurrentProject(offP);
                    offFound = true;
                }
            }
        } catch (CmsException e) {
            return cms;
        }
        return res;
    }
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;
    }
558732
public String getSitePath(CmsObject cms) {

        if (m_path != null) {
            return m_path;
        } else if (m_folder != null) {
            return cms.getRequestContext().removeSiteRoot(m_folder.getRootPath());
        }
        return null;
    }