This method is called by the cron scheduler.<p>

@param cms a OpenCms context object
@param parameters link check parameters
@return the String that is written to the OpenCms log
@throws CmsException if something goes wrong
428688
public String launch(CmsObject cms, Map<String, String> parameters) throws CmsException {

        if (Boolean.valueOf(parameters.get("writeLog")).booleanValue()) {
            m_report = new CmsLogReport(cms.getRequestContext().getLocale(), CmsExternalLinksValidator.class);
        }
        validateLinks(cms);
        return "CmsExternLinkValidator.launch(): Links checked.";
    }
1310965
public void publishResources(List<CmsResource> resources) throws CmsException {

        CmsObject cms = m_cms;
        I_CmsReport report = new CmsWorkplaceReport(
            cms.getRequestContext().getLocale(),
            cms.getRequestContext().getSiteRoot(),
            null);
        CmsPublishManager publishManager = OpenCms.getPublishManager();
        CmsPublishList publishList = publishManager.getPublishListAll(m_cms, resources, false, true);
        OpenCms.getPublishManager().publishProject(m_cms, report, publishList);
    }
1209294
protected CmsUserSearchParameters getSearchParams() throws CmsException {

        CmsListState state = getListState();
        CmsUserSearchParameters params = new CmsUserSearchParameters();
        String searchFilter = state.getFilter();
        params.setSearchFilter(searchFilter);
        params.setPaging(getList().getMaxItemsPerPage(), state.getPage());
        params.setSorting(getSortKey(state.getColumn()), state.getOrder().equals(CmsListOrderEnum.ORDER_ASCENDING));
        String groupStr = getParamGroup();
        if (!CmsStringUtil.isEmpty(groupStr)) {
            CmsGroup group = getCms().readGroup(getParamGroup());
            params.setGroup(group);
        } else {
            List<CmsOrganizationalUnit> ous = OpenCms.getRoleManager().getManageableOrgUnits(getCms(), "", true, false);
            params.setAllowedOus(ous);
        }
        if (getParamFlags() != null) {
            int flags = Integer.parseInt(getParamFlags());
            params.setFlags(flags);
        }
        params.setCaseSensitive(false);
        return params;
    }
1365670
@SuppressWarnings("unused")
    public Set<String> getCSSHeadIncludes(CmsObject cms, CmsResource resource) throws CmsException {

        return getCSSHeadIncludes();
    }
46579
public void cmsEvent(CmsEvent event) {

        if (!isStaticExportEnabled()) {
            if (LOG.isWarnEnabled()) {
                LOG.warn(Messages.get().getBundle().key(Messages.LOG_STATIC_EXPORT_DISABLED_0));
            }
            return;
        }
        I_CmsReport report = null;
        Map<String, Object> data = event.getData();
        if (data != null) {
            report = (I_CmsReport)data.get(I_CmsEventListener.KEY_REPORT);
        }
        if (report == null) {
            report = new CmsLogReport(CmsLocaleManager.getDefaultLocale(), getClass());
        }
        switch (event.getType()) {
            case I_CmsEventListener.EVENT_UPDATE_EXPORTS:
                scrubExportFolders(report);
                clearCaches(event);
                break;
            case I_CmsEventListener.EVENT_PUBLISH_PROJECT:
                if (data == null) {
                    if (LOG.isErrorEnabled()) {
                        LOG.error(Messages.get().getBundle().key(Messages.ERR_EMPTY_EVENT_DATA_0));
                    }
                    return;
                }
                // event data contains a list of the published resources
                CmsUUID publishHistoryId = new CmsUUID((String)data.get(I_CmsEventListener.KEY_PUBLISHID));
                if (LOG.isDebugEnabled()) {
                    LOG.debug(Messages.get().getBundle().key(Messages.LOG_EVENT_PUBLISH_PROJECT_1, publishHistoryId));
                }
                synchronized (m_lockCmsEvent) {
                    getHandler().performEventPublishProject(publishHistoryId, report);
                }
                clearCaches(event);

                if (LOG.isDebugEnabled()) {
                    LOG.debug(
                        Messages.get().getBundle().key(
                            Messages.LOG_EVENT_PUBLISH_PROJECT_FINISHED_1,
                            publishHistoryId));
                }

                break;
            case I_CmsEventListener.EVENT_CLEAR_CACHES:
                clearCaches(event);
                break;
            default:
                // no operation
        }
    }
