Skip to content

Commit

Permalink
rework on #12716
Browse files Browse the repository at this point in the history
  • Loading branch information
joseorsini committed Oct 3, 2017
1 parent 8867948 commit 346e47b
Showing 1 changed file with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
* @author will
*/
public class MultiTreeFactory {

private final static String deleteMultiTreeErrorMessage = "Deleting MultiTree Object failed:";
private final static String saveMultiTreeErrorMessage = "Saving MultiTree Object failed:";

public static void deleteMultiTree(Object o1, Object o2, Object o3) {
Inode inode1 = (Inode) o1;
Expand Down Expand Up @@ -162,11 +165,11 @@ public static void deleteMultiTreeByParent1(Identifier parent, Long languageId)
refreshPageInCache(parent.getId(), languageId);

} catch (SQLException e) {
throw new DotDataException("Error deleting tree and multi-tree dependencies.", e);
throw new DotDataException(deleteMultiTreeErrorMessage, e);
} catch (DotContentletStateException e) {
throw new DotContentletStateException("Error deleting tree and multi-tree dependencies.", e);
throw new DotContentletStateException(deleteMultiTreeErrorMessage, e);
} catch (DotSecurityException e) {
throw new DotSecurityException("Error deleting tree and multi-tree dependencies.", e);
throw new DotSecurityException(deleteMultiTreeErrorMessage, e);
}
}

Expand Down Expand Up @@ -202,16 +205,16 @@ public static void deleteMultiTree(MultiTree o, Long languageId) throws DotDataE
refreshPageInCache(id,languageId);
return;
} catch (DotHibernateException e) {
Logger.error(MultiTreeFactory.class,"deleteMultiTree failed:"+e,e);
Logger.error(MultiTreeFactory.class, deleteMultiTreeErrorMessage + e, e);
throw new DotRuntimeException(e.getMessage());
} catch (DotStateException e) {
Logger.error(MultiTreeFactory.class,"deleteMultiTree failed:"+e,e);
Logger.error(MultiTreeFactory.class, deleteMultiTreeErrorMessage + e, e);
throw new DotStateException(e.getMessage());
} catch (DotDataException e) {
Logger.error(MultiTreeFactory.class,"deleteMultiTree failed:"+e,e);
Logger.error(MultiTreeFactory.class, deleteMultiTreeErrorMessage + e, e);
throw new DotDataException(e.getMessage());
} catch (DotSecurityException e) {
Logger.error(MultiTreeFactory.class, "saveMultiTree failed:" + e, e);
Logger.error(MultiTreeFactory.class, deleteMultiTreeErrorMessage + e, e);
throw new DotSecurityException(e.getMessage());
}
}
Expand Down Expand Up @@ -398,16 +401,16 @@ public static void saveMultiTree(MultiTree o, long languageId) throws DotSecurit
updateVersionTs(id, languageId);
refreshPageInCache(id,languageId);
} catch (DotHibernateException e) {
Logger.error(MultiTreeFactory.class, "saveMultiTree failed:" + e, e);
Logger.error(MultiTreeFactory.class, saveMultiTreeErrorMessage + e, e);
throw new DotRuntimeException(e.getMessage());
} catch (DotStateException e) {
Logger.error(MultiTreeFactory.class, "saveMultiTree failed:" + e, e);
Logger.error(MultiTreeFactory.class, saveMultiTreeErrorMessage + e, e);
throw new DotRuntimeException(e.getMessage());
} catch (DotDataException e) {
Logger.error(MultiTreeFactory.class, "saveMultiTree failed:" + e, e);
Logger.error(MultiTreeFactory.class, saveMultiTreeErrorMessage + e, e);
throw new DotRuntimeException(e.getMessage());
} catch (DotSecurityException e) {
Logger.error(MultiTreeFactory.class, "saveMultiTree failed:" + e, e);
Logger.error(MultiTreeFactory.class, saveMultiTreeErrorMessage + e, e);
throw new DotSecurityException(e.getMessage());
}
}
Expand Down Expand Up @@ -665,7 +668,7 @@ public static java.util.List getParentsOfClass(Inode p, Class c) {
* @throws DotSecurityException
*
*/
private static void updateVersionTs(String id) throws DotStateException, DotDataException, DotSecurityException {
private static void updateVersionTs(String id) throws DotDataException {
updateVersionTs(id, APILocator.getLanguageAPI().getDefaultLanguage().getId());
}

Expand All @@ -681,7 +684,7 @@ private static void updateVersionTs(String id) throws DotStateException, DotData
* @throws DotSecurityException
*
*/
private static void updateVersionTs(String id, Long languageId) throws DotStateException, DotDataException, DotSecurityException {
private static void updateVersionTs(String id, Long languageId) throws DotDataException {
Identifier ident = APILocator.getIdentifierAPI().find(id);
ContentletVersionInfo versionInfo = APILocator.getVersionableAPI()
.getContentletVersionInfo(ident.getId(), languageId);
Expand All @@ -699,7 +702,7 @@ private static void updateVersionTs(String id, Long languageId) throws DotStateE
* @throws DotSecurityException
*
*/
private static void refreshPageInCache(String id) throws DotContentletStateException, DotDataException, DotSecurityException {
private static void refreshPageInCache(String id) throws DotDataException, DotSecurityException {
refreshPageInCache(id, APILocator.getLanguageAPI().getDefaultLanguage().getId());
}

Expand All @@ -714,9 +717,10 @@ private static void refreshPageInCache(String id) throws DotContentletStateExcep
* @throws DotSecurityException
*
*/
private static void refreshPageInCache(String id, Long languageId) throws DotContentletStateException, DotDataException, DotSecurityException {
private static void refreshPageInCache(String id, Long languageId) throws DotDataException, DotSecurityException {
Identifier ident = APILocator.getIdentifierAPI().find(id);
Contentlet content = APILocator.getContentletAPI().findContentletByIdentifier(ident.getId(), true, languageId, APILocator.systemUser(), false);
Contentlet content = APILocator.getContentletAPI()
.findContentletByIdentifier(ident.getId(), true, languageId, APILocator.systemUser(), false);
IHTMLPage htmlPage = APILocator.getHTMLPageAssetAPI().fromContentlet(content);
PageServices.invalidateAll(htmlPage);
}
Expand Down

0 comments on commit 346e47b

Please sign in to comment.