@Override public RegistryResponseType documentRepositoryProvideAndRegisterDocumentSetB( ProvideAndRegisterDocumentSetRequestType req) { log.info("################ documentRepositoryProvideAndRegisterDocumentSetB called!"); RegistryResponseType rsp; XDSDocument[] storedDocs = null; URL registryURL = null; String[] submUIDAndpatid = getSubmissionUIDandPatID(req.getSubmitObjectsRequest()); try { if (submUIDAndpatid[1] == null) throw new XDSException( XDSException.XDS_ERR_REPOSITORY_METADATA_ERROR, "Missing patientID!", null); String srcID = getSourceID(req); registryURL = getRegistryWsdlUrl(srcID); String groupID = getFsGroupID(submUIDAndpatid[1]); logRequest(req); List<ExtrinsicObjectType> extrObjs = checkRequest(req); storedDocs = storeDocuments(req, extrObjs, groupID); SubmitObjectsRequest submitRequest = req.getSubmitObjectsRequest(); rsp = dispatchSubmitObjectsRequest(submitRequest, registryURL); } catch (Exception x) { rsp = factory.createRegistryResponseType(); if (x instanceof XDSException) { XDSUtil.addError(rsp, (XDSException) x); } else { XDSUtil.addError( rsp, new XDSException( XDSException.XDS_ERR_REPOSITORY_ERROR, "Unexpected error in XDS service !: " + x.getMessage(), x)); } } boolean success = XDSConstants.XDS_B_STATUS_SUCCESS.equals(rsp.getStatus()); AuditRequestInfo info = new AuditRequestInfo(LogHandler.getInboundSOAPHeader(), wsContext); if (storedDocs != null) { XDSAudit.logRepositoryPnRExport( submUIDAndpatid[0], submUIDAndpatid[1], info, registryURL, success); } commit(storedDocs, success); if (!success) ejbContext.setRollbackOnly(); XDSAudit.logRepositoryImport( submUIDAndpatid[0], submUIDAndpatid[1], info, XDSConstants.XDS_B_STATUS_SUCCESS.equals(rsp.getStatus())); log.info("################ documentRepositoryProvideAndRegisterDocumentSetB finished!"); return rsp; }
private void doRegisterDocumentAndCheckError( SubmitObjectsRequest req, String errorCode, String prefix) { RegistryResponseType rsp = null; try { rsp = session.documentRegistryRegisterDocumentSetB(req); } catch (Exception x) { fail(prefix + ": Register document failed unexpected! Error:" + x); } if (!XDSConstants.XDS_B_STATUS_FAILURE.equals(rsp.getStatus())) { fail(prefix + ": Register document should fail with error code:" + errorCode); } String error = rsp.getRegistryErrorList().getRegistryError().get(0).getErrorCode(); assertEquals(prefix + ": Error code:", errorCode, error); }