private boolean isSubmissionSet(String sourceID) { return sourceID!=null && sourceID.equals(submissionSet.getId()); }
/** * Create an instance of {@link RegistryPackageType } * */ public RegistryPackageType createRegistryPackageType() { return new RegistryPackageType(); }
public XDSFolder(PnRRequest pnrReq, String uniqueID) { this.pnrRequest = pnrReq; id = pnrReq.nextFolderID(); metadata = Util.rimFactory.createRegistryPackageType(); metadata.setId(id); List<JAXBElement<? extends IdentifiableType>> list = pnrRequest.getRegistryObjectList().getIdentifiable(); list.add(Util.rimFactory.createRegistryPackage(metadata)); metadata.getExternalIdentifier().add(Util.createExternalIdentifier(pnrRequest.nextID(), XDSConstants.UUID_XDSFolder_patientId, id, pnrRequest.getPatientID(), XDS_FOLDER_PATIENT_ID)); metadata.getExternalIdentifier().add(Util.createExternalIdentifier(pnrRequest.nextID(), XDSConstants.UUID_XDSFolder_uniqueId, id, uniqueID, XDS_FOLDER_UNIQUE_ID)); metadata.getClassification().add(Util.createClassification(pnrReq.nextID(), XDSConstants.UUID_XDSFolder, id)); this.uniqueID = uniqueID; assoc = pnrReq.addAssociation(PnRRequest.SUBMISSION_SET_ID, id, XDSConstants.HAS_MEMBER); }
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; }
public PnRRequest(String sourceID, String submissionSetUID, String patID, String srcPatID) { if (sourceID == null || submissionSetUID == null || patID == null || srcPatID == null) { StringBuilder sb = new StringBuilder(); sb.append("Parameter values must not be null! ("); if (sourceID == null) sb.append("sourceID,"); if (submissionSetUID == null) sb.append("submissionSetUID,"); if (patID == null) sb.append("patID,"); if (srcPatID == null) sb.append("srcPatID,"); sb.setCharAt(sb.length()-1, ')'); throw new IllegalArgumentException(sb.toString()); } this.submissionSetUID = submissionSetUID; patientID = patID; srcPatIDSlot = Util.createSlot(XDSConstants.SLOT_NAME_SOURCE_PATIENT_ID, null, srcPatID); provideAndRegisterDocumentSetRequest = iheFactory.createProvideAndRegisterDocumentSetRequestType(); SubmitObjectsRequest sor = Util.rimFactory.createSubmitObjectsRequest(); registryObjectList = Util.rimFactory.createRegistryObjectListType(); sor.setRegistryObjectList(registryObjectList); provideAndRegisterDocumentSetRequest.setSubmitObjectsRequest(sor); submissionSet = Util.rimFactory.createRegistryPackageType(); submissionSet.setId(SUBMISSION_SET_ID); submissionSet.getExternalIdentifier().add(Util.createExternalIdentifier(nextID(), XDSConstants.UUID_XDSSubmissionSet_uniqueId, SUBMISSION_SET_ID, submissionSetUID, "XDSSubmissionSet.uniqueId")); submissionSet.getExternalIdentifier().add(Util.createExternalIdentifier(nextID(), XDSConstants.UUID_XDSSubmissionSet_patientId, SUBMISSION_SET_ID, patID, "XDSSubmissionSet.patientId")); submissionSet.getExternalIdentifier().add(Util.createExternalIdentifier(nextID(), XDSConstants.UUID_XDSSubmissionSet_sourceId, SUBMISSION_SET_ID, sourceID, "XDSSubmissionSet.sourceId")); registryObjectList.getIdentifiable().add(Util.rimFactory.createRegistryPackage(submissionSet)); submissionSet.getClassification().add(Util.createClassification(nextID(), XDSConstants.UUID_XDSSubmissionSet, SUBMISSION_SET_ID)); }
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; }
public static void checkFolderMetadata(RegistryPackageType rpType) throws XDSException { if (rpType.getId() == null || rpType.getId().trim().length() == 1) { throw new XDSException(XDSException.XDS_ERR_REGISTRY_METADATA_ERROR, "Folder: Missing entryUUID attribute!", null); } checkCodes(rpType, toList(XDSConstants.UUID_XDSFolder_codeList)); checkExternalIdentifiers(rpType, toList(XDSConstants.UUID_XDSFolder_patientId, XDSConstants.UUID_XDSFolder_uniqueId)); }
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; }
public static RegistryPackageType getRegistryPackage(SubmitObjectsRequest sor, String classificationUUID) { List<JAXBElement<? extends IdentifiableType>> list = sor.getRegistryObjectList().getIdentifiable(); String id = null; IdentifiableType identifiable; if ( classificationUUID != null ) { ClassificationType ct; for ( int i = 0, len = list.size() ; i < len ; i++) { identifiable = list.get(i).getValue(); if ( identifiable instanceof ClassificationType) { ct = (ClassificationType) identifiable; if ( classificationUUID.equals( ct.getClassificationNode())) { id = ct.getClassifiedObject(); break; } } } } RegistryPackageType rp; for ( int i = 0, len = list.size() ; i < len ; i++ ) { identifiable = list.get(i).getValue(); if ( identifiable instanceof RegistryPackageType) { rp = (RegistryPackageType) identifiable; if ( id == null || id.equals( rp.getId())) { return rp; } } } return null; }
public RegistryPackage toRegistryPackage(RegistryPackageType rpType) throws XDSException { RegistryPackage rp = null; List<ExternalIdentifierType> list = rpType.getExternalIdentifier(); if (list != null) { for (ExternalIdentifierType eiType : list) {
public static void checkSubmissionSetMetadata(RegistryPackageType rpType) throws XDSException { if (rpType.getId() == null || rpType.getId().trim().length() == 1) { throw new XDSException(XDSException.XDS_ERR_REGISTRY_METADATA_ERROR, "SubmissionSet: Missing entryUUID attribute!", null); } checkSlots(rpType, toList(XDSConstants.SLOT_NAME_SUBMISSION_TIME)); checkCodes(rpType, toList(XDSConstants.UUID_XDSSubmissionSet_contentTypeCode)); checkExternalIdentifiers(rpType, toList( XDSConstants.UUID_XDSSubmissionSet_patientId, XDSConstants.UUID_XDSSubmissionSet_uniqueId, XDSConstants.UUID_XDSSubmissionSet_sourceId )); }
private List<ExtrinsicObjectType> checkRequest(ProvideAndRegisterDocumentSetRequestType req) throws XDSException { SubmitObjectsRequest sor = req.getSubmitObjectsRequest(); RegistryPackageType submissionSet = InfosetUtil.getRegistryPackage(sor, XDSConstants.UUID_XDSSubmissionSet); if ( submissionSet == null ) { log.error("No RegistryPackage id=SubmissionSet found!"); throw new XDSException( XDSException.XDS_ERR_REPOSITORY_ERROR, XDSException.XDS_ERR_MISSING_REGISTRY_PACKAGE, null); } else if (submissionSet.getId() == null || submissionSet.getId().trim().length() == 0) { throw new XDSException(XDSException.XDS_ERR_REPOSITORY_METADATA_ERROR, "Missing XDSSubmissionSet.entryUUID!", null); } List<ExtrinsicObjectType> extrObjs = InfosetUtil.getExtrinsicObjects(req.getSubmitObjectsRequest()); checkPatientIDs(req, submissionSet, extrObjs); Map<String, Document> docs = InfosetUtil.getDocuments(req); if ( extrObjs.size() > docs.size() ) { log.warn("Missing Documents! Found more ExtrinsicObjects("+extrObjs.size()+") than Documents("+docs.size()+")!"); throw new XDSException(XDSException.XDS_ERR_MISSING_DOCUMENT, "", null); } else if ( extrObjs.size() < docs.size() ) { log.warn("Missing Document Metadata! Found less ExtrinsicObjects("+extrObjs.size()+") than Documents("+docs.size()+")!"); throw new XDSException(XDSException.XDS_ERR_MISSING_DOCUMENT_METADATA, "", null); } return extrObjs; }