Search in sources :

Example 1 with ImportItemGroupDataBean

use of org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean in project OpenClinica by OpenClinica.

the class OdmExtractDAO method getClinicalData.

public void getClinicalData(StudyBean study, DatasetBean dataset, OdmClinicalDataBean data, String odmVersion, String studySubjectIds, String odmType) {
    String dbName = CoreResources.getDBName();
    String subprev = "";
    HashMap<String, Integer> sepos = new HashMap<String, Integer>();
    String seprev = "";
    String formprev = "";
    HashMap<String, Integer> igpos = new HashMap<String, Integer>();
    String igprev = "";
    String oidPos = "";
    HashMap<Integer, String> oidPoses = new HashMap<Integer, String>();
    HashMap<Integer, String> idataOidPoses = new HashMap<Integer, String>();
    // String studyIds = "";
    // if (study.getParentStudyId() > 0) {
    // studyIds += study.getId();
    // } else {
    // ArrayList<Integer> ids = (ArrayList<Integer>) (new
    // StudyDAO(this.ds)).findAllSiteIdsByStudy(study);
    // for (int i = 0; i < ids.size() - 1; ++i) {
    // studyIds += ids.get(i) + ",";
    // }
    // studyIds += ids.get(ids.size() - 1);
    // }
    String studyIds = study.getId() + "";
    int datasetItemStatusId = dataset.getDatasetItemStatus().getId();
    String sql = dataset.getSQLStatement().split("order by")[0].trim();
    sql = sql.split("study_event_definition_id in")[1];
    String[] ss = sql.split("and item_id in");
    String sedIds = ss[0];
    String[] sss = ss[1].split("and");
    String itemIds = sss[0];
    String dateConstraint = "";
    if ("postgres".equalsIgnoreCase(dbName)) {
        dateConstraint = "and " + sss[1] + " and " + sss[2];
        dateConstraint = dateConstraint.replace("date_created", "ss.enrollment_date");
    } else if ("oracle".equalsIgnoreCase(dbName)) {
        String[] os = (sss[1] + sss[2]).split("'");
        dateConstraint = "and trunc(ss.enrollment_date) >= to_date('" + os[1] + "') and trunc(ss.enrollment_date) <= to_date('" + os[3] + "')";
    }
    logger.debug("Begin to GetSubjectEventFormSql");
    if (odmVersion.startsWith("oc")) {
        logger.debug("getOCSubjectEventFormSql=" + getOCSubjectEventFormSqlSS(studyIds, sedIds, itemIds, dateConstraint, datasetItemStatusId, studySubjectIds));
        this.setSubjectEventFormDataTypesExpected(odmVersion);
        ArrayList viewRows = select(getOCSubjectEventFormSqlSS(studyIds, sedIds, itemIds, dateConstraint, datasetItemStatusId, studySubjectIds));
        Iterator iter = viewRows.iterator();
        this.setDataWithOCAttributes(study, dataset, data, odmVersion, iter, oidPoses, odmType);
    } else {
        logger.debug("getSubjectEventFormSql=" + getSubjectEventFormSqlSS(studyIds, sedIds, itemIds, dateConstraint, datasetItemStatusId, studySubjectIds));
        this.setSubjectEventFormDataTypesExpected();
        ArrayList viewRows = select(getSubjectEventFormSqlSS(studyIds, sedIds, itemIds, dateConstraint, datasetItemStatusId, studySubjectIds));
        Iterator iter = viewRows.iterator();
        // updated as well because this method came from here.
        while (iter.hasNext()) {
            JobTerminationMonitor.check();
            HashMap row = (HashMap) iter.next();
            String studySubjectLabel = (String) row.get("study_subject_oid");
            String sedOID = (String) row.get("definition_oid");
            Boolean studyEventRepeating = (Boolean) row.get("definition_repeating");
            Integer sampleOrdinal = (Integer) row.get("sample_ordinal");
            String cvOID = (String) row.get("crf_version_oid");
            // ecId
            Integer ecId = (Integer) row.get("event_crf_id");
            CRFVersionBean cvBean = cvdao.findByOid(cvOID);
            CRFBean cBean = (CRFBean) crfdao.findByPK(cvBean.getCrfId());
            // should
            // be unique;
            String key = studySubjectLabel;
            ExportSubjectDataBean sub = new ExportSubjectDataBean();
            if (subprev.equals(studySubjectLabel)) {
                int p = data.getExportSubjectData().size() - 1;
                sub = data.getExportSubjectData().get(p);
            } else {
                subprev = studySubjectLabel;
                sub.setSubjectOID(studySubjectLabel);
                data.getExportSubjectData().add(sub);
                seprev = "";
                formprev = "";
                igprev = "";
            }
            oidPos = data.getExportSubjectData().size() - 1 + "";
            ExportStudyEventDataBean se = new ExportStudyEventDataBean();
            // key += sedOID + sampleOrdinal;
            key += sedOID;
            if (!seprev.equals(key) || !sepos.containsKey(key + sampleOrdinal)) {
                sepos.put(key + sampleOrdinal, sub.getExportStudyEventData().size());
                seprev = key;
                se.setStudyEventOID(sedOID);
                se.setStudyEventRepeatKey(studyEventRepeating ? sampleOrdinal + "" : "-1");
                sub.getExportStudyEventData().add(se);
                formprev = "";
                igprev = "";
            } else {
                se = sub.getExportStudyEventData().get(sepos.get(key + sampleOrdinal));
            }
            oidPos += "---" + (sub.getExportStudyEventData().size() - 1);
            ExportFormDataBean form = new ExportFormDataBean();
            key += cvOID;
            if (formprev.equals(key)) {
                form = se.getExportFormData().get(se.getExportFormData().size() - 1);
            } else {
                formprev = key;
                form.setFormOID(cBean.getOid());
                se.getExportFormData().add(form);
                igprev = "";
            }
            oidPos += "---" + (se.getExportFormData().size() - 1);
            // ecId should be distinct
            oidPoses.put(ecId, oidPos);
            oidPos = "";
        }
    }
    this.setEventGroupItemDataWithUnitTypesExpected();
    logger.debug("Begin to GetEventGroupItemWithUnitSql");
    ArrayList viewRows = select(getEventGroupItemWithUnitSql(studyIds, sedIds, itemIds, dateConstraint, datasetItemStatusId, studySubjectIds));
    logger.debug("getEventGroupItemWithUnitSql : " + getEventGroupItemWithUnitSql(studyIds, sedIds, itemIds, dateConstraint, datasetItemStatusId, studySubjectIds));
    String idataIds = "";
    if (viewRows.size() > 0) {
        Iterator iter = viewRows.iterator();
        ExportSubjectDataBean sub = new ExportSubjectDataBean();
        ExportStudyEventDataBean se = new ExportStudyEventDataBean();
        ExportFormDataBean form = new ExportFormDataBean();
        int ecprev = -1;
        igprev = "";
        boolean goon = true;
        String itprev = "";
        // HashMap<String, String> nullValueMap =
        // ClinicalDataUnit.getNullValueMap();
        HashMap<String, String> nullValueCVs = this.getNullValueCVs(study);
        HashSet<Integer> itemDataIds = new HashSet<Integer>();
        String yearMonthFormat = StringUtil.parseDateFormat(ResourceBundleProvider.getFormatBundle(locale).getString("date_format_year_month"));
        String yearFormat = StringUtil.parseDateFormat(ResourceBundleProvider.getFormatBundle(locale).getString("date_format_year"));
        while (iter.hasNext()) {
            JobTerminationMonitor.check();
            HashMap row = (HashMap) iter.next();
            Integer ecId = (Integer) row.get("event_crf_id");
            Integer igId = (Integer) row.get("item_group_id");
            String igOID = (String) row.get("item_group_oid");
            String igName = (String) row.get("item_group_name");
            Integer itId = (Integer) row.get("item_id");
            String itOID = (String) row.get("item_oid");
            Integer itDataOrdinal = (Integer) row.get("item_data_ordinal");
            String itValue = (String) row.get("value");
            Integer datatypeid = (Integer) row.get("item_data_type_id");
            Integer idataId = (Integer) row.get("item_data_id");
            String muOid = (String) row.get("mu_oid");
            String key = "";
            if (ecId != ecprev) {
                logger.debug("Found ecId=" + ecId + " in subjectEventFormSql is:" + oidPoses.containsKey(ecId));
                if (oidPoses.containsKey(ecId)) {
                    goon = true;
                    String[] poses = oidPoses.get(ecId).split("---");
                    sub = data.getExportSubjectData().get(Integer.valueOf(poses[0]));
                    se = sub.getExportStudyEventData().get(Integer.valueOf(poses[1]));
                    form = se.getExportFormData().get(Integer.valueOf(poses[2]));
                } else {
                    goon = false;
                }
                ecprev = ecId;
            }
            if (goon) {
                ImportItemGroupDataBean ig = new ImportItemGroupDataBean();
                // key = ecId + igOID;
                key = ecId + "-" + igId;
                if (!igprev.equals(key) || !igpos.containsKey(key + itDataOrdinal)) {
                    igpos.put(key + itDataOrdinal, form.getItemGroupData().size());
                    igprev = key;
                    ig.setItemGroupOID(igOID + "");
                    ig.setItemGroupRepeatKey("ungrouped".equalsIgnoreCase(igName) ? "-1" : itDataOrdinal + "");
                    form.getItemGroupData().add(ig);
                } else {
                    ig = form.getItemGroupData().get(igpos.get(key + itDataOrdinal));
                }
                String newpos = oidPoses.get(ecId) + "---" + igpos.get(key + itDataOrdinal);
                // item should be distinct; but duplicated item data have
                // been reported because "save" have been clicked twice.
                // those duplicated item data have been arranged together by
                // "distinct" because of their same
                // ecId+igOID+itOID+itDataOrdinal (08-2008)
                key = itId + "_" + itDataOrdinal + key;
                if (!itprev.equals(key)) {
                    itprev = key;
                    ImportItemDataBean it = new ImportItemDataBean();
                    it.setItemOID(itOID);
                    it.setTransactionType("Insert");
                    String nullKey = study.getId() + "-" + se.getStudyEventOID() + "-" + form.getFormOID();
                    if (ClinicalDataUtil.isNull(itValue, nullKey, nullValueCVs)) {
                        // if
                        // (nullValueMap.containsKey(itValue.trim().toUpperCase()))
                        // {
                        // itValue =
                        // nullValueMap.get(itValue.trim().toUpperCase());
                        it.setIsNull("Yes");
                        String nullvalues = ClinicalDataUtil.presetNullValueStr(nullValueCVs.get(nullKey));
                        boolean hasValueWithNull = ClinicalDataUtil.isValueWithNull(itValue, nullvalues);
                        it.setHasValueWithNull(hasValueWithNull);
                        if (hasValueWithNull) {
                            it.setValue(itValue);
                            it.setReasonForNull(ClinicalDataUtil.getNullsInValue(itValue, nullvalues));
                        } else {
                            it.setReasonForNull(itValue.trim());
                        }
                    } else {
                        if (datatypeid == 9) {
                            try {
                                itValue = new SimpleDateFormat("yyyy-MM-dd").format(new SimpleDateFormat(oc_df_string).parse(itValue));
                            } catch (Exception fe) {
                                logger.debug("Item -" + itOID + " value " + itValue + " might not be ODM date format yyyy-MM-dd.");
                            }
                        }
                        /*
                             * not be supported in openclinica-3.0.40.1
                             * else if (datatypeid == 10 && odmVersion.contains("1.3")) {
                             * if (StringUtil.isFormatDate(itValue, oc_df_string)) {
                             * try {
                             * itValue = new SimpleDateFormat("yyyy-MM-dd").format(new
                             * SimpleDateFormat(oc_df_string).parse(itValue));
                             * } catch (Exception e) {
                             * logger.info("Item -" + itOID + " value " + itValue +
                             * " might not be ODM partialDate format yyyy[-MM[-dd]].");
                             * }
                             * } else {
                             * if (StringUtil.isPartialYearMonth(itValue, yearMonthFormat)) {
                             * try {
                             * itValue = new SimpleDateFormat("yyyy-MM").format(new
                             * SimpleDateFormat(yearMonthFormat).parse(itValue));
                             * } catch (Exception e) {
                             * logger.info("Item -" + itOID + " value " + itValue +
                             * " might not be ODM partialDate format yyyy[-MM[-dd]].");
                             * }
                             * } else {
                             * try {
                             * itValue = new SimpleDateFormat("yyyy").format(new
                             * SimpleDateFormat(yearFormat).parse(itValue));
                             * } catch (Exception e) {
                             * logger.info("Item -" + itOID + " value " + itValue +
                             * " might not be ODM partialDate format yyyy[-MM[-dd]].");
                             * }
                             * }
                             * }
                             * }
                             */
                        it.setValue(itValue);
                    }
                    if (muOid != null && muOid.length() > 0) {
                        ElementRefBean measurementUnitRef = new ElementRefBean();
                        measurementUnitRef.setElementDefOID(muOid);
                        it.setMeasurementUnitRef(measurementUnitRef);
                    }
                    ig.getItemData().add(it);
                    newpos += "---" + (ig.getItemData().size() - 1);
                    idataOidPoses.put(idataId, newpos);
                }
                idataIds += "'" + idataId + "', ";
            }
        }
    }
    idataIds = idataIds.length() > 0 ? idataIds.substring(0, idataIds.length() - 2) : idataIds;
    if (idataIds.length() > 0 && itemIds.length() > 0) {
        this.setErasedScoreItemDataValues(data, itemIds, idataIds, idataOidPoses, odmVersion);
    } else {
        logger.info("OdmExtractDAO.setScoreItemDataNullValues was not called because of empty item_data_ids or/and item_ids");
    }
    if (odmType != null && odmType.equalsIgnoreCase("clinical_data")) {
        logger.debug("Do not create discrepancy notes");
    } else if (odmVersion.startsWith("oc")) {
        if (idataIds.length() > 0) {
            setOCItemDataAuditLogs(study, data, idataIds, idataOidPoses);
            setOCItemDataDNs(data, idataIds, idataOidPoses);
        } else {
            logger.info("OdmExtractDAO.setOCItemDataAuditLogs & setOCItemDataDNs weren't called because of empty idataIds");
        }
    }
}
Also used : ExportFormDataBean(org.akaza.openclinica.bean.submit.crfdata.ExportFormDataBean) ImportItemGroupDataBean(org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean) ElementRefBean(org.akaza.openclinica.bean.odmbeans.ElementRefBean) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) ImportItemDataBean(org.akaza.openclinica.bean.submit.crfdata.ImportItemDataBean) ExportStudyEventDataBean(org.akaza.openclinica.bean.submit.crfdata.ExportStudyEventDataBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) Iterator(java.util.Iterator) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) ExportSubjectDataBean(org.akaza.openclinica.bean.submit.crfdata.ExportSubjectDataBean) SimpleDateFormat(java.text.SimpleDateFormat) HashSet(java.util.HashSet)

