コード例 #1
0
  public Collection findAllByEntityAndColumn(String entityName, int entityId, String column) {
    this.setTypesExpected();
    this.setTypeExpected(11, TypeNames.STRING); // ss.label
    ArrayList alist = new ArrayList();
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(entityId));
    variables.put(new Integer(2), column);
    if ("subject".equalsIgnoreCase(entityName)) {
      alist = this.select(digester.getQuery("findAllBySubjectAndColumn"), variables);
    } else if ("studySub".equalsIgnoreCase(entityName)) {
      alist = this.select(digester.getQuery("findAllByStudySubjectAndColumn"), variables);
    } else if ("eventCrf".equalsIgnoreCase(entityName)) {
      this.setTypeExpected(12, TypeNames.DATE); // date_start
      this.setTypeExpected(13, TypeNames.STRING); // sed_name
      this.setTypeExpected(14, TypeNames.STRING); // crf_name
      alist = this.select(digester.getQuery("findAllByEventCRFAndColumn"), variables);
    } else if ("studyEvent".equalsIgnoreCase(entityName)) {
      this.setTypeExpected(12, TypeNames.DATE); // date_start
      this.setTypeExpected(13, TypeNames.STRING); // sed_name
      alist = this.select(digester.getQuery("findAllByStudyEventAndColumn"), variables);
    } else if ("itemData".equalsIgnoreCase(entityName)) {
      this.setTypeExpected(12, TypeNames.DATE); // date_start
      this.setTypeExpected(13, TypeNames.STRING); // sed_name
      this.setTypeExpected(14, TypeNames.STRING); // crf_name
      this.setTypeExpected(15, TypeNames.STRING); // item_name
      alist = this.select(digester.getQuery("findAllByItemDataAndColumn"), variables);
    }

    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
      HashMap hm = (HashMap) it.next();
      DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
      eb.setSubjectName((String) hm.get("label"));
      if ("eventCrf".equalsIgnoreCase(entityName) || "itemData".equalsIgnoreCase(entityName)) {
        eb.setEventName((String) hm.get("sed_name"));
        eb.setEventStart((Date) hm.get("date_start"));
        eb.setCrfName((String) hm.get("crf_name"));
        eb.setEntityName((String) hm.get("item_name"));

      } else if ("studyEvent".equalsIgnoreCase(entityName)) {
        eb.setEventName((String) hm.get("sed_name"));
        eb.setEventStart((Date) hm.get("date_start"));
      }
      if (fetchMapping) {
        eb = findSingleMapping(eb);
      }

      al.add(eb);
    }
    return al;
  }
コード例 #2
0
  public static DiscrepancyNoteBean createDiscrepancyNote(
      ItemBean itemBean,
      String message,
      EventCRFBean eventCrfBean,
      DisplayItemBean displayItemBean,
      Integer parentId,
      UserAccountBean uab,
      DataSource ds,
      StudyBean study) {
    // DisplayItemBean displayItemBean) {
    DiscrepancyNoteBean note = new DiscrepancyNoteBean();
    StudySubjectDAO ssdao = new StudySubjectDAO(ds);
    note.setDescription(message);
    note.setDetailedNotes("Failed Validation Check");
    note.setOwner(uab);
    note.setCreatedDate(new Date());
    note.setResolutionStatusId(ResolutionStatus.OPEN.getId());
    note.setDiscrepancyNoteTypeId(DiscrepancyNoteType.FAILEDVAL.getId());
    if (parentId != null) {
      note.setParentDnId(parentId);
    }

    note.setField(itemBean.getName());
    note.setStudyId(study.getId());
    note.setEntityName(itemBean.getName());
    note.setEntityType("ItemData");
    note.setEntityValue(displayItemBean.getData().getValue());

    note.setEventName(eventCrfBean.getName());
    note.setEventStart(eventCrfBean.getCreatedDate());
    note.setCrfName(displayItemBean.getEventDefinitionCRF().getCrfName());

    StudySubjectBean ss = (StudySubjectBean) ssdao.findByPK(eventCrfBean.getStudySubjectId());
    note.setSubjectName(ss.getName());

    note.setEntityId(displayItemBean.getData().getId());
    note.setColumn("value");

    DiscrepancyNoteDAO dndao = new DiscrepancyNoteDAO(ds);
    note = (DiscrepancyNoteBean) dndao.create(note);
    // so that the below method works, need to set the entity above
    // System.out.println("trying to create mapping with " + note.getId() + " " + note.getEntityId()
    // + " " + note.getColumn() + " " + note.getEntityType());
    dndao.createMapping(note);
    // System.out.println("just created mapping");
    return note;
  }
