Index: kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java
===================================================================
--- kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java (revision 120455)
+++ kernel-impl/src/main/java/org/sakaiproject/content/impl/BaseContentService.java (working copy)
@@ -10098,6 +10098,26 @@
}
+ /**
+ * Loads a collection of group references. Any items not found aren't
+ * included in the returned collection;
+ * @param groupRefs The group references to load.
+ * @return The group objects corresponding to the group references. Will
+ * not contain null
.
+ */
+ private Collection findGroupObjects(Collection groupRefs)
+ {
+ Collection groups = new ArrayList();
+ for (String groupRef: groupRefs)
+ {
+ Group group = m_siteService.findGroup(groupRef);
+ if (group != null)
+ {
+ groups.add(group);
+ }
+ }
+ return groups;
+ }
/**
* @inheritDoc
@@ -10109,18 +10129,7 @@
{
m_groups = new ArrayList();
}
- Collection groups = new ArrayList();
- Iterator it = m_groups.iterator();
- while(it.hasNext())
- {
- String ref = (String) it.next();
- Group group = m_siteService.findGroup(ref);
- if(group != null)
- {
- groups.add(group);
- }
- }
- return groups;
+ return findGroupObjects(m_groups);
}
@@ -10181,16 +10190,7 @@
*/
public Collection getInheritedGroupObjects()
{
- Collection groups = new ArrayList();
- Collection groupRefs = getInheritedGroups();
- Iterator it = groupRefs.iterator();
- while(it.hasNext())
- {
- String groupRef = (String) it.next();
- Group group = m_siteService.findGroup(groupRef);
- groups.add(group);
- }
- return groups;
+ return findGroupObjects(getInheritedGroups());
}
/**