Search in sources :

Example 1 with UPSProcessorException

use of org.dcm4chee.arc.ups.process.UPSProcessorException in project dcm4chee-arc-light by dcm4che.

the class UPSStoreSCU method processA.

@Override
protected void processA(UPSContext upsCtx, Attributes ups) throws Exception {
    String destinationAE = destinationAEOf(ups);
    RetrieveContext retrieveContext = calculateMatches(ups, destinationAE);
    if (retrieveContext == null) {
        throw new UPSProcessorException(NOOP_UPS, "No matching Instances found");
    }
    if (retrieveService.restrictRetrieveAccordingTransferCapabilities(retrieveContext)) {
        storeSCU.newRetrieveTaskSTORE(retrieveContext).run();
        String outcomeDescription = retrieveContext.getOutcomeDescription();
        Attributes performedProcedure = getPerformedProcedureStep(upsCtx);
        performedProcedure.setString(Tag.PerformedProcedureStepDescription, VR.LO, outcomeDescription);
        Sequence outputInformationSeq = performedProcedure.getSequence(Tag.OutputInformationSequence);
        for (InstanceLocations match : retrieveContext.getMatches()) {
            if (!retrieveContext.isFailedSOPInstanceUID(match.getSopInstanceUID())) {
                refSOPSequence(outputInformationSeq, match, destinationAE).add(toSOPRef(match));
            }
        }
        if (retrieveContext.status() != Status.Success)
            throw new DicomServiceException(retrieveContext.status(), outcomeDescription);
    }
}
Also used : InstanceLocations(org.dcm4chee.arc.store.InstanceLocations) RetrieveContext(org.dcm4chee.arc.retrieve.RetrieveContext) UPSProcessorException(org.dcm4chee.arc.ups.process.UPSProcessorException) DicomServiceException(org.dcm4che3.net.service.DicomServiceException)

Example 2 with UPSProcessorException

use of org.dcm4chee.arc.ups.process.UPSProcessorException in project dcm4chee-arc-light by dcm4che.

the class UPSMoveSCU method processA.

@Override
protected void processA(UPSContext upsCtx, Attributes ups) throws Exception {
    String moveDest = moveDestOf(ups);
    String retrieveAET = retrieveAETOf(ups);
    List<Attributes> keyss = new KeysBuilder(ups).keys();
    Association as = moveSCU.openAssociation(upsCtx.getApplicationEntity(), retrieveAET);
    try {
        Sum sum = new Sum();
        for (Attributes keys : keyss) {
            DimseRSP rsp = moveSCU.cmove(as, 0, moveDest, keys);
            while (rsp.next()) ;
            sum.add(rsp);
        }
        getPerformedProcedureStep(upsCtx).setString(Tag.PerformedProcedureStepDescription, VR.LO, toDescription(retrieveAET, moveDest, sum));
        if (sum.getStatus() != Status.Success) {
            throw new DicomServiceException(sum.getStatus(), sum.getErrorComment());
        }
        if (sum.getNumberOfCompletedSuboperations() == 0 && sum.getNumberOfWarningSuboperations() == 0) {
            throw new UPSProcessorException(NOOP_UPS, "No DICOM instances transferred from " + retrieveAET + " to " + moveDest);
        }
    } finally {
        try {
            as.release();
        } catch (IOException e) {
            LOG.info("{}: Failed to release association:\\n", as, e);
        }
    }
}
Also used : Association(org.dcm4che3.net.Association) DimseRSP(org.dcm4che3.net.DimseRSP) IOException(java.io.IOException) UPSProcessorException(org.dcm4chee.arc.ups.process.UPSProcessorException) DicomServiceException(org.dcm4che3.net.service.DicomServiceException)

Aggregations

DicomServiceException (org.dcm4che3.net.service.DicomServiceException)2 UPSProcessorException (org.dcm4chee.arc.ups.process.UPSProcessorException)2 IOException (java.io.IOException)1 Association (org.dcm4che3.net.Association)1 DimseRSP (org.dcm4che3.net.DimseRSP)1 RetrieveContext (org.dcm4chee.arc.retrieve.RetrieveContext)1 InstanceLocations (org.dcm4chee.arc.store.InstanceLocations)1