Search in sources :

Example 1 with IPageManager

use of com.agiletec.aps.system.services.page.IPageManager in project entando-core by entando.

the class BaseContentGroupBulkCommand method checkContentReferences.

protected boolean checkContentReferences(Content content) {
    List<Lang> systemLangs = this.getSystemLangs();
    IPageManager pageManager = this.getPageManager();
    SymbolicLinkValidator validator = new SymbolicLinkValidator(this.getApplier(), pageManager);
    for (AttributeInterface attribute : content.getAttributeList()) {
        if (attribute instanceof IReferenceableAttribute) {
            List<CmsAttributeReference> references = ((IReferenceableAttribute) attribute).getReferences(systemLangs);
            if (references != null) {
                for (CmsAttributeReference reference : references) {
                    SymbolicLink symbolicLink = this.convertToSymbolicLink(reference);
                    if (symbolicLink != null) {
                        String result = validator.scan(symbolicLink, content);
                        if (ICmsAttributeErrorCodes.INVALID_CONTENT_GROUPS.equals(result) || ICmsAttributeErrorCodes.INVALID_RESOURCE_GROUPS.equals(result) || ICmsAttributeErrorCodes.INVALID_PAGE_GROUPS.equals(result)) {
                            return false;
                        }
                    }
                }
            }
        }
    }
    return true;
}
Also used : IReferenceableAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.IReferenceableAttribute) IPageManager(com.agiletec.aps.system.services.page.IPageManager) SymbolicLinkValidator(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.util.SymbolicLinkValidator) Lang(com.agiletec.aps.system.services.lang.Lang) CmsAttributeReference(com.agiletec.plugins.jacms.aps.system.services.content.model.CmsAttributeReference) SymbolicLink(com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 2 with IPageManager

use of com.agiletec.aps.system.services.page.IPageManager in project entando-core by entando.

the class SystemInfoWrapper method getPageWithWidget.

public IPage getPageWithWidget(String widgetCode) {
    IPage page = null;
    try {
        IPageManager pageManager = (IPageManager) ApsWebApplicationUtils.getBean(SystemConstants.PAGE_MANAGER, this.getReqCtx().getRequest());
        List<IPage> pages = pageManager.getOnlineWidgetUtilizers(widgetCode);
        if (null != pages && !pages.isEmpty()) {
            page = pages.get(0);
        }
        return page;
    } catch (Throwable t) {
        _logger.error("Error getting page with widget: {}", widgetCode, t);
        return null;
    }
}
Also used : IPageManager(com.agiletec.aps.system.services.page.IPageManager) IPage(com.agiletec.aps.system.services.page.IPage)

Example 3 with IPageManager

use of com.agiletec.aps.system.services.page.IPageManager in project entando-core by entando.

the class PageAction method doSetOnline.

public String doSetOnline() {
    String pageCode = this.getPageCode();
    try {
        if (StringUtils.isEmpty(pageCode)) {
            pageCode = this.getSelectedNode();
            this.setPageCode(pageCode);
        }
        IPageManager pageManager = this.getPageManager();
        String check = this.checkSelectedNode(pageCode);
        if (null != check) {
            return check;
        }
        IPage page = this.getPage(pageCode);
        if (!page.getParent().isOnline()) {
            this.addActionError(this.getText("error.page.parentDraft"));
            return "pageTree";
        }
        boolean success = this.getPageActionReferencesHelper().checkContentsForSetOnline(page, this);
        if (!success) {
            this.addActionError(this.getText("error.page.setOnline.scanContentRefs"));
            return "pageTree";
        }
        if (this.hasErrors()) {
            return "pageTree";
        }
        pageManager.setPageOnline(pageCode);
        this.addActionMessage(this.getText("message.page.set.online", new String[] { this.getTitle(page.getCode(), page.getTitles()) }));
        // TODO Define a new strutsAction to map "offline" operation
        this.addActivityStreamInfo(page, PageActionConstants.PUBLISH, true);
    } catch (Throwable t) {
        _logger.error("error setting page {} online", pageCode, t);
        return FAILURE;
    }
    return SUCCESS;
}
Also used : IPageManager(com.agiletec.aps.system.services.page.IPageManager) IPage(com.agiletec.aps.system.services.page.IPage)

Example 4 with IPageManager

use of com.agiletec.aps.system.services.page.IPageManager in project entando-core by entando.

the class ContentPreviewAction method prepareForward.

private void prepareForward(String pageDestCode) throws IOException {
    Lang currentLang = this.getLangManager().getLang(this.getPreviewLangCode());
    if (null == currentLang) {
        currentLang = this.getLangManager().getDefaultLang();
    }
    IPageManager pageManager = this.getPageManager();
    IPage pageDest = pageManager.getOnlinePage(pageDestCode);
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("contentOnSessionMarker", this.getContentOnSessionMarker());
    String redirectUrl = this.getUrlManager().createURL(pageDest, currentLang, parameters, false);
    this.getServletResponse().sendRedirect(redirectUrl);
}
Also used : IPageManager(com.agiletec.aps.system.services.page.IPageManager) IPage(com.agiletec.aps.system.services.page.IPage) HashMap(java.util.HashMap) Lang(com.agiletec.aps.system.services.lang.Lang)

Example 5 with IPageManager

use of com.agiletec.aps.system.services.page.IPageManager in project entando-core by entando.

the class ContentPreviewAction method getCheckPageDestinationCode.

protected String getCheckPageDestinationCode() {
    IPageManager pageManager = this.getPageManager();
    String pageDestCode = this.getPreviewPageCode();
    if (null == pageDestCode || pageDestCode.trim().length() == 0) {
        pageDestCode = this.getContent().getViewPage();
        if (null == pageDestCode || null == pageManager.getOnlinePage(pageDestCode)) {
            String[] args = { pageDestCode };
            this.addFieldError("previewPageCode", this.getText("error.content.preview.pageNotValid", args));
            return null;
        }
    }
    if (null == pageManager.getOnlinePage(pageDestCode)) {
        String[] args = { pageDestCode };
        this.addFieldError("previewPageCode", this.getText("error.content.preview.pageNotFound", args));
        return null;
    }
    return pageDestCode;
}
Also used : IPageManager(com.agiletec.aps.system.services.page.IPageManager)

Aggregations

IPageManager (com.agiletec.aps.system.services.page.IPageManager)11 IPage (com.agiletec.aps.system.services.page.IPage)8 Lang (com.agiletec.aps.system.services.lang.Lang)3 RequestContext (com.agiletec.aps.system.RequestContext)1 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)1 ConfigInterface (com.agiletec.aps.system.services.baseconfig.ConfigInterface)1 ICategoryManager (com.agiletec.aps.system.services.category.ICategoryManager)1 II18nManager (com.agiletec.aps.system.services.i18n.II18nManager)1 IKeyGeneratorManager (com.agiletec.aps.system.services.keygenerator.IKeyGeneratorManager)1 ILangManager (com.agiletec.aps.system.services.lang.ILangManager)1 Widget (com.agiletec.aps.system.services.page.Widget)1 IPageModelManager (com.agiletec.aps.system.services.pagemodel.IPageModelManager)1 IRoleManager (com.agiletec.aps.system.services.role.IRoleManager)1 IURLManager (com.agiletec.aps.system.services.url.IURLManager)1 IUserManager (com.agiletec.aps.system.services.user.IUserManager)1 CmsAttributeReference (com.agiletec.plugins.jacms.aps.system.services.content.model.CmsAttributeReference)1 SymbolicLink (com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)1 IReferenceableAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.IReferenceableAttribute)1 SymbolicLinkValidator (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.util.SymbolicLinkValidator)1 HashMap (java.util.HashMap)1