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