Search in sources :

Example 66 with StudySubjectBean

use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.

the class UrlRewriteServlet method getOpenClinicaResourceFromURL.

/**
     * Method to parse the request URL parameters and get the respective
     * database identifiers
     *
     * @param URLPath
     *            - example "S_CPCS/320999/SE_CPCS%5B1%5D/F_CPCS_1"
     * @param queryString
     *            - example
     *            "format=html&mode=view&tabId=1&exitTo=ViewStudySubject"
     * @return
     */
public OpenClinicaResource getOpenClinicaResourceFromURL(String URLPath) /*
                                                                            * ,
                                                                            * String
                                                                            * queryString
                                                                            */
{
    OpenClinicaResource openClinicaResource = new OpenClinicaResource();
    if ((null != URLPath) && (!URLPath.equals(""))) {
        if (URLPath.contains("/")) {
            String[] tokens = URLPath.split("/");
            if (tokens.length != 0) {
                String URLParamValue = "";
                StudyDAO stdao = new StudyDAO(getDataSource());
                StudySubjectDAO ssubdao = new StudySubjectDAO(getDataSource());
                StudyEventDefinitionDAO sedefdao = new StudyEventDefinitionDAO(getDataSource());
                CRFDAO crfdao = new CRFDAO(getDataSource());
                CRFVersionDAO crfvdao = new CRFVersionDAO(getDataSource());
                ItemDAO idao = new ItemDAO(getDataSource());
                ItemGroupDAO igdao = new ItemGroupDAO(getDataSource());
                StudyEventDAO sedao = new StudyEventDAO(getDataSource());
                StudyBean study = null;
                StudySubjectBean subject = null;
                StudyEventDefinitionBean sed = null;
                CRFBean c = null;
                CRFVersionBean cv = null;
                ItemBean item = null;
                ItemGroupBean ig = null;
                StudyEventBean studyEvent = null;
                Integer studySubjectId = 0;
                Integer eventDefId = 0;
                Integer eventRepeatKey = 0;
                for (int i = 0; i < tokens.length; i++) {
                    // when interpreting these request URL parameters, the
                    // assumption is that the position of
                    // each type of parameters will be fixed. Meaning, study
                    // OID is always going to be at the start
                    // followed by StudySubjectKey followed by study event
                    // definition OID followed by
                    // study event repeat key followed by form OID followed
                    // by item group OID followed by
                    // item group repeat key followed by item OID
                    // It can also be done based on the start of OID value
                    // (example study OID presently
                    // starts with 'S_' but we will have to change it if we
                    // change the method of generating
                    // oID values in future.
                    URLParamValue = tokens[i].trim();
                    //System.out.println("URLParamValue::"+URLParamValue);
                    logger.info("URLPAramValue::" + URLParamValue);
                    if ((null != URLParamValue) && (!URLParamValue.equals(""))) {
                        switch(i) {
                            case 0:
                                {
                                    // study OID
                                    study = stdao.findByOid(URLParamValue);
                                    //validate study OID
                                    if (study == null) {
                                        openClinicaResource.setInValid(true);
                                        openClinicaResource.getMessages().add(resexception.getString("invalid_study_oid"));
                                        return openClinicaResource;
                                    } else {
                                        openClinicaResource.setStudyOID(URLParamValue);
                                        if (null != study) {
                                            openClinicaResource.setStudyID(study.getId());
                                        }
                                    }
                                    break;
                                }
                            case 1:
                                {
                                    // StudySubjectKey
                                    subject = ssubdao.findByOidAndStudy(URLParamValue, study.getId());
                                    //validate subject OID
                                    if (subject == null) {
                                        openClinicaResource.setInValid(true);
                                        openClinicaResource.getMessages().add(resexception.getString("invalid_subject_oid"));
                                        return openClinicaResource;
                                    } else {
                                        openClinicaResource.setStudySubjectOID(URLParamValue);
                                        if (null != subject) {
                                            studySubjectId = subject.getId();
                                            openClinicaResource.setStudySubjectID(studySubjectId);
                                        }
                                    }
                                    break;
                                }
                            case 2:
                                {
                                    // study event definition OID
                                    // separate study event OID and study event
                                    // repeat key
                                    String seoid = "";
                                    String eventOrdinal = "";
                                    if (URLParamValue.contains("%5B") && URLParamValue.contains("%5D")) {
                                        seoid = URLParamValue.substring(0, URLParamValue.indexOf("%5B"));
                                        openClinicaResource.setStudyEventDefOID(seoid);
                                        eventOrdinal = URLParamValue.substring(URLParamValue.indexOf("%5B") + 3, URLParamValue.indexOf("%5D"));
                                    } else if (URLParamValue.contains("[") && URLParamValue.contains("]")) {
                                        seoid = URLParamValue.substring(0, URLParamValue.indexOf("["));
                                        logger.info("seoid" + seoid);
                                        openClinicaResource.setStudyEventDefOID(seoid);
                                        eventOrdinal = URLParamValue.substring(URLParamValue.indexOf("[") + 1, URLParamValue.indexOf("]"));
                                        logger.info("eventOrdinal::" + eventOrdinal);
                                    } else {
                                        //event ordinal not specified
                                        openClinicaResource.setInValid(true);
                                        openClinicaResource.getMessages().add(resexception.getString("event_ordinal_not_specified"));
                                        return openClinicaResource;
                                    }
                                    if ((null != seoid) && (null != study)) {
                                        sed = sedefdao.findByOidAndStudy(seoid, study.getId(), study.getParentStudyId());
                                        //validate study event oid
                                        if (null == sed) {
                                            openClinicaResource.setInValid(true);
                                            openClinicaResource.getMessages().add(resexception.getString("invalid_event_oid"));
                                            return openClinicaResource;
                                        } else {
                                            eventDefId = sed.getId();
                                            openClinicaResource.setStudyEventDefID(eventDefId);
                                        }
                                    }
                                    if (null != eventRepeatKey) {
                                        eventRepeatKey = Integer.parseInt(eventOrdinal.trim());
                                        //validate the event ordinal specified exists in database
                                        studyEvent = (StudyEventBean) sedao.findByStudySubjectIdAndDefinitionIdAndOrdinal(subject.getId(), sed.getId(), eventRepeatKey);
                                        //this method return new StudyEvent (not null) even if no studyEvent can be found
                                        if (null == studyEvent || studyEvent.getId() == 0) {
                                            openClinicaResource.setInValid(true);
                                            openClinicaResource.getMessages().add(resexception.getString("invalid_event_ordinal"));
                                            return openClinicaResource;
                                        } else {
                                            openClinicaResource.setStudyEventRepeatKey(eventRepeatKey);
                                        }
                                    }
                                    break;
                                }
                            case 3:
                                {
                                    // form OID
                                    openClinicaResource.setFormVersionOID(URLParamValue);
                                    //validate the crf version oid
                                    cv = crfvdao.findByOid(URLParamValue);
                                    if (cv == null) {
                                        openClinicaResource.setInValid(true);
                                        openClinicaResource.getMessages().add(resexception.getString("invalid_crf_oid"));
                                        return openClinicaResource;
                                    } else {
                                        openClinicaResource.setFormVersionID(cv.getId());
                                        //validate if crf is removed
                                        if (cv.getStatus().equals(Status.DELETED)) {
                                            openClinicaResource.setInValid(true);
                                            openClinicaResource.getMessages().add(resexception.getString("removed_crf"));
                                            return openClinicaResource;
                                        } else {
                                            if (null != study) {
                                                // cv =
                                                // crfvdao.findByCrfVersionOidAndStudy(URLParamValue,
                                                // study.getId());
                                                // if (null != cv) {
                                                // openClinicaResource.setFormVersionID(cv.getId());
                                                // openClinicaResource.setFormID(cv.getCrfId());
                                                // }
                                                HashMap studySubjectCRFDataDetails = sedao.getStudySubjectCRFData(study, studySubjectId, eventDefId, URLParamValue, eventRepeatKey);
                                                if ((null != studySubjectCRFDataDetails) && (studySubjectCRFDataDetails.size() != 0)) {
                                                    if (studySubjectCRFDataDetails.containsKey("event_crf_id")) {
                                                        openClinicaResource.setEventCrfId((Integer) studySubjectCRFDataDetails.get("event_crf_id"));
                                                    }
                                                    if (studySubjectCRFDataDetails.containsKey("event_definition_crf_id")) {
                                                        openClinicaResource.setEventDefinitionCrfId((Integer) studySubjectCRFDataDetails.get("event_definition_crf_id"));
                                                    }
                                                    if (studySubjectCRFDataDetails.containsKey("study_event_id")) {
                                                        openClinicaResource.setStudyEventId((Integer) studySubjectCRFDataDetails.get("study_event_id"));
                                                    }
                                                } else {
                                                    //no data was found in the database for the combination of parameters in the RESTful URL. There are 2 possible reasons:
                                                    //a. The data entry is not started yet for this event CRF. As of OpenClinica 3.1.3 we have not implemented the 
                                                    // RESTful URL functionality in this case.
                                                    //b. The form version OID entered in the URL could be different than the one used in the data entry
                                                    openClinicaResource.setInValid(true);
                                                    openClinicaResource.getMessages().add(resexception.getString("either_no_data_for_crf_or_data_entry_not_started"));
                                                    return openClinicaResource;
                                                }
                                            }
                                        }
                                    }
                                    break;
                                }
                            case 4:
                                {
                                    // item group OID
                                    // separate item group OID and item group
                                    // repeat key
                                    String igoid = "";
                                    String igRepeatKey = "";
                                    if (URLParamValue.contains("[")) {
                                        igoid = URLParamValue.substring(1, URLParamValue.indexOf("["));
                                        igRepeatKey = URLParamValue.substring(URLParamValue.indexOf("["), URLParamValue.indexOf("}]"));
                                    }
                                    if ((null != igoid) && (null != cv)) {
                                        ig = igdao.findByOidAndCrf(URLParamValue, cv.getCrfId());
                                        if (null != ig) {
                                            openClinicaResource.setItemGroupID(ig.getId());
                                        }
                                    }
                                    if (null != igRepeatKey) {
                                        openClinicaResource.setItemGroupRepeatKey(Integer.parseInt(igRepeatKey));
                                    }
                                    break;
                                }
                            case 5:
                                {
                                    // item = idao.find
                                    break;
                                }
                        }
                    // switch end
                    }
                }
            }
        }
    }
    return openClinicaResource;
}
Also used : CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) ItemBean(org.akaza.openclinica.bean.submit.ItemBean) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) ItemDAO(org.akaza.openclinica.dao.submit.ItemDAO) HashMap(java.util.HashMap) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ItemGroupDAO(org.akaza.openclinica.dao.submit.ItemGroupDAO) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) ItemGroupBean(org.akaza.openclinica.bean.submit.ItemGroupBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO)

