Search in sources :

Example 11 with DataEntryStage

use of org.akaza.openclinica.bean.core.DataEntryStage in project OpenClinica by OpenClinica.

the class CrfBusinessLogicHelper method markCRFComplete.

/**
     * The following methods are for 'mark CRF complete' Note that we will also wrap Study Event status changes in this
     * code, possibly split out in a later release, tbh 06/2008
     * 
     * @return
     */
public boolean markCRFComplete(EventCRFBean ecb, UserAccountBean ub) throws Exception {
    // locale = LocaleResolver.getLocale(request);
    // < respage =
    // ResourceBundle.getBundle("org.akaza.openclinica.i18n.page_messages",
    // locale);
    // < restext =
    // ResourceBundle.getBundle("org.akaza.openclinica.i18n.notes",locale);
    // <
    // resexception=ResourceBundle.getBundle(
    // "org.akaza.openclinica.i18n.exceptions",locale);
    // getEventCRFBean();
    // getEventDefinitionCRFBean();
    DataEntryStage stage = ecb.getStage();
    EventCRFDAO eventCrfDao = new EventCRFDAO(ds);
    ItemDataDAO itemDataDao = new ItemDataDAO(ds);
    StudyDAO sdao = new StudyDAO(ds);
    StudySubjectDAO ssdao = new StudySubjectDAO(ds);
    StudyBean study = sdao.findByStudySubjectId(ecb.getStudySubjectId());
    EventDefinitionCRFBean edcb = getEventDefinitionCrfByStudyEventAndCrfVersion(ecb, study);
    // StudyEventDAO studyEventDao = new StudyEventDAO(ds);
    // StudyEventBean studyEventBean = (StudyEventBean)
    // studyEventDao.findByPK(ecb.getStudyEventId());
    // Status studyEventStatus = studyEventBean.getStatus();
    StudyEventDefinitionDAO studyEventDefinitionDao = new StudyEventDefinitionDAO(ds);
    StudyEventDefinitionBean sedBean = (StudyEventDefinitionBean) studyEventDefinitionDao.findByPK(edcb.getStudyEventDefinitionId());
    CRFDAO crfDao = new CRFDAO(ds);
    ArrayList crfs = (ArrayList) crfDao.findAllActiveByDefinition(sedBean);
    sedBean.setCrfs(crfs);
    // request.setAttribute(TableOfContentsServlet.INPUT_EVENT_CRF_BEAN,
    // ecb);
    // request.setAttribute(INPUT_EVENT_CRF_ID, new
    // Integer(ecb.getId()));
    logger.debug("inout_event_crf_id:" + ecb.getId());
    logger.debug("inout_study_event_def_id:" + sedBean.getId());
    // below bit is from DataEntryServlet, is more appropriate for filling
    // in by hand than by automatic
    // removing this in favor of the more streamlined effect below, tbh
    // 06/2008
    // Page errorPage = getJSPPage();
    // if (stage.equals(DataEntryStage.UNCOMPLETED) ||
    // stage.equals(DataEntryStage.DOUBLE_DATA_ENTRY_COMPLETE) ||
    // stage.equals(DataEntryStage.LOCKED)) {
    // logger.info(
    // "addPageMessage(respage.getString(\"not_mark_CRF_complete1\"))");
    // return false;
    // }
    //
    // if (stage.equals(DataEntryStage.INITIAL_DATA_ENTRY_COMPLETE) ||
    // stage.equals(DataEntryStage.DOUBLE_DATA_ENTRY)) {
    //
    // /*
    // * if (!edcb.isDoubleEntry()) {
    // *
    // logger.info(
    // "addPageMessage(respage.getString(\"not_mark_CRF_complete2\"))");
    // * return false; }
    // *
    // */
    // }
    //
    // /*
    // * if (!isEachSectionReviewedOnce()) { addPageMessage("You may not
    // mark
    // * this Event CRF complete, because there are some sections which have
    // * not been reviewed once."); return false; }
    // */
    //
    // if (!isEachRequiredFieldFillout(ecb)) {
    // logger.info(
    // "addPageMessage(respage.getString(\"not_mark_CRF_complete4\"))");
    // return false;
    // }
    //
    // /*
    // * if (ecb.getInterviewerName().trim().equals("")) { throw new
    // * InconsistentStateException(errorPage, "You may not mark this Event
    // * CRF complete, because the interviewer name is blank."); }
    // */
    Status newStatus = ecb.getStatus();
    DataEntryStage newStage = ecb.getStage();
    boolean ide = true;
    // currently we are setting the event crf status to complete, so this
    // block is all to
    // complete, tbh
    // if (stage.equals(DataEntryStage.INITIAL_DATA_ENTRY) &&
    // edcb.isDoubleEntry()) {
    // newStatus = Status.PENDING;
    // ecb.setUpdaterId(ub.getId());
    // ecb.setUpdater(ub);
    // ecb.setUpdatedDate(new Date());
    // ecb.setDateCompleted(new Date());
    // } else if (stage.equals(DataEntryStage.INITIAL_DATA_ENTRY) &&
    // !edcb.isDoubleEntry()) {
    // newStatus = Status.UNAVAILABLE;
    // ecb.setUpdaterId(ub.getId());
    // ecb.setUpdater(ub);
    // ecb.setUpdatedDate(new Date());
    // ecb.setDateCompleted(new Date());
    // ecb.setDateValidateCompleted(new Date());
    // } else if
    // (stage.equals(DataEntryStage.INITIAL_DATA_ENTRY_COMPLETE)
    // || stage.equals(DataEntryStage.DOUBLE_DATA_ENTRY)) {
    // newStatus = Status.UNAVAILABLE;
    // ecb.setDateValidateCompleted(new Date());
    // ide = false;
    // }
    newStatus = Status.UNAVAILABLE;
    // ecb.setUpdaterId(ub.getId());
    ecb.setUpdater(ub);
    ecb.setUpdatedDate(new Date());
    ecb.setDateCompleted(new Date());
    ecb.setDateValidateCompleted(new Date());
    /*
         * //for the non-reviewed sections, no item data in DB yet, need to //create them if
         * (!isEachSectionReviewedOnce()) { boolean canSave = saveItemsToMarkComplete(newStatus); if (canSave == false){
         * addPageMessage("You may not mark this Event CRF complete, because there are some required entries which have
         * not been filled out."); return false; } }
         */
    ecb.setStatus(newStatus);
    ecb.setStage(newStage);
    ecb = (EventCRFBean) eventCrfDao.update(ecb);
    logger.debug("just updated event crf id: " + ecb.getId());
    // note the below statement only updates the DATES, not the STATUS
    eventCrfDao.markComplete(ecb, ide);
    // update all the items' status to complete
    itemDataDao.updateStatusByEventCRF(ecb, newStatus);
    // change status for study event
    StudyEventDAO sedao = new StudyEventDAO(ds);
    StudyEventBean seb = (StudyEventBean) sedao.findByPK(ecb.getStudyEventId());
    seb.setUpdatedDate(new Date());
    seb.setUpdater(ub);
    // updates with Pauls observation from bug:2488:
    // 1. If there is only one CRF in the event (whether the CRF was
    // required or not), and data was imported for it, the status of the
    // event should be Completed.
    //
    logger.debug("sed bean get crfs get size: " + sedBean.getCrfs().size());
    logger.debug("edcb get crf id: " + edcb.getCrfId() + " version size? " + edcb.getVersions().size());
    logger.debug("ecb get crf id: " + ecb.getCrf().getId());
    logger.debug("ecb get crf version id: " + ecb.getCRFVersionId());
    if (sedBean.getCrfs().size() == 1) {
        seb.setSubjectEventStatus(SubjectEventStatus.COMPLETED);
        logger.info("just set subj event status to -- COMPLETED --");
    } else // removing sedBean.getCrfs().size() > 1 &&
    if (areAllRequired(seb, study) && !areAllCompleted(seb, study)) {
        seb.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
        logger.info("just set subj event status to -- DATAENTRYSTARTED --");
    } else // removing sedBean.getCrfs().size() > 1 &&
    if (!areAllRequired(seb, study)) {
        if (areAllRequiredCompleted(seb, study)) {
            seb.setSubjectEventStatus(SubjectEventStatus.COMPLETED);
            logger.info("just set subj event status to -- 3completed3 --");
        } else {
            seb.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
            logger.info("just set subj event status to -- DATAENTRYSTARTED --");
        }
    } else if (noneAreRequired(seb, study)) {
        seb.setSubjectEventStatus(SubjectEventStatus.COMPLETED);
        logger.info("just set subj event status to -- 5completed5 --");
    }
    logger.debug("just set subj event status, final status is " + seb.getSubjectEventStatus().getName());
    logger.debug("final overall status is " + seb.getStatus().getName());
    seb = (StudyEventBean) sedao.update(seb);
    return true;
}
Also used : Status(org.akaza.openclinica.bean.core.Status) SubjectEventStatus(org.akaza.openclinica.bean.core.SubjectEventStatus) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) ItemDataDAO(org.akaza.openclinica.dao.submit.ItemDataDAO) Date(java.util.Date) DataEntryStage(org.akaza.openclinica.bean.core.DataEntryStage) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 12 with DataEntryStage

use of org.akaza.openclinica.bean.core.DataEntryStage in project OpenClinica by OpenClinica.

the class CrfBusinessLogicHelper method markCRFComplete.

/**
     * The following methods are for 'mark CRF complete' Note that we will also wrap Study Event status changes in this
     * code, possibly split out in a later release, tbh 06/2008
     * 
     * @return
     */
public boolean markCRFComplete(EventCRFBean ecb, UserAccountBean ub, boolean inTransaction) throws Exception {
    DataEntryStage stage = ecb.getStage();
    EventCRFDAO eventCrfDao = new EventCRFDAO(ds);
    ItemDataDAO itemDataDao = new ItemDataDAO(ds);
    StudyDAO sdao = new StudyDAO(ds);
    StudySubjectDAO ssdao = new StudySubjectDAO(ds);
    StudyBean study = sdao.findByStudySubjectId(ecb.getStudySubjectId());
    EventDefinitionCRFBean edcb = getEventDefinitionCrfByStudyEventAndCrfVersion(ecb, study);
    // StudyEventDAO studyEventDao = new StudyEventDAO(ds);
    // StudyEventBean studyEventBean = (StudyEventBean)
    // studyEventDao.findByPK(ecb.getStudyEventId());
    // Status studyEventStatus = studyEventBean.getStatus();
    StudyEventDefinitionDAO studyEventDefinitionDao = new StudyEventDefinitionDAO(ds);
    StudyEventDefinitionBean sedBean = (StudyEventDefinitionBean) studyEventDefinitionDao.findByPK(edcb.getStudyEventDefinitionId());
    CRFDAO crfDao = new CRFDAO(ds);
    ArrayList crfs = (ArrayList) crfDao.findAllActiveByDefinition(sedBean);
    sedBean.setCrfs(crfs);
    // request.setAttribute(TableOfContentsServlet.INPUT_EVENT_CRF_BEAN,
    // ecb);
    // request.setAttribute(INPUT_EVENT_CRF_ID, new
    // Integer(ecb.getId()));
    logger.debug("inout_event_crf_id:" + ecb.getId());
    logger.debug("inout_study_event_def_id:" + sedBean.getId());
    Status newStatus = ecb.getStatus();
    DataEntryStage newStage = ecb.getStage();
    boolean ide = true;
    newStatus = Status.UNAVAILABLE;
    // ecb.setUpdaterId(ub.getId());
    ecb.setUpdater(ub);
    ecb.setUpdatedDate(new Date());
    ecb.setDateCompleted(new Date());
    ecb.setDateValidateCompleted(new Date());
    /*
         * //for the non-reviewed sections, no item data in DB yet, need to //create them if
         * (!isEachSectionReviewedOnce()) { boolean canSave = saveItemsToMarkComplete(newStatus); if (canSave == false){
         * addPageMessage("You may not mark this Event CRF complete, because there are some required entries which have
         * not been filled out."); return false; } }
         */
    ecb.setStatus(newStatus);
    ecb.setStage(newStage);
    ecb = (EventCRFBean) eventCrfDao.update(ecb);
    logger.debug("just updated event crf id: " + ecb.getId());
    // note the below statement only updates the DATES, not the STATUS
    eventCrfDao.markComplete(ecb, ide);
    // update all the items' status to complete
    itemDataDao.updateStatusByEventCRF(ecb, newStatus);
    // change status for study event
    StudyEventDAO sedao = new StudyEventDAO(ds);
    StudyEventBean seb = (StudyEventBean) sedao.findByPK(ecb.getStudyEventId());
    seb.setUpdatedDate(new Date());
    seb.setUpdater(ub);
    // updates with Pauls observation from bug:2488:
    // 1. If there is only one CRF in the event (whether the CRF was
    // required or not), and data was imported for it, the status of the
    // event should be Completed.
    //
    logger.debug("sed bean get crfs get size: " + sedBean.getCrfs().size());
    logger.debug("edcb get crf id: " + edcb.getCrfId() + " version size? " + edcb.getVersions().size());
    logger.debug("ecb get crf id: " + ecb.getCrf().getId());
    logger.debug("ecb get crf version id: " + ecb.getCRFVersionId());
    if (sedBean.getCrfs().size() == 1) {
        // && edcb.getCrfId() ==
        // ecb.getCrf().getId()) {
        seb.setSubjectEventStatus(SubjectEventStatus.COMPLETED);
        logger.info("just set subj event status to -- COMPLETED --");
    } else // removing sedBean.getCrfs().size() > 1 &&
    if (areAllRequired(seb, study) && !areAllCompleted(seb, study)) {
        seb.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
        logger.info("just set subj event status to -- DATAENTRYSTARTED --");
    } else // removing sedBean.getCrfs().size() > 1 &&
    if (!areAllRequired(seb, study)) {
        if (areAllRequiredCompleted(seb, study)) {
            seb.setSubjectEventStatus(SubjectEventStatus.COMPLETED);
            logger.info("just set subj event status to -- 3completed3 --");
        } else {
            seb.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
            logger.info("just set subj event status to -- DATAENTRYSTARTED --");
        }
    } else if (noneAreRequired(seb, study)) {
        seb.setSubjectEventStatus(SubjectEventStatus.COMPLETED);
        logger.info("just set subj event status to -- 5completed5 --");
    }
    logger.debug("just set subj event status, final status is " + seb.getSubjectEventStatus().getName());
    logger.debug("final overall status is " + seb.getStatus().getName());
    seb = (StudyEventBean) sedao.update(seb, inTransaction);
    return true;
}
Also used : Status(org.akaza.openclinica.bean.core.Status) SubjectEventStatus(org.akaza.openclinica.bean.core.SubjectEventStatus) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) ItemDataDAO(org.akaza.openclinica.dao.submit.ItemDataDAO) Date(java.util.Date) DataEntryStage(org.akaza.openclinica.bean.core.DataEntryStage) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 13 with DataEntryStage

use of org.akaza.openclinica.bean.core.DataEntryStage in project OpenClinica by OpenClinica.

the class CrfBusinessLogicHelper method markCRFStarted.

/**
     * The following methods are for 'mark CRF Started' Note that we will also wrap Study Event status changes in this
     * code, possibly split out in a later release, tbh 06/2008
     * 
     * @return
     */
public boolean markCRFStarted(EventCRFBean ecb, UserAccountBean ub, boolean inTransaction) throws Exception {
    EventCRFDAO eventCrfDao = new EventCRFDAO(ds);
    StudyDAO sdao = new StudyDAO(ds);
    StudyBean study = sdao.findByStudySubjectId(ecb.getStudySubjectId());
    EventDefinitionCRFBean edcb = getEventDefinitionCrfByStudyEventAndCrfVersion(ecb, study);
    StudyEventDefinitionDAO studyEventDefinitionDao = new StudyEventDefinitionDAO(ds);
    StudyEventDefinitionBean sedBean = (StudyEventDefinitionBean) studyEventDefinitionDao.findByPK(edcb.getStudyEventDefinitionId());
    CRFDAO crfDao = new CRFDAO(ds);
    ArrayList crfs = (ArrayList) crfDao.findAllActiveByDefinition(sedBean);
    sedBean.setCrfs(crfs);
    logger.debug("inout_event_crf_id:" + ecb.getId());
    logger.debug("inout_study_event_def_id:" + sedBean.getId());
    Status newStatus = Status.AVAILABLE;
    DataEntryStage newStage = ecb.getStage();
    ecb.setUpdater(ub);
    ecb.setUpdatedDate(new Date());
    ecb.setStatus(newStatus);
    ecb.setStage(newStage);
    ecb = (EventCRFBean) eventCrfDao.update(ecb);
    logger.debug("just updated event crf id: " + ecb.getId());
    StudyEventDAO sedao = new StudyEventDAO(ds);
    StudyEventBean seb = (StudyEventBean) sedao.findByPK(ecb.getStudyEventId());
    if (seb.getSubjectEventStatus().isScheduled() || seb.getSubjectEventStatus().isNotScheduled() || seb.getSubjectEventStatus().isDE_Started()) {
        // change status for study event
        seb.setUpdatedDate(new Date());
        seb.setUpdater(ub);
        seb.setSubjectEventStatus(SubjectEventStatus.DATA_ENTRY_STARTED);
        seb = (StudyEventBean) sedao.update(seb, inTransaction);
    }
    return true;
}
Also used : Status(org.akaza.openclinica.bean.core.Status) SubjectEventStatus(org.akaza.openclinica.bean.core.SubjectEventStatus) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) Date(java.util.Date) DataEntryStage(org.akaza.openclinica.bean.core.DataEntryStage) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 14 with DataEntryStage

