Ejemplo n.º 1
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);
        }