use of com.agiletec.aps.system.services.page.PageMetadata in project entando-core by entando.
the class PageService method valueMetadataFromRequest.
private void valueMetadataFromRequest(PageMetadata metadata, PageRequest request) {
metadata.setGroup(request.getOwnerGroup());
metadata.setShowable(request.isDisplayedInMenu());
metadata.setUseExtraTitles(request.isSeo());
Optional<Map<String, String>> titles = Optional.ofNullable(request.getTitles());
ApsProperties apsTitles = new ApsProperties();
titles.ifPresent(values -> values.keySet().forEach((lang) -> {
apsTitles.put(lang, values.get(lang));
}));
metadata.setTitles(apsTitles);
if (metadata.getExtraGroups() != null) {
List<String> oldGroups = new ArrayList<>(metadata.getExtraGroups());
oldGroups.forEach(metadata::removeExtraGroup);
}
if (request.getJoinGroups() != null) {
request.getJoinGroups().forEach(metadata::addExtraGroup);
}
String charset = request.getCharset();
metadata.setCharset(StringUtils.isNotBlank(charset) ? charset : null);
String mimetype = request.getContentType();
metadata.setMimeType(StringUtils.isNotBlank(mimetype) ? mimetype : null);
}
use of com.agiletec.aps.system.services.page.PageMetadata in project entando-core by entando.
the class PageService method createPage.
private IPage createPage(PageRequest pageRequest) {
Page page = new Page();
page.setCode(pageRequest.getCode());
page.setShowable(pageRequest.isDisplayedInMenu());
PageModel model = this.getPageModelManager().getPageModel(pageRequest.getPageModel());
page.setModel(model);
page.setWidgets(new Widget[model.getFrames().length]);
page.setCharset(pageRequest.getCharset());
page.setMimeType(pageRequest.getContentType());
page.setParentCode(pageRequest.getParentCode());
page.setUseExtraTitles(pageRequest.isSeo());
Optional<Map<String, String>> titles = Optional.ofNullable(pageRequest.getTitles());
ApsProperties apsTitles = new ApsProperties();
titles.ifPresent(values -> values.keySet().forEach((lang) -> {
apsTitles.put(lang, values.get(lang));
}));
page.setTitles(apsTitles);
page.setGroup(pageRequest.getOwnerGroup());
Optional<List<String>> groups = Optional.ofNullable(pageRequest.getJoinGroups());
groups.ifPresent(values -> values.forEach((group) -> {
page.addExtraGroup(group);
}));
page.setParentCode(pageRequest.getParentCode());
if (pageRequest.getParentCode() != null) {
IPage parent = this.getPageManager().getDraftPage(pageRequest.getParentCode());
page.setParentCode(parent.getCode());
}
PageMetadata metadata = page.getMetadata();
this.valueMetadataFromRequest(metadata, pageRequest);
page.setMetadata(metadata);
return page;
}
use of com.agiletec.aps.system.services.page.PageMetadata in project entando-core by entando.
the class StreamInterceptorIntegrationTest method createPage.
protected Page createPage(String pageCode, PageModel pageModel, String parent) {
if (null == parent) {
parent = "service";
}
IPage parentPage = pageManager.getDraftPage(parent);
if (null == pageModel) {
pageModel = parentPage.getMetadata().getModel();
}
PageMetadata metadata = PageTestUtil.createPageMetadata(pageModel, true, pageCode + "_title", null, null, false, null, null);
Widget[] widgets = {};
Page pageToAdd = PageTestUtil.createPage(pageCode, parentPage.getCode(), "free", metadata, widgets);
return pageToAdd;
}
use of com.agiletec.aps.system.services.page.PageMetadata in project entando-core by entando.
the class ActivityStreamControllerIntegrationTest method createPage.
protected Page createPage(String pageCode, PageModel pageModel) {
IPage parentPage = pageManager.getDraftPage("service");
if (null == pageModel) {
pageModel = parentPage.getMetadata().getModel();
}
PageMetadata metadata = PageTestUtil.createPageMetadata(pageModel, true, pageCode + "_title", null, null, false, null, null);
ApsProperties config = PageTestUtil.createProperties("modelId", "default", "contentId", "EVN24");
Widget widgetToAdd = PageTestUtil.createWidget("content_viewer", config, this.widgetTypeManager);
Widget[] widgets = { widgetToAdd };
Page pageToAdd = PageTestUtil.createPage(pageCode, parentPage.getCode(), "free", metadata, widgets);
return pageToAdd;
}
Aggregations