class HandlingActivity implements ValueObject<HandlingActivity> {

  // TODO make HandlingActivity a part of HandlingEvent too? There is some overlap. 

  @Enumerated(value = EnumType.STRING)
  @Column(name = "next_expected_handling_event_type")
  public HandlingEvent.Type type;

  @ManyToOne()
  @JoinColumn(name = "next_expected_location_id")
  public Location location;

  @ManyToOne
  @JoinColumn(name = "next_expected_voyage_id")
  public Voyage voyage;

  public HandlingActivity(final HandlingEvent.Type type, final Location location) {
    Validate.notNull(type, "Handling event type is required");
    Validate.notNull(location, "Location is required");

    this.type = type;
    this.location = location;
  }

  public HandlingActivity(final HandlingEvent.Type type, final Location location, final Voyage voyage) {
    Validate.notNull(type, "Handling event type is required");
    Validate.notNull(location, "Location is required");
    Validate.notNull(location, "Voyage is required");

    this.type = type;
    this.location = location;
    this.voyage = voyage;
  }

  public HandlingEvent.Type type() {
    return type;
  }

  public Location location() {
    return location;
  }

  public Voyage voyage() {
    return voyage;
  }

  @Override
  public boolean sameValueAs(final HandlingActivity other) {
    return other != null && new EqualsBuilder().
      append(this.type, other.type).
      append(this.location, other.location).
      append(this.voyage, other.voyage).
      isEquals();
  }

  @Override
  public int hashCode() {
    return new HashCodeBuilder().
      append(this.type).
      append(this.location).
      append(this.voyage).
      toHashCode();
  }

  @Override
  public boolean equals(final Object obj) {<FILL_FUNCTION_BODY>}

  HandlingActivity() {
    // Needed by Hibernate
  }
  
}

    if (obj == this) return true;
    if (obj == null) return false;
    if (obj.getClass() != this.getClass()) return false;

    HandlingActivity other = (HandlingActivity) obj;

    return sameValueAs(other);
  
<no_super_class>