use of org.dcm4che3.net.ApplicationEntity in project dcm4chee-arc-light by dcm4che.
the class RejectionServiceImpl method onExport.
public void onExport(@Observes ExportContext ctx) {
ExporterDescriptor desc = ctx.getExporter().getExporterDescriptor();
if (ctx.getException() != null || !desc.isRejectForDataRetentionExpiry() || ctx.getOutcome().getStatus() != Task.Status.COMPLETED)
return;
ApplicationEntity ae = getApplicationEntity(desc.getAETitle());
if (ae == null || !ae.isInstalled()) {
LOG.warn("No such Application Entity: {}", desc.getAETitle());
return;
}
ArchiveDeviceExtension arcDev = device.getDeviceExtension(ArchiveDeviceExtension.class);
RejectionNote rn = arcDev.getRejectionNote(RejectionNote.Type.DATA_RETENTION_POLICY_EXPIRED);
if (rn == null) {
LOG.warn("Data Retention Policy Expired Rejection Note not configured.");
return;
}
LOG.info("Export completed, invoke rejection of objects.");
try {
if (ejb.claimExpired(ctx.getStudyInstanceUID(), ctx.getSeriesInstanceUID(), ExpirationState.REJECTED))
reject(ae, ctx.getAETitle(), ctx.getStudyInstanceUID(), ctx.getSeriesInstanceUID(), ctx.getSopInstanceUID(), rn, ctx.getHttpServletRequestInfo());
} catch (Exception e) {
LOG.warn("Rejection of Expired Study[UID={}], Series[UID={}], SOPInstance[UID={}] failed.\n", ctx.getStudyInstanceUID(), ctx.getSeriesInstanceUID(), ctx.getSopInstanceUID(), e);
ejb.claimExpired(ctx.getStudyInstanceUID(), ctx.getSeriesInstanceUID(), ExpirationState.FAILED_TO_REJECT);
}
}
use of org.dcm4che3.net.ApplicationEntity in project dcm4chee-arc-light by dcm4che.
the class RejectionServiceImpl method reject.
@Override
public int reject(ApplicationEntity ae, String aet, String studyIUID, String seriesIUID, String sopIUID, RejectionNote rjNote, HttpServletRequestInfo httpRequest) throws Exception {
String changeRequesterAET = ae.getAEExtension(ArchiveAEExtension.class).changeRequesterAET();
StoreSession storeSession = storeService.newStoreSession(httpRequest, ae, aet, changeRequesterAET != null ? changeRequesterAET : ae.getAETitle());
String rejectionNoteObjectStorageID = rejectionNoteObjectStorageID(storeSession);
storeSession.withObjectStorageID(rejectionNoteObjectStorageID);
storeService.restoreInstances(storeSession, studyIUID, seriesIUID, null);
Attributes attrs = queryService.createRejectionNote(ae, studyIUID, seriesIUID, sopIUID, rjNote);
if (attrs == null)
return 0;
int count = countInstances(attrs);
LOG.info("Start rejection of {} instances of Study[UID={}], Series[UID={}], SOPInstance[UID={}].", count, studyIUID, seriesIUID, sopIUID);
StoreContext storeCtx = storeService.newStoreContext(storeSession);
storeCtx.setReceiveTransferSyntax(UID.ExplicitVRLittleEndian);
storeService.store(storeCtx, attrs);
LOG.info("Rejection of {} instances of Study[UID={}], Series[UID={}], SOPInstance[UID={}] completed.", count, studyIUID, seriesIUID, sopIUID);
return count;
}
use of org.dcm4che3.net.ApplicationEntity in project dcm4chee-arc-light by dcm4che.
the class RejectionServiceImpl method rejectionNoteObjectStorageID.
private String rejectionNoteObjectStorageID(StoreSession storeSession) {
String rejectionNoteStorageAET = device.getDeviceExtension(ArchiveDeviceExtension.class).getRejectionNoteStorageAET();
if (rejectionNoteStorageAET == null)
return null;
ApplicationEntity rjAE = getApplicationEntity(rejectionNoteStorageAET);
ArchiveAEExtension rjArcAE;
if (rjAE == null || !rjAE.isInstalled() || (rjArcAE = rjAE.getAEExtension(ArchiveAEExtension.class)) == null) {
LOG.warn("Rejection Note Storage Application Entity with an Archive AE Extension not configured: {}", rejectionNoteStorageAET);
return null;
}
String[] objectStorageIDs;
if ((objectStorageIDs = rjArcAE.getObjectStorageIDs()).length > 0)
return objectStorageIDs[0];
LOG.warn("Object storage for rejection notes shall fall back on those configured for AE: {} since none are " + "configured for RejectionNoteStorageAE: {}", storeSession.getLocalApplicationEntity().getAETitle(), rejectionNoteStorageAET);
return null;
}
use of org.dcm4che3.net.ApplicationEntity in project dcm4chee-arc-light by dcm4che.
the class UPSEventSCP method mkAAssociateRQ.
private static AAssociateRQ mkAAssociateRQ(ApplicationEntity localAE, String subscriberAET) {
AAssociateRQ aarq = new AAssociateRQ();
aarq.setCalledAET(subscriberAET);
TransferCapability tc = localAE.getTransferCapabilityFor(UID.UnifiedProcedureStepEvent, TransferCapability.Role.SCP);
aarq.addPresentationContext(new PresentationContext(1, UID.UnifiedProcedureStepEvent, tc != null ? tc.getTransferSyntaxes() : new String[] { UID.ImplicitVRLittleEndian }));
aarq.addRoleSelection(new RoleSelection(UID.UnifiedProcedureStepEvent, false, true));
return aarq;
}
use of org.dcm4che3.net.ApplicationEntity in project dcm4chee-arc-light by dcm4che.
the class CStoreForward method createTask.
private CStoreForwardTask createTask(final Association as) {
ApplicationEntity localAE = retrieveCtx.getLocalApplicationEntity();
Association storeas = openAssociation(as, localAE);
final CStoreForwardTask task = new CStoreForwardTask(retrieveCtx, storeas);
forwardTasks.put(as, task);
as.addAssociationListener(new AssociationListener() {
@Override
public void onClose(Association association) {
task.onStore(null);
forwardTasks.remove(as);
}
});
if (storeas != null) {
retrieveCtx.incrementPendingCStoreForward();
localAE.getDevice().execute(task);
}
return task;
}
Aggregations