Esempio n. 1
0
        public virtual 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.BaseUriBuilder.path(relativeRootResourcePath).path(org.camunda.bpm.engine.rest.DeploymentRestService_Fields.PATH).path(deployment.Id).build();

            // GET /
            deploymentDto.addReflexiveLink(uri, HttpMethod.GET, "self");

            return(deploymentDto);
        }
Esempio n. 2
0
        public virtual DeploymentWithDefinitionsDto createDeployment(UriInfo uriInfo, MultipartFormData payload)
        {
            DeploymentBuilder deploymentBuilder = extractDeploymentInformation(payload);

            if (deploymentBuilder.ResourceNames.Count > 0)
            {
                DeploymentWithDefinitions deployment = deploymentBuilder.deployWithResult();

                DeploymentWithDefinitionsDto deploymentDto = DeploymentWithDefinitionsDto.fromDeployment(deployment);


                URI uri = uriInfo.BaseUriBuilder.path(relativeRootResourcePath).path(org.camunda.bpm.engine.rest.DeploymentRestService_Fields.PATH).path(deployment.Id).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.");
            }
        }