Ejemplo n.º 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);
    }
  }