Ejemplo n.º 1
0
        protected override void Validate(HRPaidTimeOffDataContext db, ref ENTValidationErrors validationErrors)
        {
            if (WorkflowName.Trim() == "")
            {
                validationErrors.Add("The workflow name is required.");
            }
            else
            {
                //The name must be unique.
                if (new ENTWorkflowData().IsDuplicateWorkflowName(db, ID, WorkflowName))
                {
                    validationErrors.Add("The name must be unique.");
                }
            }

            //The object name is required
            if (ENTWorkflowObjectName.Trim() == "")
            {
                validationErrors.Add("The class name is required.");
            }
            else
            {
                //The object name must be unique
                if (new ENTWorkflowData().IsDuplicateObjectName(db, ID, ENTWorkflowObjectName))
                {
                    validationErrors.Add("This class already has a workflow associated with it.");
                }
            }
        }
        /// <summary>Snippet for DeleteWorkflow</summary>
        public void DeleteWorkflowRequestObject()
        {
            // Snippet: DeleteWorkflow(DeleteWorkflowRequest, CallSettings)
            // Create client
            WorkflowsClient workflowsClient = WorkflowsClient.Create();
            // Initialize request argument(s)
            DeleteWorkflowRequest request = new DeleteWorkflowRequest
            {
                WorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
            };
            // Make the request
            Operation <Empty, OperationMetadata> response = workflowsClient.DeleteWorkflow(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, OperationMetadata> retrievedResponse = workflowsClient.PollOnceDeleteWorkflow(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for DeleteWorkflowAsync</summary>
        public async Task DeleteWorkflowResourceNamesAsync()
        {
            // Snippet: DeleteWorkflowAsync(WorkflowName, CallSettings)
            // Additional: DeleteWorkflowAsync(WorkflowName, CancellationToken)
            // Create client
            WorkflowsClient workflowsClient = await WorkflowsClient.CreateAsync();

            // Initialize request argument(s)
            WorkflowName name = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
            // Make the request
            Operation <Empty, OperationMetadata> response = await workflowsClient.DeleteWorkflowAsync(name);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, OperationMetadata> retrievedResponse = await workflowsClient.PollOnceDeleteWorkflowAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Ejemplo n.º 4
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = 1561563491;

                hashCode = (hashCode * 157) + Id.GetHashCode();
                hashCode = (hashCode * 157) + WorkflowID.GetHashCode();
                hashCode = (hashCode * 157) + ExecutionID.GetHashCode();
                hashCode = (hashCode * 157) + ExecutionOrigin.GetHashCode();
                hashCode = (hashCode * 157) + IsSubExecution.GetHashCode();
                hashCode = (hashCode * 157) + IsRemoteWorkflow.GetHashCode();
                hashCode = (hashCode * 157) + WorkflowName.GetHashCode();
                hashCode = (hashCode * 157) + AuditType.GetHashCode();
                hashCode = (hashCode * 157) + PreviousActivity.GetHashCode();
                hashCode = (hashCode * 157) + PreviousActivityType.GetHashCode();
                hashCode = (hashCode * 157) + PreviousActivityId.GetHashCode();
                hashCode = (hashCode * 157) + NextActivity.GetHashCode();
                hashCode = (hashCode * 157) + NextActivityType.GetHashCode();
                hashCode = (hashCode * 157) + NextActivityId.GetHashCode();
                hashCode = (hashCode * 157) + ServerID.GetHashCode();
                hashCode = (hashCode * 157) + ParentID.GetHashCode();
                hashCode = (hashCode * 157) + ExecutingUser.GetHashCode();
                hashCode = (hashCode * 157) + ExecutionOriginDescription.GetHashCode();
                hashCode = (hashCode * 157) + ExecutionToken.GetHashCode();
                hashCode = (hashCode * 157) + AdditionalDetail.GetHashCode();
                hashCode = (hashCode * 157) + Environment.GetHashCode();
                hashCode = (hashCode * 157) + AuditDate.GetHashCode();

                return(hashCode);
            }
        }
 /// <summary>Snippet for GetWorkflow</summary>
 public void GetWorkflowResourceNames()
 {
     // Snippet: GetWorkflow(WorkflowName, CallSettings)
     // Create client
     WorkflowsClient workflowsClient = WorkflowsClient.Create();
     // Initialize request argument(s)
     WorkflowName name = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
     // Make the request
     Workflow response = workflowsClient.GetWorkflow(name);
     // End snippet
 }
 /// <summary>Snippet for CreateExecution</summary>
 public void CreateExecutionResourceNames()
 {
     // Snippet: CreateExecution(WorkflowName, Execution, CallSettings)
     // Create client
     ExecutionsClient executionsClient = ExecutionsClient.Create();
     // Initialize request argument(s)
     WorkflowName parent    = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
     Execution    execution = new Execution();
     // Make the request
     Execution response = executionsClient.CreateExecution(parent, execution);
     // End snippet
 }
Ejemplo n.º 7
0
        protected override void Execute(CodeActivityContext context)
        {
            var workflowName = WorkflowName.Get(context);

            var projectPath = Directory.GetCurrentDirectory();

            var manager = new Manager(workflowName, projectPath);

            var result = manager.GetListOfWorkflowInvocations();

            WorkflowInvocations.Set(context, result);
        }
        /// <summary>Snippet for GetWorkflowAsync</summary>
        public async Task GetWorkflowResourceNamesAsync()
        {
            // Snippet: GetWorkflowAsync(WorkflowName, CallSettings)
            // Additional: GetWorkflowAsync(WorkflowName, CancellationToken)
            // Create client
            WorkflowsClient workflowsClient = await WorkflowsClient.CreateAsync();

            // Initialize request argument(s)
            WorkflowName name = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
            // Make the request
            Workflow response = await workflowsClient.GetWorkflowAsync(name);

            // End snippet
        }
 /// <summary>Snippet for GetWorkflow</summary>
 public void GetWorkflowRequestObject()
 {
     // Snippet: GetWorkflow(GetWorkflowRequest, CallSettings)
     // Create client
     WorkflowsClient workflowsClient = WorkflowsClient.Create();
     // Initialize request argument(s)
     GetWorkflowRequest request = new GetWorkflowRequest
     {
         WorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
     };
     // Make the request
     Workflow response = workflowsClient.GetWorkflow(request);
     // End snippet
 }
        /// <summary>Snippet for ListExecutionsAsync</summary>
        public async Task ListExecutionsRequestObjectAsync()
        {
            // Snippet: ListExecutionsAsync(ListExecutionsRequest, CallSettings)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            ListExecutionsRequest request = new ListExecutionsRequest
            {
                ParentAsWorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
                View = ExecutionView.Unspecified,
            };
            // Make the request
            PagedAsyncEnumerable <ListExecutionsResponse, Execution> response = executionsClient.ListExecutionsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Execution item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListExecutionsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Execution item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <Execution> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Execution item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        /// <summary>Snippet for CreateExecutionAsync</summary>
        public async Task CreateExecutionResourceNamesAsync()
        {
            // Snippet: CreateExecutionAsync(WorkflowName, Execution, CallSettings)
            // Additional: CreateExecutionAsync(WorkflowName, Execution, CancellationToken)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            WorkflowName parent    = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
            Execution    execution = new Execution();
            // Make the request
            Execution response = await executionsClient.CreateExecutionAsync(parent, execution);

            // End snippet
        }
 /// <summary>Snippet for CreateExecution</summary>
 public void CreateExecutionRequestObject()
 {
     // Snippet: CreateExecution(CreateExecutionRequest, CallSettings)
     // Create client
     ExecutionsClient executionsClient = ExecutionsClient.Create();
     // Initialize request argument(s)
     CreateExecutionRequest request = new CreateExecutionRequest
     {
         ParentAsWorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
         Execution            = new Execution(),
     };
     // Make the request
     Execution response = executionsClient.CreateExecution(request);
     // End snippet
 }
Ejemplo n.º 13
0
        private async Task <Execution> ExecuteWorkflow(string projectId, string region, string workflow, string args)
        {
            var client = await ExecutionsClient.CreateAsync();

            var request = new CreateExecutionRequest()
            {
                Parent    = WorkflowName.Format(projectId, region, workflow),
                Execution = new Execution()
                {
                    Argument = args
                }
            };

            var response = await client.CreateExecutionAsync(request);

            return(response);
        }
        /// <summary>Snippet for CreateExecutionAsync</summary>
        public async Task CreateExecutionRequestObjectAsync()
        {
            // Snippet: CreateExecutionAsync(CreateExecutionRequest, CallSettings)
            // Additional: CreateExecutionAsync(CreateExecutionRequest, CancellationToken)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            CreateExecutionRequest request = new CreateExecutionRequest
            {
                ParentAsWorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
                Execution            = new Execution(),
            };
            // Make the request
            Execution response = await executionsClient.CreateExecutionAsync(request);

            // End snippet
        }
        /// <summary>Snippet for ListExecutions</summary>
        public void ListExecutionsResourceNames()
        {
            // Snippet: ListExecutions(WorkflowName, string, int?, CallSettings)
            // Create client
            ExecutionsClient executionsClient = ExecutionsClient.Create();
            // Initialize request argument(s)
            WorkflowName parent = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
            // Make the request
            PagedEnumerable <ListExecutionsResponse, Execution> response = executionsClient.ListExecutions(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Execution item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListExecutionsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Execution item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <Execution> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Execution item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Ejemplo n.º 16
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method determines whether or not any metadata is
        /// different between the input instance and the current instance.</summary>
        ///
        /// <param name="inputWorkflow">The workflow to compare metadata.</param>
        ///--------------------------------------------------------------------------------
        public bool IsIdenticalMetadata(Workflow inputWorkflow)
        {
            if (WorkflowName.GetString() != inputWorkflow.WorkflowName.GetString())
            {
                return(false);
            }
            if (SolutionID.GetGuid() != inputWorkflow.SolutionID.GetGuid())
            {
                return(false);
            }
            if (IsAutoUpdated.GetBool() != inputWorkflow.IsAutoUpdated.GetBool())
            {
                return(false);
            }
            if (Description.GetString() != inputWorkflow.Description.GetString())
            {
                return(false);
            }

            #region protected
            #endregion protected

            return(true);
        }