Example 67 with StudySubjectBean

use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.

the class AccountController method getAccount3.

/**
	 * @api {get} /pages/accounts/study/:studyOid/studysubject/:studySubjectId Retrieve a user account - participant
	 * @apiName getAccount3
	 * @apiPermission Module participate - enabled & admin
	 * @apiVersion 3.8.0
	 * @apiParam {String} studyOid Study Oid.
	 * @apiParam {String} studySubjectId Study Subject Id .
	 * @apiGroup User Account
	 * @apiDescription Retrieves the participant user account with the given studySubjectId and studyOid
	 * @apiParamExample {json} Request-Example:
	 *                  {
	 *                  "studyOid": " S_BL101",
	 *                  "studySubjectId": "Sub100"
	 *                  }
	 * @apiSuccessExample {json} Success-Response:
	 *                    HTTP/1.1 200 OK
	 *                    {
	 *                    "lName": "",
	 *                    "mobile": "JTaa7WGRdH5dGs42XyTrgA==",
	 *                    "accessCode": "5s02UFpiMBijWuzaxSOojg==",
	 *                    "password": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
	 *                    "email": "XzJadh3l3V7uUoPCggbSoIfoNW8IQU3qsvrtHfJH7J0=",
	 *                    "userName": "S_BL101.SS_SUB100",
	 *                    "studySubjectId": null,
	 *                    "fName": "pdyGCN1CdAKIGOUEERz/yQ=="
	 *                    }
	 */