Example 2 with ImportItemGroupDataBean

use of org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean in project OpenClinica by OpenClinica.

the class ImportDataRuleRunnerContainer method initRuleSetsAndTargets.

/**
     * Populate importDataTrueRuleSets and variableAndValue.
     * Precondition: import data file passed validation which means all OIDs are not empty.
     * @param ds
     * @param studyBean
     * @param subjectDataBean
     * @param ruleSetService
     */
@Transactional
public void initRuleSetsAndTargets(DataSource ds, StudyBean studyBean, SubjectDataBean subjectDataBean, RuleSetServiceInterface ruleSetService) {
    this.shouldRunRules = this.shouldRunRules == null ? Boolean.FALSE : this.shouldRunRules;
    this.importDataTrueRuleSets = this.importDataTrueRuleSets == null ? new ArrayList<RuleSetBean>() : this.importDataTrueRuleSets;
    this.variableAndValue = this.variableAndValue == null ? new HashMap<String, String>() : this.variableAndValue;
    studyOid = studyBean.getOid();
    studySubjectOid = subjectDataBean.getSubjectOID();
    StudySubjectBean studySubject = new StudySubjectDAO<String, ArrayList>(ds).findByOid(studySubjectOid);
    HashMap<String, StudyEventDefinitionBean> seds = new HashMap<String, StudyEventDefinitionBean>();
    HashMap<String, CRFVersionBean> cvs = new HashMap<String, CRFVersionBean>();
    ArrayList<StudyEventDataBean> studyEventDataBeans = subjectDataBean.getStudyEventData();
    for (StudyEventDataBean studyEventDataBean : studyEventDataBeans) {
        String sedOid = studyEventDataBean.getStudyEventOID();
        StudyEventDefinitionBean sed;
        if (seds.containsKey(sedOid))
            sed = seds.get(sedOid);
        else {
            sed = new StudyEventDefinitionDAO<String, ArrayList>(ds).findByOid(sedOid);
            seds.put(sedOid, sed);
        }
        ArrayList<FormDataBean> formDataBeans = studyEventDataBean.getFormData();
        for (FormDataBean formDataBean : formDataBeans) {
            String cvOid = formDataBean.getFormOID();
            CRFVersionBean crfVersion;
            if (cvs.containsKey(cvOid))
                crfVersion = cvs.get(cvOid);
            else {
                crfVersion = new CRFVersionDAO<String, ArrayList>(ds).findByOid(cvOid);
                cvs.put(cvOid, crfVersion);
            }
            String sedOrd = studyEventDataBean.getStudyEventRepeatKey();
            Integer sedOrdinal = sedOrd != null && !sedOrd.isEmpty() ? Integer.valueOf(sedOrd) : 1;
            StudyEventBean studyEvent = (StudyEventBean) new StudyEventDAO(ds).findByStudySubjectIdAndDefinitionIdAndOrdinal(studySubject.getId(), sed.getId(), sedOrdinal);
            List<RuleSetBean> ruleSets = ruleSetService.getRuleSetsByCrfStudyAndStudyEventDefinition(studyBean, sed, crfVersion);
            //Set<String> targetItemOids = new HashSet<String>();
            if (ruleSets != null && !ruleSets.isEmpty()) {
                ruleSets = filterByImportDataEntryTrue(ruleSets);
                if (ruleSets != null && !ruleSets.isEmpty()) {
                    ruleSets = ruleSetService.filterByStatusEqualsAvailable(ruleSets);
                    ruleSets = ruleSetService.filterRuleSetsByStudyEventOrdinal(ruleSets, studyEvent, crfVersion, sed);
                    //ruleSets = ruleSetService.filterRuleSetsByHiddenItems(ruleSets, eventCrfBean, crfVersion, new ArrayList<ItemBean>());
                    shouldRunRules = ruleSetService.shouldRunRulesForRuleSets(ruleSets, Phase.IMPORT);
                    if (shouldRunRules != null && shouldRunRules == Boolean.TRUE) {
                        //targetItemOids = collectTargetItemOids(ruleSets);
                        HashMap<String, Integer> grouped = new HashMap<String, Integer>();
                        ArrayList<ImportItemGroupDataBean> itemGroupDataBeans = formDataBean.getItemGroupData();
                        for (ImportItemGroupDataBean itemGroupDataBean : itemGroupDataBeans) {
                            ArrayList<ImportItemDataBean> itemDataBeans = itemGroupDataBean.getItemData();
                            for (ImportItemDataBean importItemDataBean : itemDataBeans) {
                                //if(targetItemOids.contains(importItemDataBean.getItemOID())) {
                                ItemBean item = new ItemDAO<String, ArrayList>(ds).findByOid(importItemDataBean.getItemOID()).get(0);
                                String igOid = itemGroupDataBean.getItemGroupOID();
                                String igOrd = itemGroupDataBean.getItemGroupRepeatKey();
                                Integer igOrdinal = igOrd != null && !igOrd.isEmpty() ? Integer.valueOf(igOrd) : 1;
                                //logic from DataEntryServlet method: populateRuleSpecificHashMaps()
                                if (isRepeatIGForSure(ds, crfVersion.getId(), igOid, igOrdinal, item.getId())) {
                                    String key1 = igOid + "[" + igOrdinal + "]." + importItemDataBean.getItemOID();
                                    String key = igOid + "." + importItemDataBean.getItemOID();
                                    variableAndValue.put(key1, importItemDataBean.getValue());
                                    if (grouped.containsKey(key)) {
                                        grouped.put(key, grouped.get(key) + 1);
                                    } else {
                                        grouped.put(key, 1);
                                    }
                                } else {
                                    variableAndValue.put(importItemDataBean.getItemOID(), importItemDataBean.getValue());
                                    grouped.put(importItemDataBean.getItemOID(), 1);
                                }
                            //
                            //}
                            }
                        }
                        ruleSets = ruleSetService.solidifyGroupOrdinalsUsingFormProperties(ruleSets, grouped);
                        importDataTrueRuleSets.addAll(ruleSets);
                    }
                }
            }
        }
    }
}
Also used : ImportItemGroupDataBean(org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean) ItemBean(org.akaza.openclinica.bean.submit.ItemBean) HashMap(java.util.HashMap) ItemDAO(org.akaza.openclinica.dao.submit.ItemDAO) ArrayList(java.util.ArrayList) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean) ImportItemDataBean(org.akaza.openclinica.bean.submit.crfdata.ImportItemDataBean) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) StudyEventDataBean(org.akaza.openclinica.bean.submit.crfdata.StudyEventDataBean) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) FormDataBean(org.akaza.openclinica.bean.submit.crfdata.FormDataBean) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with ImportItemGroupDataBean