138174
private String getNoEditReason(CmsObject cms, CmsResource containerPage) throws CmsException {

        return new CmsResourceUtil(cms, containerPage).getNoEditReason(
            OpenCms.getWorkplaceManager().getWorkplaceLocale(cms));
    }
416493
private CmsObject getOnlineCmsObject(CmsObject cms) {

        CmsObject res = null;
        try {
            res = OpenCms.initCmsObject(cms);
            res.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID));
        } catch (CmsException e) {
            LOG.error("Cannot create CmsObject", e);
        }
        return res;
    }
650311
protected CmsSubscriptionFilter getSubscriptionFilter(CmsObject cms, String param) throws CmsException {

        return getSubscriptionFilter(cms, getParameters(param));
    }
223618
public String displayDialog() throws IOException, CmsException {

        if ((OpenCms.getSiteManager().getSites().size() > 1)
            && !OpenCms.getSiteManager().isWorkplaceRequest(getRequest())) {

            // this is a multi site-configuration, but not a request to the configured Workplace site
            // do not send any redirects to the workplace site for security reasons
            getResponse().sendError(HttpServletResponse.SC_NOT_FOUND);
            return null;
        }

        CmsObject cms = getCmsObject();
        if (shouldUseNewLogin() && (cms.getRequestContext().getCurrentUser().isGuestUser())) {
            if (getRequest().getParameter(PARAM_ACTION_LOGOUT) != null) {
                getResponse().sendRedirect(OpenCms.getLinkManager().substituteLink(cms, "/system/login"));
                return "";
            } else {
                return CmsLoginUI.displayVaadinLoginDialog(getRequest(), getResponse());
            }
        }

        m_message = null;
        if (cms.getRequestContext().getCurrentUser().isGuestUser()) {
            // user is not currently logged in
            m_action = ACTION_DISPLAY;
            m_username = CmsRequestUtil.getNotEmptyParameter(getRequest(), PARAM_USERNAME);
            if (m_username != null) {
                // remove white spaces, can only lead to confusion on user name
                m_username = m_username.trim();
            }
            m_password = CmsRequestUtil.getNotEmptyParameter(getRequest(), PARAM_PASSWORD);
            m_actionLogin = CmsRequestUtil.getNotEmptyParameter(getRequest(), PARAM_ACTION_LOGIN);
            m_oufqn = getRequest().getParameter(PARAM_OUFQN);
            if (m_oufqn == null) {
                m_oufqn = getPreDefOuFqn();
            }
            if (OpenCms.getLoginManager().isEnableSecurity()) {
                // security option is enabled, try to get PC type from request parameter
                m_pcType = CmsRequestUtil.getNotEmptyParameter(getRequest(), PARAM_PCTYPE);
            } else {
                // if security option is disabled, just set PC type to "private" to get common login dialog
                m_pcType = PCTYPE_PRIVATE;
            }

            // try to get some info from a cookie
            getCookieData();

            // set PC type to "public" as default if not already set by cookie, request or if security option is disabled
            if (m_pcType == null) {
                m_pcType = PCTYPE_PUBLIC;
            }
        } else {
            // user is already logged in
            m_oufqn = cms.getRequestContext().getOuFqn();
            m_action = ACTION_LOGIN;
            m_actionLogout = CmsRequestUtil.getNotEmptyParameter(getRequest(), PARAM_ACTION_LOGOUT);
        }

        if (m_oufqn == null) {
            m_oufqn = CmsOrganizationalUnit.SEPARATOR;
        }

        String actionGetOus = CmsRequestUtil.getNotEmptyParameter(getRequest(), PARAM_ACTION_GETOULIST);
        if (Boolean.TRUE.toString().equals(actionGetOus)) {
            return getJsonOrgUnitList();
        }

        // initialize the right ou
        m_ou = null;
        try {
            m_ou = OpenCms.getOrgUnitManager().readOrganizationalUnit(getCmsObject(), m_oufqn);
        } catch (CmsException e) {
            m_oufqn = CmsOrganizationalUnit.SEPARATOR;
            try {
                m_ou = OpenCms.getOrgUnitManager().readOrganizationalUnit(getCmsObject(), m_oufqn);
            } catch (CmsException exc) {
                LOG.error(exc.getLocalizedMessage(), exc);
            }
        }

        // initialize the requested resource
        m_requestedResource = CmsRequestUtil.getNotEmptyParameter(
            getRequest(),
            CmsWorkplaceManager.PARAM_LOGIN_REQUESTED_RESOURCE);
        if (m_requestedResource == null) {
            // no resource was requested, use default workplace URI
            m_requestedResource = CmsVaadinUtils.getWorkplaceLink();
        }

        if (Boolean.valueOf(m_actionLogin).booleanValue()) {
            CmsMessageContainer emptyValidation = validateUserAndPasswordNotEmpty(m_username, m_password);
            if (emptyValidation != null) {
                m_message = emptyValidation;
            } else {

                // try to login with the given user information
                login((m_oufqn == null ? CmsOrganizationalUnit.SEPARATOR : m_oufqn) + m_username, m_password);

                if (getLoginException() == null) {
                    // the login was successful
                    m_action = ACTION_LOGIN;

                    CmsWorkplaceSettings settings = initSiteAndProject(cms);
                    getRequest().getSession().setAttribute(CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS, settings);
                    m_directEditPath = getDirectEditPath(cms, settings.getUserSettings());
                } else {
                    // there was an error during login
                    CmsException loginException = getLoginException();

                    if (org.opencms.security.Messages.ERR_LOGIN_FAILED_DISABLED_2 == loginException.getMessageContainer().getKey()) {
                        // the user account is disabled
                        m_message = Messages.get().container(Messages.GUI_LOGIN_FAILED_DISABLED_0);
                    } else if (org.opencms.security.Messages.ERR_LOGIN_FAILED_TEMP_DISABLED_4 == loginException.getMessageContainer().getKey()) {
                        // the user account is temporarily disabled because of too many login failures
                        m_message = Messages.get().container(Messages.GUI_LOGIN_FAILED_TEMP_DISABLED_0);
                    } else if (org.opencms.security.Messages.ERR_LOGIN_FAILED_WITH_MESSAGE_1 == loginException.getMessageContainer().getKey()) {
                        // all logins have been disabled be the Administration
                        CmsLoginMessage loginMessage = OpenCms.getLoginManager().getLoginMessage();
                        if (loginMessage != null) {
                            m_message = Messages.get().container(
                                Messages.GUI_LOGIN_FAILED_WITH_MESSAGE_1,
                                loginMessage.getMessage());
                        }
                    }
                    if (m_message == null) {
                        if (loginException instanceof CmsCustomLoginException) {
                            m_message = loginException.getMessageContainer();
                        } else {
                            // any other error - display default message
                            m_message = Messages.get().container(Messages.GUI_LOGIN_FAILED_0);
                        }
                    }
                }
            }
        } else if (Boolean.valueOf(m_actionLogout).booleanValue()) {
            m_action = ACTION_LOGOUT;
            // store the workplace window data
            Cookie wpDataCookie = getCookie(getRequest(), COOKIE_WP_DATA);
            String wpData = CmsRequestUtil.getNotEmptyParameter(getRequest(), PARAM_WPDATA);
            if (wpData != null) {
                wpData = CmsEncoder.escapeXml(wpData);
                wpDataCookie.setValue(wpData);
                setCookie(wpDataCookie, false, getRequest(), getResponse());
            }
            // after logout this will automatically redirect to the login form again
            logout();
            return null;
        }

        if (m_action == ACTION_LOGIN) {
            // clear message
            m_message = null;
            // login is successful, check if the requested resource can be read
            CmsUriSplitter splitter = new CmsUriSplitter(m_requestedResource, true);
            String resource = splitter.getPrefix();
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(resource)) {
                // bad resource name, use workplace as default
                resource = CmsWorkplace.JSP_WORKPLACE_URI;
            }
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_directEditPath)
                && !getCmsObject().existsResource(resource, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) {
                // requested resource does either not exist or is not readable by user
                if (CmsWorkplace.JSP_WORKPLACE_URI.equals(resource)) {
                    // we know the Workplace exists, so the user does not have access to the Workplace
                    // probably this is a "Guest" user in a default setup where "Guest" has no access to the Workplace
                    m_message = Messages.get().container(Messages.GUI_LOGIN_FAILED_NO_WORKPLACE_PERMISSIONS_0);
                    m_action = ACTION_DISPLAY;
                } else if (getCmsObject().existsResource(CmsWorkplace.JSP_WORKPLACE_URI)) {
                    // resource does either not exist or is not readable, but general workplace permissions are granted
                    m_message = Messages.get().container(Messages.GUI_LOGIN_UNKNOWN_RESOURCE_1, m_requestedResource);
                    m_requestedResource = CmsWorkplace.JSP_WORKPLACE_URI;
                } else {
                    // resource does not exist and no general workplace permissions granted
                    m_message = Messages.get().container(
                        Messages.GUI_LOGIN_FAILED_NO_TARGET_PERMISSIONS_1,
                        m_requestedResource);
                    m_action = ACTION_DISPLAY;
                }
            }
            if (m_action == ACTION_DISPLAY) {
                //the login was invalid
                m_requestedResource = null;
                // destroy the generated session
                HttpSession session = getRequest().getSession(false);
                if (session != null) {
                    session.invalidate();
                }
                setCookieData(getRequest(), getResponse());
            } else {
                // successfully logged in, so set the cookie
                setCookieData(getRequest(), getResponse());
            }
        }

        return displayLoginForm();
    }