@RequestMapping(value = "/study/{studyOid}/studysubject/{studySubjectId}", method = RequestMethod.GET)
public ResponseEntity<UserDTO> getAccount3(@PathVariable("studyOid") String studyOid, @PathVariable("studySubjectId") String studySubjectId) throws Exception {
    ResourceBundleProvider.updateLocale(new Locale("en_US"));
    uDTO = null;
    System.out.println("I'm in getAccount3");
    StudyBean parentStudy = getParentStudy(studyOid);
    String oid = parentStudy.getOid();
    StudySubjectBean studySubjectBean = getStudySubject(studySubjectId, parentStudy);
    if (isStudyASiteLevelStudy(studyOid))
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
    if (!mayProceed(oid, studySubjectBean))
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
    if (isStudyDoesNotExist(oid))
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
    if (isStudySubjectDoesNotExist(studySubjectBean))
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.NOT_ACCEPTABLE);
    // build UserName
    HashMap<String, String> mapValues = buildParticipantUserName(studySubjectBean);
    // Participant User Name
    String pUserName = mapValues.get("pUserName");
    udao = new UserAccountDAO(dataSource);
    UserAccountBean userAccountBean = (UserAccountBean) udao.findByUserName(pUserName);
    if (!userAccountBean.isActive()) {
        uDTO = new UserDTO();
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.OK);
    } else {
        buildUserDTO(userAccountBean);
        return new ResponseEntity<UserDTO>(uDTO, org.springframework.http.HttpStatus.OK);
    }
}
Also used : Locale(java.util.Locale) ResponseEntity(org.springframework.http.ResponseEntity) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) UserDTO(org.akaza.openclinica.bean.login.UserDTO) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO)

