Search in sources :

Example 1 with DeploymentResourceNotFoundException

use of org.camunda.bpm.engine.exception.DeploymentResourceNotFoundException in project camunda-bpm-platform by camunda.

the class AbstractGetDeployedFormCmd method execute.

public InputStream execute(final CommandContext commandContext) {
    checkAuthorization(commandContext);
    final FormData formData = getFormData(commandContext);
    String formKey = formData.getFormKey();
    if (formKey == null) {
        throw new BadUserRequestException("The form key is not set.");
    }
    final String resourceName = getResourceName(formKey);
    try {
        return commandContext.runWithoutAuthorization(new Callable<InputStream>() {

            @Override
            public InputStream call() throws Exception {
                return new GetDeploymentResourceCmd(formData.getDeploymentId(), resourceName).execute(commandContext);
            }
        });
    } catch (DeploymentResourceNotFoundException e) {
        throw new NotFoundException("The form with the resource name '" + resourceName + "' cannot be found in deployment.", e);
    }
}
Also used : FormData(org.camunda.bpm.engine.form.FormData) DeploymentResourceNotFoundException(org.camunda.bpm.engine.exception.DeploymentResourceNotFoundException) InputStream(java.io.InputStream) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) DeploymentResourceNotFoundException(org.camunda.bpm.engine.exception.DeploymentResourceNotFoundException) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException) DeploymentResourceNotFoundException(org.camunda.bpm.engine.exception.DeploymentResourceNotFoundException)

Aggregations

InputStream (java.io.InputStream)1 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)1 DeploymentResourceNotFoundException (org.camunda.bpm.engine.exception.DeploymentResourceNotFoundException)1 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)1 FormData (org.camunda.bpm.engine.form.FormData)1