*/
public String buildAclGroups(Groups groups, ArrayList<String> pickedGroups) {
// TODO: Transfer ownership of documents is an issue since
// user might not be member of a group for acl is set for a document
Collection<Group> grps = groups.values();
Groups selectedGroups = new Groups();
for (String o : pickedGroups) {
for (Group group : grps) {
if (group != null && group.getName().equals(o)) {
selectedGroups.add(group);
break;
}
}
}
if (selectedGroups.size() > 0) {
} else {
for (String o : pickedGroups) {
Group group = groups.get(o);
if (group != null) {
selectedGroups.add(group);
}
}
}
StringBuffer sbAclXml = new StringBuffer();
if (selectedGroups != null && selectedGroups.isEmpty()) {
return null;
}
sbAclXml.append("<acl>");
for (Group group : selectedGroups.values()) {
sbAclXml.append("<principal type=\"groupDn\">");
sbAclXml.append(Val.escapeXml(group.getDistinguishedName()));
sbAclXml.append("</principal>");
}
sbAclXml.append("</acl>");