@Override public List<KeyValue> getKeyValues() { final List<ProtocolPersonRoleMappingBase> validPersonRoles = getProtocolPersonnelService().getPersonRoleMapping(getSourceRoleId()); List<ConcreteKeyValue> keyValues = new ArrayList<ConcreteKeyValue>(); keyValues.add(new ConcreteKeyValue(getSourceRoleId(), getSourceRoleDescription())); for (ProtocolPersonRoleMappingBase protocolPersonRole : validPersonRoles) { keyValues.add( new ConcreteKeyValue( protocolPersonRole.getTargetRoleId(), getTargetRoleDescription(protocolPersonRole))); } Collections.sort(keyValues); List<KeyValue> returnKeyValues = new ArrayList<KeyValue>(); returnKeyValues.addAll(keyValues); return returnKeyValues; }
/** * This method is used to refresh target role object and return description * * @param protocolPersonRole * @return String - target role name */ private String getTargetRoleDescription(ProtocolPersonRoleMappingBase protocolPersonRole) { protocolPersonRole.refreshReferenceObject(targetRoleReferenceObject); return protocolPersonRole.getTargetRole().getDescription(); }