use of org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean in project OpenClinica by OpenClinica.

the class ImportCRFDataService method validateStudyMetadata.

/*
     * meant to answer the following questions 3.a. is that study subject in that study? 3.b. is that study event def in
     * that study? 3.c. is that site in that study? 3.d. is that crf version in that study event def? 3.e. are those
     * item groups in that crf version? 3.f. are those items in that item group?
     */
public List<String> validateStudyMetadata(ODMContainer odmContainer, int currentStudyId) {
    List<String> errors = new ArrayList<String>();
    MessageFormat mf = new MessageFormat("");
    // throw new OpenClinicaException(mf.format(arguments), "");
    try {
        StudyDAO studyDAO = new StudyDAO(ds);
        String studyOid = odmContainer.getCrfDataPostImportContainer().getStudyOID();
        StudyBean studyBean = studyDAO.findByOid(studyOid);
        if (studyBean == null) {
            mf.applyPattern(respage.getString("your_study_oid_does_not_reference_an_existing"));
            Object[] arguments = { studyOid };
            errors.add(mf.format(arguments));
            // errors.add("Your Study OID " + studyOid + " does not
            // reference an existing Study or Site in the database. Please
            // check it and try again.");
            // throw an error here because getting the ID would be difficult
            // otherwise
            logger.debug("unknown study OID");
            throw new OpenClinicaException("Unknown Study OID", "");
        } else if (studyBean.getId() != currentStudyId) {
            mf.applyPattern(respage.getString("your_current_study_is_not_the_same_as"));
            Object[] arguments = { studyBean.getName() };
            //
            // errors.add("Your current study is not the same as the Study "
            // + studyBean.getName()
            // + ", for which you are trying to enter data. Please log out
            // of your current study and into the study for which the data
            // is keyed.");
            errors.add(mf.format(arguments));
        }
        ArrayList<SubjectDataBean> subjectDataBeans = odmContainer.getCrfDataPostImportContainer().getSubjectData();
        StudySubjectDAO studySubjectDAO = new StudySubjectDAO(ds);
        StudyEventDefinitionDAO studyEventDefinitionDAO = new StudyEventDefinitionDAO(ds);
        CRFVersionDAO crfVersionDAO = new CRFVersionDAO(ds);
        ItemGroupDAO itemGroupDAO = new ItemGroupDAO(ds);
        ItemDAO itemDAO = new ItemDAO(ds);
        if (subjectDataBeans != null) {
            // report all available errors, tbh
            for (SubjectDataBean subjectDataBean : subjectDataBeans) {
                String oid = subjectDataBean.getSubjectOID();
                StudySubjectBean studySubjectBean = studySubjectDAO.findByOidAndStudy(oid, studyBean.getId());
                if (studySubjectBean == null) {
                    mf.applyPattern(respage.getString("your_subject_oid_does_not_reference"));
                    Object[] arguments = { oid };
                    errors.add(mf.format(arguments));
                    // errors.add("Your Subject OID " + oid + " does not
                    // reference an existing Subject in the Study.");
                    logger.debug("logged an error with subject oid " + oid);
                }
                ArrayList<StudyEventDataBean> studyEventDataBeans = subjectDataBean.getStudyEventData();
                if (studyEventDataBeans != null) {
                    for (StudyEventDataBean studyEventDataBean : studyEventDataBeans) {
                        String sedOid = studyEventDataBean.getStudyEventOID();
                        StudyEventDefinitionBean studyEventDefintionBean = studyEventDefinitionDAO.findByOidAndStudy(sedOid, studyBean.getId(), studyBean.getParentStudyId());
                        if (studyEventDefintionBean == null) {
                            mf.applyPattern(respage.getString("your_study_event_oid_for_subject_oid"));
                            Object[] arguments = { sedOid, oid };
                            errors.add(mf.format(arguments));
                            // errors.add("Your Study Event OID " + sedOid +
                            // " for Subject OID " + oid
                            // + " does not reference an existing Study
                            // Event in the Study.");
                            logger.debug("logged an error with se oid " + sedOid + " and subject oid " + oid);
                        }
                        ArrayList<FormDataBean> formDataBeans = studyEventDataBean.getFormData();
                        if (formDataBeans != null) {
                            for (FormDataBean formDataBean : formDataBeans) {
                                String formOid = formDataBean.getFormOID();
                                ArrayList<CRFVersionBean> crfVersionBeans = crfVersionDAO.findAllByOid(formOid);
                                // right now just check nulls
                                if (crfVersionBeans != null) {
                                    for (CRFVersionBean crfVersionBean : crfVersionBeans) {
                                        if (crfVersionBean == null) {
                                            mf.applyPattern(respage.getString("your_crf_version_oid_for_study_event_oid"));
                                            Object[] arguments = { formOid, sedOid };
                                            errors.add(mf.format(arguments));
                                            // errors.add("Your CRF Version
                                            // OID " + formOid + " for Study
                                            // Event OID " + sedOid
                                            // + " does not reference a
                                            // proper CRF Version in that
                                            // Study Event.");
                                            logger.debug("logged an error with form " + formOid + " and se oid " + sedOid);
                                        }
                                    }
                                } else {
                                    mf.applyPattern(respage.getString("your_crf_version_oid_did_not_generate"));
                                    Object[] arguments = { formOid };
                                    errors.add(mf.format(arguments));
                                // errors.add("Your CRF Version OID " +
                                // formOid
                                // + " did not generate any results in
                                // the database. Please check it and try
                                // again.");
                                }
                                ArrayList<ImportItemGroupDataBean> itemGroupDataBeans = formDataBean.getItemGroupData();
                                if (itemGroupDataBeans != null) {
                                    for (ImportItemGroupDataBean itemGroupDataBean : itemGroupDataBeans) {
                                        String itemGroupOID = itemGroupDataBean.getItemGroupOID();
                                        List<ItemGroupBean> itemGroupBeans = itemGroupDAO.findAllByOid(itemGroupOID);
                                        if (itemGroupBeans != null) {
                                            logger.debug("number of item group beans: " + itemGroupBeans.size());
                                            logger.debug("item group oid: " + itemGroupOID);
                                            for (ItemGroupBean itemGroupBean : itemGroupBeans) {
                                                if (itemGroupBean == null) {
                                                    mf.applyPattern(respage.getString("your_item_group_oid_for_form_oid"));
                                                    Object[] arguments = { itemGroupOID, formOid };
                                                    errors.add(mf.format(arguments));
                                                // errors.add("Your Item
                                                // Group OID " +
                                                // itemGroupOID + " for
                                                // Form OID " + formOid
                                                // + " does not
                                                // reference a proper
                                                // Item Group in that
                                                // CRF Version.");
                                                }
                                            }
                                        } else {
                                            mf.applyPattern(respage.getString("the_item_group_oid_did_not"));
                                            Object[] arguments = { itemGroupOID };
                                            errors.add(mf.format(arguments));
                                        // errors.add("The Item Group
                                        // OID " + itemGroupOID
                                        // + " did not generate any
                                        // results in the database,
                                        // please check it and try
                                        // again.");
                                        }
                                        ArrayList<ImportItemDataBean> itemDataBeans = itemGroupDataBean.getItemData();
                                        if (itemDataBeans != null) {
                                            for (ImportItemDataBean itemDataBean : itemDataBeans) {
                                                String itemOID = itemDataBean.getItemOID();
                                                List<ItemBean> itemBeans = itemDAO.findByOid(itemOID);
                                                if (itemBeans != null) {
                                                    logger.debug("found itembeans: ");
                                                    for (ItemBean itemBean : itemBeans) {
                                                        if (itemBean == null) {
                                                            mf.applyPattern(respage.getString("your_item_oid_for_item_group_oid"));
                                                            Object[] arguments = { itemOID, itemGroupOID };
                                                            errors.add(mf.format(arguments));
                                                        // errors.add(
                                                        // "Your
                                                        // Item OID " +
                                                        // itemOID + "
                                                        // for Item
                                                        // Group OID " +
                                                        // itemGroupOID
                                                        // + " does not
                                                        // reference a
                                                        // proper Item
                                                        // in the Item
                                                        // Group.");
                                                        } else {
                                                            logger.debug("found " + itemBean.getOid() + ", passing");
                                                        }
                                                    }
                                                }
                                            }
                                        } else {
                                            mf.applyPattern(respage.getString("the_item_group_oid_did_not_contain_item_data"));
                                            Object[] arguments = { itemGroupOID };
                                            errors.add(mf.format(arguments));
                                        // errors.add("The Item Group
                                        // OID " + itemGroupOID
                                        // + " did not contain any Item
                                        // Data in the XML file, please
                                        // check it and try again.");
                                        }
                                    }
                                } else {
                                    mf.applyPattern(respage.getString("your_study_event_contains_no_form_data"));
                                    Object[] arguments = { sedOid };
                                    errors.add(mf.format(arguments));
                                // errors.add("Your Study Event " +
                                // sedOid
                                // + " contains no Form Data, or the
                                // Form OIDs are incorrect. Please check
                                // it and try again.");
                                }
                            }
                        }
                    }
                }
            }
        }
    } catch (OpenClinicaException oce) {
    } catch (NullPointerException npe) {
        logger.debug("found a nullpointer here");
    }
    // if errors == null you pass, if not you fail
    return errors;
}
Also used : ImportItemGroupDataBean(org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean) ItemBean(org.akaza.openclinica.bean.submit.ItemBean) DisplayItemBean(org.akaza.openclinica.bean.submit.DisplayItemBean) ItemDAO(org.akaza.openclinica.dao.submit.ItemDAO) ArrayList(java.util.ArrayList) ItemGroupDAO(org.akaza.openclinica.dao.submit.ItemGroupDAO) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) ImportItemDataBean(org.akaza.openclinica.bean.submit.crfdata.ImportItemDataBean) OpenClinicaException(org.akaza.openclinica.exception.OpenClinicaException) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) MessageFormat(java.text.MessageFormat) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) StudyEventDataBean(org.akaza.openclinica.bean.submit.crfdata.StudyEventDataBean) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudySubjectBean(org.akaza.openclinica.bean.managestudy.StudySubjectBean) SubjectDataBean(org.akaza.openclinica.bean.submit.crfdata.SubjectDataBean) FormDataBean(org.akaza.openclinica.bean.submit.crfdata.FormDataBean) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) ItemGroupBean(org.akaza.openclinica.bean.submit.ItemGroupBean)

