use of org.gluu.oxtrust.model.Person in project oxTrust by GluuFederation.
the class CopyUtils2 method copy.
/**
* Copy data from GluuCustomPerson object to Person object
*
* @param source
* @param destination
* @return
* @throws Exception
*/
public Person copy(GluuCustomPerson source, Person destination, List<GluuAttribute> attributes) {
if (source == null) {
return null;
}
if (destination == null) {
destination = new Person();
}
destination.setInum(source.getInum());
destination.setIname(source.getIname());
destination.setUserId(source.getUid());
destination.setFirstName(source.getGivenName());
destination.setDisplayName(source.getDisplayName());
destination.setLastName(source.getSurname());
destination.setEmail(source.getMail());
destination.setPassword(source.getUserPassword());
destination.setCommonName(source.getGivenName() + " " + source.getDisplayName());
List<PersonAttribute> personAttrList = new ArrayList<PersonAttribute>();
for (GluuAttribute attribute : attributes) {
PersonAttribute personAttr = new PersonAttribute(attribute.getName(), source.getAttribute(attribute.getName()), attribute.getDisplayName());
personAttrList.add(personAttr);
}
destination.setPersonAttrList(personAttrList);
return destination;
}
Aggregations