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); }
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); }); }
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); }
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); }
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); }
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); }
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}"); } }
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); }
public static void DeactivateWorkflow(ApplicationArgumments a) { SetWorkflowStatius(a, ProcessDefStatusEnum.NotActive); ListdeployedWorkflows(a); }
public static void UndeployWorkflow(ApplicationArgumments a) { DeactivateWorkflow(a); }
public static void ListWorkflowasInAssemblies(ApplicationArgumments a) { Console.WriteLine("ID |MD5 |Name - Description"); Console.WriteLine("---------------------------------------------------------------------------------"); WfDeployer.Processes.ToList().ForEach(Console.WriteLine); }
private static void RemoveRoles(ApplicationArgumments a) { }