use of org.entando.entando.web.page.model.WidgetConfigurationRequest in project entando-core by entando.
the class RowContentListViewerConfigProcessor method buildConfiguration.
@SuppressWarnings("unchecked")
@Override
public Object buildConfiguration(WidgetConfigurationRequest widget) {
ApsProperties properties = new ApsProperties();
List<RowContentListConfigurationEntry> entryList = (List<RowContentListConfigurationEntry>) widget.getProcessInfo().get(WidgetConfigurationValidator.PROCESS_INFO_CONFIG);
if (null != entryList && !entryList.isEmpty()) {
StringBuffer sbuffer = new StringBuffer("[");
List<String> configTokens = entryList.stream().map(i -> i.toCfg()).collect(Collectors.toList());
sbuffer.append(StringUtils.join(configTokens, ","));
sbuffer.append("]");
properties.put("contents", sbuffer.toString());
}
return properties;
}
use of org.entando.entando.web.page.model.WidgetConfigurationRequest in project entando-core by entando.
the class PageServiceWidgetIntegrationTest method testUpdatePageWidget.
public void testUpdatePageWidget() throws JsonProcessingException, ApsSystemException {
String pageCode = "temp001";
IPage parentPage = pageManager.getDraftRoot();
PageModel pageModel = parentPage.getMetadata().getModel();
PageMetadata metadata = PageTestUtil.createPageMetadata(pageModel.getCode(), true, pageCode, null, null, false, null, null);
Page pageToAdd = PageTestUtil.createPage(pageCode, parentPage, "free", metadata, null);
try {
pageManager.addPage(pageToAdd);
WidgetConfigurationDto widgetConfigurationDto = this.pageService.getWidgetConfiguration(pageToAdd.getCode(), 0, IPageService.STATUS_DRAFT);
assertThat(widgetConfigurationDto, is(nullValue()));
WidgetConfigurationRequest widgetConfigurationRequest = new WidgetConfigurationRequest();
widgetConfigurationRequest.setCode("login_form");
widgetConfigurationRequest.setConfig(null);
this.pageService.updateWidgetConfiguration(pageCode, 0, widgetConfigurationRequest);
assertThat(this.pageService.getWidgetConfiguration(pageToAdd.getCode(), 0, IPageService.STATUS_DRAFT).getCode(), is("login_form"));
} finally {
pageManager.deletePage(pageCode);
}
}
use of org.entando.entando.web.page.model.WidgetConfigurationRequest in project entando-core by entando.
the class PageServiceWidgetIntegrationTest method testRemovePageWidget.
public void testRemovePageWidget() throws JsonProcessingException, ApsSystemException {
String pageCode = "temp001";
IPage parentPage = pageManager.getDraftRoot();
PageModel pageModel = parentPage.getMetadata().getModel();
PageMetadata metadata = PageTestUtil.createPageMetadata(pageModel.getCode(), true, pageCode, null, null, false, null, null);
Page pageToAdd = PageTestUtil.createPage(pageCode, parentPage, "free", metadata, null);
try {
pageManager.addPage(pageToAdd);
WidgetConfigurationDto widgetConfigurationDto = this.pageService.getWidgetConfiguration(pageToAdd.getCode(), 0, IPageService.STATUS_DRAFT);
assertThat(widgetConfigurationDto, is(nullValue()));
WidgetConfigurationRequest widgetConfigurationRequest = new WidgetConfigurationRequest();
widgetConfigurationRequest.setCode("login_form");
widgetConfigurationRequest.setConfig(null);
this.pageService.updateWidgetConfiguration(pageCode, 0, widgetConfigurationRequest);
assertThat(this.pageService.getWidgetConfiguration(pageToAdd.getCode(), 0, IPageService.STATUS_DRAFT).getCode(), is("login_form"));
this.pageService.deleteWidgetConfiguration(pageToAdd.getCode(), 0);
assertThat(widgetConfigurationDto, is(nullValue()));
} finally {
pageManager.deletePage(pageCode);
}
}
Aggregations