720820
public String buildResourceList() throws CmsException {

        List resourcesWithProperty = getCms().readResourcesWithProperty(getParamPropertyName());

        return buildResourceList(resourcesWithProperty, false);
    }
837386
private CmsResource readResource(String resourceName) throws CmsException {

        CmsResource resource = null;
        try {
            resource = getCms().readResource(resourceName, CmsResourceFilter.ALL);
        } catch (CmsVfsResourceNotFoundException e) {
            throw new CmsVfsResourceNotFoundException(
                Messages.get().container(
                    Messages.ERR_RESOURCE_DOES_NOT_EXIST_3,
                    resourceName,
                    getCms().getRequestContext().getCurrentProject().getName(),
                    getCms().getRequestContext().getSiteRoot()),
                e);
        }
        return resource;
    }
717923
protected void parseLinks(CmsObject cms) throws CmsException {

        List<CmsResource> linkParseables = new ArrayList<>();
        for (CmsResourceImportData resData : m_moduleData.getResourceData()) {
            CmsResource importRes = resData.getImportResource();
            if ((importRes != null) && m_importIds.contains(importRes.getStructureId()) && isLinkParsable(importRes)) {
                linkParseables.add(importRes);
            }
        }
        m_report.println(Messages.get().container(Messages.RPT_START_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
        CmsImportVersion10.parseLinks(cms, linkParseables, m_report);
        m_report.println(Messages.get().container(Messages.RPT_END_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
    }
179055
@Override
  public final String toDateTimeSecMsString(final Date pDate,
    final Map<String, Object> pAddParam) throws Exception {
    return this.dateTimeSecMsFormat.format(pDate);
  }
120844
public static String formatDateTime(CmsObject cms, long date) {

        return CmsDateUtil.getDateTime(
            new Date(date),
            DateFormat.MEDIUM,
            OpenCms.getWorkplaceManager().getWorkplaceLocale(cms));
    }
24068
public long countUsers(CmsObject cms, CmsUserSearchParameters params) throws CmsException {

        return m_securityManager.countUsers(cms.getRequestContext(), params);
    }
872679
protected CmsObject rootCms(CmsObject cms) throws CmsException {

        CmsObject result = OpenCms.initCmsObject(cms);
        result.getRequestContext().setSiteRoot("");
        return result;
    }
10832
private CmsObject getRootCms() throws CmsException {

        if (null == m_rootCms) {
            m_rootCms = OpenCms.initCmsObject(m_cms);
            m_rootCms.getRequestContext().setSiteRoot("");
        }
        return m_rootCms;
    }