@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); }
public static Attributes mkRSP(Attributes rq, int status, Dimse rqCmd) { Attributes rsp = new Attributes(); rsp.setInt(Tag.CommandField, VR.US, rqCmd.commandFieldOfRSP()); rsp.setInt(Tag.Status, VR.US, status); rsp.setInt(Tag.MessageIDBeingRespondedTo, VR.US, rq.getInt(Tag.MessageID, 0)); rsp.setString(Tag.AffectedSOPClassUID, VR.UI, rq.getString(rqCmd.tagOfSOPClassUID())); int tagOfIUID = rqCmd.tagOfSOPInstanceUID(); if (tagOfIUID != 0) rsp.setString(Tag.AffectedSOPInstanceUID, VR.UI, rq.getString(tagOfIUID)); return rsp; }
public static Attributes mkRSP(Attributes rq, int status, Dimse rqCmd) { Attributes rsp = new Attributes(); rsp.setInt(Tag.CommandField, VR.US, rqCmd.commandFieldOfRSP()); rsp.setInt(Tag.Status, VR.US, status); rsp.setInt(Tag.MessageIDBeingRespondedTo, VR.US, rq.getInt(Tag.MessageID, 0)); rsp.setString(Tag.AffectedSOPClassUID, VR.UI, rq.getString(rqCmd.tagOfSOPClassUID())); int tagOfIUID = rqCmd.tagOfSOPInstanceUID(); if (tagOfIUID != 0) rsp.setString(Tag.AffectedSOPInstanceUID, VR.UI, rq.getString(tagOfIUID)); return rsp; }