Search in sources :

Example 6 with DicomServiceException

use of org.dcm4che3.net.service.DicomServiceException in project dcm4chee-arc-light by dcm4che.

the class UPSServiceImpl method createSubscription.

@Override
public void createSubscription(UPSContext ctx) throws DicomServiceException {
    validateSupportEventReports(ctx);
    try {
        validateSubscriberAET(ctx);
        switch(ctx.getUPSInstanceUID()) {
            case UID.UPSFilteredGlobalSubscriptionInstance:
                if (ctx.getAttributes().isEmpty()) {
                    throw new DicomServiceException(Status.InvalidArgumentValue, "Matching Keys are missing.", false);
                }
            case UID.UPSGlobalSubscriptionInstance:
                ejb.createOrUpdateGlobalSubscription(ctx, searchNotSubscribedUPS(ctx));
                break;
            default:
                ejb.createOrUpdateSubscription(ctx);
        }
        fireUPSEvents(ctx);
    } catch (DicomServiceException e) {
        throw e;
    } catch (Exception e) {
        throw new DicomServiceException(Status.ProcessingFailure, e);
    }
}
Also used : DicomServiceException(org.dcm4che3.net.service.DicomServiceException) EJBException(javax.ejb.EJBException) SAXException(org.xml.sax.SAXException) ConfigurationException(org.dcm4che3.conf.api.ConfigurationException) DicomServiceException(org.dcm4che3.net.service.DicomServiceException) ConfigurationNotFoundException(org.dcm4che3.conf.api.ConfigurationNotFoundException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) IOException(java.io.IOException)

Example 7 with DicomServiceException

use of org.dcm4che3.net.service.DicomServiceException in project dcm4chee-arc-light by dcm4che.

the class UPSServiceImpl method updateUPS.

@Override
public UPS updateUPS(UPSContext ctx) throws DicomServiceException {
    Attributes attrs = ctx.getAttributes();
    ValidationResult validate = attrs.validate(SET_IOD);
    if (!validate.isValid()) {
        throw DicomServiceException.valueOf(validate, attrs);
    }
    try {
        UPS ups = ejb.updateUPS(ctx);
        fireUPSEvents(ctx);
        return ups;
    } catch (DicomServiceException e) {
        throw e;
    } catch (Exception e) {
        throw new DicomServiceException(Status.ProcessingFailure, e);
    }
}
Also used : QueryAttributes(org.dcm4chee.arc.query.util.QueryAttributes) UPS(org.dcm4chee.arc.entity.UPS) DicomServiceException(org.dcm4che3.net.service.DicomServiceException) EJBException(javax.ejb.EJBException) SAXException(org.xml.sax.SAXException) ConfigurationException(org.dcm4che3.conf.api.ConfigurationException) DicomServiceException(org.dcm4che3.net.service.DicomServiceException) ConfigurationNotFoundException(org.dcm4che3.conf.api.ConfigurationNotFoundException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) IOException(java.io.IOException)

Example 8 with DicomServiceException

use of org.dcm4che3.net.service.DicomServiceException in project dcm4chee-arc-light by dcm4che.

the class UPSServiceImpl method createOnHL7.

private void createOnHL7(UPSContext ctx, ArchiveHL7ApplicationExtension arcHL7App, UnparsedHL7Message msg, HL7Fields hl7Fields, Calendar now, UPSOnHL7 upsOnHL7) {
    Attributes attrs = applyXSLT(arcHL7App, msg, upsOnHL7);
    if (attrs.size() == 0)
        return;
    ctx.setAttributes(UPSUtils.createOnHL7(arcHL7App, attrs, hl7Fields, now, upsOnHL7));
    try {
        createUPS(ctx);
    } catch (DicomServiceException e) {
        LOG.info("Failed to apply {} to create UPS", upsOnHL7, e);
    }
}
Also used : QueryAttributes(org.dcm4chee.arc.query.util.QueryAttributes) DicomServiceException(org.dcm4che3.net.service.DicomServiceException)

Example 9 with DicomServiceException

use of org.dcm4che3.net.service.DicomServiceException 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 10 with DicomServiceException

use of org.dcm4che3.net.service.DicomServiceException 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)

Aggregations

DicomServiceException (org.dcm4che3.net.service.DicomServiceException)70 IOException (java.io.IOException)28 Attributes (org.dcm4che3.data.Attributes)21 UPSContext (org.dcm4chee.arc.ups.UPSContext)16 ConfigurationException (org.dcm4che3.conf.api.ConfigurationException)10 StoreSession (org.dcm4chee.arc.store.StoreSession)10 EJBException (javax.ejb.EJBException)8 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)8 ConfigurationNotFoundException (org.dcm4che3.conf.api.ConfigurationNotFoundException)8 QueryAttributes (org.dcm4chee.arc.query.util.QueryAttributes)8 SAXException (org.xml.sax.SAXException)8 ArchiveAEExtension (org.dcm4chee.arc.conf.ArchiveAEExtension)7 ArchiveDeviceExtension (org.dcm4chee.arc.conf.ArchiveDeviceExtension)5 UPS (org.dcm4chee.arc.entity.UPS)5 QueryContext (org.dcm4chee.arc.query.QueryContext)5 File (java.io.File)4 DicomOutputStream (org.dcm4che3.io.DicomOutputStream)4 QueryOption (org.dcm4che3.net.QueryOption)4 InstanceLocations (org.dcm4chee.arc.store.InstanceLocations)4 Association (org.dcm4che3.net.Association)3