// attributes, derived attributes, virtual attributes and resources
return fill(role, roleMod, AttributableUtil.getInstance(AttributableType.ROLE), scce);
}
public RoleTO getRoleTO(SyncopeRole role) {
RoleTO roleTO = new RoleTO();
roleTO.setId(role.getId());
roleTO.setName(role.getName());
roleTO.setInheritAttributes(role.isInheritAttributes());
roleTO.setInheritDerivedAttributes(role.isInheritDerivedAttributes());
roleTO.setInheritVirtualAttributes(role.isInheritVirtualAttributes());
roleTO.setInheritPasswordPolicy(role.isInheritPasswordPolicy());
roleTO.setInheritAccountPolicy(role.isInheritAccountPolicy());
if (role.getParent() != null) {
roleTO.setParent(role.getParent().getId());
}
// -------------------------
// Retrieve all [derived/virtual] attributes (inherited and not)
// -------------------------
final List<RAttr> allAttributes = role.findInheritedAttributes();
allAttributes.addAll((List<RAttr>) role.getAttributes());
final List<RDerAttr> allDerAttributes = role.findInheritedDerivedAttributes();
allDerAttributes.addAll((List<RDerAttr>) role.getDerivedAttributes());
final List<RVirAttr> allVirAttributes = role.findInheritedVirtualAttributes();
allVirAttributes.addAll((List<RVirAttr>) role.getVirtualAttributes());
// -------------------------
fillTO(roleTO, allAttributes, allDerAttributes, allVirAttributes, role.getResources());
for (Entitlement entitlement : role.getEntitlements()) {
roleTO.addEntitlement(entitlement.getName());
}
roleTO.setPasswordPolicy(role.getPasswordPolicy() != null
? role.getPasswordPolicy().getId()
: null);
roleTO.setAccountPolicy(role.getAccountPolicy() != null
? role.getAccountPolicy().getId()
: null);
return roleTO;
}