Example 68 with StudySubjectBean

use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.

the class OdmController method getODM.

private ODM getODM(String studyOID, String subjectKey) {
    ODM odm = new ODM();
    String ssoid = subjectKey;
    if (ssoid == null) {
        return null;
    }
    FormLayoutDAO formLayoutDAO = new FormLayoutDAO(dataSource);
    StudyDAO studyDAO = new StudyDAO(dataSource);
    StudySubjectDAO studySubjectDAO = new StudySubjectDAO(dataSource);
    EventCRFDAO eventCRFDAO = new EventCRFDAO(dataSource);
    ItemDataDAO itemDataDAO = new ItemDataDAO(dataSource);
    CRFDAO crfDAO = new CRFDAO(dataSource);
    List<ODMcomplexTypeDefinitionFormData> formDatas = new ArrayList<>();
    try {
        // Retrieve crfs for next event
        StudySubjectBean studySubjectBean = studySubjectDAO.findByOid(ssoid);
        ParticipantEventService participantEventService = new ParticipantEventService(dataSource);
        StudyEventBean nextEvent = participantEventService.getNextParticipantEvent(studySubjectBean);
        if (nextEvent != null) {
            logger.debug("Found event: " + nextEvent.getName() + " - ID: " + nextEvent.getId());
            List<EventCRFBean> eventCrfs = eventCRFDAO.findAllByStudyEvent(nextEvent);
            StudyBean study = studyDAO.findByOid(studyOID);
            if (!mayProceed(studyOID, studySubjectBean))
                return odm;
            List<EventDefinitionCRFBean> eventDefCrfs = participantEventService.getEventDefCrfsForStudyEvent(studySubjectBean, nextEvent);
            for (EventDefinitionCRFBean eventDefCrf : eventDefCrfs) {
                if (eventDefCrf.isParticipantForm()) {
                    EventCRFBean eventCRF = participantEventService.getExistingEventCRF(studySubjectBean, nextEvent, eventDefCrf);
                    boolean itemDataExists = false;
                    boolean validStatus = true;
                    FormLayoutBean formLayout = null;
                    if (eventCRF != null) {
                        if (eventCRF.getStatus().getId() != 1 && eventCRF.getStatus().getId() != 2)
                            validStatus = false;
                        if (itemDataDAO.findAllByEventCRFId(eventCRF.getId()).size() > 0)
                            itemDataExists = true;
                        formLayout = (FormLayoutBean) formLayoutDAO.findByPK(eventCRF.getFormLayoutId());
                    } else
                        formLayout = (FormLayoutBean) formLayoutDAO.findByPK(eventDefCrf.getDefaultVersionId());
                    if (validStatus) {
                        String formUrl = null;
                        if (!itemDataExists)
                            formUrl = createEnketoUrl(studyOID, formLayout, nextEvent, ssoid);
                        else
                            formUrl = createEditUrl(studyOID, formLayout, nextEvent, ssoid);
                        formDatas.add(getFormDataPerCrf(formLayout, nextEvent, eventCrfs, crfDAO, formUrl, itemDataExists));
                    }
                }
            }
            return createOdm(study, studySubjectBean, nextEvent, formDatas);
        } else {
            logger.debug("Unable to find next event for subject.");
        }
    } catch (Exception e) {
        logger.error(e.getMessage());
        logger.error(ExceptionUtils.getStackTrace(e));
    }
    return odm;
}
Also used : EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) ParticipantEventService(org.akaza.openclinica.service.ParticipantEventService) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) ItemDataDAO(org.akaza.openclinica.dao.submit.ItemDataDAO) ODMcomplexTypeDefinitionFormData(org.cdisc.ns.odm.v130.ODMcomplexTypeDefinitionFormData) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) FormLayoutDAO(org.akaza.openclinica.dao.submit.FormLayoutDAO) ODM(org.cdisc.ns.odm.v130.ODM) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 69 with StudySubjectBean

