use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class PageService method valueMetadataFromRequest.
private void valueMetadataFromRequest(PageMetadata metadata, PageRequest request) {
if (metadata.getModel() == null || !metadata.getModel().getCode().equals(request.getPageModel())) {
// Ho cambiato modello e allora cancello tutte le showlets
// Precedenti
PageModel model = this.getPageModelManager().getPageModel(request.getPageModel());
metadata.setModel(model);
}
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);
Optional<List<String>> groups = Optional.ofNullable(request.getJoinGroups());
groups.ifPresent(values -> values.forEach((group) -> {
metadata.addExtraGroup(group);
}));
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.util.ApsProperties 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.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.setParent(parent);
}
PageMetadata metadata = new PageMetadata();
this.valueMetadataFromRequest(metadata, pageRequest);
page.setMetadata(metadata);
return page;
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class WidgetService method processWidgetType.
private void processWidgetType(WidgetType type, WidgetRequest widgetRequest) {
type.setCode(widgetRequest.getCode());
ApsProperties titles = new ApsProperties();
widgetRequest.getTitles().forEach((k, v) -> titles.put(k, v));
type.setTitles(titles);
type.setMainGroup(widgetRequest.getGroup());
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestPageManager method checkUpdatePage.
private void checkUpdatePage() throws Exception {
Page dbPage = (Page) _pageManager.getDraftPage("temp");
Page pageToUpdate = PageTestUtil.createPage("temp", dbPage.getParent(), "free", dbPage.getMetadata().clone(), PageTestUtil.copyArray(dbPage.getWidgets()));
pageToUpdate.setPosition(dbPage.getPosition());
PageMetadata onlineMetadata = pageToUpdate.getMetadata();
onlineMetadata.setTitle("en", "temptitle1");
onlineMetadata.setShowable(true);
ApsProperties config = PageTestUtil.createProperties("temp1", "temp1", "contentId", "ART11");
Widget widgetToAdd = PageTestUtil.createWidget("content_viewer", config, this._widgetTypeManager);
pageToUpdate.getWidgets()[2] = widgetToAdd;
_pageManager.setPageOnline(pageToUpdate.getCode());
IPage updatedPage = _pageManager.getOnlinePage(dbPage.getCode());
pageToUpdate = (Page) _pageManager.getOnlinePage(pageToUpdate.getCode());
assertNotNull(updatedPage);
PageTestUtil.comparePages(pageToUpdate, updatedPage, false);
PageTestUtil.comparePageMetadata(pageToUpdate.getMetadata(), updatedPage.getMetadata(), 0);
assertEquals(1, pageToUpdate.getMetadata().getTitles().size());
PageTestUtil.compareWidgets(pageToUpdate.getWidgets(), updatedPage.getWidgets());
// assertNotNull(updatedPage.getWidgets()[2]);
// assertEquals(widgetToAdd, updatedPage.getWidgets()[2]);
}
use of com.agiletec.aps.util.ApsProperties in project entando-core by entando.
the class TestWidgetTypeManager method createNewWidgetType.
private WidgetType createNewWidgetType(String code) {
WidgetType type = new WidgetType();
type.setCode(code);
ApsProperties titles = new ApsProperties();
titles.put("it", "Titolo");
titles.put("en", "Title");
type.setTitles(titles);
WidgetType parent = this._widgetTypeManager.getWidgetType("content_viewer");
assertNotNull(parent);
type.setParentType(parent);
type.setPluginCode("jacms");
ApsProperties config = new ApsProperties();
config.put("contentId", "ART112");
type.setConfig(config);
return type;
}
Aggregations