Search in sources :

Example 16 with AAssociateRQ

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);
        }
    }
}
Also used : AAssociateRQ(org.dcm4che3.net.pdu.AAssociateRQ) StgCmtResult(org.dcm4chee.arc.entity.StgCmtResult) IOException(java.io.IOException) DicomServiceException(org.dcm4che3.net.service.DicomServiceException) ConfigurationNotFoundException(org.dcm4che3.conf.api.ConfigurationNotFoundException) IOException(java.io.IOException)

Example 17 with AAssociateRQ

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());
        }
    }
}
Also used : AAssociateRQ(org.dcm4che3.net.pdu.AAssociateRQ) Outcome(org.dcm4chee.arc.qmgt.Outcome) IOException(java.io.IOException)

Example 18 with AAssociateRQ

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;
}
Also used : AAssociateRQ(org.dcm4che3.net.pdu.AAssociateRQ) RoleSelection(org.dcm4che3.net.pdu.RoleSelection) PresentationContext(org.dcm4che3.net.pdu.PresentationContext)

Example 19 with AAssociateRQ

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;
}
Also used : AAssociateRQ(org.dcm4che3.net.pdu.AAssociateRQ) ApplicationEntity(org.dcm4che3.net.ApplicationEntity) RoleSelection(org.dcm4che3.net.pdu.RoleSelection) TransferCapability(org.dcm4che3.net.TransferCapability) PresentationContext(org.dcm4che3.net.pdu.PresentationContext)

Example 20 with AAssociateRQ

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;
}
Also used : AAssociateRQ(org.dcm4che3.net.pdu.AAssociateRQ)

Aggregations

AAssociateRQ (org.dcm4che3.net.pdu.AAssociateRQ)19 PresentationContext (org.dcm4che3.net.pdu.PresentationContext)10 IOException (java.io.IOException)5 RoleSelection (org.dcm4che3.net.pdu.RoleSelection)4 ExtendedNegotiation (org.dcm4che3.net.pdu.ExtendedNegotiation)3 AAssociateAC (org.dcm4che3.net.pdu.AAssociateAC)2 AAssociateRJ (org.dcm4che3.net.pdu.AAssociateRJ)2 CommonExtendedNegotiation (org.dcm4che3.net.pdu.CommonExtendedNegotiation)2 DicomServiceException (org.dcm4che3.net.service.DicomServiceException)2 Outcome (org.dcm4chee.arc.qmgt.Outcome)2 ConfigurationNotFoundException (org.dcm4che3.conf.api.ConfigurationNotFoundException)1 ApplicationEntity (org.dcm4che3.net.ApplicationEntity)1 TransferCapability (org.dcm4che3.net.TransferCapability)1 AAbort (org.dcm4che3.net.pdu.AAbort)1 UserIdentityAC (org.dcm4che3.net.pdu.UserIdentityAC)1 Location (org.dcm4chee.arc.entity.Location)1 StgCmtResult (org.dcm4chee.arc.entity.StgCmtResult)1 ProcedureContext (org.dcm4chee.arc.procedure.ProcedureContext)1 InstanceLocations (org.dcm4chee.arc.store.InstanceLocations)1