@Override
public void onDimseRQ(Association as, PresentationContext pc, Dimse dimse,
Attributes rq, Attributes actionInfo) throws IOException {
if (dimse != Dimse.N_ACTION_RQ)
throw new DicomServiceException(Status.UnrecognizedOperation);
int actionTypeID = rq.getInt(Tag.ActionTypeID, 0);
if (actionTypeID != 1)
throw new DicomServiceException(Status.NoSuchActionType)
.setActionTypeID(actionTypeID);
Attributes rsp = Commands.mkNActionRSP(rq, Status.Success);
String callingAET = as.getCallingAET();
String calledAET = as.getCalledAET();
Connection remoteConnection = getRemoteConnection(callingAET);
if (remoteConnection == null)
throw new DicomServiceException(Status.ProcessingFailure,
"Unknown Calling AET: " + callingAET);
Attributes eventInfo =
calculateStorageCommitmentResult(calledAET, actionInfo);
try {
as.writeDimseRSP(pc, rsp, null);