ConfigSupport.apply(new SingleConfigCode<Resources>() {
public Object run(Resources param) throws PropertyVetoException,
TransactionFailure {
WorkSecurityMap workSecurityMap =
param.createChild(WorkSecurityMap.class);
workSecurityMap.setName(mapName);
workSecurityMap.setResourceAdapterName(raName);
if (principalsMap != null) {
for (Map.Entry e : principalsMap.entrySet()) {
PrincipalMap principalMap = workSecurityMap.createChild(PrincipalMap.class);
principalMap.setEisPrincipal((String)e.getKey());
principalMap.setMappedPrincipal((String)e.getValue());
workSecurityMap.getPrincipalMap().add(principalMap);
}
} else if (groupsMap != null) {
for (Map.Entry e : groupsMap.entrySet()) {
GroupMap groupMap = workSecurityMap.createChild(GroupMap.class);
groupMap.setEisGroup((String)e.getKey());
groupMap.setMappedGroup((String)e.getValue());
workSecurityMap.getGroupMap().add(groupMap);
}
} else {
// no mapping
}