コード例 #3
0
  public ArrayList findAllItemDataByStudy(StudyBean study) {
    this.setTypesExpected();
    ArrayList alist = new ArrayList();
    this.setTypeExpected(11, TypeNames.STRING); // ss.label
    this.setTypeExpected(12, TypeNames.DATE); // date_start
    this.setTypeExpected(13, TypeNames.STRING); // sed_name
    this.setTypeExpected(14, TypeNames.STRING); // crf_name
    this.setTypeExpected(15, TypeNames.STRING); // item_name
    this.setTypeExpected(16, TypeNames.STRING); // value
    this.setTypeExpected(17, TypeNames.INT); // item_data_id
    this.setTypeExpected(18, TypeNames.INT); // item_id

    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(study.getId()));
    variables.put(new Integer(2), new Integer(study.getId()));
    alist = this.select(digester.getQuery("findAllItemDataByStudy"), variables);

    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
      HashMap hm = (HashMap) it.next();
      DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
      eb.setEventName((String) hm.get("sed_name"));
      eb.setEventStart((Date) hm.get("date_start"));
      eb.setCrfName((String) hm.get("crf_name"));
      eb.setSubjectName((String) hm.get("label"));
      eb.setEntityName((String) hm.get("item_name"));
      eb.setEntityValue((String) hm.get("value"));
      // YW << change EntityId from item_id to item_data_id.
      eb.setEntityId(((Integer) hm.get("item_data_id")).intValue());
      eb.setItemId(((Integer) hm.get("item_id")).intValue());
      // YW >>
      al.add(eb);
    }
    return al;
  }
コード例 #4
0
  public ArrayList findAllEntityByPK(String entityName, int noteId) {
    this.setTypesExpected();
    ArrayList alist = new ArrayList();
    this.setTypeExpected(11, TypeNames.STRING); // ss.label

    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(noteId));
    variables.put(new Integer(2), new Integer(noteId));
    if ("subject".equalsIgnoreCase(entityName)) {
      this.setTypeExpected(12, TypeNames.STRING); // column_name
      alist = this.select(digester.getQuery("findAllSubjectByPK"), variables);
    } else if ("studySub".equalsIgnoreCase(entityName)) {
      this.setTypeExpected(12, TypeNames.STRING); // column_name
      alist = this.select(digester.getQuery("findAllStudySubjectByPK"), variables);
    } else if ("eventCrf".equalsIgnoreCase(entityName)) {
      this.setTypeExpected(12, TypeNames.DATE); // date_start
      this.setTypeExpected(13, TypeNames.STRING); // sed_name
      this.setTypeExpected(14, TypeNames.STRING); // crf_name
      this.setTypeExpected(15, TypeNames.STRING); // column_name
      alist = this.select(digester.getQuery("findAllEventCRFByPK"), variables);
    } else if ("studyEvent".equalsIgnoreCase(entityName)) {
      this.setTypeExpected(12, TypeNames.DATE); // date_start
      this.setTypeExpected(13, TypeNames.STRING); // sed_name
      this.setTypeExpected(14, TypeNames.STRING); // column_name
      alist = this.select(digester.getQuery("findAllStudyEventByPK"), variables);
    } else if ("itemData".equalsIgnoreCase(entityName)) {
      this.setTypeExpected(12, TypeNames.DATE); // date_start
      this.setTypeExpected(13, TypeNames.STRING); // sed_name
      this.setTypeExpected(14, TypeNames.STRING); // crf_name
      this.setTypeExpected(15, TypeNames.STRING); // item_name
      this.setTypeExpected(16, TypeNames.STRING); // value
      // YW <<
      this.setTypeExpected(17, TypeNames.INT); // item_data_id
      this.setTypeExpected(18, TypeNames.INT); // item_id
      // YW >>
      alist = this.select(digester.getQuery("findAllItemDataByPK"), variables);
    }

    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
      HashMap hm = (HashMap) it.next();
      DiscrepancyNoteBean eb = (DiscrepancyNoteBean) this.getEntityFromHashMap(hm);
      if ("subject".equalsIgnoreCase(entityName) || "studySub".equalsIgnoreCase(entityName)) {
        eb.setSubjectName((String) hm.get("label"));
        eb.setColumn((String) hm.get("column_name"));
      } else if ("eventCrf".equalsIgnoreCase(entityName)) {
        eb.setSubjectName((String) hm.get("label"));
        eb.setEventName((String) hm.get("sed_name"));
        eb.setEventStart((Date) hm.get("date_start"));
        eb.setCrfName((String) hm.get("crf_name"));
        eb.setColumn((String) hm.get("column_name"));
      } else if ("itemData".equalsIgnoreCase(entityName)) {
        eb.setSubjectName((String) hm.get("label"));
        eb.setEventName((String) hm.get("sed_name"));
        eb.setEventStart((Date) hm.get("date_start"));
        eb.setCrfName((String) hm.get("crf_name"));
        eb.setEntityName((String) hm.get("item_name"));
        eb.setEntityValue((String) hm.get("value"));
        // YW <<
        eb.setEntityId(((Integer) hm.get("item_data_id")).intValue());
        eb.setItemId(((Integer) hm.get("item_id")).intValue());
        // YW >>

      } else if ("studyEvent".equalsIgnoreCase(entityName)) {
        eb.setSubjectName((String) hm.get("label"));
        eb.setEventName((String) hm.get("sed_name"));
        eb.setEventStart((Date) hm.get("date_start"));
        eb.setColumn((String) hm.get("column_name"));
      }
      if (fetchMapping) {
        eb = findSingleMapping(eb);
      }
      al.add(eb);
    }
    return al;
  }