use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class CaseExecutionResourceImpl method manualStart.
public void manualStart(CaseExecutionTriggerDto triggerDto) {
try {
CaseService caseService = engine.getCaseService();
CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseExecutionId);
initializeCommand(commandBuilder, triggerDto, "start manually");
commandBuilder.manualStart();
} catch (NotFoundException e) {
throw createInvalidRequestException("manualStart", Status.NOT_FOUND, e);
} catch (NotValidException e) {
throw createInvalidRequestException("manualStart", Status.BAD_REQUEST, e);
} catch (NotAllowedException e) {
throw createInvalidRequestException("manualStart", Status.FORBIDDEN, e);
} catch (ProcessEngineException e) {
throw createRestException("manualStart", Status.INTERNAL_SERVER_ERROR, e);
}
}
use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class CaseExecutionResourceImpl method complete.
public void complete(CaseExecutionTriggerDto triggerDto) {
try {
CaseService caseService = engine.getCaseService();
CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseExecutionId);
initializeCommand(commandBuilder, triggerDto, "complete");
commandBuilder.complete();
} catch (NotFoundException e) {
throw createInvalidRequestException("complete", Status.NOT_FOUND, e);
} catch (NotValidException e) {
throw createInvalidRequestException("complete", Status.BAD_REQUEST, e);
} catch (NotAllowedException e) {
throw createInvalidRequestException("complete", Status.FORBIDDEN, e);
} catch (ProcessEngineException e) {
throw createRestException("complete", Status.INTERNAL_SERVER_ERROR, e);
}
}
use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class CaseInstanceResourceImpl method close.
public void close(CaseExecutionTriggerDto triggerDto) {
try {
CaseService caseService = engine.getCaseService();
CaseExecutionCommandBuilder commandBuilder = caseService.withCaseExecution(caseInstanceId);
initializeCommand(commandBuilder, triggerDto, "close");
commandBuilder.close();
} catch (NotFoundException e) {
throw createInvalidRequestException("close", Status.NOT_FOUND, e);
} catch (NotValidException e) {
throw createInvalidRequestException("close", Status.BAD_REQUEST, e);
} catch (NotAllowedException e) {
throw createInvalidRequestException("close", Status.FORBIDDEN, e);
} catch (ProcessEngineException e) {
throw createRestException("close", Status.INTERNAL_SERVER_ERROR, e);
}
}
use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class FilterRestServiceImpl method createFilter.
public FilterDto createFilter(FilterDto filterDto) {
FilterService filterService = getProcessEngine().getFilterService();
String resourceType = filterDto.getResourceType();
Filter filter;
if (EntityTypes.TASK.equals(resourceType)) {
filter = filterService.newTaskFilter();
} else {
throw new InvalidRequestException(Response.Status.BAD_REQUEST, "Unable to create filter with invalid resource type '" + resourceType + "'");
}
try {
filterDto.updateFilter(filter, getProcessEngine());
} catch (NotValidException e) {
throw new InvalidRequestException(Response.Status.BAD_REQUEST, e, "Unable to create filter with invalid content");
}
filterService.saveFilter(filter);
return FilterDto.fromFilter(filter);
}
use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.
the class DeployCmd method doExecute.
protected DeploymentWithDefinitions doExecute(final CommandContext commandContext) {
DeploymentManager deploymentManager = commandContext.getDeploymentManager();
Set<String> deploymentIds = getAllDeploymentIds(deploymentBuilder);
if (!deploymentIds.isEmpty()) {
String[] deploymentIdArray = deploymentIds.toArray(new String[deploymentIds.size()]);
List<DeploymentEntity> deployments = deploymentManager.findDeploymentsByIds(deploymentIdArray);
ensureDeploymentsWithIdsExists(deploymentIds, deployments);
}
checkCreateAndReadDeployments(commandContext, deploymentIds);
// set deployment name if it should retrieved from an existing deployment
String nameFromDeployment = deploymentBuilder.getNameFromDeployment();
setDeploymentName(nameFromDeployment, deploymentBuilder, commandContext);
// get resources to re-deploy
List<ResourceEntity> resources = getResources(deploymentBuilder, commandContext);
// .. and add them the builder
addResources(resources, deploymentBuilder);
Collection<String> resourceNames = deploymentBuilder.getResourceNames();
if (resourceNames == null || resourceNames.isEmpty()) {
throw new NotValidException("No deployment resources contained to deploy.");
}
// perform deployment
DeploymentWithDefinitions deployment = commandContext.runWithoutAuthorization(new Callable<DeploymentWithDefinitions>() {
@Override
public DeploymentWithDefinitions call() throws Exception {
acquireExclusiveLock(commandContext);
DeploymentEntity deployment = initDeployment();
Map<String, ResourceEntity> resourcesToDeploy = resolveResourcesToDeploy(commandContext, deployment);
Map<String, ResourceEntity> resourcesToIgnore = new HashMap<String, ResourceEntity>(deployment.getResources());
resourcesToIgnore.keySet().removeAll(resourcesToDeploy.keySet());
if (!resourcesToDeploy.isEmpty()) {
LOG.debugCreatingNewDeployment();
deployment.setResources(resourcesToDeploy);
deploy(deployment);
} else {
LOG.usingExistingDeployment();
deployment = getExistingDeployment(commandContext, deployment.getName());
}
scheduleProcessDefinitionActivation(commandContext, deployment);
if (deploymentBuilder instanceof ProcessApplicationDeploymentBuilder) {
// for process application deployments, job executor registration is managed by
// process application manager
Set<String> processesToRegisterFor = retrieveProcessKeysFromResources(resourcesToIgnore);
ProcessApplicationRegistration registration = registerProcessApplication(commandContext, deployment, processesToRegisterFor);
return new ProcessApplicationDeploymentImpl(deployment, registration);
} else {
registerWithJobExecutor(commandContext, deployment);
}
return deployment;
}
});
createUserOperationLog(deploymentBuilder, deployment, commandContext);
return deployment;
}
Aggregations