/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }