/// <summary> /// Moves task {task} from the subtasks list of the /// epic task {epicTask} to the general tasks list in specified project. /// </summary> /// <param name="project">Project object</param> /// <param name="task">Simple/Story task object</param> /// <param name="epicTask">Epic task object</param> /// <exception cref="ArgumentException">Exception throws when the specified task is not /// simple or story.</exception> public void RemoveTaskFromEpic(Project project, IAssignable task, EpicTask epicTask) { switch (task) { case BugTask _: throw new ArgumentException("Unable to remove bug task from the epic task."); case SimpleTask simple: if (epicTask.SimpleTasks.Any(t => t.Id == simple.Id)) { epicTask.SimpleTasks.Remove( epicTask.SimpleTasks.Find(t => t.Id == simple.Id)); } break; case StoryTask story: if (epicTask.StoryTasks.Any(t => t.Id == story.Id)) { epicTask.StoryTasks.Remove( epicTask.StoryTasks.Find(t => t.Id == story.Id)); } break; default: throw new ArgumentException("This task wasn't located in this epic task."); } }
/// <summary> /// 实现任务分配工作,该方法一般的实现逻辑是: /// 首先根据performerName查询出所有的操作员,可以把performerName当作角色名称。 /// 然后调用asignable.asignToActor(String actorId,Boolean needSign)或者 /// asignable.asignToActor(String actorId)或者asignable.asignToActorS(List actorIds) /// 进行任务分配。 /// </summary> /// <param name="asignable">IAssignable实现类,在FireWorkflow中实际上就是TaskInstance对象。</param> /// <param name="performerName">角色名称</param> public void assign(IAssignable asignable, String performerName)// throws EngineException, KernelException { if (ActorIdsList == null || ActorIdsList.Count == 0) { TaskInstance taskInstance = (TaskInstance)asignable; throw new EngineException(taskInstance.ProcessInstanceId, taskInstance.WorkflowProcess, taskInstance.TaskId, "actorIdsList can not be empty"); } List <IWorkItem> workItems = asignable.assignToActors(ActorIdsList); ITaskInstance taskInst = (ITaskInstance)asignable; //如果不需要签收,这里自动进行签收,(FormTask的strategy="all"或者=any并且工作项数量为1) if (!IsNeedClaim) { if (FormTaskEnum.ALL == taskInst.AssignmentStrategy || (FormTaskEnum.ANY == taskInst.AssignmentStrategy && ActorIdsList.Count == 1)) { for (int i = 0; i < workItems.Count; i++) { IWorkItem wi = workItems[i]; wi.claim(); } } } }
public override bool CheckSemantic(List <Error> errors, SymbolTable symbolTable) { if (base.CheckSemantic(errors, symbolTable)) { //ya esta analizado que los dos sean del mismo tipo if (LeftOperand is IAssignable) { IAssignable leftHand = LeftOperand as IAssignable; if (leftHand.IsLValue) { Scope = symbolTable.TopScope.Clone(); ReturnType = TypeExpression.VoidType; return(true); } if (leftHand is IdentifierNode)//iteration var of for loop { string message = "The for iteration variable may not be assigned."; errors.Add(new Error(message, RightOperand.Line, RightOperand.CharPositionInLine)); } else//access to invalid lvalue { string message = "The left-hand side may not be used as an assigment target."; errors.Add(new Error(message, RightOperand.Line, RightOperand.CharPositionInLine)); } } else//function call, constant (Note:grammar allow this expressions as LValue) { string message = "The left-hand side may not be used as an assigment target."; errors.Add(new Error(message, RightOperand.Line, RightOperand.CharPositionInLine)); } } ReturnType = TypeExpression.ErrorType; return(false); }
public CallingParametersList GetParametersForCallFromXmlNode(XmlNode node, XmlNamespaceManager nsmgr) { var cpl = new List <IAssignable>(); if (node != null) { var parametersCount = node.SelectNodes("gxml:mutation/gxml:arg", nsmgr).Count; for (int i = 0; i < parametersCount; i++) { IAssignable toAdd = null; var currentArgBlock = node.SelectSingleNode($"gxml:value[@name=\"ARG{i}\"]/gxml:block", nsmgr); if (currentArgBlock != null) { toAdd = GetAssignableFromXmlNode(currentArgBlock, nsmgr); } cpl.Add(toAdd ?? new ConstantValue() { Value = string.Empty }); } } return(new CallingParametersList() { Parameters = cpl }); }
Assignment ParseFunctionDecl(ParseTreeNode node) { if (node.Term.Name == "FunctionDecl") { IAssignable expr = ParseVariable(node.ChildNodes[1]); ParseTreeNode argsNode = node.ChildNodes[3].ChildNodes[0]; ParseTreeNode chunkNode = node.ChildNodes[4]; Block block = ParseBlock(chunkNode); FunctionDefinition def = new FunctionDefinition(); def.Arguments = new List <Argument>(); var nameNode = node.ChildNodes[2]; if (nameNode.ChildNodes.Count > 0) { def.Arguments.Add(new Argument() { Name = "self" }); expr = new Variable() { Name = nameNode.ChildNodes[0].Token.ValueString, Prefix = expr }; } def.Body = block; if (argsNode.ChildNodes.Count > 0) { argsNode = argsNode.ChildNodes[0]; while (argsNode.ChildNodes.Count > 0) { if (argsNode.ChildNodes[0].Term.Name == "Varargs") { def.Varargs = true; } else { string ident = argsNode.ChildNodes[0].Token.ValueString; def.Arguments.Add(new Argument() { Name = ident }); } if (argsNode.ChildNodes.Count == 1) { break; } argsNode = argsNode.ChildNodes[1]; } } Assignment assign = new Assignment(); assign.Variables.Add(expr); assign.Expressions.Add(def); return(assign); } throw new Exception("Invalid FunctionDecl node"); }
public AssignStatement(IAssignable <T> lExpression, IExpression <T> rExpression) { this.lExpression = lExpression; this.rExpression = rExpression; if (this.lExpression is Variable) { ((Variable)this.lExpression).SetType(rExpression.Type); } }
static void SetAssignable(IAssignable Expression, LuaObject Value, LuaContext Context) { if (Expression is Variable) { SetVariable(Expression as Variable, Value, Context); } else { SetTable(Expression as TableAccess, Value, Context); } }
internal void addSearchHistory(IAssignable item, User searcher) { QmsWorkitemviewlog log = new QmsWorkitemviewlog(); log.Createdat = DateTime.Now; log.Workitemid = item.Id; log.WorkItemTypeCode = item.WorkItemType; log.Userid = searcher.UserId; context.Add(log); context.SaveChanges(); }
/// <summary> /// Removes user from subtask. /// </summary> /// <param name="subtaskName"></param> /// <param name="userName"></param> public void RemoveUserFromSubtask(string subtaskName, string userName) { Task subtaskToRemoveUserFrom; if ((subtaskToRemoveUserFrom = subTaskList.Find(x => x.TaskName == subtaskName)) == default(Task)) { throw new ArgumentException($"Subtask with name {subtaskName} not found."); } IAssignable subtaskToIAssignable = (IAssignable)subtaskToRemoveUserFrom; subtaskToIAssignable.RemoveUser(userName); }
public void AddComment(IAssignable item, User author, string message) { QmsWorkitemcomment comment = new QmsWorkitemcomment(); comment.Message = message; comment.WorkItemId = item.Id; comment.WorkItemTypeCode = item.WorkItemType; comment.AuthorId = author.UserId; comment.CreatedAt = DateTime.Now; context.Add(comment); context.SaveChanges(); }
/// <summary> /// Assigns user to subtask. /// </summary> /// <param name="subtaskName"></param> /// <param name="userName"></param> public void AssignUserToSubtask(string subtaskName, string userName) { Task taskToAddUserTo; if ((taskToAddUserTo = subTaskList.Find(x => x.TaskName == subtaskName)) == default(Task)) { throw new ArgumentException($"Subtask with name {subtaskName} not found."); } IAssignable subtaskToIAssignable = (IAssignable)taskToAddUserTo; subtaskToIAssignable.AddUser(userName); }
public bool Match(IXMLLuaSearchAssignable req, IAssignable real) { Logger.Debug($"Match assignable {req} -> {real}"); if (req is XMLLuaSearchVariable && real is Variable) { return(Match((XMLLuaSearchVariable)req, (Variable)real)); } if (req is XMLLuaSearchTableAccess && real is TableAccess) { return(Match((XMLLuaSearchTableAccess)req, (TableAccess)real)); } return(false); }
public void assign(IAssignable asignable, string performerName) { TaskInstance taskInstance = (TaskInstance)asignable; IProcessInstance processInstance = taskInstance.AliveProcessInstance; String creator = processInstance.CreatorId; if (creator == null) { throw new EngineException(processInstance, taskInstance.Task, "分配工单错误,流程创建者Id为null"); } asignable.assignToActor(creator); }
public void assign(IAssignable arg0, String arg1) { HttpContext context = HttpContext.Current; if (context != null) { //将当前用户设置为操作员 IWorkItem wi = arg0.assignToActor(context.User.Identity.Name); //假设在目前的两个example中都规定:首个环节信息录入后,立即提交到下一个环节。 //则需要对新创建的WorkItem执行 claim()和complete()操作。 wi.claim(); wi.complete("系统自动提交任务。"); } }
internal void addHistory(IAssignable item, User actionTakenByUser, string ActionDescription) { QmsWorkitemhistory itemHistory = new QmsWorkitemhistory(); itemHistory.ActionTakenByUserId = actionTakenByUser.UserId; itemHistory.CreatedAt = DateTime.Now; itemHistory.WorkItemId = item.Id; itemHistory.PreviousStatusId = item.StatusId; itemHistory.PreviousAssignedByUserId = item.AssignedByUserId; itemHistory.PreviousAssignedToOrgId = item.AssignedToOrgId; itemHistory.PreviousAssignedtoUserId = item.AssignedToUserId; itemHistory.ActionDescription = ActionDescription; itemHistory.WorkItemTypeCode = item.WorkItemType; context.Add(itemHistory); context.SaveChanges(); }
private IAction TAssignStatement(IAssignable lExpression) { Consume(TokenType.Assign); var rExpression = TExpression(); if (rExpression.Type == typeof(double)) { return(new AssignStatement <double>((IAssignable <double>)lExpression, (IExpression <double>)rExpression)); } else if (rExpression.Type == typeof(string)) { return(new AssignStatement <string>((IAssignable <string>)lExpression, (IExpression <string>)rExpression)); } else // if (rExpression.Type == typeof(bool)) { return(new AssignStatement <bool>((IAssignable <bool>)lExpression, (IExpression <bool>)rExpression)); } }
/// <summary> /// Moves task {task} to the subtasks list of the /// epic task {epicTask} in specified project. /// </summary> /// <param name="project">Project object</param> /// <param name="task">Simple/Story task object</param> /// <param name="epicTask">Epic task object</param> /// <exception cref="ArgumentException">Exception throws when the specified task is not /// simple or story.</exception> public void InsertTaskToEpic(Project project, IAssignable task, EpicTask epicTask) { switch (task) { case BugTask _: throw new ArgumentException("Unable to insert bug task to the epic task."); case SimpleTask simple: epicTask.SimpleTasks.Add(simple); break; case StoryTask story: epicTask.StoryTasks.Add(story); break; default: throw new ArgumentException("Invalid task."); } }
private void EvalAssignable(IAssignable assignable, Object target) { if (assignable == null) { return; } switch (assignable.GetType().Name) { case Assignables.Variable: { Variable variable = assignable as Variable; context.Set(variable.Name, target); break; } default: Debug.LogWarning($"unknown assignable: {assignable.GetType().Name}"); break; } }
/// <summary> /// <para>实现任务分配工作,该方法一般的实现逻辑是:</para> /// <para>首先根据performerName查询出所有的操作员,可以把performerName当作角色名称。</para> /// <para>然后调用asignable.asignToActor(String actorId,Boolean needSign)或者</para> /// <para>asignable.asignToActor(String actorId)或者asignable.asignToActorS(List actorIds)</para> /// 进行任务分配。 /// </summary> /// <param name="asignable">IAssignable实现类,在FireWorkflow中实际上就是TaskInstance对象。</param> /// <param name="performerName">角色名称</param> public void assign(IAssignable asignable, string performerName) { ITaskInstance taskInst = (ITaskInstance)asignable; String roleName = performerName == null ? "" : performerName.Trim(); List<String> users = new List<string>(); switch (roleName) { case "WarehouseKeeper": users = new List<string>() { "warehousekeeper1", "warehousekeeper2" }; break; case "Deliveryman": users = new List<string>() { "deliveryman1", "deliveryman2", "deliveryman3" }; break; case "RiskEvaluator": users = new List<string>() { "riskevaluator1", "riskevaluator2" }; break; case "Approver": users = new List<string>() { "approver1", "approver2", "approver3" }; break; case "LendMoneyOfficer": users = new List<string>() { "lendmoneyofficer1" }; break; default: break; } if (users == null || users.Count <= 0) { throw new EngineException(taskInst.ProcessInstanceId, taskInst.WorkflowProcess, taskInst.TaskId, "没有任何用户和角色" + performerName + "相关联,无法分配任务实例[id=" + taskInst.Id + ",任务名称=" + taskInst.DisplayName); } List<String> userIds = new List<string>(); foreach (string item in users) { userIds.Add(item); } asignable.assignToActors(userIds); }
public void Invalid(IAssignable toAssign) { _assignable = toAssign.AssignMe; }
public void AlsoValidAsWell(IAssignable toAssign) { _assignable = toAssign; }
public void AlsoValid(IAssignable toAssign) { _assignable.AssignMe = toAssign.AssignMe; }
/// <summary> /// Convenience method to pass values to an assignable command, and return the command. This is useful for /// fluent-based configuration method calls. /// </summary> /// <typeparam name="TKey">The key type.</typeparam> /// <typeparam name="TValue">The value type.</typeparam> /// <param name="this">The assignable to command to invoke.</param> /// <param name="key">The key to pass in.</param> /// <param name="value">The value to pass in.</param> /// <returns>The assignable command.</returns> public static IAssignable <TKey, TValue> Apply <TKey, TValue>(this IAssignable <TKey, TValue> @this, TKey key, TValue value) { @this.Assign(key, value); return(@this); }
public static AbstractExpression ASSIGN(this IAssignable target, AbstractExpression value) => null;
/// <summary> /// <para>实现任务分配工作,该方法一般的实现逻辑是:</para> /// <para>首先根据performerName查询出所有的操作员,可以把performerName当作角色名称。</para> /// <para>然后调用asignable.asignToActor(String actorId,Boolean needSign)或者</para> /// <para>asignable.asignToActor(String actorId)或者asignable.asignToActorS(List actorIds)</para> /// 进行任务分配。 /// </summary> /// <param name="asignable">IAssignable实现类,在FireWorkflow中实际上就是TaskInstance对象。</param> /// <param name="performerName">角色名称</param> public void assign(IAssignable asignable, string performerName) { ITaskInstance taskInst = (ITaskInstance)asignable; String roleName = performerName == null ? "" : performerName.Trim(); List <String> users = new List <string>(); switch (roleName) { case "WarehouseKeeper": users = new List <string>() { "warehousekeeper1", "warehousekeeper2" }; break; case "Deliveryman": users = new List <string>() { "deliveryman1", "deliveryman2", "deliveryman3" }; break; case "RiskEvaluator": users = new List <string>() { "riskevaluator1", "riskevaluator2" }; break; case "Approver": users = new List <string>() { "approver1", "approver2", "approver3" }; break; case "LendMoneyOfficer": users = new List <string>() { "lendmoneyofficer1" }; break; default: break; } if (users == null || users.Count <= 0) { throw new EngineException(taskInst.ProcessInstanceId, taskInst.WorkflowProcess, taskInst.TaskId, "没有任何用户和角色" + performerName + "相关联,无法分配任务实例[id=" + taskInst.Id + ",任务名称=" + taskInst.DisplayName); } List <String> userIds = new List <string>(); foreach (string item in users) { userIds.Add(item); } asignable.assignToActors(userIds); }
/// <summary> /// Very simple method. /// </summary> /// <param name="task">IAssignable task object</param> /// <param name="user">User object</param> public void UnassignUserFromTask(IAssignable task, User user) { task.RemoveExecutor(GetUserById(user.Id)); }
public void Valid(IAssignable toAssign) { _assignable.AssignMe = toAssign; }
/// <summary> /// Very simple method. /// </summary> /// <param name="task">IAssignable task object</param> /// <param name="user">User object</param> public void AssignUserToTask(IAssignable task, User user) { task.AddExecutor(GetUserById(user.Id)); }
public ForeachStatement(IAssignable variable, IExpression enumerable, IStatement statement) : base(statement) { this.variable = variable; this.enumerable = enumerable; }
private Object EvalStatement(IStatement statement) { if (statement == null) { return(null); } string typeName = statement.GetType().Name; // When you wanna see the process of evaluation // Debug.Log(typeName); // switch (typeName) { case Statements.Assignment: { Assignment assignment = statement as Assignment; for (int i = 0; i < assignment.Values.Count; i++) { IExpression expr = assignment.Values[i]; IAssignable assignable = assignment.Targets[i]; Object result = EvalExpr(expr); if (result.IsError()) { return(result); } EvalAssignable(assignable, result); } break; } case Statements.If: { If ifStmt = statement as If; if (EvalExpr(ifStmt.MainIf.Condition).ToBool().value) { return(EvaluateNode(ifStmt.MainIf.Block)); } if (ifStmt.ElseIfs != null) { foreach (ConditionalBlock condition in ifStmt.ElseIfs) { if (EvalExpr(condition.Condition).ToBool().value) { return(EvaluateNode(condition.Block)); } } } if (ifStmt.Else != null) { return(EvaluateNode(ifStmt.Else)); } break; } case Statements.FunctionCall: { FunctionCall fc = statement as FunctionCall; Object function = EvalExpr(fc.Function); Object[] parameters = new Object[fc.Arguments.Count]; for (int i = 0; i < fc.Arguments.Count; ++i) { parameters[i] = EvalExpr(fc.Arguments[i]); if (parameters[i].GetType() == Error.Name) { return(parameters[i]); } } if (function.GetType() != Function.Name) { return(new Error($"function call is not a function")); } Function fn = function as Function; return(fn.Call(parameters)); } case Statements.Return: { Return returnStmt = statement as Return; foreach (IExpression expr in returnStmt.Expressions) { return(EvalExpr(expr)); } break; } default: Debug.LogWarning($"unknown statement {typeName}"); break; } return(Null.NULL); }
// throws EngineException, KernelException /// <summary> /// 实现任务分配工作,该方法一般的实现逻辑是: /// 首先根据performerName查询出所有的操作员,可以把performerName当作角色名称。 /// 然后调用asignable.asignToActor(String actorId,Boolean needSign)或者 /// asignable.asignToActor(String actorId)或者asignable.asignToActorS(List actorIds) /// 进行任务分配。 /// </summary> /// <param name="asignable">IAssignable实现类,在FireWorkflow中实际上就是TaskInstance对象。</param> /// <param name="performerName">角色名称</param> public void assign(IAssignable asignable, String performerName) { if (ActorIdsList == null || ActorIdsList.Count == 0) { TaskInstance taskInstance = (TaskInstance)asignable; throw new EngineException(taskInstance.ProcessInstanceId, taskInstance.WorkflowProcess, taskInstance.TaskId, "actorIdsList can not be empty"); } List<IWorkItem> workItems = asignable.assignToActors(ActorIdsList); ITaskInstance taskInst = (ITaskInstance)asignable; //如果不需要签收,这里自动进行签收,(FormTask的strategy="all"或者=any并且工作项数量为1) if (!IsNeedClaim) { if (FormTaskEnum.ALL==taskInst.AssignmentStrategy || (FormTaskEnum.ANY==taskInst.AssignmentStrategy && ActorIdsList.Count == 1)) { for (int i = 0; i < workItems.Count; i++) { IWorkItem wi = workItems[i]; wi.claim(); } } } }