Re: svn commit: r1062164 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java

2011-01-22 Thread risali...@gmail.com
Hi Adrian,

you are right I'm not always remember to do it but in this case I probably I 
don't know how to avoid the casting.

If I try to change from :

public void setStatusTargets(ListString opList) {
   statusTargets = (String [])opList.toArray();
}

to:

public void setStatusTargets(ListString opList) {
   statusTargets = opList.toArray();
}

is not allow, probably you know how to change it without casting it.

Thanks
Marco


Il giorno 22/gen/2011, alle ore 16.06, Adrian Crum ha scritto:

 If you use a parameterized List, then you don't need to cast its elements. 
 Fixing the casts is outside the scope of eliminating compiler warnings, but 
 it would be nice if they were fixed while you're working on the file.
 
 -Adrian
 
 On 1/22/2011 6:53 AM, mrisal...@apache.org wrote:
 Author: mrisaliti
 Date: Sat Jan 22 14:53:40 2011
 New Revision: 1062164
 
 URL: http://svn.apache.org/viewvc?rev=1062164view=rev
 Log:
 Remove java compilation warnings of PermissionRecorder (OFBIZ-4102)
 
 Modified:
 
 ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
 
 Modified: 
 ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
 URL: 
 http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java?rev=1062164r1=1062163r2=1062164view=diff
 ==
 --- 
 ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
  (original)
 +++ 
 ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
  Sat Jan 22 14:53:40 2011
 @@ -25,6 +25,7 @@ import java.util.Map;
  import javolution.util.FastList;
  import javolution.util.FastMap;
 
 +import org.ofbiz.base.util.UtilGenerics;
  import org.ofbiz.base.util.UtilMisc;
  import org.ofbiz.base.util.UtilProperties;
  import org.ofbiz.entity.GenericValue;
 @@ -42,10 +43,10 @@ public class PermissionRecorder {
 
  protected boolean isOn = false;
  protected GenericValue userLogin;
 -protected List permCheckResults = FastList.newInstance();
 +protected ListMapString, Object  permCheckResults = 
 FastList.newInstance();
  protected boolean entityPermCheckResult = false;
  protected String currentContentId = ;
 -protected Map currentContentMap;
 +protected MapString, Object  currentContentMap;
  protected String privilegeEnumId;
  protected int currentCheckMode;
  protected GenericValue [] contentPurposeOperations;
 @@ -97,7 +98,7 @@ public class PermissionRecorder {
 return contentPurposeOperations;
  }
 
 -public void setContentPurposeOperations(List opList) {
 +public void setContentPurposeOperations(ListGenericValue  opList) {
 contentPurposeOperations = (GenericValue [])opList.toArray();
  }
 
 @@ -113,7 +114,7 @@ public class PermissionRecorder {
 return statusTargets;
  }
 
 -public void setStatusTargets(List opList) {
 +public void setStatusTargets(ListString  opList) {
 statusTargets = (String [])opList.toArray();
  }
 
 @@ -121,7 +122,7 @@ public class PermissionRecorder {
 return targetOperations;
  }
 
 -public void setTargetOperations(List opList) {
 +public void setTargetOperations(ListString  opList) {
 targetOperations = (String [])opList.toArray();
  }
 
 @@ -139,7 +140,7 @@ public class PermissionRecorder {
  return currentContentId;
  }
 
 -public void setRoles(List roles) {
 +public void setRoles(ListString  roles) {
  if (currentContentMap != null) {
  if (roles != null)
  currentContentMap.put(roles, roles.toArray());
 @@ -148,7 +149,7 @@ public class PermissionRecorder {
  }
  }
 
 -public void setPurposes(List purposes) {
 +public void setPurposes(ListString  purposes) {
  if (currentContentMap != null) {
  if (purposes != null)
  currentContentMap.put(purposes, purposes.toArray());
 @@ -157,8 +158,7 @@ public class PermissionRecorder {
  }
  }
 
 -public void startMatchGroup(List targetOperations, List purposes, List 
 roles, List targStatusList, String targPrivilegeEnumId, String contentId) {
 -
 +public void startMatchGroup(ListString  targetOperations, 
 ListString  purposes, ListString  roles, ListString  targStatusList, 
 String targPrivilegeEnumId, String contentId) {
  currentContentMap = FastMap.newInstance();
  permCheckResults.add(currentContentMap);
  String s = null;
 @@ -186,25 +186,26 @@ public class PermissionRecorder {
  //if (Debug.infoOn()) Debug.logInfo(startMatchGroup, 
 targStatusList(string): + s, module);
  currentContentMap.put(statusId, s);
  }
 +ListMapString, Object  checkResultList = FastList.newInstance();
  currentContentMap.put(privilegeEnumId, 

Re: svn commit: r1062164 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java

2011-01-22 Thread Adrian Crum

You're right, that method returns an Object array. Never mind. Carry on.

-Adrian

On 1/22/2011 7:54 AM, risali...@gmail.com wrote:

Hi Adrian,

you are right I'm not always remember to do it but in this case I probably I 
don't know how to avoid the casting.

If I try to change from :

public void setStatusTargets(ListString  opList) {
statusTargets = (String [])opList.toArray();
}

to:

public void setStatusTargets(ListString  opList) {
statusTargets = opList.toArray();
}

is not allow, probably you know how to change it without casting it.

Thanks
Marco


Il giorno 22/gen/2011, alle ore 16.06, Adrian Crum ha scritto:


If you use a parameterized List, then you don't need to cast its elements. 
Fixing the casts is outside the scope of eliminating compiler warnings, but it 
would be nice if they were fixed while you're working on the file.

-Adrian

On 1/22/2011 6:53 AM, mrisal...@apache.org wrote:

Author: mrisaliti
Date: Sat Jan 22 14:53:40 2011
New Revision: 1062164

URL: http://svn.apache.org/viewvc?rev=1062164view=rev
Log:
Remove java compilation warnings of PermissionRecorder (OFBIZ-4102)

Modified:
 
ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java

Modified: 
ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java?rev=1062164r1=1062163r2=1062164view=diff
==
--- 
ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
 (original)
+++ 
ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
 Sat Jan 22 14:53:40 2011
@@ -25,6 +25,7 @@ import java.util.Map;
  import javolution.util.FastList;
  import javolution.util.FastMap;

+import org.ofbiz.base.util.UtilGenerics;
  import org.ofbiz.base.util.UtilMisc;
  import org.ofbiz.base.util.UtilProperties;
  import org.ofbiz.entity.GenericValue;
@@ -42,10 +43,10 @@ public class PermissionRecorder {

  protected boolean isOn = false;
  protected GenericValue userLogin;
-protected List permCheckResults = FastList.newInstance();
+protected ListMapString, Object   permCheckResults = 
FastList.newInstance();
  protected boolean entityPermCheckResult = false;
  protected String currentContentId = ;
-protected Map currentContentMap;
+protected MapString, Object   currentContentMap;
  protected String privilegeEnumId;
  protected int currentCheckMode;
  protected GenericValue [] contentPurposeOperations;
@@ -97,7 +98,7 @@ public class PermissionRecorder {
 return contentPurposeOperations;
  }

-public void setContentPurposeOperations(List opList) {
+public void setContentPurposeOperations(ListGenericValue   opList) {
 contentPurposeOperations = (GenericValue [])opList.toArray();
  }

@@ -113,7 +114,7 @@ public class PermissionRecorder {
 return statusTargets;
  }

-public void setStatusTargets(List opList) {
+public void setStatusTargets(ListString   opList) {
 statusTargets = (String [])opList.toArray();
  }

@@ -121,7 +122,7 @@ public class PermissionRecorder {
 return targetOperations;
  }

-public void setTargetOperations(List opList) {
+public void setTargetOperations(ListString   opList) {
 targetOperations = (String [])opList.toArray();
  }

@@ -139,7 +140,7 @@ public class PermissionRecorder {
  return currentContentId;
  }

-public void setRoles(List roles) {
+public void setRoles(ListString   roles) {
  if (currentContentMap != null) {
  if (roles != null)
  currentContentMap.put(roles, roles.toArray());
@@ -148,7 +149,7 @@ public class PermissionRecorder {
  }
  }

-public void setPurposes(List purposes) {
+public void setPurposes(ListString   purposes) {
  if (currentContentMap != null) {
  if (purposes != null)
  currentContentMap.put(purposes, purposes.toArray());
@@ -157,8 +158,7 @@ public class PermissionRecorder {
  }
  }

-public void startMatchGroup(List targetOperations, List purposes, List 
roles, List targStatusList, String targPrivilegeEnumId, String contentId) {
-
+public void startMatchGroup(ListString   targetOperations, ListString   purposes, 
ListString   roles, ListString   targStatusList, String targPrivilegeEnumId, String 
contentId) {
  currentContentMap = FastMap.newInstance();
  permCheckResults.add(currentContentMap);
  String s = null;
@@ -186,25 +186,26 @@ public class PermissionRecorder {
  //if (Debug.infoOn()) Debug.logInfo(startMatchGroup, 
targStatusList(string): + s, module);
  currentContentMap.put(statusId, s);
  }
+ListMapString, Object   checkResultList 

Re: svn commit: r1062164 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java

2011-01-22 Thread risali...@gmail.com
Anyway Adrian thanks for your suggestion.

Marco


Il giorno 22/gen/2011, alle ore 16.57, Adrian Crum ha scritto:

 You're right, that method returns an Object array. Never mind. Carry on.
 
 -Adrian
 
 On 1/22/2011 7:54 AM, risali...@gmail.com wrote:
 Hi Adrian,
 
 you are right I'm not always remember to do it but in this case I probably I 
 don't know how to avoid the casting.
 
 If I try to change from :
 
 public void setStatusTargets(ListString  opList) {
statusTargets = (String [])opList.toArray();
 }
 
 to:
 
 public void setStatusTargets(ListString  opList) {
statusTargets = opList.toArray();
 }
 
 is not allow, probably you know how to change it without casting it.
 
 Thanks
 Marco
 
 
 Il giorno 22/gen/2011, alle ore 16.06, Adrian Crum ha scritto:
 
 If you use a parameterized List, then you don't need to cast its elements. 
 Fixing the casts is outside the scope of eliminating compiler warnings, but 
 it would be nice if they were fixed while you're working on the file.
 
 -Adrian
 
 On 1/22/2011 6:53 AM, mrisal...@apache.org wrote:
 Author: mrisaliti
 Date: Sat Jan 22 14:53:40 2011
 New Revision: 1062164
 
 URL: http://svn.apache.org/viewvc?rev=1062164view=rev
 Log:
 Remove java compilation warnings of PermissionRecorder (OFBIZ-4102)
 
 Modified:
 
 ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
 
 Modified: 
 ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
 URL: 
 http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java?rev=1062164r1=1062163r2=1062164view=diff
 ==
 --- 
 ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
  (original)
 +++ 
 ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java
  Sat Jan 22 14:53:40 2011
 @@ -25,6 +25,7 @@ import java.util.Map;
  import javolution.util.FastList;
  import javolution.util.FastMap;
 
 +import org.ofbiz.base.util.UtilGenerics;
  import org.ofbiz.base.util.UtilMisc;
  import org.ofbiz.base.util.UtilProperties;
  import org.ofbiz.entity.GenericValue;
 @@ -42,10 +43,10 @@ public class PermissionRecorder {
 
  protected boolean isOn = false;
  protected GenericValue userLogin;
 -protected List permCheckResults = FastList.newInstance();
 +protected ListMapString, Object   permCheckResults = 
 FastList.newInstance();
  protected boolean entityPermCheckResult = false;
  protected String currentContentId = ;
 -protected Map currentContentMap;
 +protected MapString, Object   currentContentMap;
  protected String privilegeEnumId;
  protected int currentCheckMode;
  protected GenericValue [] contentPurposeOperations;
 @@ -97,7 +98,7 @@ public class PermissionRecorder {
 return contentPurposeOperations;
  }
 
 -public void setContentPurposeOperations(List opList) {
 +public void setContentPurposeOperations(ListGenericValue   opList) {
 contentPurposeOperations = (GenericValue [])opList.toArray();
  }
 
 @@ -113,7 +114,7 @@ public class PermissionRecorder {
 return statusTargets;
  }
 
 -public void setStatusTargets(List opList) {
 +public void setStatusTargets(ListString   opList) {
 statusTargets = (String [])opList.toArray();
  }
 
 @@ -121,7 +122,7 @@ public class PermissionRecorder {
 return targetOperations;
  }
 
 -public void setTargetOperations(List opList) {
 +public void setTargetOperations(ListString   opList) {
 targetOperations = (String [])opList.toArray();
  }
 
 @@ -139,7 +140,7 @@ public class PermissionRecorder {
  return currentContentId;
  }
 
 -public void setRoles(List roles) {
 +public void setRoles(ListString   roles) {
  if (currentContentMap != null) {
  if (roles != null)
  currentContentMap.put(roles, roles.toArray());
 @@ -148,7 +149,7 @@ public class PermissionRecorder {
  }
  }
 
 -public void setPurposes(List purposes) {
 +public void setPurposes(ListString   purposes) {
  if (currentContentMap != null) {
  if (purposes != null)
  currentContentMap.put(purposes, purposes.toArray());
 @@ -157,8 +158,7 @@ public class PermissionRecorder {
  }
  }
 
 -public void startMatchGroup(List targetOperations, List purposes, 
 List roles, List targStatusList, String targPrivilegeEnumId, String 
 contentId) {
 -
 +public void startMatchGroup(ListString   targetOperations, 
 ListString   purposes, ListString   roles, ListString   
 targStatusList, String targPrivilegeEnumId, String contentId) {
  currentContentMap = FastMap.newInstance();
  permCheckResults.add(currentContentMap);
  String s = null;
 @@ -186,25 +186,26 @@ public class PermissionRecorder {