Search in sources :

Example 1 with UPSContext

use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.

the class UPSServiceEJB method createOnStore.

private UPSContext createOnStore(String iuid, StoreContext storeCtx, Calendar now, UPSOnStore rule) {
    UPSContext ctx = new UPSContextImpl(storeCtx, rule);
    ctx.setUPSInstanceUID(iuid);
    ctx.setAttributes(createOnStore(storeCtx, now, rule));
    createUPS(ctx);
    return ctx;
}
Also used : UPSContext(org.dcm4chee.arc.ups.UPSContext)

Example 2 with UPSContext

use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.

the class UpsRS method changeUPSState.

private Response changeUPSState(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.changeUPSState(ctx);
    } catch (DicomServiceException e) {
        return errResponse(UpsRS::changeStateFailed, e);
    }
    Response.ResponseBuilder ok = Response.ok();
    switch(ctx.getStatus()) {
        case Status.UPSAlreadyInRequestedStateOfCanceled:
            ok.header("Warning", toWarning("The UPS is already in the requested state of CANCELED."));
            break;
        case Status.UPSAlreadyInRequestedStateOfCompleted:
            ok.header("Warning", toWarning("The UPS is already in the requested state of COMPLETED."));
            break;
    }
    return ok.build();
}
Also used : UPSContext(org.dcm4chee.arc.ups.UPSContext) DicomServiceException(org.dcm4che3.net.service.DicomServiceException)

Example 3 with UPSContext

use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.

the class UpsRS method subscribe.

@POST
@Path("/workitems/{workitem}/subscribers/{SubscriberAET}")
public Response subscribe(@PathParam("workitem") String iuid, @PathParam("SubscriberAET") String subscriber) {
    UPSContext ctx = service.newUPSContext(HttpServletRequestInfo.valueOf(request), getArchiveAE());
    ctx.setUPSInstanceUID(iuid);
    ctx.setSubscriberAET(subscriber);
    ctx.setDeletionLock(Boolean.parseBoolean(deletionlock));
    ctx.setAttributes(matchKeys);
    try {
        service.createSubscription(ctx);
    } catch (DicomServiceException e) {
        return errResponse(UpsRS::subscriptionFailed, e);
    }
    return Response.created(websocketOf(ctx)).build();
}
Also used : UPSContext(org.dcm4chee.arc.ups.UPSContext) DicomServiceException(org.dcm4che3.net.service.DicomServiceException)

Example 4 with UPSContext

use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.

the class UPSPushSCP method get.

private Attributes get(Association as, Attributes rq, Attributes rqAttrs, Attributes rsp) throws DicomServiceException {
    UPSContext ctx = service.newUPSContext(as);
    ctx.setUPSInstanceUID(rq.getString(Tag.RequestedSOPInstanceUID));
    service.findUPS(ctx);
    return filter(ctx.getAttributes(), rq.getInts(Tag.AttributeIdentifierList));
}
Also used : UPSContext(org.dcm4chee.arc.ups.UPSContext)

Example 5 with UPSContext

use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.

the class UPSPushSCP method create.

private Attributes create(Association as, Attributes rq, Attributes rqAttrs, Attributes rsp) throws DicomServiceException {
    UPSContext ctx = service.newUPSContext(as);
    ctx.setUPSInstanceUID(rq.getString(Tag.AffectedSOPInstanceUID));
    ctx.setAttributes(rqAttrs);
    service.createUPS(ctx);
    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