Ejemplo n.º 1
0
  @Override
  public Object createAddress(Address address, Integer ownerId) {
    if (editable) {
      address.setCategory(category);

      if (checkOwner) {
        address.setOwnerId(ownerId);
      }

      addressDAO.createAddress(address);
      return address.getId();
    }

    return null;
  }
Ejemplo n.º 2
0
 @Override
 public int hashCode() {
   int result = id != null ? id.hashCode() : 0;
   result = 31 * result + (ssn != null ? ssn.hashCode() : 0);
   result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
   result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
   result = 31 * result + (frequentFlyerMiles != null ? frequentFlyerMiles.hashCode() : 0);
   result = 31 * result + (picture != null ? Arrays.hashCode(picture) : 0);
   result = 31 * result + (dateOfBirth != null ? dateOfBirth.hashCode() : 0);
   result = 31 * result + age;
   result = 31 * result + (lastFlight != null ? lastFlight.hashCode() : 0);
   result = 31 * result + (passengerType != null ? passengerType.hashCode() : 0);
   result = 31 * result + (preferences != null ? preferences.hashCode() : 0);
   result = 31 * result + (cards != null ? cards.hashCode() : 0);
   result = 31 * result + (address != null ? address.hashCode() : 0);
   result = 31 * result + (tickets != null ? tickets.hashCode() : 0);
   return result;
 }
Ejemplo n.º 3
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    Passenger passenger = (Passenger) o;

    if (age != passenger.age) return false;
    if (id != null ? !id.equals(passenger.id) : passenger.id != null) return false;
    if (ssn != null ? !ssn.equals(passenger.ssn) : passenger.ssn != null) return false;
    if (firstName != null ? !firstName.equals(passenger.firstName) : passenger.firstName != null)
      return false;
    if (lastName != null ? !lastName.equals(passenger.lastName) : passenger.lastName != null)
      return false;
    if (frequentFlyerMiles != null
        ? !frequentFlyerMiles.equals(passenger.frequentFlyerMiles)
        : passenger.frequentFlyerMiles != null) return false;
    if (!Arrays.equals(picture, passenger.picture)) return false;
    if (dateOfBirth != null
        ? !dateOfBirth.equals(passenger.dateOfBirth)
        : passenger.dateOfBirth != null) return false;
    if (lastFlight != null
        ? !lastFlight.equals(passenger.lastFlight)
        : passenger.lastFlight != null) return false;
    if (passengerType != passenger.passengerType) return false;

    //        if (preferences != null ? !preferences.equals(passenger.preferences) :
    // passenger.preferences != null)
    //            return false;
    //        if (cards != null ? !cards.equals(passenger.cards) : passenger.cards != null) return
    // false;
    if (address != null ? !address.equals(passenger.address) : passenger.address != null)
      return false;
    //        return !(tickets != null ? !tickets.equals(passenger.tickets) : passenger.tickets !=
    // null);
    return true;
  }
Ejemplo n.º 4
0
 /**
  * Removes the address.
  *
  * @param address the address
  */
 public void removeAddress(Address address) {
   this.addresses.remove(address);
   address.setOwner(null);
 }
Ejemplo n.º 5
0
 /**
  * Adds the address.
  *
  * @param address the address
  */
 public void addAddress(Address address) {
   address.setOwner(this);
   this.addresses.add(address);
 }