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);
}
}
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);
}
}
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);
}
}
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();
}
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();
}
Aggregations