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; }
public static ExternalIdentifierType createExternalIdentifier(String id, String scheme, String registryObject, String value, String name) { ExternalIdentifierType ei = rimFactory.createExternalIdentifierType(); ei.setId(id); ei.setIdentificationScheme(scheme); ei.setObjectType("urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier"); ei.setRegistryObject(registryObject); ei.setValue(value); InternationalStringType is = rimFactory.createInternationalStringType(); LocalizedStringType v = rimFactory.createLocalizedStringType(); v.setValue(name); is.getLocalizedString().add(v); ei.setName(is); return ei; }
private String getPatID(ExternalIdentifierType eiType) { if (XDSConstants.UUID_XDSDocumentEntry_patientId.equals(eiType.getIdentificationScheme()) || XDSConstants.UUID_XDSFolder_patientId.equals(eiType.getIdentificationScheme()) || XDSConstants.UUID_XDSSubmissionSet_patientId.equals(eiType.getIdentificationScheme()) ) { return eiType.getValue() != null ? eiType.getValue() : ""; } return null; }
private void copyExternalIdentifierType(Set<ExternalIdentifier> externalIdentifiers, RegistryObjectType roType) { if (externalIdentifiers != null) { List<ExternalIdentifierType> eiTypes = roType.getExternalIdentifier(); ExternalIdentifierType eiType; for (ExternalIdentifier ei : externalIdentifiers) { eiType = factory.createExternalIdentifierType(); toEbXmlObj(ei, eiType); if (ei.getIdentificationScheme() != null) { eiType.setIdentificationScheme(ei.getIdentificationScheme().getId()); } else { log.error("IdentificationScheme is null! ExternalIdentifier id:"+ei.getId()); eiType.setIdentificationScheme("urn:willi:12345-abcd-123"); } eiType.setValue(ei.getValue()); if (ei.getRegistryObject() != null) { eiType.setRegistryObject(ei.getRegistryObject().getId()); } else { log.error("RegistryObject is null! ExternalIdentifier id:"+ei.getId()); eiType.setRegistryObject("urn:willi:12345-abcd-456"); } eiTypes.add(eiType); } } }
private void copyExternalIdentifier(List<ExternalIdentifierType> list, RegistryObject ro) throws XDSException { if (list != null) { ExternalIdentifier ei; for (ExternalIdentifierType eiType : list) { ei = new ExternalIdentifier(); toPersistenceObj(eiType, ei); ei.setIdentificationScheme((ClassificationScheme) getRegistryObject(eiType.getIdentificationScheme())); ei.setValue(eiType.getValue()); ei.setRegistryObject(eiType.getRegistryObject() != null ? getRegistryObject(eiType.getRegistryObject()) : ro); ro.getExternalIdentifiers().add(ei); } } }
private XADPatient getPatient(ExternalIdentifierType eiType) throws XDSException { XADPatient pat = getPatient(eiType.getValue(), cfg.isCreateMissingPIDs()); if (pat.getIssuerOfPatientID().getNamespaceID() != null) { log.debug("XAD PatientID ("+eiType.getValue()+") contains Namespace ID! Corrected in metadata!"); eiType.setValue(pat.getXADPatientID()); } return pat; } private XADPatient getPatient(String pid, boolean createMissing) throws XDSException {
private static void checkExternalIdentifiers(RegistryObjectType roType, List<String> requiredExternalIdentifiers) throws XDSException { List<ExternalIdentifierType> eiList = roType.getExternalIdentifier(); for (ExternalIdentifierType ei : eiList) { requiredExternalIdentifiers.remove(ei.getIdentificationScheme()); } if (requiredExternalIdentifiers.size() > 0) throw new XDSException(XDSException.XDS_ERR_REGISTRY_METADATA_ERROR, "Missing attributes in '"+roType.getId()+"'! codes:"+requiredExternalIdentifiers, null); }
/** * Create an instance of {@link ExternalIdentifierType } * */ public ExternalIdentifierType createExternalIdentifierType() { return new ExternalIdentifierType(); }
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; } public static String setExternalIdentifierValue(String urn, String value, RegistryObjectType ro) {
private String[] getSubmissionUIDandPatID(SubmitObjectsRequest req) { String[] result = new String[]{UNKNOWN, UNKNOWN}; List<JAXBElement<? extends IdentifiableType>> objs = req.getRegistryObjectList().getIdentifiable(); IdentifiableType obj; whole: for (int i=0,len=objs.size() ; i < len ; i++) { obj = objs.get(i).getValue(); if (obj instanceof RegistryPackageType) { List<ExternalIdentifierType> list = ((RegistryPackageType)obj).getExternalIdentifier(); if (list != null) { for (ExternalIdentifierType eiType : list) { if (XDSConstants.UUID_XDSSubmissionSet_patientId.equals(eiType.getIdentificationScheme())) { if (eiType.getValue() != null) result[1] = eiType.getValue(); } else if (XDSConstants.UUID_XDSSubmissionSet_uniqueId.equals(eiType.getIdentificationScheme())) { if (eiType.getValue() != null) result[0] = eiType.getValue(); } else { continue; } if (result[0] != UNKNOWN && result[1] != UNKNOWN) break whole; } } } } return result; }
private String[] getSubmissionUIDandPatID(SubmitObjectsRequest req) { String[] result = new String[2]; List<JAXBElement<? extends IdentifiableType>> objs = req.getRegistryObjectList().getIdentifiable(); IdentifiableType obj; whole: for (int i=0,len=objs.size() ; i < len ; i++) { obj = objs.get(i).getValue(); if (obj instanceof RegistryPackageType) { List<ExternalIdentifierType> list = ((RegistryPackageType)obj).getExternalIdentifier(); if (list != null) { for (ExternalIdentifierType eiType : list) { if (XDSConstants.UUID_XDSSubmissionSet_patientId.equals(eiType.getIdentificationScheme())) { result[1] = eiType.getValue(); } else if (XDSConstants.UUID_XDSSubmissionSet_uniqueId.equals(eiType.getIdentificationScheme())) { result[0] = eiType.getValue(); } else { continue; } if (result[0] != null && result[1] != null) break whole; } } } } return result; }
private String[] getSubmissionUIDandPatID(SubmitObjectsRequest req) { String[] result = new String[2]; List<JAXBElement<? extends IdentifiableType>> objs = req.getRegistryObjectList().getIdentifiable(); IdentifiableType obj; whole: for (int i=0,len=objs.size() ; i < len ; i++) { obj = objs.get(i).getValue(); if (obj instanceof RegistryPackageType) { List<ExternalIdentifierType> list = ((RegistryPackageType)obj).getExternalIdentifier(); if (list != null) { for (ExternalIdentifierType eiType : list) { if (XDSConstants.UUID_XDSSubmissionSet_patientId.equals(eiType.getIdentificationScheme())) { result[1] = eiType.getValue(); } else if (XDSConstants.UUID_XDSSubmissionSet_uniqueId.equals(eiType.getIdentificationScheme())) { result[0] = eiType.getValue(); } else { continue; } if (result[0] != null && result[1] != null) break whole; } } } } return result; }
if (list != null) { for (ExternalIdentifierType eiType : list) { if (XDSConstants.UUID_XDSSubmissionSet_patientId.equals(eiType.getIdentificationScheme())) { if (rp == null) { XDSValidator.checkSubmissionSetMetadata(rpType); } else if (XDSConstants.UUID_XDSSubmissionSet_uniqueId.equals(eiType.getIdentificationScheme())) { if (rp == null) { XDSValidator.checkSubmissionSetMetadata(rpType); rp = new XDSSubmissionSet(); ((XDSSubmissionSet)rp).setUniqueId(eiType.getValue()); } else if (XDSConstants.UUID_XDSFolder_patientId.equals(eiType.getIdentificationScheme())) { if (rp == null) { XDSValidator.checkFolderMetadata(rpType); } else if (XDSConstants.UUID_XDSFolder_uniqueId.equals(eiType.getIdentificationScheme())) { if (rp == null){ XDSValidator.checkFolderMetadata(rpType); rp = new XDSFolder(); ((XDSFolder)rp).setUniqueId(eiType.getValue());
public ExtrinsicObject toExtrinsicObject(ExtrinsicObjectType eoType) throws XDSException { ExtrinsicObject eo; XDSDocumentEntry doc = null; if (XDSConstants.UUID_XDSDocumentEntry.equals(eoType.getObjectType())) { XDSValidator.checkDocumentEntryMetadata(eoType); doc = new XDSDocumentEntry(); eo = doc; List<ExternalIdentifierType> list = eoType.getExternalIdentifier(); if (list != null) { for (ExternalIdentifierType eiType : list) { if (XDSConstants.UUID_XDSDocumentEntry_patientId.equals(eiType.getIdentificationScheme())) { doc.setPatient(getPatient(eiType)); } else if (XDSConstants.UUID_XDSDocumentEntry_uniqueId.equals(eiType.getIdentificationScheme())) { XDSValidator.checkAlreadyExists(eiType.getValue(), eoType, session); doc.setUniqueId(eiType.getValue()); } } } doc.setSourcePatient(getPatient(getSlotValue(eoType, XDSConstants.SLOT_NAME_SOURCE_PATIENT_ID), true)); } else { eo = new ExtrinsicObject(); } toPersistenceObj(eoType, eo); eo.setMimeType(eoType.getMimeType()); return eo; }