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;
}
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;
}
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;
}
Aggregations