@Override public void onDimseRQ(Association as, PresentationContext pc, Dimse dimse, Attributes cmd, PDVInputStream data) throws IOException { try { lookupService(as, dimse, cmd).onDimseRQ(as, pc, dimse, cmd, data); } catch (DicomServiceException e) { Association.LOG.info("{}: processing {} failed. Caused by:\t", as, dimse.toString(cmd, pc.getPCID(), pc.getTransferSyntax()), e); Attributes rsp = e.mkRSP(dimse.commandFieldOfRSP(), cmd.getInt(Tag.MessageID, 0)); as.tryWriteDimseRSP(pc, rsp, e.getDataset()); } }
@Override public void onDimseRQ(Association as, PresentationContext pc, Dimse dimse, Attributes cmd, PDVInputStream data) throws IOException { try { lookupService(as, dimse, cmd).onDimseRQ(as, pc, dimse, cmd, data); } catch (DicomServiceException e) { Association.LOG.info("{}: processing {} failed. Caused by:\t", as, dimse.toString(cmd, pc.getPCID(), pc.getTransferSyntax()), e); Attributes rsp = e.mkRSP(dimse.commandFieldOfRSP(), cmd.getInt(Tag.MessageID, 0)); as.tryWriteDimseRSP(pc, rsp, e.getDataset()); } }
@Override public void done(boolean doneSync) { Attributes cmd; Attributes data; if (exchange.getException() != null) { DicomServiceException dse; Exception ex = exchange.getException(); if (ex instanceof DicomServiceException) { dse = (DicomServiceException) ex; } else { dse = new DicomServiceException(Status.ProcessingFailure, ex); } cmd = dse.mkRSP(dimse.commandFieldOfRSP(), msgId); data = dse.getDataset(); } else { DicomMessage out = exchange.getOut(DicomMessage.class); cmd = out.getCommand(); data = out.getBody(Attributes.class); } as.tryWriteDimseRSP(pc, cmd, data); }
@Override public void run() { try { int msgId = rq.getInt(Tag.MessageID, -1); as.addCancelRQHandler(msgId, this); try { while (!canceled && hasMoreMatches()) { Attributes match = adjust(nextMatch()); if (match != null) { int status = optionalKeysNotSupported ? Status.PendingWarning : Status.Pending; as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status), match); } } int status = canceled ? Status.Cancel : Status.Success; as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status)); } catch (DicomServiceException e) { Attributes rsp = e.mkRSP(0x8020, msgId); as.writeDimseRSP(pc, rsp, e.getDataset()); } finally { as.removeCancelRQHandler(msgId); close(); } } catch (IOException e) { // handled by Association } }
@Override public void run() { try { int msgId = rq.getInt(Tag.MessageID, -1); as.addCancelRQHandler(msgId, this); try { while (!canceled && hasMoreMatches()) { Attributes match = adjust(nextMatch()); if (match != null) { int status = optionalKeysNotSupported ? Status.PendingWarning : Status.Pending; as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status), match); } } int status = canceled ? Status.Cancel : Status.Success; as.writeDimseRSP(pc, Commands.mkCFindRSP(rq, status)); } catch (DicomServiceException e) { Attributes rsp = e.mkRSP(0x8020, msgId); as.writeDimseRSP(pc, rsp, e.getDataset()); } finally { as.removeCancelRQHandler(msgId); close(); } } catch (IOException e) { // handled by Association } }