use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.
the class UpsRS method unsubscribe.
@DELETE
@Path("/workitems/{workitem}/subscribers/{SubscriberAET}")
public Response unsubscribe(@PathParam("workitem") String iuid, @PathParam("SubscriberAET") String subscriber) {
UPSContext ctx = service.newUPSContext(HttpServletRequestInfo.valueOf(request), getArchiveAE());
ctx.setUPSInstanceUID(iuid);
ctx.setSubscriberAET(subscriber);
try {
service.deleteSubscription(ctx);
} catch (DicomServiceException e) {
return errResponse(UpsRS::internalServerError, e);
}
return Response.ok().build();
}
use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.
the class UpsRS method requestUPSCancel.
private Response requestUPSCancel(String iuid, String requester, Attributes attrs) {
UPSContext ctx = service.newUPSContext(HttpServletRequestInfo.valueOf(request), getArchiveAE());
ctx.setUPSInstanceUID(iuid);
ctx.setRequesterAET(requester);
ctx.setAttributes(attrs);
try {
service.requestUPSCancel(ctx);
} catch (DicomServiceException e) {
return errResponse(UpsRS::requestCancelFailed, e);
}
Response.ResponseBuilder accepted = Response.accepted();
switch(ctx.getStatus()) {
case Status.UPSAlreadyInRequestedStateOfCanceled:
accepted.header("Warning", toWarning("The UPS is already in the requested state of CANCELED."));
break;
}
return accepted.build();
}
use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.
the class UpsRS method retrieveUPS.
@GET
@NoCache
@Path("/workitems/{workitem}")
public Response retrieveUPS(@PathParam("workitem") String iuid) {
ResponseMediaType responseMediaType = getResponseMediaType();
UPSContext ctx = service.newUPSContext(HttpServletRequestInfo.valueOf(request), getArchiveAE());
ctx.setUPSInstanceUID(iuid);
try {
service.findUPS(ctx);
} catch (DicomServiceException e) {
return errResponse(UpsRS::retrieveFailed, e);
}
return Response.ok(responseMediaType.entity(ctx), responseMediaType.type).build();
}
use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.
the class UPSPushSCP method set.
private Attributes set(Association as, Attributes rq, Attributes rqAttrs, Attributes rsp) throws DicomServiceException {
UPSContext ctx = service.newUPSContext(as);
ctx.setUPSInstanceUID(rq.getString(Tag.RequestedSOPInstanceUID));
ctx.setAttributes(rqAttrs);
service.updateUPS(ctx);
return null;
}
use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.
the class UPSPushSCP method action.
private Attributes action(Association as, Attributes rq, Attributes rqAttrs, Attributes rsp, int validActionTypeIDs) throws DicomServiceException {
int actionTypeID = validateActionTypeID(rq.getInt(Tag.ActionTypeID, 0), validActionTypeIDs);
UPSContext ctx = service.newUPSContext(as);
ctx.setUPSInstanceUID(rq.getString(Tag.RequestedSOPInstanceUID));
switch(actionTypeID) {
case 1:
ctx.setAttributes(rqAttrs);
service.changeUPSState(ctx);
break;
case 2:
ctx.setAttributes(rqAttrs);
service.requestUPSCancel(ctx);
break;
case 3:
ctx.setSubscriberAET(requireNonNull(rqAttrs, Tag.ReceivingAE));
ctx.setDeletionLock(validateDeletionLock(rqAttrs));
if (ctx.getUPSInstanceUID().equals(UID.UPSFilteredGlobalSubscriptionInstance)) {
rqAttrs.removeSelected(Tag.DeletionLock, Tag.ReceivingAE);
ctx.setAttributes(rqAttrs);
}
service.createSubscription(ctx);
break;
case 4:
ctx.setSubscriberAET(requireNonNull(rqAttrs, Tag.ReceivingAE));
service.deleteSubscription(ctx);
break;
case 5:
ctx.setSubscriberAET(requireNonNull(rqAttrs, Tag.ReceivingAE));
service.suspendSubscription(ctx);
break;
}
return null;
}
Aggregations