Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private DeploymentBuilder extractDeploymentInformation(MultipartFormData payload)
        {
            DeploymentBuilder deploymentBuilder = ProcessEngine.RepositoryService.createDeployment();

            ISet <string> partNames = payload.PartNames;

            foreach (string name in partNames)
            {
                MultipartFormData.FormPart part = payload.getNamedPart(name);

                if (!RESERVED_KEYWORDS.Contains(name))
                {
                    string fileName = part.FileName;
                    if (!string.ReferenceEquals(fileName, null))
                    {
                        deploymentBuilder.addInputStream(part.FileName, new MemoryStream(part.BinaryContent));
                    }
                    else
                    {
                        throw new InvalidRequestException(Status.BAD_REQUEST, "No file name found in the deployment resource described by form parameter '" + fileName + "'.");
                    }
                }
            }

            MultipartFormData.FormPart deploymentName = payload.getNamedPart(DEPLOYMENT_NAME);
            if (deploymentName != null)
            {
                deploymentBuilder.name(deploymentName.TextContent);
            }

            MultipartFormData.FormPart deploymentSource = payload.getNamedPart(DEPLOYMENT_SOURCE);
            if (deploymentSource != null)
            {
                deploymentBuilder.source(deploymentSource.TextContent);
            }

            MultipartFormData.FormPart deploymentTenantId = payload.getNamedPart(TENANT_ID);
            if (deploymentTenantId != null)
            {
                deploymentBuilder.tenantId(deploymentTenantId.TextContent);
            }

            extractDuplicateFilteringForDeployment(payload, deploymentBuilder);
            return(deploymentBuilder);
        }