use of com.helger.photon.core.menu.IMenuItemPage in project peppol-practical by phax.
the class PageSecureAdminAddons method _handleAction.
@Nullable
private IHCNode _handleAction(@Nullable final String sAction) {
if (ACTION_EXPIRE_PAGE_CACHE.equals(sAction)) {
final IMenuTree aPublicMenuTree = PhotonGlobalState.state(CApplicationID.APP_ID_PUBLIC).getMenuTree();
// Bulk modify
final MutableInt aCounterUpdated = new MutableInt(0);
final MutableInt aCounterNoNeed = new MutableInt(0);
aPublicMenuTree.iterateAllMenuObjects(aMenuObj -> {
if (aMenuObj instanceof IMenuItemPage) {
final IMenuItemPage aMenuItemPage = (IMenuItemPage) aMenuObj;
if (aMenuItemPage.getPage() instanceof IWebPageResourceContent) {
final IWebPageResourceContent aPageViewExternal = (IWebPageResourceContent) aMenuItemPage.getPage();
if (aPageViewExternal.isReadEveryTime())
aCounterNoNeed.inc();
else {
aPageViewExternal.updateFromResource();
aCounterUpdated.inc();
}
}
}
});
final String sMsg = aCounterUpdated.intValue() + " pages were reloaded." + (aCounterNoNeed.isGT0() ? " On " + aCounterNoNeed.intValue() + " pages no action was necessary because they are set to reload every time." : "");
LOGGER.info(sMsg);
AuditHelper.onAuditExecuteSuccess("page-reload", aCounterUpdated.getAsInteger(), aCounterNoNeed.getAsInteger());
return success(sMsg);
}
return null;
}
Aggregations