use of org.dcm4che3.net.pdu.AAssociateRQ in project dcm4chee-arc-light by dcm4che.
the class StgCmtImpl method sendNActionRQ.
@Override
public DimseRSP sendNActionRQ(String localAET, String remoteAET, String studyInstanceUID, String seriesInstanceUID, String sopInstanceUID, String exporterID, Long taskPK, String batchID, Attributes actionInfo) throws Exception {
ApplicationEntity localAE = device.getApplicationEntity(localAET, true);
ApplicationEntity remoteAE = aeCache.findApplicationEntity(remoteAET);
AAssociateRQ aarq = mkAAssociateRQ(localAE, TransferCapability.Role.SCU);
if (!localAE.isMasqueradeCallingAETitle(remoteAET))
aarq.setCallingAET(localAET);
Association as = localAE.connect(remoteAE, aarq);
try {
StgCmtResult result = new StgCmtResult();
result.setStgCmtRequest(actionInfo);
result.setStudyInstanceUID(studyInstanceUID);
result.setSeriesInstanceUID(seriesInstanceUID);
result.setSopInstanceUID(sopInstanceUID);
result.setExporterID(exporterID);
result.setTaskPK(taskPK);
result.setBatchID(batchID);
result.setDeviceName(device.getDeviceName());
ejb.persistStgCmtResult(result);
DimseRSP dimseRSP = as.naction(UID.StorageCommitmentPushModel, UID.StorageCommitmentPushModelInstance, 1, actionInfo, null);
dimseRSP.next();
if (dimseRSP.getCommand().getInt(Tag.Status, -1) != Status.Success)
ejb.deleteStgCmt(actionInfo.getString(Tag.TransactionUID));
return dimseRSP;
} catch (Exception e) {
ejb.deleteStgCmt(actionInfo.getString(Tag.TransactionUID));
throw e;
} finally {
try {
as.release();
} catch (IOException e) {
LOG.info("{}: Failed to release association to {}", as, remoteAET);
}
}
}
use of org.dcm4che3.net.pdu.AAssociateRQ in project dcm4chee-arc-light by dcm4che.
the class StgCmtImpl method sendNEventReport.
@Override
public Outcome sendNEventReport(String localAET, ApplicationEntity remoteAE, Attributes eventInfo) throws Exception {
ApplicationEntity localAE = device.getApplicationEntity(localAET, true);
AAssociateRQ aarq = mkAAssociateRQ(localAE, TransferCapability.Role.SCP);
aarq.setCallingAET(localAET);
Association as = localAE.connect(remoteAE, aarq);
try {
int successful = sequenceSizeOf(eventInfo, Tag.ReferencedSOPSequence);
int failed = sequenceSizeOf(eventInfo, Tag.FailedSOPSequence);
DimseRSP neventReport = as.neventReport(UID.StorageCommitmentPushModel, UID.StorageCommitmentPushModelInstance, failed > 0 ? 2 : 1, eventInfo, null);
neventReport.next();
return new Outcome(failed > 0 ? Task.Status.WARNING : Task.Status.COMPLETED, "Return Storage Commitment Result[successful: " + successful + ", failed: " + failed + "] to AE: " + remoteAE.getAETitle());
} finally {
try {
as.release();
} catch (IOException e) {
LOG.info("{}: Failed to release association to {}", as, remoteAE.getAETitle());
}
}
}
use of org.dcm4che3.net.pdu.AAssociateRQ in project dcm4chee-arc-light by dcm4che.
the class StgCmtImpl method mkAAssociateRQ.
private AAssociateRQ mkAAssociateRQ(ApplicationEntity localAE, TransferCapability.Role role) {
AAssociateRQ aarq = new AAssociateRQ();
TransferCapability tc = localAE.getTransferCapabilityFor(UID.StorageCommitmentPushModel, role);
aarq.addPresentationContext(new PresentationContext(1, UID.StorageCommitmentPushModel, tc.getTransferSyntaxes()));
if (role == TransferCapability.Role.SCP)
aarq.addRoleSelection(new RoleSelection(UID.StorageCommitmentPushModel, false, true));
return aarq;
}
use of org.dcm4che3.net.pdu.AAssociateRQ in project dcm4che by dcm4che.
the class SendStgCmtResult method makeAAssociateRQ.
private AAssociateRQ makeAAssociateRQ() {
AAssociateRQ aarq = new AAssociateRQ();
aarq.setCallingAET(as.getLocalAET());
aarq.setCalledAET(as.getRemoteAET());
ApplicationEntity ae = as.getApplicationEntity();
TransferCapability tc = ae.getTransferCapabilityFor(UID.StorageCommitmentPushModel, TransferCapability.Role.SCP);
aarq.addPresentationContext(new PresentationContext(1, UID.StorageCommitmentPushModel, tc.getTransferSyntaxes()));
aarq.addRoleSelection(new RoleSelection(UID.StorageCommitmentPushModel, false, true));
return aarq;
}
use of org.dcm4che3.net.pdu.AAssociateRQ in project dcm4che by dcm4che.
the class PDUDecoderTest method aarq.
private AAssociateRQ aarq() {
AAssociateRQ aarq = new AAssociateRQ();
aarq.addPresentationContextFor(UID.Verification, UID.ImplicitVRLittleEndian);
return aarq;
}
Aggregations