Called from the JSP that is used for the AJAX requests to OpenCms.<p>
3762
public void displayDialog() {

        if (DIALOG_CHANGEITEMTITLE.equals(getParamAction())) {
            // build the JSON object for the current item with changed title property
            changeItemTitle(getJsp().getRequest().getParameter(PARAM_ITEMPATH));
        } else if (DIALOG_CHANGEITEMLINKURL.equals(getParamAction())) {
            // build the JSON object for the current item with changed resource content (CmsResourcePointer)
            changeItemLinkUrl(getJsp().getRequest().getParameter(PARAM_ITEMPATH));
        } else if (DIALOG_GETCATEGORIES.equals(getParamAction())) {
            // get the available categories as JSON array
            buildJsonCategoryList();
        } else if (DIALOG_GETGALLERIES.equals(getParamAction())) {
            // get the available galleries as JSON array
            buildJsonGalleryList();
        } else if (DIALOG_GETGALLERY.equals(getParamAction())) {
            // get the desired gallery as JSON object
            buildJsonGalleryItem(getJsp().getRequest().getParameter(PARAM_GALLERYPATH));
        } else if (DIALOG_GETITEMS.equals(getParamAction())) {
            if (LISTMODE_CATEGORY.equals(getParamListMode())) {
                // get the items of selected category
                buildJsonResourceItems(getCategoryItems(), null);
            } else {
                // get the items of a selected gallery
                buildJsonResourceItems(getGalleryItems(), getParamGalleryPath());
            }
        } else if (DIALOG_GETACTIVEITEM.equals(getParamAction())) {
            // build the JSON object for the currently active item
            buildJsonActiveItem(getJsp().getRequest().getParameter(PARAM_ITEMPATH));
        }
    }
1104104
public void onCancel() {

        if (m_publishSelectPanel.m_model != null) {
            final List<CmsUUID> toRemove = m_publishSelectPanel.m_model.getIdsOfAlreadyPublishedResources();
            if (toRemove.isEmpty()) {
                hide();
            } else {
                CmsRpcAction<CmsWorkflowResponse> action = new CmsRpcAction<CmsWorkflowResponse>() {

                    @Override
                    public void execute() {

                        start(0, true);
                        CmsWorkflowActionParams params = getWorkflowActionParams();
                        getService().executeAction(
                            new CmsWorkflowAction(CmsWorkflowAction.ACTION_CANCEL, "", true),
                            params,
                            this);
                    }

                    @Override
                    protected void onResponse(CmsWorkflowResponse result) {

                        stop(false);
                        hide();

                    }
                };
                action.execute();
            }
        } else {
            hide();
        }
    }
446978
protected void fillHtmlImport() {

        CmsExtendedHtmlImportDefault extimport = OpenCms.getImportExportManager().getExtendedHtmlImportDefault();
        m_htmlimport.setDestinationDir(extimport.getDestinationDir());
        m_htmlimport.setInputDir(extimport.getInputDir());
        m_htmlimport.setDownloadGallery(extimport.getDownloadGallery());
        m_htmlimport.setImageGallery(extimport.getImageGallery());
        m_htmlimport.setLinkGallery(extimport.getLinkGallery());
        m_htmlimport.setTemplate(extimport.getTemplate());
        m_htmlimport.setElement(extimport.getElement());
        m_htmlimport.setLocale(extimport.getLocale());
        m_htmlimport.setInputEncoding(extimport.getEncoding());
        m_htmlimport.setStartPattern(extimport.getStartPattern());
        m_htmlimport.setEndPattern(extimport.getEndPattern());
        m_htmlimport.setOverwrite(Boolean.valueOf(extimport.getOverwrite()).booleanValue());
        m_htmlimport.setKeepBrokenLinks(Boolean.valueOf(extimport.getKeepBrokenLinks()).booleanValue());
    }
800620
public void initialize() {

        OpenCms.getExecutor().scheduleWithFixedDelay(new Runnable() {

            public void run() {

                checkForUpdates();
            }
        }, DELAY_MILLIS, DELAY_MILLIS, TimeUnit.MILLISECONDS);
        reload();
    }
156428
@UiHandler("m_okButton")
    protected void onClickOk(ClickEvent e) {

        final boolean undoMove = m_undoMoveCheckbox.getFormValue().booleanValue();
        m_popup.hide();
        CmsRpcAction<Void> action = new CmsRpcAction<Void>() {

            @Override
            public void execute() {

                start(200, true);
                I_CmsVfsServiceAsync service = CmsCoreProvider.getVfsService();
                service.undoChanges(m_restoreInfo.getStructureId(), undoMove, this);
            }

            @Override
            protected void onResponse(Void result) {

                stop(false);
                if (m_afterRestoreAction != null) {
                    m_afterRestoreAction.run();
                }
            }

        };
        action.execute();

    }
