Skip to content

Commit

Permalink
issue #12716 add suggestions discussed with devs
Browse files Browse the repository at this point in the history
  • Loading branch information
joseorsini committed Oct 2, 2017
1 parent b7768db commit ab63ac7
Showing 1 changed file with 27 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,29 @@ protected IHTMLPage loadPage(String inode, User user) throws DotDataException, D
return APILocator.getHTMLPageAssetAPI().fromContentlet(APILocator.getContentletAPI().find(inode, user, false));

}

/**
* Invalidates Cached Resources of Page
* in order to refresh any recent update on
* contents that were added/removed from it
*
* @param htmlPage
* - The Legacy or Content Page that has changed.
* @param user
* - The user performing this action.
* @throws DotStateException
* @throws DotDataException
* An error occurred when persisting the changes in the
* database.
* @throws DotSecurityException
*/
protected void refreshPage(IHTMLPage htmlPage, User user)
throws DotStateException, DotDataException, DotSecurityException {
if (htmlPage.isContent()) {

This comment has been minimized.

Copy link
@wezell

wezell Oct 2, 2017

Contributor
  1. In 4.x, htmlpage will always be content
  2. should the cache invalidations be called lower in the MultiTreeAPIFactory.delete method rather than in the director?
PageServices.invalidateAll(htmlPage);
updatePageModDate(htmlPage, user);
}
}

/**
* Updates the modification date of the page that has been recently
Expand Down Expand Up @@ -565,8 +588,6 @@ else if (workingLink.isLocked()) {
if (versionInfo != null) {
MultiTreeFactory.saveMultiTree(mTree,
contentlet.getLanguageId());
updatePageModDate(htmlPage, user,
contentlet.getLanguageId());
} else {
// The language in the page and the
// contentlet do not match
Expand All @@ -589,9 +610,8 @@ else if (workingLink.isLocked()) {
}
} else {
MultiTreeFactory.saveMultiTree(mTree);
updatePageModDate(htmlPage, user);
}
PageServices.invalidateAll(htmlPage);
refreshPage(htmlPage,user);
}

} else {
Expand Down Expand Up @@ -653,8 +673,7 @@ else if (workingLink.isLocked()) {
MultiTree multiTree = MultiTreeFactory.getMultiTree(htmlPageIdentifier,containerIdentifier,identifier);
Logger.debug(DirectorAction.class, "multiTree=" + multiTree);
MultiTreeFactory.deleteMultiTree(multiTree);
PageServices.invalidateAll(htmlPage);
updatePageModDate(htmlPage, user);
refreshPage(htmlPage,user);
} catch (DotRuntimeException e) {
Logger.error(this, "Unable to remove content from page", e);
} finally {
Expand Down Expand Up @@ -762,7 +781,7 @@ else if (workingLink.isLocked()) {

}
}
PageServices.invalidateAll(htmlPage);
refreshPage(htmlPage,user);
_sendToReferral(req, res, referer);
return;
}
Expand Down Expand Up @@ -832,7 +851,7 @@ else if (workingLink.isLocked()) {

}
}
PageServices.invalidateAll(htmlPage);
refreshPage(htmlPage,user);
_sendToReferral(req, res, referer);
return;

Expand Down Expand Up @@ -864,23 +883,6 @@ else if (workingLink.isLocked()) {
return;
}

/*if(cmd!=null && cmd.equals("migrate")) {
try {
HibernateUtil.startTransaction();
HTMLPage htmlPage = (HTMLPage) HibernateUtil.load(HTMLPage.class, req.getParameter("htmlPage"));
APILocator.getHTMLPageAssetAPI().migrateLegacyPage(htmlPage, user, false);
HibernateUtil.closeAndCommitTransaction();
}
catch(Exception ex) {
HibernateUtil.rollbackTransaction();
Logger.error(this, "can't migrate page inode "+req.getParameter("htmlPage"),ex);
}
_sendToReferral(req, res, referer);
return;
}*/


Contentlet contentlet = new Contentlet();
String cInode = req.getParameter("contentlet");
if(InodeUtils.isSet(cInode)){
Expand Down

0 comments on commit ab63ac7

Please sign in to comment.