if (newDescriptor instanceof EnvironmentProperty) {
descriptor.addApplicationParam((ApplicationParameter)newDescriptor);
} else if (newDescriptor instanceof WLModuleDescriptor) {
descriptor.addWLModule((WLModuleDescriptor)newDescriptor);
} else if (newDescriptor instanceof WLSecurityRoleAssignment) {
WLSecurityRoleAssignment roleMap = (WLSecurityRoleAssignment) newDescriptor;
if (descriptor!=null && !descriptor.isVirtual()) {
descriptor.addWLRoleAssignments(roleMap);
Role role = new Role(roleMap.getRoleName());
SecurityRoleMapper rm = descriptor.getRoleMapper();
if (rm != null) {
if(roleMap.isExternallyDefined()){
rm.assignRole(new Group(roleMap.getRoleName()),
role, descriptor);
} else {
List<String> principals = roleMap.getPrincipalNames();
for (int i = 0; i < principals.size(); i++) {
rm.assignRole(new PrincipalImpl(principals.get(i)),
role, descriptor);
}
}