[roleInheritance] Added compose message method
authorCarlos Aristu <carlos.aristu@openbravo.com>
Thu, 01 Oct 2015 09:10:12 +0200
changeset 27783 785f90e7329f
parent 27782 1e5a95337267
child 27784 046c0208ee72
[roleInheritance] Added compose message method
src/org/openbravo/roleInheritance/RecalculatePermissionsHandler.java
src/org/openbravo/roleInheritance/RoleInheritanceManager.java
--- a/src/org/openbravo/roleInheritance/RecalculatePermissionsHandler.java	Wed Sep 30 20:12:56 2015 +0200
+++ b/src/org/openbravo/roleInheritance/RecalculatePermissionsHandler.java	Thu Oct 01 09:10:12 2015 +0200
@@ -56,12 +56,7 @@
       if ("TEMPLATE".equals(action)) {
         List<Role> updatedRoles = RoleInheritanceManager.recalculateAllAccessesFromTemplate(role);
         if (updatedRoles.size() > 0) {
-          String updatedRoleList = "";
-          for (Role updatedRole : updatedRoles) {
-            updatedRoleList += ", " + updatedRole.getName();
-          }
-          String[] msgParam = { updatedRoleList.substring(1) };
-          textMessage = OBMessageUtils.getI18NMessage("PermissionsModifiedForRoles", msgParam);
+          textMessage = composeTemplateAccessMessageText(updatedRoles);
         } else {
           textMessage = "PermissionsNotModified";
         }
@@ -120,4 +115,14 @@
     }
     return text;
   }
+
+  private String composeTemplateAccessMessageText(List<Role> updatedRoles) {
+    String text, updatedRoleList = "";
+    for (Role updatedRole : updatedRoles) {
+      updatedRoleList += ", " + updatedRole.getName();
+    }
+    String[] msgParam = { updatedRoleList.substring(1) };
+    text = OBMessageUtils.getI18NMessage("PermissionsModifiedForRoles", msgParam);
+    return text;
+  }
 }
--- a/src/org/openbravo/roleInheritance/RoleInheritanceManager.java	Wed Sep 30 20:12:56 2015 +0200
+++ b/src/org/openbravo/roleInheritance/RoleInheritanceManager.java	Thu Oct 01 09:10:12 2015 +0200
@@ -399,7 +399,7 @@
 
   /**
    * Sets to null the Inherit From field to child elements (TabAccess and FieldAccess). This allows
-   * the cascade deletion of these elements when removing a Window Access or a Tab Access.
+   * the cascade deletion of these elements when removing an inherited Window Access or Tab Access.
    * 
    * @param access
    *          The access to be removed from the parent list
@@ -515,7 +515,7 @@
    * 
    * @param role
    *          The role whose accesses will be recalculated
-   * @return a map with the number of accesses updated an created for every access type
+   * @return a map with the number of accesses updated and created for every access type
    */
   public static Map<AccessType, List<Integer>> recalculateAllAccessesForRole(Role role) {
     Map<AccessType, List<Integer>> result = new HashMap<AccessType, List<Integer>>();