diff --git a/delegatedaccess/delegatedaccess_hierarchy.patch b/delegatedaccess/delegatedaccess_hierarchy.patch index 3eec4021ee25..7a8ef8577a72 100644 --- a/delegatedaccess/delegatedaccess_hierarchy.patch +++ b/delegatedaccess/delegatedaccess_hierarchy.patch @@ -11,16 +11,40 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -@@ -45,6 +47,8 @@ +@@ -36,6 +38,7 @@ + import org.sakaiproject.hierarchy.dao.model.HierarchyPersistentNode; + import org.sakaiproject.hierarchy.impl.utils.HierarchyImplUtils; + import org.sakaiproject.hierarchy.model.HierarchyNode; ++import org.sakaiproject.db.api.SqlService; + + /** + * The default implementation of the Hierarchy interface +@@ -45,8 +48,12 @@ public class HierarchyServiceImpl implements HierarchyService { private static Log log = LogFactory.getLog(HierarchyServiceImpl.class); + + private static int ORACLE_IN_CLAUSE_SIZE_LIMIT = 1000; ++ private boolean oracle = false; private HierarchyDao dao; ++ private SqlService sqlService; public void setDao(HierarchyDao dao) { -@@ -651,14 +655,26 @@ + this.dao = dao; + } +@@ -58,6 +65,11 @@ + + public void init() { + log.info("init"); ++ ++ if(sqlService != null && "oracle".equals(sqlService.getVendor())){ ++ oracle = true; ++ } ++ + // handle any DB migration/cleanup which needs to happen (mostly for upgrades) + dao.fixupDatabase(); + } +@@ -651,14 +663,26 @@ if (node != null && node.childNodeIds != null && node.childNodeIds.size() > 0) { @@ -38,7 +62,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java + List nodePerms = new ArrayList(); + do{ + int arraySize = nodeIdsList.size() - i; -+ if(arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ ++ if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + // get all the permissions which are related to the nodes under this one @@ -55,7 +79,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java Set allPerms = new HashSet(); if (nodePerms.size() == 0) { // add all new ones -@@ -717,19 +733,27 @@ +@@ -717,19 +741,27 @@ if (node.childNodeIds != null && node.childNodeIds.size() > 0) { nodeIdsSet.addAll(node.childNodeIds); @@ -77,7 +101,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; -+ if(arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ ++ if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + // get all the permissions which are related to the nodes under this one @@ -96,7 +120,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java } } } -@@ -782,14 +806,23 @@ +@@ -782,14 +814,23 @@ } Set userIds = new HashSet(); if (nodeIds.length > 0) { @@ -112,7 +136,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; -+ if(arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ ++ if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List nodePerms = dao.findBySearch(HierarchyNodePermission.class, new Search( @@ -128,7 +152,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java } return userIds; } -@@ -801,14 +834,23 @@ +@@ -801,14 +842,23 @@ } Set perms = new HashSet(); if (nodeIds.length > 0) { @@ -144,7 +168,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; -+ if(arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ ++ if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List nodePerms = dao.findBySearch(HierarchyNodePermission.class, new Search( @@ -160,7 +184,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java } return perms; } -@@ -821,8 +863,20 @@ +@@ -821,8 +871,20 @@ for (String nodeId : nodeIds) { m.put(nodeId, new HashMap>()); } @@ -171,7 +195,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; -+ if(arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ ++ if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List nodePermsItteration = dao.findBySearch(HierarchyNodePermission.class, @@ -183,7 +207,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java // nodeId -> (map of userId -> Set(permission)) for (HierarchyNodePermission nodePerm : nodePerms) { String nodeId = nodePerm.getNodeId(); -@@ -846,8 +900,20 @@ +@@ -846,8 +908,20 @@ for (String userId : userIds) { m.put(userId, new HashMap>()); } @@ -194,7 +218,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java + List nodePerms = new ArrayList(); + do{ + int arraySize = userIdsList.size() - i; -+ if(arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ ++ if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List nodePermsItteration = dao.findBySearch(HierarchyNodePermission.class, @@ -206,7 +230,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java // userId -> (map of nodeId -> Set(permission)) for (HierarchyNodePermission nodePerm : nodePerms) { String userId = nodePerm.getUserId(); -@@ -941,8 +1007,19 @@ +@@ -941,8 +1015,19 @@ for (int i = 0; i < nodeIds.length; i++) { pNodeIds[i] = new Long(nodeIds[i]); } @@ -217,7 +241,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; -+ if(arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ ++ if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List lIterration = dao.findBySearch(HierarchyNodeMetaData.class, @@ -228,7 +252,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java } return l; } -@@ -966,8 +1043,19 @@ +@@ -966,8 +1051,19 @@ for (int i = 0; i < nodeIds.length; i++) { pNodeIds[i] = new Long(nodeIds[i]); } @@ -239,7 +263,7 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java + int i = 0; + do{ + int arraySize = nodeIdsList.size() - i; -+ if(arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ ++ if(oracle && arraySize > ORACLE_IN_CLAUSE_SIZE_LIMIT){ + arraySize = ORACLE_IN_CLAUSE_SIZE_LIMIT; + } + List lIterration = dao.findBySearch(HierarchyPersistentNode.class, @@ -250,3 +274,53 @@ Index: impl/src/java/org/sakaiproject/hierarchy/impl/HierarchyServiceImpl.java } return l; } +@@ -986,4 +1082,12 @@ + return parentNodeId; + } + ++ public SqlService getSqlService() { ++ return sqlService; ++ } ++ ++ public void setSqlService(SqlService sqlService) { ++ this.sqlService = sqlService; ++ } ++ + } +Index: impl/pom.xml +=================================================================== +--- impl/pom.xml (revision 78244) ++++ impl/pom.xml (working copy) +@@ -35,6 +35,12 @@ + ${sakai.generic-dao.version} + + ++ ++ ++ org.sakaiproject ++ sakai-db-api ++ ++ + + + org.springframework +@@ -174,4 +180,4 @@ + + + +- +\ No newline at end of file ++ +Index: pack/src/webapp/WEB-INF/components.xml +=================================================================== +--- pack/src/webapp/WEB-INF/components.xml (revision 78244) ++++ pack/src/webapp/WEB-INF/components.xml (working copy) +@@ -12,6 +12,7 @@ + + ++ + + + +\ No newline at end of file