1369331
public void actionMoveElement() throws JspException {

        // set editor values from request
        try {
            setEditorValues(getElementLocale());
        } catch (CmsXmlException e) {
            // an error occurred while trying to set the values, stop action
            showErrorPage(e);
            return;
        }
        // get the necessary parameters to move the element
        int index = 0;
        try {
            index = Integer.parseInt(getParamElementIndex());
        } catch (Exception e) {
            // ignore, should not happen
        }

        // get the value to move
        I_CmsXmlContentValue value = m_content.getValue(getParamElementName(), getElementLocale(), index);

        if (getAction() == ACTION_ELEMENT_MOVE_DOWN) {
            // move down the value
            value.moveDown();
        } else {
            // move up the value
            value.moveUp();
        }
        if (getValidationHandler().hasWarnings(getElementLocale())) {
            // there were warnings for the edited content, reset validation handler to avoid display issues
            resetErrorHandler();
        }
        try {
            // write the modified content to the temporary file
            writeContent();
        } catch (CmsException e) {
            // an error occurred while trying to save
            showErrorPage(e);
        }
    }
176801
public void loadRecent(final I_CmsSimpleCallback<List<CmsContainerElementData>> callback) {

        CmsRpcAction<List<CmsContainerElementData>> action = new CmsRpcAction<List<CmsContainerElementData>>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                start(200, true);
                getContainerpageService().getRecentList(
                    CmsCoreProvider.get().getStructureId(),
                    getData().getDetailId(),
                    getPageState(),
                    getLocale(),
                    this);
            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(List<CmsContainerElementData> result) {

                stop(false);
                addElements(result);
                callback.execute(result);
            }
        };
        action.execute();
    }
874192
protected void submit() {

        CmsLoginMessage loginMessage = new CmsLoginMessage();
        CmsLoginMessage beforeLoginMessage = new CmsLoginMessage();
        try {
            m_formBinderAfter.writeBean(loginMessage);
            m_formBinderBefore.writeBean(beforeLoginMessage);
            OpenCms.getLoginManager().setLoginMessage(A_CmsUI.getCmsObject(), loginMessage);
            OpenCms.getLoginManager().setBeforeLoginMessage(A_CmsUI.getCmsObject(), beforeLoginMessage);
            // update the system configuration
            OpenCms.writeConfiguration(CmsVariablesConfiguration.class);
        } catch (Exception e) {
            LOG.error("Unable to save Login Message", e);
        }
    }
