/**
  * Creates an account object from another one, given as argument.
  *
  * @param o other account to copy
  */
 public static Account create(Account o) {
   Account a = new AccountImpl();
   a.setUid(o.getUid());
   a.setCommonName(o.getCommonName());
   a.setSurname(o.getSurname());
   a.setOrg(o.getOrg());
   a.setEmail(o.getEmail());
   a.setPhone(o.getPhone());
   a.setDescription(o.getDescription());
   // passwords / new passwords fields voluntarily omitted:
   // the password update process should not go through this.
   a.setGivenName(o.getGivenName());
   a.setTitle(o.getTitle());
   a.setPostalAddress(o.getPostalAddress());
   a.setPostalCode(o.getPostalCode());
   a.setRegisteredAddress(o.getRegisteredAddress());
   a.setPostOfficeBox(o.getPostOfficeBox());
   a.setPhysicalDeliveryOfficeName(o.getPhysicalDeliveryOfficeName());
   a.setStreet(o.getStreet());
   a.setLocality(o.getLocality());
   a.setFacsimile(o.getFacsimile());
   a.setMobile(o.getMobile());
   a.setRoomNumber(o.getRoomNumber());
   a.setStateOrProvince(o.getStateOrProvince());
   a.setOrganizationalUnit(o.getOrganizationalUnit());
   a.setHomePostalAddress(o.getHomePostalAddress());
   return a;
 }
  /** Creates an account object with detailed data. */
  public static Account createDetails(
      String uid,
      String givenName,
      String surname,
      String org,
      String physicalDeliveryOfficeName,
      String postalAddress,
      String postalCode,
      String postOfficeBox,
      String registeredAddress,
      String title) {

    Account a = new AccountImpl();

    a.setUid(uid);

    a.setGivenName(givenName);
    a.setSurname(surname);
    a.setCommonName(formatCommonName(givenName, surname));

    a.setOrg(org);

    a.setPhysicalDeliveryOfficeName(physicalDeliveryOfficeName);
    a.setPostalAddress(postalAddress);
    a.setPostalCode(postalCode);
    a.setPostOfficeBox(postOfficeBox);

    a.setRegisteredAddress(registeredAddress);
    a.setTitle(title);

    return a;
  }
  /**
   * Creates an account object with all data.
   *
   * @param uid
   * @param cn full name
   * @param surname surname
   * @param givenName first name
   * @param email
   * @param org
   * @param title
   * @param phone
   * @param description
   * @param postalAddress
   * @param postalCode
   * @param registeredAddress
   * @param postOfficeBox
   * @param physicalDeliveryOfficeName
   * @param locality
   * @param street
   * @param facsimile
   * @param organizationalUnit
   * @param mobile
   * @param roomNumber
   * @return {@link Account}
   */
  public static Account createFull(
      String uid,
      String cn,
      String surname,
      String givenName,
      String email,
      String org,
      String title,
      String phone,
      String description,
      String postalAddress,
      String postalCode,
      String registeredAddress,
      String postOfficeBox,
      String physicalDeliveryOfficeName,
      String street,
      String locality,
      String facsimile,
      String organizationalUnit,
      String homePostalAddress,
      String mobile,
      String roomNumber,
      String stateOrProvince) {

    Account a = new AccountImpl();

    a.setUid(uid);
    a.setCommonName(cn);
    a.setGivenName(givenName);
    a.setSurname(surname);
    a.setEmail(email);

    a.setOrg(org);
    a.setTitle(title);

    a.setPhone(phone);
    a.setDescription(description);

    a.setStreet(street);
    a.setLocality(locality);

    a.setPostalAddress(postalAddress);
    a.setPostalCode(postalCode);
    a.setRegisteredAddress(registeredAddress);
    a.setPostOfficeBox(postOfficeBox);
    a.setPhysicalDeliveryOfficeName(physicalDeliveryOfficeName);

    a.setFacsimile(facsimile);
    a.setOrganizationalUnit(organizationalUnit);

    a.setHomePostalAddress(homePostalAddress);
    a.setMobile(mobile);
    a.setRoomNumber(roomNumber);
    a.setStateOrProvince(stateOrProvince);

    return a;
  }