Search in sources :

Example 1 with Person

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;
}
Also used : ArrayList(java.util.ArrayList) Person(org.gluu.oxtrust.model.Person) GluuCustomPerson(org.gluu.oxtrust.model.GluuCustomPerson) ScimPerson(org.gluu.oxtrust.model.scim.ScimPerson) PersonAttribute(org.gluu.oxtrust.model.PersonAttribute) GluuAttribute(org.xdi.model.GluuAttribute)

Aggregations

ArrayList (java.util.ArrayList)1 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)1 Person (org.gluu.oxtrust.model.Person)1 PersonAttribute (org.gluu.oxtrust.model.PersonAttribute)1 ScimPerson (org.gluu.oxtrust.model.scim.ScimPerson)1 GluuAttribute (org.xdi.model.GluuAttribute)1