public void ContainerTest() { container = new WindsorContainer(TestHelper.GetConfigDir() + "WindsorContainerTest.xml"); IOrganisationService organisationSession = (IOrganisationService)container["OrganisationSession"]; Assert.IsNotNull(organisationSession); organisationSession = (IOrganisationService)container[typeof(IOrganisationService)]; Assert.IsNotNull(organisationSession); ISchedulerSessionLocal schedulerSession = (ISchedulerSessionLocal)container["SchedulerSession"]; Assert.IsNotNull(schedulerSession); schedulerSession = (ISchedulerSessionLocal)container[typeof(ISchedulerSessionLocal)]; Assert.IsNotNull(schedulerSession); IProcessDefinitionService definitionSession = (IProcessDefinitionService)container["DefinitionSession"]; Assert.IsNotNull(definitionSession); definitionSession = (IProcessDefinitionService)container[typeof(IProcessDefinitionService)]; Assert.IsNotNull(definitionSession); IExecutionApplicationService executionSession = (IExecutionApplicationService)container["ExecutionSession"]; Assert.IsNotNull(executionSession); executionSession = (IExecutionApplicationService)container[typeof(IExecutionApplicationService)]; Assert.IsNotNull(executionSession); ILogSessionLocal logSession = (ILogSessionLocal)container["LogSession"]; Assert.IsNotNull(logSession); logSession = (ILogSessionLocal)container[typeof(ILogSessionLocal)]; Assert.IsNotNull(logSession); }
public String CreateLogDetail(Int64 flowId) { logComponent = ServiceLocator.Instance.GetService(typeof(ILogSessionLocal)) as ILogSessionLocal; try { details = new ArrayList(); StringWriter logDetail = new StringWriter(); IFlow flow = GetFlow(flowId); WriteFlow(logDetail, flow); return(logDetail.ToString()); } finally { ServiceLocator.Instance.Release(logComponent); } }
public String CreateLogDetail(Int64 flowId) { logComponent = ServiceLocator.Instance.GetService(typeof (ILogSessionLocal)) as ILogSessionLocal; try { details = new ArrayList(); StringWriter logDetail=new StringWriter(); IFlow flow = GetFlow(flowId); WriteFlow(logDetail, flow); return logDetail.ToString(); } finally { ServiceLocator.Instance.Release(logComponent); } }
public virtual void ExportPPMFile(String exportPath) { try { logComponent = ServiceLocator.Instance.GetService(typeof(ILogSessionLocal)) as ILogSessionLocal; if (logComponent == null) { throw new ArgumentException("Can’t create log component. Container is not configured please check the configfile"); } IList processList = logComponent.FindProcessInstances(DateTime.MinValue, DateTime.MinValue, null, null, 0); IEnumerator processEnum = processList.GetEnumerator(); if (!Directory.Exists(exportPath)) { throw new FileNotFoundException(String.Format("The directory `{0}' does not exist", exportPath)); } //create File FileInfo exportFile = new FileInfo(exportPath + "/" + DateTime.Today.ToString("yyyyMMddhhmm") + ".xml"); FileStream fstream = exportFile.OpenWrite(); StreamWriter xmlwriter = new StreamWriter(fstream); xmlwriter.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); xmlwriter.WriteLine("<!DOCTYPE graphlist SYSTEM \"graph.dtd\">"); xmlwriter.WriteLine("<graphlist>"); while (processEnum.MoveNext()) { IProcessInstance processInstance = (IProcessInstance)processEnum.Current; WriteProcess(xmlwriter, processInstance); } xmlwriter.WriteLine("</graphlist>"); xmlwriter.Flush(); xmlwriter.Close(); } finally { ServiceLocator.Instance.Release(logComponent); } }
public virtual void ExportPPMFile(String exportPath) { try { logComponent = ServiceLocator.Instance.GetService(typeof (ILogSessionLocal)) as ILogSessionLocal; if (logComponent==null) { throw new ArgumentException("Can’t create log component. Container is not configured please check the configfile"); } IList processList = logComponent.FindProcessInstances(DateTime.MinValue,DateTime.MinValue,null,null,0); IEnumerator processEnum=processList.GetEnumerator(); if (!Directory.Exists (exportPath)) throw new FileNotFoundException (String.Format ("The directory `{0}' does not exist", exportPath)); //create File FileInfo exportFile = new FileInfo(exportPath+"/"+DateTime.Today.ToString("yyyyMMddhhmm")+".xml"); FileStream fstream = exportFile.OpenWrite(); StreamWriter xmlwriter = new StreamWriter(fstream); xmlwriter.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); xmlwriter.WriteLine("<!DOCTYPE graphlist SYSTEM \"graph.dtd\">"); xmlwriter.WriteLine("<graphlist>"); while (processEnum.MoveNext()) { IProcessInstance processInstance=(IProcessInstance)processEnum.Current; WriteProcess(xmlwriter, processInstance); } xmlwriter.WriteLine("</graphlist>"); xmlwriter.Flush(); xmlwriter.Close(); } finally { ServiceLocator.Instance.Release(logComponent); } }
public void ShowProcessInstance(Int32 processInstanceId) { ILogSessionLocal logComponent = null; try { logComponent = ServiceLocator.Instance.GetService(typeof(ILogSessionLocal)) as ILogSessionLocal; IProcessInstance processInstance = logComponent.GetProcessInstance(processInstanceId); IList state = new ArrayList(); IList attributeRows = new ArrayList(); GetStateAndAttributes(state, attributeRows, "", processInstance.RootFlow); Context.Flash["processInstance"] = processInstance; Context.Flash["processInstanceStates"] = state; Context.Flash["attributeRows"] = attributeRows; } finally { ServiceLocator.Instance.Release(logComponent); } }
public void ShowHome(Int32 processDefinitionId, String startAfter, String startBefore, String initiator, String actor) { IDefinitionSessionLocal definitionComponent = null; ILogSessionLocal logComponent = null; try { definitionComponent = ServiceLocator.Instance.GetService(typeof(IDefinitionSessionLocal)) as IDefinitionSessionLocal; logComponent = ServiceLocator.Instance.GetService(typeof(ILogSessionLocal)) as ILogSessionLocal; if (log.IsDebugEnabled) { log.Debug("ShowHome processDefinitionId:" + processDefinitionId + " startAfter:" + startAfter + " startBefore:" + startBefore + " initiator:" + initiator + " actor:" + actor); } Context.Flash["allProcessDefinitions"] = definitionComponent.GetAllProcessDefinitions(); // date text to datetime DateTime before = DateTime.MinValue; DateTime after = DateTime.MinValue; if (startAfter != null && startAfter != "") { try { after = DateTime.ParseExact(startAfter, DATEFORMAT, enUS); } catch (FormatException ex) { AddMessage(startAfter + " is not a vaild dateformat!"); log.Debug(startAfter + " is not a vaild dateformat!" + ex.Message); } } if (startBefore != null && startBefore != "") { try { before = DateTime.ParseExact(startBefore, DATEFORMAT, enUS); } catch (FormatException ex) { AddMessage(startBefore + " is not a vaild dateformat!"); log.Debug(startBefore + " is not a vaild dateformat!" + ex.Message); } } //show processes only if a definition is selected if (processDefinitionId != 0) { // TODO: add the handling of startAfter and startBefore IList allProcessInstances = logComponent.FindProcessInstances(after, before, initiator, actor, processDefinitionId); if (allProcessInstances.Count != 0) { Context.Flash["allProcessInstances"] = allProcessInstances; } } Context.Flash["processDefinitionId"] = processDefinitionId; Context.Flash["initiator"] = initiator; Context.Flash["actor"] = actor; Context.Flash["startBefore"] = startBefore; Context.Flash["startAfter"] = startAfter; Context.Flash["serviceLocator"] = ServiceLocator.Instance; } finally { ServiceLocator.Instance.Release(logComponent); ServiceLocator.Instance.Release(definitionComponent); } }