Beispiel #1
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;
 }
 /**
  * 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");
 }
 @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);
 }
Beispiel #4
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;
 }