Пример #1
0
  /**
   * Will copy into this Person, the details from the input Person.
   *
   * @param rs - The Person from which the details to be copied from.
   */
  public void sync(final ResearchStaff rs) {
    super.sync(rs);
    setNciIdentifier(rs.getNciIdentifier());
    if (getAddress() != null) {
      getAddress().sync(rs.getAddress());
    } else {
      setAddress(rs.getAddress());
    }

    // sync the site researchstaffs
    CollectionUtils.forAllDo(
        getSiteResearchStaffs(),
        new Closure<SiteResearchStaff>() {
          public void execute(SiteResearchStaff srs) {
            SiteResearchStaff otherSRS = rs.findSiteResearchStaff(srs);
            srs.sync(otherSRS);
          }
        });

    // add new site researchstaff if needed
    for (SiteResearchStaff srs : rs.getSiteResearchStaffs()) {
      SiteResearchStaff availableSRS = findSiteResearchStaff(srs);
      if (availableSRS == null) addSiteResearchStaff(srs);
    }
  }
Пример #2
0
  /* (non-Javadoc)
   * @see java.lang.Object#equals(java.lang.Object)
   */
  public boolean equals(Object o) {

    if (o == null) return false;

    if (o == this) return true;

    if (!(o instanceof ResearchStaff)) return false;
    ResearchStaff that = (ResearchStaff) o;
    if (that.getId() != null && getId() != null) return that.getId().equals(getId());

    if (!super.equals(o)) return false;

    if (emailAddress != null ? !emailAddress.equals(that.emailAddress) : that.emailAddress != null)
      return false;
    return true;
  }