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); }
protected internal virtual DeploymentWithDefinitions tryToRedeploy(RedeploymentDto redeployment) { RepositoryService repositoryService = ProcessEngine.RepositoryService; DeploymentBuilder builder = repositoryService.createDeployment(); builder.nameFromDeployment(deploymentId); string tenantId = Deployment.TenantId; if (!string.ReferenceEquals(tenantId, null)) { builder.tenantId(tenantId); } if (redeployment != null) { builder = addRedeploymentResources(builder, redeployment); } else { builder.addDeploymentResources(deploymentId); } return(builder.deployWithResult()); }
protected internal virtual DeploymentBuilder addRedeploymentResources(DeploymentBuilder builder, RedeploymentDto redeployment) { builder.source(redeployment.Source); IList <string> resourceIds = redeployment.ResourceIds; IList <string> resourceNames = redeployment.ResourceNames; bool isResourceIdListEmpty = resourceIds == null || resourceIds.Count == 0; bool isResourceNameListEmpty = resourceNames == null || resourceNames.Count == 0; if (isResourceIdListEmpty && isResourceNameListEmpty) { builder.addDeploymentResources(deploymentId); } else { if (!isResourceIdListEmpty) { builder.addDeploymentResourcesById(deploymentId, resourceIds); } if (!isResourceNameListEmpty) { builder.addDeploymentResourcesByName(deploymentId, resourceNames); } } return(builder); }