@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; }
@Override protected List<ModificationItem> storeDiffs( ApplicationEntity a, ApplicationEntity b, String deviceDN, List<ModificationItem> mods) { super.storeDiffs(a, b, deviceDN, mods); storeDiff( mods, "dcmAcceptedCallingAETitle", a.getAcceptedCallingAETitles(), b.getAcceptedCallingAETitles()); return mods; }
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; } }
private Device createDevice( String name, Issuer issuer, Code institutionCode, String aet, String host, int port, int tlsPort) throws Exception { Device device = init(new Device(name), issuer, institutionCode); ApplicationEntity ae = new ApplicationEntity(aet); ae.setAssociationAcceptor(true); device.addApplicationEntity(ae); Connection dicom = new Connection("dicom", host, port); device.addConnection(dicom); ae.addConnection(dicom); Connection dicomTLS = new Connection("dicom-tls", host, tlsPort); dicomTLS.setTlsCipherSuites( Connection.TLS_RSA_WITH_AES_128_CBC_SHA, Connection.TLS_RSA_WITH_3DES_EDE_CBC_SHA); device.addConnection(dicomTLS); ae.addConnection(dicomTLS); return device; }
@Override protected void loadFrom(ApplicationEntity ae, Attributes attrs) throws NamingException { super.loadFrom(ae, attrs); if (!hasObjectClass(attrs, "dcmNetworkAE")) return; ae.setAcceptedCallingAETitles(stringArray(attrs.get("dcmAcceptedCallingAETitle"))); }
@Override protected Attributes storeTo(ApplicationEntity ae, String deviceDN, Attributes attrs) { super.storeTo(ae, deviceDN, attrs); storeNotEmpty(attrs, "dcmAcceptedCallingAETitle", ae.getAcceptedCallingAETitles()); return attrs; }