use of com.agiletec.aps.system.services.pagemodel.PageModel in project entando-core by entando.
the class PageConfigurationControllerWidgetsIntegrationTest 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;
}
use of com.agiletec.aps.system.services.pagemodel.PageModel 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 com.agiletec.aps.system.services.pagemodel.PageModel in project entando-core by entando.
the class DataObjectMapperCacheWrapper method searchPublishedDataObjects.
private void searchPublishedDataObjects(DataObjectPageMapper dataObjectPageMapper, IPage page, IPageManager pageManager) {
PageModel pageModel = page.getModel();
if (pageModel != null) {
int mainFrame = pageModel.getMainFrame();
Widget[] widgets = page.getWidgets();
Widget widget = null;
if (null != widgets && mainFrame != -1) {
widget = widgets[mainFrame];
}
ApsProperties config = (null != widget) ? widget.getConfig() : null;
String dataId = (null != config) ? config.getProperty("dataId") : null;
if (null != dataId) {
dataObjectPageMapper.add(dataId, page.getCode());
}
String[] childCodes = page.getChildrenCodes();
for (String childCode : childCodes) {
IPage child = pageManager.getOnlinePage(childCode);
if (null != child) {
this.searchPublishedDataObjects(dataObjectPageMapper, child, pageManager);
}
}
}
}
use of com.agiletec.aps.system.services.pagemodel.PageModel in project entando-core by entando.
the class GuiFragmentDtoBuilder method toDto.
@Override
protected GuiFragmentDto toDto(GuiFragment src) {
if (null == src) {
return null;
}
WidgetType type = null;
if (StringUtils.isNotEmpty(src.getWidgetTypeCode())) {
type = this.getWidgetTypeManager().getWidgetType(src.getWidgetTypeCode());
}
GuiFragmentDto dest = new GuiFragmentDto(src, type);
ListableBeanFactory factory = (ListableBeanFactory) this.beanFactory;
String[] defNames = factory.getBeanNamesForType(GuiFragmentUtilizer.class);
for (String defName : defNames) {
GuiFragmentUtilizer utilizers = null;
try {
utilizers = this.beanFactory.getBean(defName, GuiFragmentUtilizer.class);
List<Object> references = utilizers.getGuiFragmentUtilizers(src.getCode());
if (null != references) {
for (Object reference : references) {
if (reference instanceof GuiFragment) {
dest.addFragmentRef((GuiFragment) reference);
} else if (reference instanceof PageModel) {
dest.addPageModelRef((PageModel) reference);
} else {
logger.info("unexpected reference - type {}", reference.getClass());
}
}
}
} catch (Throwable t) {
logger.error("Error extracting reference from bean '{}'", defName);
utilizers = null;
}
}
return dest;
}
use of com.agiletec.aps.system.services.pagemodel.PageModel in project entando-core by entando.
the class DataObjectMapperCacheWrapperTest method createMockPageModel.
private PageModel createMockPageModel() {
PageModel model = new PageModel();
model.setCode("temp_model");
Frame frame = new Frame();
frame.setMainFrame(true);
frame.setDescription("Main Frame");
frame.setPos(0);
Frame[] configuration = new Frame[] { frame };
model.setConfiguration(configuration);
model.setMainFrame(0);
return model;
}
Aggregations