use of org.akaza.openclinica.bean.core.DataEntryStage in project OpenClinica by OpenClinica.

the class ExtractBean method getSEDCRFStatus.

// private String getSEDCRFName(int sedInd, int crfInd) {
// syncCRFIndex(sedInd, crfInd);
// return currentCRF.getName();
// }
// private String getSEDCRFVersionName(int h, int sedInd, int crfInd) {
// syncCRFIndex(sedInd, crfInd);
//
// StudyEventBean seb = getEvent(h, sedInd, crfInd);
//
// String returnMe = "";
// //ArrayList versions = currentCRF.getVersions();//returns zero results
// EventCRFBean eventCRF = null;
// if (seb.getEventCRFs().size() > 0) {
// logger.info("found getEventCRFs.size " + seb.getEventCRFs().size());
// for (int t = 0; t < seb.getEventCRFs().size(); t++) {
// eventCRF = (EventCRFBean) seb.getEventCRFs().get(t);
// returnMe = eventCRF.getCrfVersion().getName();
// //logger.info("found versions.size "+versions.size());
// //for (int s = 0; s < versions.size(); s++) {
// // CRFVersionBean version = (CRFVersionBean)versions.get(s);
// // if (version.getId()==eventCRF.getCRFVersionId()) {
// // returnMe = version.getName();
// //break;
// // }
// //}
// }
//
// }
// logger.info("returning the following for crf version name: " + returnMe);
// return returnMe;
// }
private String getSEDCRFStatus(int h, int sedInd, int crfInd) {
    // BADS Flag
    syncCRFIndex(sedInd, crfInd);
    StudyEventBean seb = getEvent(h, sedInd, crfInd);
    Status ecStatus = Status.AVAILABLE;
    EventCRFBean eventCRF = null;
    if (seb.getEventCRFs().size() > 0) {
        eventCRF = (EventCRFBean) seb.getEventCRFs().get(0);
    }
    String crfVersionStatus = "";
    SubjectEventStatus status = SubjectEventStatus.NOT_SCHEDULED;
    CRFVersionBean crfv = new CRFVersionBean();
    crfv.setStatus(Status.AVAILABLE);
    // modified stage so that crfVersionStatus could be the same as what it
    // shows in subject matrix - as required.
    DataEntryStage stage = DataEntryStage.INVALID;
    try {
        stage = eventCRF.getStage();
        ecStatus = eventCRF.getStatus();
        // SubjectEventStatus.get(
        status = seb.getSubjectEventStatus();
        // eventCRF
        // .getCompletionStatusId());
        crfv = eventCRF.getCrfVersion();
    } catch (NullPointerException e) {
        logger.info("exception hit, status set to not scheduled");
    }
    // currentCRF.getStatus().getName();
    //
    logger.info("event crf stage: " + stage.getName() + ", event crf status: " + ecStatus.getName() + ", STATUS: " + status.getName() + " crf version: " + crfv.getStatus().getName() + " data entry stage: " + stage.getName());
    if (stage.equals(DataEntryStage.INVALID) || ecStatus.equals(Status.INVALID)) {
        stage = DataEntryStage.UNCOMPLETED;
    }
    crfVersionStatus = stage.getName();
    if (status.equals(SubjectEventStatus.LOCKED) || status.equals(SubjectEventStatus.SKIPPED) || status.equals(SubjectEventStatus.STOPPED)) {
        crfVersionStatus = DataEntryStage.LOCKED.getName();
    } else if (status.equals(SubjectEventStatus.INVALID)) {
        crfVersionStatus = DataEntryStage.LOCKED.getName();
    } else if (!currentCRF.getStatus().equals(Status.AVAILABLE)) {
        crfVersionStatus = DataEntryStage.LOCKED.getName();
    } else if (!crfv.getStatus().equals(Status.AVAILABLE)) {
        crfVersionStatus = DataEntryStage.LOCKED.getName();
    }
    logger.info("returning: " + crfVersionStatus);
    return crfVersionStatus;
}
Also used : Status(org.akaza.openclinica.bean.core.Status) SubjectEventStatus(org.akaza.openclinica.bean.core.SubjectEventStatus) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) SubjectEventStatus(org.akaza.openclinica.bean.core.SubjectEventStatus) DataEntryStage(org.akaza.openclinica.bean.core.DataEntryStage)