use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.

the class BatchCRFMigrationController method run.

@Override
public void run() {
    dataSource = helperObject.getDataSource();
    cBean = helperObject.getcBean();
    reportLog = helperObject.getReportLog();
    stBean = helperObject.getStBean();
    resterms = helperObject.getResterms();
    userAccountBean = helperObject.getUserAccountBean();
    openClinicaMailSender = helperObject.getOpenClinicaMailSender();
    sessionFactory = helperObject.getSessionFactory();
    Session session = sessionFactory.openSession();
    Transaction tx = session.beginTransaction();
    helperObject.setSession(session);
    int i = 0;
    for (EventCRFBean eventCrfToMigrate : helperObject.getEventCrfListToMigrate()) {
        i++;
        executeMigrationAction(helperObject, eventCrfToMigrate);
        if (i % 50 == 0) {
            session.flush();
            session.clear();
        }
        StudySubjectBean ssBean = (StudySubjectBean) ssdao().findByPK(eventCrfToMigrate.getStudySubjectId());
        StudyBean sBean = (StudyBean) sdao().findByPK(ssBean.getStudyId());
        StudyEventBean seBean = (StudyEventBean) sedao().findByPK(eventCrfToMigrate.getStudyEventId());
        StudyEventDefinitionBean sedBean = (StudyEventDefinitionBean) seddao().findByPK(seBean.getStudyEventDefinitionId());
        reportLog.getLogs().add(cBean.getName() + "," + helperObject.getSourceCrfVersionBean().getName() + "," + helperObject.getTargetCrfVersionBean().getName() + "," + ssBean.getLabel() + "," + sBean.getName() + "," + sedBean.getName() + "," + seBean.getSampleOrdinal());
    }
    tx.commit();
    session.close();
    String fileName = new SimpleDateFormat("_yyyy-MM-dd-hhmmssSaa'.txt'").format(new Date());
    fileName = "logFile" + fileName;
    File file = createLogFile(fileName);
    PrintWriter writer = null;
    try {
        writer = openFile(file);
    } catch (FileNotFoundException | UnsupportedEncodingException e) {
        e.printStackTrace();
    } finally {
        writer.print(toStringTextFormat(reportLog, resterms, stBean, cBean));
        closeFile(writer);
    }
    String reportUrl = getReportUrl(fileName, helperObject.getUrlBase());
    String fullName = userAccountBean.getFirstName() + " " + userAccountBean.getLastName();
    StringBuilder body = new StringBuilder();
    body.append(resterms.getString("Dear") + " " + fullName + ",<br><br>" + resterms.getString("Batch_CRF_version_migration_has_finished_running") + "<br>" + resterms.getString("Study") + ": " + stBean.getName() + "<br>" + resterms.getString("CRF") + ": " + cBean.getName() + "<br><br>" + resterms.getString("A_summary_report_of_the_migration_is_available_here") + ":<br>" + reportUrl + "<br><br>" + resterms.getString("Thank_you_Your_OpenClinica_System"));
    logger.info(body.toString());
    openClinicaMailSender.sendEmail(userAccountBean.getEmail(), EmailEngine.getAdminEmail(), resterms.getString("Batch_Migration_Complete_For") + " " + stBean.getName(), body.toString(), true);
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) Date(java.util.Date) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) Transaction(org.hibernate.Transaction) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) SimpleDateFormat(java.text.SimpleDateFormat) File(java.io.File) Session(org.hibernate.Session) PrintWriter(java.io.PrintWriter)

