public WorkflowAdmin AddWorkflowAdmin(WorkflowAdmin workflow) { vault.MetricGatherer.MethodCalled(); // TODO: verify if (workflow is TestWorkflowAdmin) { vault.Workflows.Add((TestWorkflowAdmin)workflow); } else { xWorkflowAdmin wkAdmin = new xWorkflowAdmin(workflow); TestWorkflowAdmin twka = new TestWorkflowAdmin(wkAdmin); vault.Workflows.Add(twka); } ValueListItem valueListItemWorkflow = new ValueListItem { ID = workflow.Workflow.ID, Name = workflow.Workflow.Name }; vault.ValueListItemOperations.AddValueListItem(( int )MFBuiltInValueList.MFBuiltInValueListWorkflows, valueListItemWorkflow); for (int i = 1; i <= workflow.States.Count; ++i) { StateAdmin stateAdmin = workflow.States[i]; ValueListItem valueListItemState = new ValueListItem { ID = stateAdmin.ID, Name = stateAdmin.Name, OwnerID = workflow.Workflow.ID }; vault.ValueListItemOperations.AddValueListItem(( int )MFBuiltInValueList.MFBuiltInValueListStates, valueListItemState); } return(workflow); }
public TestWorkflowAdmin(xWorkflowAdmin wfa) { Description = wfa.Description; Permissions = new TestAccessControlList(wfa.Permissions); SemanticAliases = new SemanticAliases { Value = string.Join(";", wfa.SemanticAliases) }; States = new StatesAdmin(); foreach (xStateAdmin stateAdmin in wfa.States) { States.Add(-1, new TestStateAdmin(stateAdmin)); } StateTransitions = new StateTransitions(); foreach (xStateTransition transition in wfa.StateTransitions) { StateTransitions.Add(-1, new TestStateTransition(transition)); } Workflow = new TestWorkflow(wfa.Workflow); }