Search in sources :

Example 21 with PageMetadata

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

the class PageAction method buildNewPage.

protected IPage buildNewPage() throws ApsSystemException {
    Page page = new Page();
    try {
        page.setParent(this.getPage(this.getParentPageCode()));
        if (this.getStrutsAction() == ApsAdminSystemConstants.PASTE) {
            IPage copyPage = this.getPage(this.getCopyPageCode());
            IPage publicPage = this.getOnlinePage(this.getCopyPageCode());
            boolean online = copyPage.isOnline();
            page.setWidgets(null != publicPage ? publicPage.getWidgets() : copyPage.getWidgets());
            PageMetadata metadata = (null != publicPage) ? publicPage.getMetadata() : copyPage.getMetadata();
            if (metadata != null) {
                metadata = metadata.clone();
                metadata.setTitles(this.getTitles());
                page.setMetadata(metadata);
            }
            page.setGroup(copyPage.getGroup());
        } else {
            page.setGroup(this.getGroup());
            PageMetadata metadata = new PageMetadata();
            this.valueMetadataFromForm(metadata);
            page.setMetadata(metadata);
            // if (this.isDefaultShowlet()) {
            // this.setDefaultWidgets(page);
            // } else {
            page.setWidgets(new Widget[metadata.getModel().getFrames().length]);
        // }
        }
        // ricava il codice
        page.setCode(this.buildNewPageCode(page.getMetadata()));
    } catch (Throwable t) {
        _logger.error("Error building new page", t);
        throw new ApsSystemException("Error building new page", t);
    }
    return page;
}
Also used : PageMetadata(com.agiletec.aps.system.services.page.PageMetadata) IPage(com.agiletec.aps.system.services.page.IPage) Page(com.agiletec.aps.system.services.page.Page) IPage(com.agiletec.aps.system.services.page.IPage) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException)

Example 22 with PageMetadata

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

the class PageAction method copy.

public String copy() {
    String selectedNode = this.getSelectedNode();
    try {
        String check = this.checkSelectedNode(selectedNode);
        if (null != check) {
            return check;
        }
        IPage pageToCopy = this.getPage(selectedNode);
        IPage publicToCopy = this.getOnlinePage(selectedNode);
        this.setStrutsAction(ApsAdminSystemConstants.PASTE);
        this.setCopyPageCode(selectedNode);
        this.setGroup(pageToCopy.getGroup());
        PageMetadata metadata = (null != publicToCopy) ? publicToCopy.getMetadata() : pageToCopy.getMetadata();
        this.copyMetadataToForm(metadata);
        this.getTitles().clear();
        this.setParentPageCode(selectedNode);
    } catch (Throwable t) {
        _logger.error("error in paste", t);
        return FAILURE;
    }
    return SUCCESS;
}
Also used : PageMetadata(com.agiletec.aps.system.services.page.PageMetadata) IPage(com.agiletec.aps.system.services.page.IPage)

Example 23 with PageMetadata

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

the class PageConfigurationControllerIntegrationTest method createPage.

protected Page createPage(String pageCode) {
    IPage parentPage = pageManager.getDraftPage("service");
    PageModel pageModel = parentPage.getMetadata().getModel();
    PageMetadata metadata = PageTestUtil.createPageMetadata(pageModel.getCode(), true, pageCode + "_title", null, null, false, null, null);
    ApsProperties config = PageTestUtil.createProperties("temp", "tempValue", "contentId", "ART11");
    Widget widgetToAdd = PageTestUtil.createWidget("content_viewer", config, this.widgetTypeManager);
    Widget[] widgets = { widgetToAdd };
    Page pageToAdd = PageTestUtil.createPage(pageCode, parentPage, "free", metadata, widgets);
    return pageToAdd;
}
Also used : PageMetadata(com.agiletec.aps.system.services.page.PageMetadata) IPage(com.agiletec.aps.system.services.page.IPage) Widget(com.agiletec.aps.system.services.page.Widget) Page(com.agiletec.aps.system.services.page.Page) IPage(com.agiletec.aps.system.services.page.IPage) PageModel(com.agiletec.aps.system.services.pagemodel.PageModel) ApsProperties(com.agiletec.aps.util.ApsProperties)

Aggregations

PageMetadata (com.agiletec.aps.system.services.page.PageMetadata)23 IPage (com.agiletec.aps.system.services.page.IPage)18 Page (com.agiletec.aps.system.services.page.Page)13 Widget (com.agiletec.aps.system.services.page.Widget)9 PageModel (com.agiletec.aps.system.services.pagemodel.PageModel)9 ArrayList (java.util.ArrayList)7 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)6 ApsProperties (com.agiletec.aps.util.ApsProperties)6 WidgetConfigurationDto (org.entando.entando.aps.system.services.page.model.WidgetConfigurationDto)5 WidgetConfigurationRequest (org.entando.entando.web.page.model.WidgetConfigurationRequest)5 List (java.util.List)4 IManager (com.agiletec.aps.system.common.IManager)3 GroupUtilizer (com.agiletec.aps.system.services.group.GroupUtilizer)3 IGroupManager (com.agiletec.aps.system.services.group.IGroupManager)3 IPageManager (com.agiletec.aps.system.services.page.IPageManager)3 IPageModelManager (com.agiletec.aps.system.services.pagemodel.IPageModelManager)3 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)3 Arrays (java.util.Arrays)3 Map (java.util.Map)3 Optional (java.util.Optional)3