use of org.akaza.openclinica.bean.login.StudyUserRoleBean in project OpenClinica by OpenClinica.
the class StudyEndpoint method getStudies.
private HashMap<Integer, ArrayList<StudyBean>> getStudies() {
ArrayList<StudyUserRoleBean> studyUserRoleBeans = getUserAccountDao().findStudyByUser(getUserAccount().getName(), (ArrayList) getStudyDao().findAll());
HashMap<Integer, ArrayList<StudyBean>> validStudySiteMap = new HashMap<Integer, ArrayList<StudyBean>>();
for (int i = 0; i < studyUserRoleBeans.size(); i++) {
StudyUserRoleBean sr = studyUserRoleBeans.get(i);
StudyBean study = (StudyBean) studyDao.findByPK(sr.getStudyId());
if (study != null && study.getStatus().equals(Status.PENDING)) {
sr.setStatus(study.getStatus());
}
if (study.isSite(study.getParentStudyId()) && !sr.isInvalid()) {
if (validStudySiteMap.get(study.getParentStudyId()) == null) {
ArrayList<StudyBean> sites = new ArrayList<StudyBean>();
sites.add(study);
validStudySiteMap.put(study.getParentStudyId(), sites);
} else {
validStudySiteMap.get(study.getParentStudyId()).add(study);
}
} else if (!study.isSite(study.getParentStudyId())) {
if (validStudySiteMap.get(study.getId()) == null) {
ArrayList<StudyBean> sites = new ArrayList<StudyBean>();
validStudySiteMap.put(study.getId(), sites);
}
}
}
return validStudySiteMap;
}
Aggregations