use of org.dcm4che3.net.DimseRSP in project dcm4chee-arc-light by dcm4che.
the class UPSStgCmtSCU method processA.
@Override
protected void processA(UPSContext upsCtx, Attributes ups) throws Exception {
String destinationAE = destinationAEOf(ups);
for (Map.Entry<String, StgCmtInfo> entry : seriesStgCmtInfoFrom(ups).entrySet()) {
String seriesIUID = entry.getKey();
StgCmtInfo stgCmtInfo = entry.getValue();
DimseRSP dimseRSP = stgCmtSCU.sendNActionRQ(rule.getAETitle(), destinationAE, stgCmtInfo.getStudyIUID(), seriesIUID, null, null, null, ups.getString(Tag.ProcedureStepLabel), stgCmtInfo.getActionInfo());
Attributes cmd = dimseRSP.getCommand();
int status = cmd.getInt(Tag.Status, -1);
getPerformedProcedureStep(upsCtx).setString(Tag.PerformedProcedureStepDescription, VR.LO, outcomeDesc(status, cmd.getString(Tag.ErrorComment), destinationAE));
}
}
use of org.dcm4che3.net.DimseRSP 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);
}
}
}
use of org.dcm4che3.net.DimseRSP in project dcm4chee-arc-light by dcm4che.
the class RetrieveRS method export.
private Response export(String destAET, Attributes keys) throws Exception {
ApplicationEntity localAE = device.getApplicationEntity(aet, true);
if (localAE == null || !localAE.isInstalled())
throw new ConfigurationException("No such Application Entity: " + aet);
Association as = moveSCU.openAssociation(localAE, externalAET);
try {
final DimseRSP rsp = moveSCU.cmove(as, priority(), destAET, keys);
while (rsp.next()) ;
Attributes cmd = rsp.getCommand();
instancesRetrievedEvent.fire(createExtRetrieveCtx(destAET, keys).setRemoteHostName(ReverseDNS.hostNameOf(as.getSocket().getInetAddress())).setResponse(cmd));
return status(cmd).entity(entity(cmd)).build();
} finally {
try {
as.release();
} catch (IOException e) {
LOG.info("{}: Failed to release association:\\n", as, e);
}
}
}
use of org.dcm4che3.net.DimseRSP in project dcm4chee-arc-light by dcm4che.
the class MPPSSCUImpl method forwardMPPS.
@Override
public Outcome forwardMPPS(String localAET, String remoteAET, Dimse dimse, String sopInstanceUID, Attributes attrs, Attributes procAttrs) throws Exception {
ApplicationEntity localAE = device.getApplicationEntity(localAET, true);
ApplicationEntity remoteAE = aeCache.findApplicationEntity(remoteAET);
AAssociateRQ aarq = mkAAssociateRQ(localAE);
Association as = localAE.connect(remoteAE, aarq);
ProcedureContext pCtx = createProcedureCtx(sopInstanceUID, attrs.getString(Tag.PerformedProcedureStepStatus), as, dimse, procAttrs);
try {
DimseRSP rsp = dimse == Dimse.N_CREATE_RQ ? as.ncreate(UID.ModalityPerformedProcedureStep, sopInstanceUID, attrs, null) : as.nset(UID.ModalityPerformedProcedureStep, sopInstanceUID, attrs, null);
rsp.next();
return outcome(rsp.getCommand().getInt(Tag.Status, -1), dimse, sopInstanceUID, remoteAET, pCtx);
} finally {
try {
as.release();
} catch (IOException e) {
LOG.info("{}: Failed to release association to {}", as, remoteAET);
} finally {
procedureEvent.fire(pCtx);
}
}
}
use of org.dcm4che3.net.DimseRSP in project dcm4chee-arc-light by dcm4che.
the class StgCmtImpl method sendNAction.
@Override
public Outcome sendNAction(String localAET, String remoteAET, String studyInstanceUID, String seriesInstanceUID, String sopInstanceUID, String exporterID, Long taskPK, String batchID, Attributes actionInfo) throws Exception {
DimseRSP dimseRSP = sendNActionRQ(localAET, remoteAET, studyInstanceUID, seriesInstanceUID, sopInstanceUID, exporterID, taskPK, batchID, actionInfo);
Attributes cmd = dimseRSP.getCommand();
int status = cmd.getInt(Tag.Status, -1);
if (status != Status.Success) {
return new Outcome(Task.Status.WARNING, "Request Storage Commitment from AE: " + remoteAET + " failed with status: " + TagUtils.shortToHexString(status) + "H, error comment: " + cmd.getString(Tag.ErrorComment));
}
return new Outcome(Task.Status.COMPLETED, "Request Storage Commitment from AE: " + remoteAET);
}
Aggregations