Exemplo n.º 1
0
 /**
  * Sets the end date.
  *
  * @param date the new end date
  */
 @Transient
 public void setEndDate(Date date) {
   if (getSiteResearchStaffs() == null) return;
   for (SiteResearchStaff srs : this.getSiteResearchStaffs()) {
     srs.setEndDate(date);
   }
 }
Exemplo n.º 2
0
 @Transient
 public void setActive(boolean _active) {
   if (getSiteResearchStaffs() == null) return;
   for (SiteResearchStaff srs : this.getSiteResearchStaffs()) {
     if (!_active) srs.setEndDate(new Date());
     else srs.setEndDate(null);
   }
 }
Exemplo n.º 3
0
  /**
   * Will return SiteResearchStaff having at least one active role provided in roleCodes parameter.
   *
   * @param roleCodes - roles to check
   * @return A list of SiteResearchStaff
   */
  public List<SiteResearchStaff> findSiteResearchStaffByRoles(final String... roleCodes) {
    List<SiteResearchStaff> srsList = new ArrayList<SiteResearchStaff>();
    for (SiteResearchStaff srs : getSiteResearchStaffs()) {
      if (srs.hasActiveRolesOfType(roleCodes)) srsList.add(srs);
    }

    return srsList;
  }
Exemplo n.º 4
0
 /**
  * Will return all the SiteResearchStaff which are currently active.
  *
  * @return the in active site research staff
  */
 @Transient
 public List<SiteResearchStaff> getInActiveSiteResearchStaff() {
   List<SiteResearchStaff> srsList = new ArrayList<SiteResearchStaff>();
   for (SiteResearchStaff srs : getSiteResearchStaffs()) {
     if (!srs.isActive()) srsList.add(srs);
   }
   return srsList;
 }
Exemplo n.º 5
0
 /**
  * Find site research staff.
  *
  * @param other the other
  * @return the site research staff
  */
 public SiteResearchStaff findSiteResearchStaff(SiteResearchStaff other) {
   for (SiteResearchStaff siteResearchStaff : getSiteResearchStaffs()) {
     if (siteResearchStaff.getOrganization().equals(other.getOrganization())) {
       return siteResearchStaff;
     }
   }
   return null;
 }
Exemplo n.º 6
0
  /**
   * Checks if is active.
   *
   * @return true, if is active
   */
  @Transient
  public boolean isActive() {
    if (getSiteResearchStaffs() == null) return false;

    for (SiteResearchStaff srs : this.getSiteResearchStaffs()) {
      if (srs.isActive()) return true;
    }
    return false;
  }
Exemplo n.º 7
0
 /**
  * The earliest start date of this research staff.
  *
  * @return the active date
  */
 @Transient
 public Date getActiveDate() {
   SortedSet<Date> dates = new TreeSet<Date>();
   for (SiteResearchStaff srs : this.getSiteResearchStaffs()) {
     Date activeDate = srs.getActiveDate();
     if (activeDate != null) dates.add(activeDate);
   }
   if (dates.size() > 0) return dates.first();
   else return null;
 }
Exemplo n.º 8
0
 /**
  * Gets the site roles mapping.
  *
  * @return the site roles mapping
  */
 @Transient
 public Map<String, List<String>> getSiteRolesMapping() {
   Map<String, List<String>> siteRolesMap = new HashMap<String, List<String>>();
   List<String> roleCodeList = null;
   for (SiteResearchStaff siteResearchStaff : getSiteResearchStaffs()) {
     for (SiteResearchStaffRole siteResearchStaffRole :
         siteResearchStaff.getSiteResearchStaffRoles()) {
       roleCodeList = new ArrayList<String>();
       roleCodeList.add(siteResearchStaffRole.getRoleCode());
     }
     siteRolesMap.put(siteResearchStaff.getOrganization().getNciInstituteCode(), roleCodeList);
   }
   return siteRolesMap;
 }
Exemplo n.º 9
0
 /**
  * Gets the all roles.
  *
  * @return the all roles
  */
 @Transient
 public List<String> getAllRoles() {
   Set<String> roleSet = new HashSet<String>();
   for (SiteResearchStaff siteResearchStaff : getSiteResearchStaffs()) {
     for (SiteResearchStaffRole siteResearchStaffRole :
         siteResearchStaff.getSiteResearchStaffRoles()) {
       if (siteResearchStaffRole.isActive()) {
         roleSet.add(siteResearchStaffRole.getRoleCode());
       }
     }
   }
   List<String> roleList = new ArrayList<String>();
   roleList.addAll(roleSet);
   return roleList;
 }
Exemplo n.º 10
0
 /* (non-Javadoc)
  * @see org.apache.commons.collections15.Factory#create()
  */
 public SiteResearchStaff create() {
   SiteResearchStaff siteResearchStaff = new SiteResearchStaff();
   siteResearchStaff.setResearchStaff(researchStaff);
   return siteResearchStaff;
 }
Exemplo n.º 11
0
 /**
  * Find site research staff by id.
  *
  * @param id the id
  * @return the site research staff
  */
 public SiteResearchStaff findActiveSiteResearchStaffByOrganizationId(Integer id) {
   for (SiteResearchStaff srs : getActiveSiteResearchStaff()) {
     if (srs.getOrganization() != null && srs.getOrganization().getId().equals(id)) return srs;
   }
   return null;
 }
Exemplo n.º 12
0
 /**
  * Find site research staff by id.
  *
  * @param id the id
  * @return the site research staff
  */
 public SiteResearchStaff findSiteResearchStaffById(Integer id) {
   for (SiteResearchStaff srs : getSiteResearchStaffs()) {
     if (srs.getId() != null && srs.getId().equals(id)) return srs;
   }
   return null;
 }
Exemplo n.º 13
0
 /**
  * Utility method to SiteResearchStaff.
  *
  * @param siteResearchStaff the site research staff
  */
 public void addSiteResearchStaff(final SiteResearchStaff siteResearchStaff) {
   getSiteResearchStaffs().add(siteResearchStaff);
   siteResearchStaff.setResearchStaff(this);
 }