Example 15 with DataEntryStage

use of org.akaza.openclinica.bean.core.DataEntryStage in project OpenClinica by OpenClinica.

the class OdmExtractDAO method getCrfVersionStatus.

private String getCrfVersionStatus(String seSubjectEventStatus, int cvStatusId, int ecStatusId, int validatorId) {
    DataEntryStage stage = DataEntryStage.INVALID;
    Status status = Status.get(ecStatusId);
    // }
    if (stage.equals(DataEntryStage.INVALID) || status.equals(Status.INVALID)) {
        stage = DataEntryStage.UNCOMPLETED;
    }
    if (status.equals(Status.AVAILABLE)) {
        stage = DataEntryStage.INITIAL_DATA_ENTRY;
    }
    if (status.equals(Status.PENDING)) {
        if (validatorId != 0) {
            stage = DataEntryStage.DOUBLE_DATA_ENTRY;
        } else {
            stage = DataEntryStage.INITIAL_DATA_ENTRY_COMPLETE;
        }
    }
    if (status.equals(Status.UNAVAILABLE)) {
        stage = DataEntryStage.DOUBLE_DATA_ENTRY_COMPLETE;
    }
    if (status.equals(Status.LOCKED)) {
        stage = DataEntryStage.LOCKED;
    }
    try {
        if (seSubjectEventStatus.equals(SubjectEventStatus.LOCKED.getName()) || seSubjectEventStatus.equals(SubjectEventStatus.SKIPPED.getName()) || seSubjectEventStatus.equals(SubjectEventStatus.STOPPED.getName())) {
            stage = DataEntryStage.LOCKED;
        } else if (seSubjectEventStatus.equals(SubjectEventStatus.INVALID.getName())) {
            stage = DataEntryStage.LOCKED;
        } else if (cvStatusId != 1) {
            stage = DataEntryStage.LOCKED;
        }
    } catch (NullPointerException e) {
        // TODO Auto-generated catch block
        // e.printStackTrace();
        // System.out.println("caught NPE here");
        logger.debug("caught NPE here");
    }
    logger.debug("returning " + stage.getName());
    return stage.getName();
}
Also used : Status(org.akaza.openclinica.bean.core.Status) SubjectEventStatus(org.akaza.openclinica.bean.core.SubjectEventStatus) DataEntryStage(org.akaza.openclinica.bean.core.DataEntryStage)

Aggregations

DataEntryStage (org.akaza.openclinica.bean.core.DataEntryStage)22 ArrayList (java.util.ArrayList)14 Status (org.akaza.openclinica.bean.core.Status)13 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)13 SubjectEventStatus (org.akaza.openclinica.bean.core.SubjectEventStatus)10 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)10 HashMap (java.util.HashMap)9 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)9 Date (java.util.Date)8 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)8 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)8 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)7 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)7 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)6 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)6 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)6 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)5 SectionDAO (org.akaza.openclinica.dao.submit.SectionDAO)5 HttpSession (javax.servlet.http.HttpSession)4 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)4