"Work security map {0} created.", mapName);
return new ResourceStatus(ResourceStatus.SUCCESS, msg, true);
}
private ResourceStatus isValid(Resources resources){
ResourceStatus status = new ResourceStatus(ResourceStatus.SUCCESS, "Validation Successful");
if (mapName == null) {
String msg = localStrings.getLocalString(
"create.connector.work.security.map.noMapName",
"No mapname defined for connector work security map.");
return new ResourceStatus(ResourceStatus.FAILURE, msg, true);
}
if (raName == null) {
String msg = localStrings.getLocalString(
"create.connector.work.security.map.noRaName",
"No raname defined for connector work security map.");
return new ResourceStatus(ResourceStatus.FAILURE, msg, true);
}
if (principalsMap == null && groupsMap == null) {
String msg = localStrings.getLocalString(
"create.connector.work.security.map.noMap",
"No principalsmap or groupsmap defined for connector work security map.");
return new ResourceStatus(ResourceStatus.FAILURE, msg, true);
}
if (principalsMap != null && groupsMap != null) {
String msg = localStrings.getLocalString(
"create.connector.work.security.map.specifyPrincipalsOrGroupsMap",
"A work-security-map can have either (any number of) group mapping " +
"or (any number of) principals mapping but not both. Specify" +
"--principalsmap or --groupsmap.");
return new ResourceStatus(ResourceStatus.FAILURE, msg, true);
}
// ensure we don't already have one of this name
for (Resource resource : resources.getResources()) {
if (resource instanceof WorkSecurityMap) {
if (((WorkSecurityMap) resource).getName().equals(mapName) &&
((WorkSecurityMap) resource).getResourceAdapterName().equals(raName)) {
String msg = localStrings.getLocalString(
"create.connector.work.security.map.duplicate",
"A connector work security map named {0} for resource adapter {1} already exists.",
mapName, raName);
return new ResourceStatus(ResourceStatus.FAILURE, msg, true);
}
}
}
return status;
}