WebuiRequestContext context = event.getRequestContext();
String id = context.getRequestParameter(OBJECTID);
UserPortalConfigService service = uiPageBrowser.getApplicationComponent(UserPortalConfigService.class);
UIApplication uiApp = context.getUIApplication();
PageContext page = (id != null) ? service.getPageService().loadPage(PageKey.parse(id)) : null;
if (page == null) {
uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.PageNotExist", new String[] { id }, 1));
return;
}
UserACL userACL = uiPageBrowser.getApplicationComponent(UserACL.class);
if (!userACL.hasEditPermission(page)) {
uiApp.addMessage(new ApplicationMessage("UIPageBrowser.msg.delete.NotDelete", new String[] { id }, 1));
return;
}
UIPortal uiPortal = Util.getUIPortal();
UserNode userNode = uiPortal.getSelectedUserNode();
boolean isDeleteCurrentPage = page.getKey().equals(userNode.getPageRef());
service.getPageService().destroyPage(page.getKey());
// Minh Hoang TO: The cached UIPage objects corresponding to removed Page should be removed here.
// As we have multiple UIPortal, which means multiple caches of UIPage. It 's unwise to garbage
// all UIPage caches at once. Better solution is to clear UIPage on browsing to PageNode having Page
// removed