955359
private boolean performDialogOperation(HttpServletRequest request) throws CmsException {

        List<CmsPropertyDefinition> propertyDef = getCms().readAllPropertyDefinitions();
        boolean useTempfileProject = Boolean.valueOf(getParamUsetempfileproject()).booleanValue();
        try {
            if (useTempfileProject) {
                switchToTempProject();
            }
            Map<String, CmsProperty> activeProperties = getActiveProperties();
            String activeTab = getActiveTabName();
            List<CmsProperty> propertiesToWrite = new ArrayList<CmsProperty>();

            // check all property definitions of the resource for new values
            Iterator<CmsPropertyDefinition> i = propertyDef.iterator();
            while (i.hasNext()) {
                CmsPropertyDefinition curPropDef = i.next();
                String propName = CmsEncoder.escapeXml(curPropDef.getName());
                String valueStructure = null;
                String valueResource = null;

                if (key(Messages.GUI_PROPERTIES_INDIVIDUAL_0).equals(activeTab)) {
                    // get parameters from the structure tab
                    valueStructure = request.getParameter(PREFIX_VALUE + propName);
                    valueResource = request.getParameter(PREFIX_RESOURCE + propName);
                    if ((valueStructure != null)
                        && !"".equals(valueStructure.trim())
                        && valueStructure.equals(valueResource)) {
                        // the resource value was shown/entered in input field, set structure value to empty String
                        valueStructure = "";
                    }
                } else {
                    // get parameters from the resource tab
                    valueStructure = request.getParameter(PREFIX_STRUCTURE + propName);
                    valueResource = request.getParameter(PREFIX_VALUE + propName);
                }

                // check values for blanks and null
                if (valueStructure != null) {
                    valueStructure = valueStructure.trim();
                }

                if (valueResource != null) {
                    valueResource = valueResource.trim();
                }

                // create new CmsProperty object to store
                CmsProperty newProperty = new CmsProperty();
                newProperty.setName(curPropDef.getName());
                newProperty.setStructureValue(valueStructure);
                newProperty.setResourceValue(valueResource);

                // get the old property values
                CmsProperty oldProperty = activeProperties.get(curPropDef.getName());
                if (oldProperty == null) {
                    // property was not set, create new empty property object
                    oldProperty = new CmsProperty();
                    oldProperty.setName(curPropDef.getName());
                }

                boolean writeStructureValue = false;
                boolean writeResourceValue = false;
                String oldValue = oldProperty.getStructureValue();
                String newValue = newProperty.getStructureValue();

                // write the structure value if the existing structure value is not null and we want to delete the structure value
                writeStructureValue = ((oldValue != null) && newProperty.isDeleteStructureValue());
                // or if we want to write a value which is neither the delete value or an empty value
                writeStructureValue |= !newValue.equals(oldValue)
                    && !"".equalsIgnoreCase(newValue)
                    && !CmsProperty.DELETE_VALUE.equalsIgnoreCase(newValue);
                // set the structure value explicitly to null to leave it as is in the database
                if (!writeStructureValue) {
                    newProperty.setStructureValue(null);
                }

                oldValue = oldProperty.getResourceValue();
                newValue = newProperty.getResourceValue();

                // write the resource value if the existing resource value is not null and we want to delete the resource value
                writeResourceValue = ((oldValue != null) && newProperty.isDeleteResourceValue());
                // or if we want to write a value which is neither the delete value or an empty value
                writeResourceValue |= !newValue.equals(oldValue)
                    && !"".equalsIgnoreCase(newValue)
                    && !CmsProperty.DELETE_VALUE.equalsIgnoreCase(newValue);
                // set the resource value explicitly to null to leave it as is in the database
                if (!writeResourceValue) {
                    newProperty.setResourceValue(null);
                }

                if (writeStructureValue || writeResourceValue) {
                    // add property to list only if property values have changed
                    propertiesToWrite.add(newProperty);
                }
            }
            if (propertiesToWrite.size() > 0) {
                // lock resource if autolock is enabled
                checkLock(getParamResource());
                //write the new property values
                getCms().writePropertyObjects(getParamResource(), propertiesToWrite);
            }
        } finally {
            if (useTempfileProject) {
                switchToCurrentProject();
            }
        }
        return true;
    }
753643
@Override
    public void run() {

        try {
            // do the validation
            m_externLinkValidator.validateLinks(m_cms);
        } catch (Throwable e) {
            getReport().println(e);
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage());
            }
        }
        if (m_fin != null) {
            m_fin.run();
        }
    }