Example 4 with ImportItemGroupDataBean

use of org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean in project OpenClinica by OpenClinica.

the class ClinicalDataReportBean method addNodeClinicalData.

public void addNodeClinicalData(boolean header, boolean footer) {
    String ODMVersion = this.getODMVersion();
    // when collecting data, only item with value has been collected.
    StringBuffer xml = this.getXmlOutput();
    String indent = this.getIndent();
    String nls = System.getProperty("line.separator");
    if (header) {
        xml.append(indent + "<ClinicalData StudyOID=\"" + StringEscapeUtils.escapeXml(clinicalData.getStudyOID()) + "\" MetaDataVersionOID=\"" + StringEscapeUtils.escapeXml(this.clinicalData.getMetaDataVersionOID()) + "\">");
        xml.append(nls);
    }
    ArrayList<ExportSubjectDataBean> subs = (ArrayList<ExportSubjectDataBean>) this.clinicalData.getExportSubjectData();
    for (ExportSubjectDataBean sub : subs) {
        xml.append(indent + indent + "<SubjectData SubjectKey=\"" + StringEscapeUtils.escapeXml(sub.getSubjectOID()));
        if ("oc1.2".equalsIgnoreCase(ODMVersion) || "oc1.3".equalsIgnoreCase(ODMVersion)) {
            xml.append("\" OpenClinica:StudySubjectID=\"" + StringEscapeUtils.escapeXml(sub.getStudySubjectId()));
            String uniqueIdentifier = sub.getUniqueIdentifier();
            if (uniqueIdentifier != null && uniqueIdentifier.length() > 0) {
                xml.append("\" OpenClinica:UniqueIdentifier=\"" + StringEscapeUtils.escapeXml(uniqueIdentifier));
            }
            String status = sub.getStatus();
            if (status != null && status.length() > 0) {
                xml.append("\" OpenClinica:Status=\"" + StringEscapeUtils.escapeXml(status));
            }
            String secondaryId = sub.getSecondaryId();
            if (secondaryId != null && secondaryId.length() > 0) {
                xml.append("\"  OpenClinica:SecondaryID=\"" + StringEscapeUtils.escapeXml(secondaryId));
            }
            Integer year = sub.getYearOfBirth();
            if (year != null) {
                xml.append("\" OpenClinica:YearOfBirth=\"" + sub.getYearOfBirth());
            } else {
                if (sub.getDateOfBirth() != null) {
                    xml.append("\" OpenClinica:DateOfBirth=\"" + sub.getDateOfBirth());
                }
            }
            String gender = sub.getSubjectGender();
            if (gender != null && gender.length() > 0) {
                xml.append("\" OpenClinica:Sex=\"" + StringEscapeUtils.escapeXml(gender));
            }
            String enrollmentDate = sub.getEnrollmentDate();
            if (enrollmentDate != null && enrollmentDate.length() > 0) {
                xml.append("\" OpenClinica:EnrollmentDate=\"" + enrollmentDate);
            }
        }
        xml.append("\">");
        xml.append(nls);
        //
        ArrayList<ExportStudyEventDataBean> ses = (ArrayList<ExportStudyEventDataBean>) sub.getExportStudyEventData();
        for (ExportStudyEventDataBean se : ses) {
            xml.append(indent + indent + indent + "<StudyEventData StudyEventOID=\"" + StringEscapeUtils.escapeXml(se.getStudyEventOID()));
            if ("oc1.2".equalsIgnoreCase(ODMVersion) || "oc1.3".equalsIgnoreCase(ODMVersion)) {
                String location = se.getLocation();
                if (location != null && location.length() > 0) {
                    xml.append("\" OpenClinica:StudyEventLocation=\"" + StringEscapeUtils.escapeXml(location));
                }
                String startDate = se.getStartDate();
                if (startDate != null && startDate.length() > 0) {
                    xml.append("\" OpenClinica:StartDate=\"" + startDate);
                }
                String endDate = se.getEndDate();
                if (endDate != null && endDate.length() > 0) {
                    xml.append("\" OpenClinica:EndDate=\"" + endDate);
                }
                String status = se.getStatus();
                if (status != null && status.length() > 0) {
                    xml.append("\" OpenClinica:Status=\"" + StringEscapeUtils.escapeXml(status));
                }
                if (se.getAgeAtEvent() != null) {
                    xml.append("\" OpenClinica:SubjectAgeAtEvent=\"" + se.getAgeAtEvent());
                }
            }
            xml.append("\"");
            if (!"-1".equals(se.getStudyEventRepeatKey())) {
                xml.append(" StudyEventRepeatKey=\"" + se.getStudyEventRepeatKey() + "\"");
            }
            xml.append(">");
            xml.append(nls);
            //
            ArrayList<ExportFormDataBean> forms = se.getExportFormData();
            for (ExportFormDataBean form : forms) {
                xml.append(indent + indent + indent + indent + "<FormData FormOID=\"" + StringEscapeUtils.escapeXml(form.getFormOID()));
                if ("oc1.2".equalsIgnoreCase(ODMVersion) || "oc1.3".equalsIgnoreCase(ODMVersion)) {
                    String formLayout = form.getFormLayout();
                    if (!StringUtils.isEmpty(formLayout)) {
                        xml.append("\" OpenClinica:FormLayoutOID=\"" + StringEscapeUtils.escapeXml(formLayout));
                    }
                    String interviewerName = form.getInterviewerName();
                    if (interviewerName != null && interviewerName.length() > 0) {
                        xml.append("\" OpenClinica:InterviewerName=\"" + StringEscapeUtils.escapeXml(interviewerName));
                    }
                    if (form.getInterviewDate() != null && form.getInterviewDate().length() > 0) {
                        xml.append("\" OpenClinica:InterviewDate=\"" + form.getInterviewDate());
                    }
                    String status = form.getStatus();
                    if (status != null && status.length() > 0) {
                        xml.append("\" OpenClinica:Status=\"" + StringEscapeUtils.escapeXml(status));
                    }
                }
                xml.append("\">");
                xml.append(nls);
                //
                ArrayList<ImportItemGroupDataBean> igs = form.getItemGroupData();
                sortImportItemGroupDataBeanList(igs);
                for (ImportItemGroupDataBean ig : igs) {
                    xml.append(indent + indent + indent + indent + indent + "<ItemGroupData ItemGroupOID=\"" + StringEscapeUtils.escapeXml(ig.getItemGroupOID()) + "\" ");
                    if (!"-1".equals(ig.getItemGroupRepeatKey())) {
                        xml.append("ItemGroupRepeatKey=\"" + ig.getItemGroupRepeatKey() + "\" ");
                    }
                    if (ig.getItemData().get(0).isDeleted()) {
                        xml.append("OpenClinica:Removed=\"" + (ig.getItemData().get(0).isDeleted() ? "Yes" : "No") + "\" ");
                    }
                    xml.append("TransactionType=\"Insert\">");
                    xml.append(nls);
                    ArrayList<ImportItemDataBean> items = ig.getItemData();
                    sortImportItemDataBeanList(items);
                    for (ImportItemDataBean item : items) {
                        boolean printValue = true;
                        xml.append(indent + indent + indent + indent + indent + indent + "<ItemData ItemOID=\"" + StringEscapeUtils.escapeXml(item.getItemOID()) + "\" ");
                        if ("Yes".equals(item.getIsNull())) {
                            xml.append("IsNull=\"Yes\"");
                            if (!item.isHasValueWithNull()) {
                                printValue = false;
                            }
                            if ("oc1.2".equalsIgnoreCase(ODMVersion) || "oc1.3".equalsIgnoreCase(ODMVersion)) {
                                xml.append(" OpenClinica:ReasonForNull=\"" + StringEscapeUtils.escapeXml(item.getReasonForNull()) + "\" ");
                                if (!printValue) {
                                    xml.append("/>");
                                    xml.append(nls);
                                }
                            }
                        }
                        if (printValue) {
                            Boolean hasElm = false;
                            xml.append("Value=\"" + StringEscapeUtils.escapeXml(item.getValue()) + "\"");
                            String muRefOid = item.getMeasurementUnitRef().getElementDefOID();
                            if (muRefOid != null && muRefOid.length() > 0) {
                                if (hasElm) {
                                } else {
                                    xml.append(">");
                                    xml.append(nls);
                                    hasElm = true;
                                }
                                xml.append(indent + indent + indent + indent + indent + indent + indent + "<MeasurementUnitRef MeasurementUnitOID=\"" + StringEscapeUtils.escapeXml(muRefOid) + "\"/>");
                                xml.append(nls);
                            }
                            if ("oc1.2".equalsIgnoreCase(ODMVersion) || "oc1.3".equalsIgnoreCase(ODMVersion)) {
                                if (item.getAuditLogs() != null && item.getAuditLogs().getAuditLogs().size() > 0) {
                                    if (hasElm) {
                                    } else {
                                        xml.append(">");
                                        xml.append(nls);
                                        hasElm = true;
                                    }
                                    this.addAuditLogs(item.getAuditLogs(), indent + indent + indent + indent + indent + indent + indent, "item");
                                }
                                //
                                if (item.getDiscrepancyNotes() != null && item.getDiscrepancyNotes().getDiscrepancyNotes().size() > 0) {
                                    if (hasElm) {
                                    } else {
                                        xml.append(">");
                                        xml.append(nls);
                                        hasElm = true;
                                    }
                                    this.addDiscrepancyNotes(item.getDiscrepancyNotes(), indent + indent + indent + indent + indent + indent + indent);
                                }
                            }
                            if (hasElm) {
                                xml.append(indent + indent + indent + indent + indent + indent + "</ItemData>");
                                xml.append(nls);
                                hasElm = false;
                            } else {
                                xml.append("/>");
                                xml.append(nls);
                            }
                        }
                    }
                    xml.append(indent + indent + indent + indent + indent + "</ItemGroupData>");
                    xml.append(nls);
                }
                //
                if ("oc1.2".equalsIgnoreCase(ODMVersion) || "oc1.3".equalsIgnoreCase(ODMVersion)) {
                    if (form.getAuditLogs() != null && form.getAuditLogs().getAuditLogs().size() > 0) {
                        this.addAuditLogs(form.getAuditLogs(), indent + indent + indent + indent + indent, "form");
                    }
                    //
                    if (form.getDiscrepancyNotes() != null && form.getDiscrepancyNotes().getDiscrepancyNotes().size() > 0) {
                        this.addDiscrepancyNotes(form.getDiscrepancyNotes(), indent + indent + indent + indent + indent);
                    }
                }
                xml.append(indent + indent + indent + indent + "</FormData>");
                xml.append(nls);
            }
            //
            if ("oc1.2".equalsIgnoreCase(ODMVersion) || "oc1.3".equalsIgnoreCase(ODMVersion)) {
                if (se.getAuditLogs() != null && se.getAuditLogs().getAuditLogs().size() > 0) {
                    this.addAuditLogs(se.getAuditLogs(), indent + indent + indent + indent, "se");
                }
                //
                if (se.getDiscrepancyNotes() != null && se.getDiscrepancyNotes().getDiscrepancyNotes().size() > 0) {
                    this.addDiscrepancyNotes(se.getDiscrepancyNotes(), indent + indent + indent + indent);
                }
            }
            xml.append(indent + indent + indent + "</StudyEventData>");
            xml.append(nls);
        }
        if ("oc1.2".equalsIgnoreCase(ODMVersion) || "oc1.3".equalsIgnoreCase(ODMVersion)) {
            ArrayList<SubjectGroupDataBean> sgddata = (ArrayList<SubjectGroupDataBean>) sub.getSubjectGroupData();
            if (sgddata.size() > 0) {
                for (SubjectGroupDataBean sgd : sgddata) {
                    String cid = sgd.getStudyGroupClassId() != null ? "OpenClinica:StudyGroupClassID=\"" + StringEscapeUtils.escapeXml(sgd.getStudyGroupClassId()) + "\" " : "";
                    if (cid.length() > 0) {
                        String cn = sgd.getStudyGroupClassName() != null ? "OpenClinica:StudyGroupClassName=\"" + StringEscapeUtils.escapeXml(sgd.getStudyGroupClassName()) + "\" " : "";
                        String gn = sgd.getStudyGroupName() != null ? "OpenClinica:StudyGroupName=\"" + StringEscapeUtils.escapeXml(sgd.getStudyGroupName()) + "\" " : "";
                        xml.append(indent + indent + indent + "<OpenClinica:SubjectGroupData " + cid + cn + gn);
                    }
                    xml.append(" />");
                    xml.append(nls);
                }
            }
            //
            if (sub.getAuditLogs() != null && sub.getAuditLogs().getAuditLogs().size() > 0) {
                this.addAuditLogs(sub.getAuditLogs(), indent + indent + indent, "sub");
            }
            //
            if (sub.getDiscrepancyNotes() != null && sub.getDiscrepancyNotes().getDiscrepancyNotes().size() > 0) {
                this.addDiscrepancyNotes(sub.getDiscrepancyNotes(), indent + indent + indent);
            }
        }
        xml.append(indent + indent + "</SubjectData>");
        xml.append(nls);
    }
    if (footer) {
        xml.append(indent + "</ClinicalData>");
        xml.append(nls);
    }
}
Also used : ExportFormDataBean(org.akaza.openclinica.bean.submit.crfdata.ExportFormDataBean) ImportItemGroupDataBean(org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean) ArrayList(java.util.ArrayList) ImportItemDataBean(org.akaza.openclinica.bean.submit.crfdata.ImportItemDataBean) ExportStudyEventDataBean(org.akaza.openclinica.bean.submit.crfdata.ExportStudyEventDataBean) SubjectGroupDataBean(org.akaza.openclinica.bean.submit.crfdata.SubjectGroupDataBean) ExportSubjectDataBean(org.akaza.openclinica.bean.submit.crfdata.ExportSubjectDataBean)

