Ejemplo n.º 1
0
 /**
  * Check if expected error (XDSPatientIdDoesNotMatch) is returned if an Association references two
  * XDSObjects with different patientId's.
  *
  * @throws Exception
  */
 @Test
 public void checkErrorPatIdDoesntMatch() throws Exception {
   log.info(
       "\n############################# TEST: check error PatId doesn't Match  ############################");
   SubmitObjectsRequest req = XDSTestUtil.getSubmitObjectsRequest(TEST_METADATA_FILENAME);
   RegistryObjectType obj =
       (RegistryObjectType) req.getRegistryObjectList().getIdentifiable().get(0).getValue();
   XDSTestUtil.setExternalIdentifierValue(
       obj.getExternalIdentifier(),
       XDSConstants.UUID_XDSDocumentEntry_patientId,
       "test1234_2^^^&1.2.3.45.4.3.2.1&ISO");
   doRegisterDocumentAndCheckError(
       req, XDSException.XDS_ERR_PATID_DOESNOT_MATCH, "Check Unknown PID");
 }
Ejemplo n.º 2
0
 @Test
 public void checkErrorMergedPatId() throws Exception {
   log.info(
       "\n############################# TEST: check merged PatId ############################");
   String mergedPID = XDSTestUtil.TEST_PID_MERGED + XDSTestUtil.TEST_ISSUER;
   session.linkPatient(mergedPID, XDSTestUtil.TEST_PID_1 + XDSTestUtil.TEST_ISSUER);
   SubmitObjectsRequest req = XDSTestUtil.getSubmitObjectsRequest(TEST_METADATA_FILENAME);
   RegistryObjectType obj =
       (RegistryObjectType) req.getRegistryObjectList().getIdentifiable().get(0).getValue();
   XDSTestUtil.setExternalIdentifierValue(
       obj.getExternalIdentifier(), XDSConstants.UUID_XDSDocumentEntry_patientId, mergedPID);
   doRegisterDocumentAndCheckError(
       req, XDSException.XDS_ERR_PATID_DOESNOT_MATCH, "Check merged PID");
   session.linkPatient(mergedPID, null);
 }
Ejemplo n.º 3
0
 public static void addOrOverwriteSlot(
     RegistryObjectType ro, Map<String, SlotType1> slots, String slotName, String... val)
     throws JAXBException {
   if (slots.containsKey(slotName)) {
     SlotType1 oldSlot = (SlotType1) slots.get(slotName);
     ro.getSlot().remove(oldSlot);
   }
   SlotType1 slot = objFac.createSlotType1();
   slot.setName(slotName);
   ValueListType valueList = objFac.createValueListType();
   for (int i = 0; i < val.length; i++) {
     valueList.getValue().add(val[i]);
   }
   slot.setValueList(valueList);
   ro.getSlot().add(slot);
 }
Ejemplo n.º 4
0
 public static String getExternalIdentifierValue(String urn, RegistryObjectType ro) {
   List<ExternalIdentifierType> list = ro.getExternalIdentifier();
   ExternalIdentifierType ei;
   for (int i = 0, len = list.size(); i < len; i++) {
     ei = list.get(i);
     if (ei.getIdentificationScheme().equals(urn)) {
       return ei.getValue();
     }
   }
   return null;
 }
Ejemplo n.º 5
0
 public static Map<String, SlotType1> getSlotsFromRegistryObject(RegistryObjectType ro)
     throws JAXBException {
   List<SlotType1> slots = ro.getSlot();
   Map<String, SlotType1> slotByName =
       new HashMap<String, SlotType1>(slots == null ? 0 : slots.size());
   if (slots != null) {
     SlotType1 slot;
     for (int i = 0, len = slots.size(); i < len; i++) {
       slot = slots.get(i);
       slotByName.put(slot.getName(), slot);
     }
   }
   return slotByName;
 }
Ejemplo n.º 6
0
 public static String setExternalIdentifierValue(String urn, String value, RegistryObjectType ro) {
   List<ExternalIdentifierType> list = ro.getExternalIdentifier();
   ExternalIdentifierType ei;
   for (int i = 0, len = list.size(); i < len; i++) {
     ei = list.get(i);
     if (ei.getIdentificationScheme().equals(urn)) {
       String oldValue = ei.getValue();
       ei.setValue(value);
       return oldValue;
     }
   }
   ei = new ExternalIdentifierType();
   ei.setIdentificationScheme(urn);
   ei.setValue(value);
   list.add(ei);
   return null;
 }