790077
@Override
    public int doStartTag() throws JspException {

        if (isEditableRequest(pageContext.getRequest())) {
            // all this does NOT apply to the "online" project, or for temporary files
            I_CmsDirectEditProvider eb = getDirectEditProvider(pageContext);
            // if no provider is available this is the first "editable" tag on the page
            m_firstOnPage = (eb == null);
            m_manualPlacement = false;
            if ((m_mode == CmsDirectEditMode.MANUAL) || !m_editEmpty) {
                // manual mode requested, we may need to insert HTML
                if (!m_firstOnPage && (eb != null)) {
                    // first tag on a page is only for insertion of header HTML
                    if (eb.isManual(m_mode)) {
                        // the provider supports manual placement of buttons
                        m_manualPlacement = true;
                        editableTagAction(pageContext, m_provider, m_mode, m_file);
                    }
                }
            } else if (!m_firstOnPage && (eb != null) && m_editEmpty) {
                try {
                    insertEditEmpty();
                } catch (CmsException e) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
        } else {
            // this will ensure the "end" tag is also ignored in the online project
            m_firstOnPage = false;
            m_manualPlacement = false;
        }
        return EVAL_BODY_INCLUDE;
    }
131134
public void cmsEvent(org.opencms.main.CmsEvent event) {

        if (!isEnabled()) {
            return;
        }

        switch (event.getType()) {
            case I_CmsEventListener.EVENT_PUBLISH_PROJECT:
                if (LOG.isDebugEnabled()) {
                    LOG.debug("FlexCache: Received event PUBLISH_PROJECT");
                }
                String publishIdStr = (String)(event.getData().get(I_CmsEventListener.KEY_PUBLISHID));
                if (!CmsUUID.isValidUUID(publishIdStr)) {
                    clear();
                } else {
                    try {
                        CmsUUID publishId = new CmsUUID(publishIdStr);
                        List<CmsPublishedResource> publishedResources = m_cmsObject.readPublishedResources(publishId);
                        boolean updateConfiguration = false;
                        for (CmsPublishedResource res : publishedResources) {
                            if (res.getRootPath().equals(CONFIG_PATH)) {
                                updateConfiguration = true;
                                break;
                            }
                        }
                        CmsFlexBucketConfiguration bucketConfig = m_bucketConfiguration;
                        if (updateConfiguration) {
                            LOG.info("Flex bucket configuration was updated, re-initializing configuration...");
                            try {
                                m_bucketConfiguration = CmsFlexBucketConfiguration.loadFromVfsFile(
                                    m_cmsObject,
                                    CONFIG_PATH);
                            } catch (CmsException e) {
                                LOG.error(e.getLocalizedMessage(), e);
                            }
                            // Make sure no entries built for the old configuration remain in the cache
                            clear();
                        } else if (bucketConfig != null) {
                            boolean bucketClearOk = clearBucketsForPublishList(
                                bucketConfig,
                                publishId,
                                publishedResources);
                            if (!bucketClearOk) {
                                clear();
                            }
                        } else {
                            clear();
                        }

                    } catch (CmsException e1) {
                        LOG.error(e1.getLocalizedMessage(), e1);
                        clear();
                    }
                }
                break;
            case I_CmsEventListener.EVENT_CLEAR_CACHES:
                if (LOG.isDebugEnabled()) {
                    LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCACHE_RECEIVED_EVENT_CLEAR_CACHE_0));
                }
                clear();
                break;
            case I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY:
                if (LOG.isDebugEnabled()) {
                    LOG.debug(Messages.get().getBundle().key(Messages.LOG_FLEXCACHE_RECEIVED_EVENT_PURGE_REPOSITORY_0));
                }
                purgeJspRepository();
                break;
            case I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR:
                if (LOG.isDebugEnabled()) {
                    LOG.debug(
                        Messages.get().getBundle().key(Messages.LOG_FLEXCACHE_RECEIVED_EVENT_CLEAR_CACHE_PARTIALLY_0));
                }
                Map<String, ?> m = event.getData();
                if (m == null) {
                    break;
                }
                Integer it = null;
                try {
                    it = (Integer)m.get(CACHE_ACTION);
                } catch (Exception e) {
                    // it will be null
                }
                if (it == null) {
                    break;
                }
                int i = it.intValue();
                switch (i) {
                    case CLEAR_ALL:
                        clear();
                        break;
                    case CLEAR_ENTRIES:
                        clearEntries();
                        break;
                    case CLEAR_ONLINE_ALL:
                        clearOnline();
                        break;
                    case CLEAR_ONLINE_ENTRIES:
                        clearOnlineEntries();
                        break;
                    case CLEAR_OFFLINE_ALL:
                        clearOffline();
                        break;
                    case CLEAR_OFFLINE_ENTRIES:
                        clearOfflineEntries();
                        break;
                    default:
                        // no operation
                }
                break;
            default:
                // no operation
        }
    }
210138
public void loadModelPages() {

        CmsRpcAction<CmsModelInfo> action = new CmsRpcAction<CmsModelInfo>() {

            @Override
            public void execute() {

                start(500, false);
                getService().getModelInfos(m_data.getRoot().getId(), this);

            }

            @Override
            protected void onResponse(CmsModelInfo result) {

                stop(false);
                CmsSitemapView.getInstance().displayModelPages(result);
            }
        };
        action.execute();
    }
