@Test
 public void testToEbXML_MPQ() {
   multiplePatientsQueryTransformer.toEbXML(multiplePatientsQuery, ebXML);
   assertEquals(QueryType.FIND_DOCUMENTS_MPQ.getId(), ebXML.getId());
   assertEquals(
       Arrays.asList("('id3^^^&1.3&ISO')", "('id4^^^&1.4&ISO')"),
       ebXML.getSlotValues(QueryParameter.DOC_ENTRY_PATIENT_ID.getSlotName()));
   toEbXML(query, ebXML);
 }
 @Test
 public void testToEbXML() {
   transformer.toEbXML(query, ebXML);
   assertEquals(QueryType.FIND_DOCUMENTS.getId(), ebXML.getId());
   assertEquals("12.21.41", ebXML.getHome());
   assertEquals(
       Arrays.asList("'id3^^^&1.3&ISO'"),
       ebXML.getSlotValues(QueryParameter.DOC_ENTRY_PATIENT_ID.getSlotName()));
   toEbXML(query, ebXML);
 }
Esempio n. 3
0
  /**
   * Transforms the request into its ebXML representation.
   *
   * @param request the request. Can be <code>null</code>.
   * @return the ebXML representation. <code>null</code> if the input was <code>null</code>.
   */
  public EbXMLAdhocQueryRequest toEbXML(QueryRegistry request) {
    if (request == null) {
      return null;
    }

    Query query = request.getQuery();
    EbXMLAdhocQueryRequest ebXML = createAdhocQueryRequest(query);
    query.accept(new ToEbXMLVisitor(ebXML));

    ebXML.setReturnType(request.getReturnType().getCode());

    return ebXML;
  }
Esempio n. 4
0
  /**
   * Transforms the ebXML representation into a request.
   *
   * @param ebXML the ebXML representation. Can be <code>null</code>.
   * @return the request. <code>null</code> if the input was <code>null</code>.
   */
  public QueryRegistry fromEbXML(EbXMLAdhocQueryRequest ebXML) {
    if (ebXML == null) {
      return null;
    }

    String id = ebXML.getId();
    QueryType queryType = id == null ? QueryType.SQL : QueryType.valueOfId(id);
    if (queryType == null) {
      return null;
    }

    Query query = createQuery(queryType);
    query.accept(new FromEbXMLVisitor(ebXML));

    QueryRegistry queryRegistry = new QueryRegistry(query);
    queryRegistry.setReturnType(QueryReturnType.valueOfCode(ebXML.getReturnType()));

    return queryRegistry;
  }
  public void toEbXML(DocumentsQuery query, EbXMLAdhocQueryRequest ebXML) {

    assertEquals("12.21.41", ebXML.getHome());

    assertEquals(
        Arrays.asList("('code1^^scheme1')", "('code2^^scheme2')"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_CLASS_CODE.getSlotName()));

    assertEquals(
        Arrays.asList("('codet1^^schemet1')", "('codet2^^schemet2')"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_TYPE_CODE.getSlotName()));

    assertEquals(
        Arrays.asList("('code3^^scheme3')", "('code4^^scheme4')"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_PRACTICE_SETTING_CODE.getSlotName()));

    assertEquals(
        Arrays.asList("1980"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_CREATION_TIME_FROM.getSlotName()));
    assertEquals(
        Arrays.asList("1981"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_CREATION_TIME_TO.getSlotName()));

    assertEquals(
        Arrays.asList("1982"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_SERVICE_START_TIME_FROM.getSlotName()));
    assertEquals(
        Arrays.asList("1983"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_SERVICE_START_TIME_TO.getSlotName()));

    assertEquals(
        Arrays.asList("1984"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_SERVICE_STOP_TIME_FROM.getSlotName()));
    assertEquals(
        Arrays.asList("1985"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_SERVICE_STOP_TIME_TO.getSlotName()));

    assertEquals(
        Arrays.asList("('code5^^scheme5')", "('code6^^scheme6')"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_HEALTHCARE_FACILITY_TYPE_CODE.getSlotName()));

    List<EbXMLSlot> slots = ebXML.getSlots(QueryParameter.DOC_ENTRY_EVENT_CODE.getSlotName());
    assertEquals(2, slots.size());
    assertEquals(
        Arrays.asList("('code7^^scheme7')", "('code8^^scheme8')"), slots.get(0).getValueList());
    assertEquals(Arrays.asList("('code9^^scheme9')"), slots.get(1).getValueList());

    slots = ebXML.getSlots(QueryParameter.DOC_ENTRY_CONFIDENTIALITY_CODE.getSlotName());
    assertEquals(2, slots.size());
    assertEquals(
        Arrays.asList("('code10^^scheme10')", "('code11^^scheme11')"), slots.get(0).getValueList());
    assertEquals(Arrays.asList("('code12^^scheme12')"), slots.get(1).getValueList());

    assertEquals(
        Arrays.asList("('per''son1')", "('person2')"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_AUTHOR_PERSON.getSlotName()));

    assertEquals(
        Arrays.asList("('code13^^scheme13')", "('code14^^scheme14')"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_FORMAT_CODE.getSlotName()));

    assertEquals(
        Arrays.asList(
            "('urn:oasis:names:tc:ebxml-regrep:StatusType:Approved')",
            "('urn:oasis:names:tc:ebxml-regrep:StatusType:Submitted')"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_STATUS.getSlotName()));

    assertEquals(
        Arrays.asList("('urn:uuid:7edca82f-054d-47f2-a032-9b2a5b5186c1')"),
        ebXML.getSlotValues(QueryParameter.DOC_ENTRY_TYPE.getSlotName()));

    assertEquals(19, ebXML.getSlots().size());
  }
 @Test
 public void testToEbXMLEmpty_MPQ() {
   multiplePatientsQueryTransformer.toEbXML(new FindDocumentsForMultiplePatientsQuery(), ebXML);
   assertEquals(0, ebXML.getSlots().size());
 }
 @Test
 public void testToEbXMLEmpty() {
   transformer.toEbXML(new FindDocumentsQuery(), ebXML);
   assertEquals(0, ebXML.getSlots().size());
 }
 @Test
 public void testToEbXMLNull_MPQ() {
   multiplePatientsQueryTransformer.toEbXML(null, ebXML);
   assertEquals(0, ebXML.getSlots().size());
 }
 @Test
 public void testToEbXMLNull() {
   transformer.toEbXML(null, ebXML);
   assertEquals(0, ebXML.getSlots().size());
 }