@Override protected Attributes create(Association as, Attributes rq, Attributes rqAttrs, Attributes rsp) throws DicomServiceException { String localAET = as.getLocalAET(); String sourceAET = as.getRemoteAET(); String iuid = rq.getString(Tag.AffectedSOPInstanceUID); ApplicationEntity ae = as.getApplicationEntity(); ArchiveAEExtension aeExt = ae.getAEExtension(ArchiveAEExtension.class); try { try { ApplicationEntity sourceAE = Archive.getInstance().findApplicationEntity(sourceAET); Supplements.supplementMPPS(rqAttrs, sourceAE.getDevice()); } catch (ConfigurationNotFoundException e) { } mppsService.createPerformedProcedureStep(iuid, rqAttrs, StoreParam.valueOf(ae)); } catch (DicomServiceException e) { throw e; } catch (Exception e) { throw new DicomServiceException(Status.ProcessingFailure, e); } for (String remoteAET : aeExt.getForwardMPPSDestinations()) if (matchIssuerOfPatientID(remoteAET, rqAttrs)) Archive.getInstance().scheduleMPPSCreate(localAET, remoteAET, iuid, rqAttrs); return null; }
@Override protected Attributes set(Association as, Attributes rq, Attributes rqAttrs, Attributes rsp) throws DicomServiceException { String localAET = as.getLocalAET(); String iuid = rq.getString(Tag.RequestedSOPInstanceUID); ApplicationEntity ae = as.getApplicationEntity(); ArchiveAEExtension aeExt = ae.getAEExtension(ArchiveAEExtension.class); PPSWithIAN ppsWithIAN; try { ppsWithIAN = mppsService.updatePerformedProcedureStep(iuid, rqAttrs, StoreParam.valueOf(ae)); } catch (DicomServiceException e) { throw e; } catch (Exception e) { throw new DicomServiceException(Status.ProcessingFailure, e); } for (String remoteAET : aeExt.getForwardMPPSDestinations()) if (matchIssuerOfPatientID(remoteAET, ppsWithIAN.pps.getPatient().getAttributes())) Archive.getInstance().scheduleMPPSSet(localAET, remoteAET, iuid, rqAttrs); List<Attributes> ians = ppsWithIAN.ians; Archive r = Archive.getInstance(); if (ians != null && !ians.isEmpty()) for (String remoteAET1 : ae.getAEExtension(ArchiveAEExtension.class).getIANDestinations()) for (Attributes ian : ians) r.scheduleIAN(ae.getAETitle(), remoteAET1, ian); return null; }
private boolean matchIssuerOfPatientID(String remoteAET, Attributes rqAttrs) { Issuer issuer = Issuer.issuerOfPatientID(rqAttrs); if (issuer == null) return true; try { ApplicationEntity remoteAE = Archive.getInstance().findApplicationEntity(remoteAET); return issuer.matches(remoteAE.getDevice().getIssuerOfPatientID()); } catch (ConfigurationException e) { return true; } }