Search in sources :

Example 76 with StudyUserRoleBean

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;
}
Also used : HashMap(java.util.HashMap) StudyUserRoleBean(org.akaza.openclinica.bean.login.StudyUserRoleBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) Endpoint(org.springframework.ws.server.endpoint.annotation.Endpoint)

Aggregations

StudyUserRoleBean (org.akaza.openclinica.bean.login.StudyUserRoleBean)76 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)35 ArrayList (java.util.ArrayList)34 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)28 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)23 UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)22 Date (java.util.Date)16 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)16 Role (org.akaza.openclinica.bean.core.Role)15 HashMap (java.util.HashMap)14 Iterator (java.util.Iterator)12 InsufficientPermissionException (org.akaza.openclinica.web.InsufficientPermissionException)10 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)9 Validator (org.akaza.openclinica.control.form.Validator)6 SimpleDateFormat (java.text.SimpleDateFormat)4 HttpSession (javax.servlet.http.HttpSession)4 DatasetBean (org.akaza.openclinica.bean.extract.DatasetBean)4 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)4 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)4 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)4