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);
}
}
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);
}
}
}
Aggregations