Search in sources :

Example 21 with UPSContext

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();
}
Also used : UPSContext(org.dcm4chee.arc.ups.UPSContext) DicomServiceException(org.dcm4che3.net.service.DicomServiceException)

Example 22 with UPSContext

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();
}
Also used : UPSContext(org.dcm4chee.arc.ups.UPSContext) DicomServiceException(org.dcm4che3.net.service.DicomServiceException)

Example 23 with UPSContext

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();
}
Also used : UPSContext(org.dcm4chee.arc.ups.UPSContext) DicomServiceException(org.dcm4che3.net.service.DicomServiceException) NoCache(org.jboss.resteasy.annotations.cache.NoCache)

Example 24 with UPSContext

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;
}
Also used : UPSContext(org.dcm4chee.arc.ups.UPSContext)

Example 25 with UPSContext

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;
}
Also used : UPSContext(org.dcm4chee.arc.ups.UPSContext)

Aggregations

UPSContext (org.dcm4chee.arc.ups.UPSContext)25 DicomServiceException (org.dcm4che3.net.service.DicomServiceException)16 UPS (org.dcm4chee.arc.entity.UPS)3 QueryAttributes (org.dcm4chee.arc.query.util.QueryAttributes)3 Date (java.util.Date)2 IOException (java.io.IOException)1 Socket (java.net.Socket)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Collectors (java.util.stream.Collectors)1 EJBException (javax.ejb.EJBException)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Event (javax.enterprise.event.Event)1 Observes (javax.enterprise.event.Observes)1 Inject (javax.inject.Inject)1 Session (javax.websocket.Session)1