Ejemplo n.º 1
0
        private static Guid CheckId(ApplicationArgumments a)
        {
            if (string.IsNullOrEmpty(a.FlowId))
            {
                return(Guid.Empty);
            }
            Guid guid;

            return(Guid.TryParse(a.FlowId, out guid) ? guid : Guid.Empty);
        }
Ejemplo n.º 2
0
        public static void ListdeployedWorkflows(ApplicationArgumments a)
        {
            Console.WriteLine("ID                                  |MD5                     |Version|Status|Name - Description");
            Console.WriteLine("-----------------------------------------------------------------------------------------------");

            WfDeployer.DeployedWorkflows.ToList().ForEach(w =>
            {
                string str = $"{w.Id}|{w.Md5}|{w.Version}|{w.Status}|{w.Name}-{w.Description} {w.LastUpdated}";
                Console.WriteLine(str);
            });
        }
Ejemplo n.º 3
0
        private static void PrintDefinition(ApplicationArgumments a)
        {
            Guid guid = CheckId(a);

            if (guid == Guid.Empty)
            {
                Console.WriteLine("Valid Process Definition GUID required.");
                return;
            }
            if (a.Version == -1)
            {
                Console.WriteLine("Version number is required.");
                return;
            }
            WfDeployer.PrintDefinition(guid, a.Version);
        }
Ejemplo n.º 4
0
        private static void SetWorkflowStatius(ApplicationArgumments a, ProcessDefStatusEnum status)
        {
            Guid guid = CheckId(a);

            if (guid == Guid.Empty)
            {
                Console.WriteLine("Valid Process Definition GUID required.");
                return;
            }
            if (a.Version == -1)
            {
                Console.WriteLine("Version number is required.");
                return;
            }
            WfDeployer.SetWorkflowStatus(guid, a.Version, status);
        }
Ejemplo n.º 5
0
        private static void RemoveFlow(ApplicationArgumments a)
        {
            Guid guid = CheckId(a);

            if (guid == Guid.Empty)
            {
                Console.WriteLine("Valid Process Definition GUID required.");
                return;
            }
            if (a.Version == -1)
            {
                Console.WriteLine("Version number is required.");
                return;
            }
            Console.WriteLine($"Removing workflow: {guid} {a.Version}");
            WfDeployer.RemoveWorkflow(guid, a.Version);
        }
Ejemplo n.º 6
0
 private static void AddRoles(ApplicationArgumments a)
 {
     if (string.IsNullOrEmpty(a.RoleString))
     {
         Console.WriteLine("Role string should be provided.");
         return;
     }
     if (string.IsNullOrEmpty(a.FlowId))
     {
         Console.WriteLine("Flow Id should be provided.");
         return;
     }
     if (a.Version == -1)
     {
         Console.WriteLine("Version should be provided");
         return;
     }
     WfDeployer.AddRole(new Guid(a.FlowId), a.Version, a.RoleString);
 }
Ejemplo n.º 7
0
        public static void DeployWorkflow(ApplicationArgumments a)
        {
            Guid guid = CheckId(a);

            if (guid == Guid.Empty)
            {
                Console.WriteLine("Valid Process Definition GUID required.");
                return;
            }
            try
            {
                WfDeployer.DeployWorkflow(guid);
                Console.WriteLine($"Process ID={guid} has been deployed.");
                ListdeployedWorkflows(a);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error deploying process ID={guid}. Error={ex.Message}");
            }
        }
Ejemplo n.º 8
0
        public static void PrintHelp(ApplicationArgumments a)
        {
            Console.WriteLine("use -c <command> [-f <flowguid>] [-v <version>]");
            string commands = @"
commands:
 h,? or help          - print help
 la or listassemblies - list workflows in assemblies catalog
 ld or listdeployed   - list deployed workflowa
 p  or print          - print JSON workflow definition
 d  or deploy         - deploy a workflow
 u  or undeploy       - undeploy a workflow
 a  or activate       - activate workflow
 x  or deactivate     - deactivate workflow
 r+                   - add role
 r-                   - remove role
 m                    - remove workflow
";

            Console.WriteLine(commands);
        }
Ejemplo n.º 9
0
 public static void DeactivateWorkflow(ApplicationArgumments a)
 {
     SetWorkflowStatius(a, ProcessDefStatusEnum.NotActive);
     ListdeployedWorkflows(a);
 }
Ejemplo n.º 10
0
 public static void UndeployWorkflow(ApplicationArgumments a)
 {
     DeactivateWorkflow(a);
 }
Ejemplo n.º 11
0
 public static void ListWorkflowasInAssemblies(ApplicationArgumments a)
 {
     Console.WriteLine("ID                                  |MD5                     |Name - Description");
     Console.WriteLine("---------------------------------------------------------------------------------");
     WfDeployer.Processes.ToList().ForEach(Console.WriteLine);
 }
Ejemplo n.º 12
0
 private static void RemoveRoles(ApplicationArgumments a)
 {
 }