Example 5 with ImportItemGroupDataBean

use of org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean in project OpenClinica by OpenClinica.

the class GenerateClinicalDataServiceImpl method populateImportItemGrpBean.

private ArrayList<ImportItemGroupDataBean> populateImportItemGrpBean(HashMap<String, ArrayList<String>> oidMap, HashMap<String, List<ItemData>> oidDNAuditMap) {
    Set<String> keysGrpOIDs = oidMap.keySet();
    ArrayList<ImportItemGroupDataBean> iigDataBean = new ArrayList<ImportItemGroupDataBean>();
    ImportItemGroupDataBean importItemGrpDataBean = new ImportItemGroupDataBean();
    for (String grpOID : keysGrpOIDs) {
        ArrayList<String> vals = oidMap.get(grpOID);
        importItemGrpDataBean = new ImportItemGroupDataBean();
        int firstIndexOf = StringUtils.ordinalIndexOf(grpOID, GROUPOID_ORDINAL_DELIM, 1);
        int secondIndexOf = StringUtils.ordinalIndexOf(grpOID, GROUPOID_ORDINAL_DELIM, 2);
        // int groupIdx = grpOID.indexOf(GROUPOID_ORDINAL_DELIM);
        if (firstIndexOf != -1) {
            importItemGrpDataBean.setItemGroupOID(grpOID.substring(0, firstIndexOf));
            importItemGrpDataBean.setItemGroupRepeatKey(grpOID.substring(firstIndexOf + 1, secondIndexOf));
            boolean isDeleted = Boolean.parseBoolean(grpOID.substring(secondIndexOf + 1));
            ArrayList<ImportItemDataBean> iiDList = new ArrayList<ImportItemDataBean>();
            for (String value : vals) {
                ImportItemDataBean iiDataBean = new ImportItemDataBean();
                int index = value.indexOf(DELIMITER);
                if (!value.trim().equalsIgnoreCase(DELIMITER)) {
                    iiDataBean.setItemOID(value.substring(0, index));
                    iiDataBean.setValue(value.substring(index + 1, value.length()));
                    iiDataBean.setDeleted(isDeleted);
                    if (isCollectAudits() || isCollectDns()) {
                        iiDataBean = fetchItemDataAuditValue(oidDNAuditMap.get(grpOID), iiDataBean);
                    }
                    // if(isCollectDns())
                    // iiDataBean.setDiscrepancyNotes(fetchDiscrepancyNotes(oidDNAuditMap.get(grpOID)));
                    iiDList.add(iiDataBean);
                }
            }
            importItemGrpDataBean.setItemData(iiDList);
            iigDataBean.add(importItemGrpDataBean);
        }
    }
    return iigDataBean;
}
Also used : ImportItemGroupDataBean(org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean) ArrayList(java.util.ArrayList) ImportItemDataBean(org.akaza.openclinica.bean.submit.crfdata.ImportItemDataBean)

Aggregations

ImportItemDataBean (org.akaza.openclinica.bean.submit.crfdata.ImportItemDataBean)8 ImportItemGroupDataBean (org.akaza.openclinica.bean.submit.crfdata.ImportItemGroupDataBean)8 ArrayList (java.util.ArrayList)6 FormDataBean (org.akaza.openclinica.bean.submit.crfdata.FormDataBean)5 StudyEventDataBean (org.akaza.openclinica.bean.submit.crfdata.StudyEventDataBean)5 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)4 SubjectDataBean (org.akaza.openclinica.bean.submit.crfdata.SubjectDataBean)4 HashMap (java.util.HashMap)3 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)3 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)3 ItemBean (org.akaza.openclinica.bean.submit.ItemBean)3 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)3 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)3 MessageFormat (java.text.MessageFormat)2 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)2 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)2 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)2 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)2 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)2 ItemGroupBean (org.akaza.openclinica.bean.submit.ItemGroupBean)2