private String getSourceID(ProvideAndRegisterDocumentSetRequestType req) { List<JAXBElement<? extends IdentifiableType>> objs = req.getSubmitObjectsRequest().getRegistryObjectList().getIdentifiable(); IdentifiableType obj; for (int i = 0, len = objs.size() ; i < len ; i++) { obj = objs.get(i).getValue(); if (obj instanceof RegistryPackageType) { return InfosetUtil.getExternalIdentifierValue(XDSConstants.UUID_XDSSubmissionSet_sourceId, (RegistryPackageType)obj); } } return null; }
private String getSourceID(ProvideAndRegisterDocumentSetRequestType req) throws XDSException { List<JAXBElement<? extends IdentifiableType>> objs = req.getSubmitObjectsRequest().getRegistryObjectList().getIdentifiable(); IdentifiableType obj; for (int i = 0, len = objs.size() ; i < len ; i++) { obj = objs.get(i).getValue(); if (obj instanceof RegistryPackageType) { return InfosetUtil.getExternalIdentifierValue(XDSConstants.UUID_XDSSubmissionSet_sourceId, (RegistryPackageType)obj); } } throw new XDSException(XDSException.XDS_ERR_REPOSITORY_METADATA_ERROR, "Missing XDSSubmissionSet.sourceId!", null); }
private void logRequest(ProvideAndRegisterDocumentSetRequestType req) { log.info("###### SubmitObjectRequest:"+req.getSubmitObjectsRequest()); List<Document> docs = req.getDocument(); log.info("###### Documents:"+docs); if (docs != null) { StringBuilder sb = new StringBuilder(); sb.append("######Number of Documents:").append(docs.size()); int dumpValLen; for (Document d : docs) { sb.append("\nDocument ID:"+d.getId()) .append(" size:").append(d.getValue().length) .append(" value:"); try { dumpValLen = Math.min(d.getValue().length, 40); sb.append(new String(d.getValue(), 0, dumpValLen)); if (dumpValLen == 40) sb.append("..."); } catch (Exception x) { log.warn("Failed to convert value in String!", x); } } log.info(sb.toString()); } }
private void logRequest(ProvideAndRegisterDocumentSetRequestType req) { log.info("###### SubmitObjectRequest:"+req.getSubmitObjectsRequest()); List<Document> docs = req.getDocument(); log.info("###### Documents:"+docs); if (docs != null) { StringBuilder sb = new StringBuilder(); sb.append("######Number of Documents:").append(docs.size()); int dumpValLen; for (Document d : docs) { sb.append("\nDocument ID:"+d.getId()) .append(" size:").append(d.getValue().length) .append(" value:"); try { dumpValLen = Math.min(d.getValue().length, 40); sb.append(new String(d.getValue(), 0, dumpValLen)); if (dumpValLen == 40) sb.append("..."); } catch (Exception x) { log.warn("Failed to convert value in String!", x); } } log.info(sb.toString()); } } private XdsRepository getConfig() {
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); } 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; }
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; }
private String checkPatientIDs(ProvideAndRegisterDocumentSetRequestType req, RegistryPackageType submissionSet, List<ExtrinsicObjectType> extrObjs) throws XDSException { String submissionPatId = InfosetUtil.getExternalIdentifierValue(XDSConstants.UUID_XDSSubmissionSet_patientId, submissionSet); String docPatId; ExtrinsicObjectType eo; for ( int i = 0, len = extrObjs.size() ; i < len ; i++ ) { eo = extrObjs.get(i); docPatId = InfosetUtil.getExternalIdentifierValue(XDSConstants.UUID_XDSDocumentEntry_patientId, eo); if ( docPatId != null && !docPatId.equals(submissionPatId)) { String msg = "XDSDocumentEntry.patientId ("+docPatId+")and XDSSubmissionSet.patientId ("+submissionPatId+") doesn't match! ExtrinsicObject.Id:"+eo.getId(); log.warn(msg); throw new XDSException(XDSException.XDS_ERR_PATID_DOESNOT_MATCH, msg, null); } } RegistryPackageType folder = InfosetUtil.getRegistryPackage(req.getSubmitObjectsRequest(), XDSConstants.UUID_XDSFolder); String folderPatId = InfosetUtil.getExternalIdentifierValue(XDSConstants.UUID_XDSFolder_patientId, folder); if ( folderPatId != null && !folderPatId.equals(submissionPatId)) { String msg = "XDSFolder.patientId ("+folderPatId+")and XDSSubmissionSet.patientId ("+submissionPatId+") doesn't match!"; log.warn(msg); throw new XDSException(XDSException.XDS_ERR_PATID_DOESNOT_MATCH, msg, null); } return submissionPatId; }
private String checkPatientIDs(ProvideAndRegisterDocumentSetRequestType req, RegistryPackageType submissionSet, List<ExtrinsicObjectType> extrObjs) throws XDSException { String submissionPatId = InfosetUtil.getExternalIdentifierValue(XDSConstants.UUID_XDSSubmissionSet_patientId, submissionSet); String docPatId; ExtrinsicObjectType eo; for ( int i = 0, len = extrObjs.size() ; i < len ; i++ ) { eo = extrObjs.get(i); docPatId = InfosetUtil.getExternalIdentifierValue(XDSConstants.UUID_XDSDocumentEntry_patientId, eo); if ( docPatId != null && !docPatId.equals(submissionPatId)) { String msg = "XDSDocumentEntry.patientId ("+docPatId+")and XDSSubmissionSet.patientId ("+submissionPatId+") doesn't match! ExtrinsicObject.Id:"+eo.getId(); log.warn(msg); throw new XDSException(XDSException.XDS_ERR_PATID_DOESNOT_MATCH, msg, null); } } RegistryPackageType folder = InfosetUtil.getRegistryPackage(req.getSubmitObjectsRequest(), XDSConstants.UUID_XDSFolder); String folderPatId = folder == null ? null : InfosetUtil.getExternalIdentifierValue(XDSConstants.UUID_XDSFolder_patientId, folder); if ( folderPatId != null && !folderPatId.equals(submissionPatId)) { String msg = "XDSFolder.patientId ("+folderPatId+")and XDSSubmissionSet.patientId ("+submissionPatId+") doesn't match!"; log.warn(msg); throw new XDSException(XDSException.XDS_ERR_PATID_DOESNOT_MATCH, msg, null); } return submissionPatId; }
List<ExtrinsicObjectType> extrObjs = checkRequest(req); storedUIDs = storeDocuments(req, extrObjs); SubmitObjectsRequest submitRequest = req.getSubmitObjectsRequest(); rsp = dispatchSubmitObjectsRequest(submitRequest, registryURL); } catch (Exception x) { String[] submUIDAndpatid = getSubmissionUIDandPatID(req.getSubmitObjectsRequest()); if (storedUIDs != null) { XDSAudit.logRepositoryPnRExport(submUIDAndpatid[0], submUIDAndpatid[1], info, registryURL, success);
XDSDocument[] storedDocs = null; URL registryURL = null; String[] submUIDAndpatid = getSubmissionUIDandPatID(req.getSubmitObjectsRequest()); try { if (submUIDAndpatid[1] == null) List<ExtrinsicObjectType> extrObjs = checkRequest(req); storedDocs = storeDocuments(req, extrObjs, groupID); SubmitObjectsRequest submitRequest = req.getSubmitObjectsRequest(); rsp = dispatchSubmitObjectsRequest(submitRequest, registryURL); } catch (Exception x) {