public CandidateCommandList getCandidateCommands(string wfName, string instanceId)
        {
            Assembly trackingWorkFlowAssembly = Assembly.Load("TrackingWorkFlow");

            Type[]        types          = trackingWorkFlowAssembly.GetTypes();
            List <string> requiredInputs = new List <string>();

            foreach (Type t in types)
            {
                if (t.Name.Equals(wfName))
                {
                    Type            tt            = typeof(String);
                    ConstructorInfo ci            = t.GetConstructor(new Type[] { tt });
                    List <string>   bookmarkInfos = null;
                    using (TrackingWorkFlow twf = (TrackingWorkFlow)(ci.Invoke(new object[] { instanceId })))
                    {
                        bookmarkInfos = twf.GetCandidateCommand();
                    }
                    CandidateCommandList cmdList = null;
                    if (bookmarkInfos != null)
                    {
                        cmdList = new CandidateCommandList();
                        cmdList.AddRange(bookmarkInfos);
                        return(cmdList);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            throw new WorkFlowNotFoundException("workFlow named " + wfName + " not found");
        }
 public CandidateCommandList getCandidateCommands(string wfName, string instanceId)
 {
     Assembly trackingWorkFlowAssembly = Assembly.Load("TrackingWorkFlow");
     Type[] types = trackingWorkFlowAssembly.GetTypes();
     List<string> requiredInputs = new List<string>();
     foreach (Type t in types)
     {
         if (t.Name.Equals(wfName))
         {
             Type tt = typeof(String);
             ConstructorInfo ci = t.GetConstructor(new Type[] { tt });
             List<string> bookmarkInfos = null;
             using (TrackingWorkFlow twf = (TrackingWorkFlow)(ci.Invoke(new object[] { instanceId })))
             {
                 bookmarkInfos = twf.GetCandidateCommand();
             }
             CandidateCommandList cmdList=null;
             if (bookmarkInfos != null)
             {
                 cmdList = new CandidateCommandList();
                 cmdList.AddRange(bookmarkInfos);
                 return cmdList;
             }
             else
             {
                 return null;
             }
         }
     }
     throw new WorkFlowNotFoundException("workFlow named "+wfName+" not found");
 }
示例#3
0
        public WorkFlowInstance startWorkFlow(CommandInfo CommandInfo)
        {
            string WFName = CommandInfo.WFName;
            TrackingWorkFlowInteraction twfi = new TrackingWorkFlowInteraction();

            string id = twfi.startProcess(WFName);

            WorkFlowInstance wfi = new WorkFlowInstance();

            wfi.Id = id;
            List <string>        candCmds = twfi.getCandidateCommands(WFName, id);
            CandidateCommandList ccl      = new CandidateCommandList();

            ccl.AddRange(candCmds);
            wfi.CandidateCommandList = ccl;
            return(wfi);
        }
示例#4
0
        public WorkFlowInstance GetWorkFlowInstance(string InstanceId)
        {
            WorkFlowInstance wfi = new WorkFlowInstance();

            wfi.Id = InstanceId;
            try
            {
                TrackingDataContext trackingContext = new TrackingDataContext();
                Guid guid = new Guid(InstanceId);
                IQueryable <CommonResource.Tracking> trackingQuery =
                    from tracking in trackingContext.Trackings
                    where ((tracking.wfinstanceid == guid))
                    select tracking;
                foreach (CommonResource.Tracking t in trackingQuery)
                {
                    using (TrackingWorkFlowInteraction twfi = new TrackingWorkFlowInteraction())
                    {
                        wfi        = new WorkFlowInstance();
                        wfi.BugId  = t.bugid;
                        wfi.Id     = t.wfinstanceid.ToString();
                        wfi.Title  = t.title;
                        wfi.WFName = t.wfname;
                        //wfi.LastModified = t.lastmodified==null?"N/A":t.lastmodified.ToString();
                        wfi.LastModified   = t.lastmodified == null ? "N/A" : t.lastmodified.ToString();
                        wfi.QFEStatus      = t.qfestatus;
                        wfi.AssignedTo     = t.assignedto;
                        wfi.LastModifiedBy = t.lastmodifiedby;
                        try
                        {
                            CandidateCommandList ccl = twfi.getCandidateCommands(t.wfname.Trim(), InstanceId);
                            wfi.CandidateCommandList = ccl;
                        }
                        catch (WorkFlowNotFoundException e)
                        {
                        }
                    }
                    return(wfi);
                }
            }
            catch (Exception e)
            {
                throw new WebFaultException <string>(e.ToString(), HttpStatusCode.InternalServerError);
            }
            return(null);
        }
示例#5
0
 public WorkFlowInstance GetWorkFlowInstance(string InstanceId)
 {
     WorkFlowInstance wfi = new WorkFlowInstance();
     TrackingDataContext trackingContext = new TrackingDataContext();
     Guid guid = new Guid(InstanceId);
     IQueryable<Tracking> trackingQuery =
         from tracking in trackingContext.Trackings
         where ((tracking.wfinstanceid == guid))
         select tracking;
     foreach (Tracking t in trackingQuery)
     {
         TrackingWorkFlowInteraction twfi = new TrackingWorkFlowInteraction();
         wfi = new WorkFlowInstance();
         List<string> candCmds=twfi.getCandidateCommands(t.wfname, InstanceId);
         CandidateCommandList ccl=new CandidateCommandList();
         ccl.AddRange(candCmds);
         wfi.CandidateCommandList = ccl;
         return wfi;
     }
     return null;
 }
示例#6
0
        public WorkFlowInstance startWorkFlow(CommandInfo CommandInfo)
        {
            WorkFlowInstance wfi = new WorkFlowInstance();

            try
            {
                string WFName = CommandInfo.WFName.Trim();
                TrackingWorkFlowInteraction twfi = new TrackingWorkFlowInteraction();
                string id = twfi.startProcess(WFName);

                CommandInteraction          cmdInteraction = new CommandInteraction();
                Dictionary <string, string> paras          = new Dictionary <string, string>();
                paras.Add("InstanceId", id);
                paras.Add("WFName", CommandInfo.WFName);
                if (CommandInfo.ParameterList != null)
                {
                    foreach (Parameter p in CommandInfo.ParameterList)
                    {
                        paras.Add(p.Name, p.Value);
                    }
                }
                TrackingWorkFlowInteraction II = new TrackingWorkFlowInteraction();
                StateMachineDefinition      statemachineDefinition = II.getStateMachineDefinition(CommandInfo.WFName);
                paras.Add("QFEStatus", statemachineDefinition.InitialState);
                cmdInteraction.executeCommand(CommandInfo.CommandName, paras);


                wfi.Id = id;
                List <string>        candCmds = twfi.getCandidateCommands(WFName, id);
                CandidateCommandList ccl      = new CandidateCommandList();
                ccl.AddRange(candCmds);
                wfi.CandidateCommandList = ccl;
            }
            catch (Exception e)
            {
                throw new WebFaultException <string>(e.ToString(), HttpStatusCode.InternalServerError);
//                TrackingLog.Log(e.Message + "!!" + e.ToString());
            }
            return(wfi);
        }
示例#7
0
        public WorkFlowInstance GetWorkFlowInstance(string InstanceId)
        {
            WorkFlowInstance    wfi             = new WorkFlowInstance();
            TrackingDataContext trackingContext = new TrackingDataContext();
            Guid guid = new Guid(InstanceId);
            IQueryable <Tracking> trackingQuery =
                from tracking in trackingContext.Trackings
                where ((tracking.wfinstanceid == guid))
                select tracking;

            foreach (Tracking t in trackingQuery)
            {
                TrackingWorkFlowInteraction twfi = new TrackingWorkFlowInteraction();
                wfi = new WorkFlowInstance();
                List <string>        candCmds = twfi.getCandidateCommands(t.wfname, InstanceId);
                CandidateCommandList ccl      = new CandidateCommandList();
                ccl.AddRange(candCmds);
                wfi.CandidateCommandList = ccl;
                return(wfi);
            }
            return(null);
        }
示例#8
0
        public WorkFlowInstance startWorkFlow(CommandInfo CommandInfo)
        {
            string WFName = CommandInfo.WFName;
            TrackingWorkFlowInteraction twfi = new TrackingWorkFlowInteraction();

            string id=twfi.startProcess(WFName);

            WorkFlowInstance wfi = new WorkFlowInstance();
            wfi.Id = id;
            List<string> candCmds = twfi.getCandidateCommands(WFName, id);
            CandidateCommandList ccl = new CandidateCommandList();
            ccl.AddRange(candCmds);
            wfi.CandidateCommandList = ccl;
            return wfi;
        }
示例#9
0
        public WorkFlowInstance startWorkFlow(CommandInfo CommandInfo)
        {
            WorkFlowInstance wfi = new WorkFlowInstance();
            try
            {
                string WFName = CommandInfo.WFName.Trim();
                TrackingWorkFlowInteraction twfi = new TrackingWorkFlowInteraction();
                string id = twfi.startProcess(WFName);

                CommandInteraction cmdInteraction = new CommandInteraction();
                Dictionary<string, string> paras = new Dictionary<string, string>();
                paras.Add("InstanceId", id);
                paras.Add("WFName", CommandInfo.WFName);
                if (CommandInfo.ParameterList != null)
                {
                    foreach (Parameter p in CommandInfo.ParameterList)
                    {
                        paras.Add(p.Name, p.Value);
                    }
                }
                TrackingWorkFlowInteraction II = new TrackingWorkFlowInteraction();
                StateMachineDefinition statemachineDefinition = II.getStateMachineDefinition(CommandInfo.WFName);
                paras.Add("QFEStatus", statemachineDefinition.InitialState);
                cmdInteraction.executeCommand(CommandInfo.CommandName, paras);

                wfi.Id = id;
                List<string> candCmds = twfi.getCandidateCommands(WFName, id);
                CandidateCommandList ccl = new CandidateCommandList();
                ccl.AddRange(candCmds);
                wfi.CandidateCommandList = ccl;
            }
            catch (Exception e)
            {
                throw new WebFaultException<string>(e.ToString(), HttpStatusCode.InternalServerError);
            //                TrackingLog.Log(e.Message + "!!" + e.ToString());
            }
            return wfi;
        }