896763
public void render() throws IOException {

        I_CmsFormatterBean formatterConfig = OpenCms.getADEManager().getCachedFormatters(
            m_cms.getRequestContext().getCurrentProject().isOnlineProject()).getFormatters().get(
                m_element.getFormatterId());
        if (formatterConfig instanceof CmsFlexFormatterBean) {
            CmsFlexFormatterBean config = (CmsFlexFormatterBean)formatterConfig;
            String template = config.getStringTemplate();
            if (m_element.isInMemoryOnly()) {
                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(config.getPlaceholderStringTemplate())) {
                    template = config.getPlaceholderStringTemplate();
                }
                if (config.getDefaultContentStructureId() != null) {
                    try {
                        CmsResource defaultContent = m_cms.readResource(
                            ((CmsMacroFormatterBean)formatterConfig).getDefaultContentStructureId());
                        CmsFile defaultFile = m_cms.readFile(defaultContent);
                        m_element = new CmsContainerElementBean(
                            defaultFile,
                            m_element.getFormatterId(),
                            m_element.getIndividualSettings(),
                            true,
                            m_element.editorHash(),
                            m_element.isCreateNew());
                    } catch (CmsException e) {
                        //      LOG.error("Error reading default content for new resource", e);
                    }
                }
            }
            try {
                Map<String, Object> context = new HashMap<String, Object>();
                context.put(KEY_SETTINGS, wrapSettings(m_cms, m_element.getSettings()));
                context.put(
                    KEY_FUNCTIONS,
                    CmsCollectionsGenericWrapper.createLazyMap(new CmsObjectFunctionTransformer(m_cms)));
                String output = renderTemplate(m_cms, template, m_element.getResource(), context);
                if (CmsJspTagEditable.isEditableRequest(m_request)) {
                    CmsHtmlValidator validator = new CmsHtmlValidator();
                    validator.validate(output);
                    if (!validator.isBalanced()) {
                        Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms);
                        String messages = "";
                        for (CmsMessageContainer message : validator.getMessages()) {
                            messages += message.key(locale) + "\n";
                        }
                        output = String.format(
                            ERROR_DISPLAY_WITH_DETAILS,
                            Messages.get().getBundle(locale).key(Messages.GUI_FORMATTER_RENDERING_ERROR_0),
                            formatterConfig.getJspRootPath(),
                            Messages.get().getBundle(locale).key(Messages.GUI_FORMATTER_RENDERING_NOT_WELL_FORMED_0),
                            messages);
                    } else if (validator.getRootElementCount() > 1) {
                        Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms);
                        output = String.format(
                            ERROR_DISPLAY,
                            Messages.get().getBundle(locale).key(Messages.GUI_FORMATTER_RENDERING_ERROR_0),
                            formatterConfig.getJspRootPath(),
                            Messages.get().getBundle(locale).key(
                                Messages.GUI_FORMATTER_RENDERING_MULTIPLE_ROOT_ELEMENTS_0));
                    }

                }
                m_context.getOut().print(output);
            } catch (Throwable t) {
                if (CmsJspTagEditable.isEditableRequest(m_request)) {
                    String stackTrace = "";
                    for (StackTraceElement element : t.getStackTrace()) {
                        stackTrace += element.toString() + "\n";
                    }
                    Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms);
                    m_context.getOut().println(
                        String.format(
                            ERROR_DISPLAY_WITH_DETAILS,
                            Messages.get().getBundle(locale).key(Messages.GUI_FORMATTER_RENDERING_ERROR_0),
                            formatterConfig.getJspRootPath(),
                            t.getMessage(),
                            stackTrace));
                }
            }
        }
    }
769611
void submit() {

        try {
            CmsProject project = m_context.getCms().readProject((CmsUUID)m_projectComboBox.getValue());
            if (!m_context.getCms().getRequestContext().getCurrentProject().equals(project)) {
                A_CmsUI.get().changeProject(project);
            } else {
                project = null;
            }
            String siteRoot = (String)m_siteComboBox.getValue();
            if (!m_context.getCms().getRequestContext().getSiteRoot().equals(siteRoot)) {
                A_CmsUI.get().changeSite(siteRoot);
            } else {
                siteRoot = null;
            }
            if ((siteRoot != null) && CmsFileExplorerConfiguration.APP_ID.equals(m_context.getAppId())) {
                I_CmsWorkplaceAppConfiguration editorConf = OpenCms.getWorkplaceAppManager().getAppConfiguration(
                    CmsPageEditorConfiguration.APP_ID);
                if (editorConf.getVisibility(m_context.getCms()).isActive()) {
                    ((I_CmsHasAppLaunchCommand)editorConf).getAppLaunchCommand().run();
                    return;
                }
            }
            m_context.finish(project, siteRoot);
        } catch (CmsException e) {
            m_context.error(e);
        }
    }
860811
private static synchronized void registerListener() {

        if (!m_listenerRegistered) {
            OpenCms.getEventManager().addCmsEventListener(
                new CmsIconUtil(),
                new int[] {I_CmsEventListener.EVENT_CLEAR_CACHES});
            m_listenerRegistered = true;
        }
    }
986666
public void actionPreview() throws IOException, JspException {

        try {
            // save content of the editor to the temporary file
            performSaveContent(getParamElementname(), getElementLocale());
        } catch (CmsException e) {
            // show error page
            showErrorPage(this, e);
        }

        // redirect to the temporary file with current active element language
        String param = "?" + org.opencms.i18n.CmsLocaleManager.PARAMETER_LOCALE + "=" + getParamElementlanguage();
        sendCmsRedirect(getParamTempfile() + param);
    }