UIPage uiPage = event.getSource();
String id = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
if (uiPage.isModifiable()) {
uiPage.removeChildById(id);
Page page = (Page) PortalDataMapper.buildModelObject(uiPage);
if (page.getChildren() == null) {
page.setChildren(new ArrayList<ModelObject>());
}
//
PageService pageService = uiPage.getApplicationComponent(PageService.class);
PageState pageState = new PageState(page.getTitle(), page.getDescription(), page.isShowMaxWindow(),
page.getFactoryId(), page.getAccessPermissions() != null ? Arrays.asList(page.getAccessPermissions())
: null, page.getEditPermission());
pageService.savePage(new PageContext(page.getPageKey(), pageState));
//
DataStorage dataService = uiPage.getApplicationComponent(DataStorage.class);
dataService.save(page);