try {
ConfigSupport.apply(new SingleConfigCode<WorkSecurityMap>() {
public Object run(WorkSecurityMap wsm) throws PropertyVetoException, TransactionFailure {
if (addGroups != null) {
for (Map.Entry e : addGroups.entrySet()) {
GroupMap gm = wsm.createChild(GroupMap.class);
gm.setEisGroup((String) e.getKey());
gm.setMappedGroup((String) e.getValue());
wsm.getGroupMap().add(gm);
}
} else if (addPrincipals != null) {
for (Map.Entry e : addPrincipals.entrySet()) {
PrincipalMap pm = wsm.createChild(PrincipalMap.class);
pm.setEisPrincipal((String) e.getKey());
pm.setMappedPrincipal((String) e.getValue());
wsm.getPrincipalMap().add(pm);
}
}
if (removeGroups != null) {
for (String rg : removeGroups) {
for (GroupMap gm : existingUserGroups) {
if (gm.getEisGroup().equals(rg)) {
wsm.getGroupMap().remove(gm);
}
}
}
} else if (removePrincipals != null) {