Search in sources :

Example 1 with DeploymentWithDefinitionsDto

use of org.camunda.bpm.engine.rest.dto.repository.DeploymentWithDefinitionsDto in project camunda-bpm-platform by camunda.

the class DeploymentRestServiceImpl method createDeployment.

public DeploymentWithDefinitionsDto createDeployment(UriInfo uriInfo, MultipartFormData payload) {
    DeploymentBuilder deploymentBuilder = extractDeploymentInformation(payload);
    if (!deploymentBuilder.getResourceNames().isEmpty()) {
        DeploymentWithDefinitions deployment = deploymentBuilder.deployWithResult();
        DeploymentWithDefinitionsDto deploymentDto = DeploymentWithDefinitionsDto.fromDeployment(deployment);
        URI uri = uriInfo.getBaseUriBuilder().path(relativeRootResourcePath).path(DeploymentRestService.PATH).path(deployment.getId()).build();
        // GET
        deploymentDto.addReflexiveLink(uri, HttpMethod.GET, "self");
        return deploymentDto;
    } else {
        throw new InvalidRequestException(Status.BAD_REQUEST, "No deployment resources contained in the form upload.");
    }
}
Also used : DeploymentWithDefinitionsDto(org.camunda.bpm.engine.rest.dto.repository.DeploymentWithDefinitionsDto) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) URI(java.net.URI)

Example 2 with DeploymentWithDefinitionsDto

use of org.camunda.bpm.engine.rest.dto.repository.DeploymentWithDefinitionsDto in project camunda-bpm-platform by camunda.

the class DeploymentResourceImpl method redeploy.

public DeploymentDto redeploy(UriInfo uriInfo, RedeploymentDto redeployment) {
    DeploymentWithDefinitions deployment = null;
    try {
        deployment = tryToRedeploy(redeployment);
    } catch (NotFoundException e) {
        throw createInvalidRequestException("redeploy", Status.NOT_FOUND, e);
    } catch (NotValidException e) {
        throw createInvalidRequestException("redeploy", Status.BAD_REQUEST, e);
    }
    DeploymentWithDefinitionsDto deploymentDto = DeploymentWithDefinitionsDto.fromDeployment(deployment);
    URI uri = uriInfo.getBaseUriBuilder().path(relativeRootResourcePath).path(DeploymentRestService.PATH).path(deployment.getId()).build();
    // GET /
    deploymentDto.addReflexiveLink(uri, HttpMethod.GET, "self");
    return deploymentDto;
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) DeploymentWithDefinitionsDto(org.camunda.bpm.engine.rest.dto.repository.DeploymentWithDefinitionsDto) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) URI(java.net.URI) DeploymentWithDefinitions(org.camunda.bpm.engine.repository.DeploymentWithDefinitions)

Aggregations

URI (java.net.URI)2 DeploymentWithDefinitionsDto (org.camunda.bpm.engine.rest.dto.repository.DeploymentWithDefinitionsDto)2 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1 DeploymentWithDefinitions (org.camunda.bpm.engine.repository.DeploymentWithDefinitions)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1