Example 70 with StudySubjectBean

use of org.akaza.openclinica.bean.managestudy.StudySubjectBean in project OpenClinica by OpenClinica.

the class AccountController method isStudySubjecAndCRCRolesMatch.

private Boolean isStudySubjecAndCRCRolesMatch(String studySubjectId, String crcUserName, String studyOid) {
    // crc is siteA studySubject is siteA , pass (same site)
    // crc is siteA studySubject is siteB , Fail
    // crc is siteA studySubject is study , Fail
    // crc is study studySubject is siteA , pass
    // crc is study studySubject is siteB , pass
    // crc is study studySubject is study , pass
    StudyBean parentStudy = getParentStudy(studyOid);
    Integer studyIdFromStudyOid = parentStudy.getId();
    StudySubjectBean studySubjectBean = getStudySubject(studySubjectId, parentStudy);
    Integer studyIdFromStudySubjectId = studySubjectBean.getStudyId();
    System.out.println("    ------------------     ");
    System.out.println("studyIdFromStudyOid :  " + studyIdFromStudyOid);
    System.out.println("studySubjectId:  " + studySubjectId);
    System.out.println("studyIdFromStudySubjectId:  " + studyIdFromStudySubjectId);
    return doesStudySubjecAndCRCRolesMatch(crcUserName, studyIdFromStudySubjectId);
}
Also used : StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean)

Aggregations

StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)155 ArrayList (java.util.ArrayList)102 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)86 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)71 HashMap (java.util.HashMap)66 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)66 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)57 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)52 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)52 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)49 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)45 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)43 Date (java.util.Date)42 Iterator (java.util.Iterator)38 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)35 SubjectBean (org.akaza.openclinica.bean.submit.SubjectBean)29 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)26 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)26 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)26 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)23