private static void FillStatusAndAssignees(WfClientMainStreamActivityDescriptor client, IWfMainStreamActivityDescriptor server) { IWfActivity actInstance = server.Activity.ProcessInstance.Activities. FindActivityByDescriptorKey(server.Activity.Key); if (actInstance != null) { client.Status = actInstance.Status.ToClientActivityStatus(); client.Elapsed = server.Elapsed; client.ActivityInstanceID = actInstance.ID; client.Operator = (WfClientUser)actInstance.Operator.ToClientOguObject(); client.BranchProcessGroupsCount = actInstance.BranchProcessGroups.Count; client.FromTransitionDescriptor = ConvertServerTransitionToClient(actInstance.FromTransitionDescriptor); client.ToTransitionDescriptor = ConvertServerTransitionToClient(actInstance.ToTransitionDescriptor); if (actInstance.Assignees.Count != 0) { WfClientAssigneeCollectionConverter.Instance.ServerToClient(actInstance.Assignees, client.Assignees); } else { WfAssigneeCollection candidates = actInstance.Candidates.GetSelectedAssignees(); WfClientAssigneeCollectionConverter.Instance.ServerToClient(candidates, client.Assignees); } } }
private static void FillStatusAndAssignees(WfClientMainStreamActivityDescriptor client, IWfMainStreamActivityDescriptor server) { IWfActivity actInstance = server.Activity.ProcessInstance.Activities. FindActivityByDescriptorKey(server.Activity.Key); if (actInstance != null) { client.Status = actInstance.Status.ToClientActivityStatus(); client.Elapsed = server.Elapsed; client.ActivityInstanceID = actInstance.ID; client.Operator = (WfClientUser)actInstance.Operator.ToClientOguObject(); client.BranchProcessGroupsCount = actInstance.BranchProcessGroups.Count; client.FromTransitionDescriptor = ConvertServerTransitionToClient(actInstance.FromTransitionDescriptor); client.ToTransitionDescriptor = ConvertServerTransitionToClient(actInstance.ToTransitionDescriptor); if (actInstance.Assignees.Count != 0) { WfClientAssigneeCollectionConverter.Instance.ServerToClient(actInstance.Assignees, client.Assignees); } else { WfAssigneeCollection candidates = actInstance.Candidates.GetSelectedAssignees(); WfClientAssigneeCollectionConverter.Instance.ServerToClient(candidates, client.Assignees); } } }
public void ServerToClient(IWfMainStreamActivityDescriptor server, ref WfClientMainStreamActivityDescriptor client) { server.NullCheck("server"); WfClientActivityDescriptor clientActDesp = null; WfClientActivityDescriptorConverter.Instance.ServerToClient((WfActivityDescriptor)server.Activity, ref clientActDesp); if (client == null) { client = new WfClientMainStreamActivityDescriptor(clientActDesp); } client.Level = server.Level; foreach (WfActivityDescriptor actDesp in server.AssociatedActivities) { WfClientActivityDescriptor cad = null; WfClientActivityDescriptorConverter.Instance.ServerToClient(actDesp, ref cad); client.AssociatedActivities.Add(cad); } FillStatusAndAssignees(client, server); }
public void ServerToClient(IEnumerable <IWfMainStreamActivityDescriptor> server, WfClientMainStreamActivityDescriptorCollection client) { server.NullCheck("server"); client.NullCheck("client"); client.Clear(); foreach (IWfMainStreamActivityDescriptor msActDesp in server) { WfClientMainStreamActivityDescriptor clientMSActDesp = null; WfClientMainStreamActivityDescriptorConverter.Instance.ServerToClient(msActDesp, ref clientMSActDesp); client.Add(clientMSActDesp); } }
public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer) { WfClientMainStreamActivityDescriptor result = new WfClientMainStreamActivityDescriptor(); result.Activity = JSONSerializerExecute.Deserialize<WfClientActivityDescriptor>(dictionary.GetValue("activity", (object)null)); result.ActivityInstanceID = dictionary.GetValue("activityInstanceID", string.Empty); result.Level = dictionary.GetValue("level", 0); result.Elapsed = dictionary.GetValue("elapsed", false); result.BranchProcessGroupsCount = dictionary.GetValue("branchProcessGroupsCount", 0); result.Status = dictionary.GetValue("status", WfClientActivityStatus.NotRunning); result.Operator = JSONSerializerExecute.Deserialize<WfClientUser>(dictionary.GetValue("operator", (object)null)); result.FromTransitionDescriptor = JSONSerializerExecute.Deserialize<WfClientTransitionDescriptor>(dictionary.GetValue("fromTransitionDescriptor", (object)null)); result.ToTransitionDescriptor = JSONSerializerExecute.Deserialize<WfClientTransitionDescriptor>(dictionary.GetValue("toTransitionDescriptor", (object)null)); JSONSerializerExecute.FillDeserializedCollection(dictionary.GetValue("assignees", (object)null), result.Assignees); JSONSerializerExecute.FillDeserializedCollection(dictionary.GetValue("associatedActivities", (object)null), result.AssociatedActivities); return result; }
public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer) { WfClientMainStreamActivityDescriptor result = new WfClientMainStreamActivityDescriptor(); result.Activity = JSONSerializerExecute.Deserialize <WfClientActivityDescriptor>(dictionary.GetValue("activity", (object)null)); result.ActivityInstanceID = dictionary.GetValue("activityInstanceID", string.Empty); result.Level = dictionary.GetValue("level", 0); result.Elapsed = dictionary.GetValue("elapsed", false); result.BranchProcessGroupsCount = dictionary.GetValue("branchProcessGroupsCount", 0); result.Status = dictionary.GetValue("status", WfClientActivityStatus.NotRunning); result.Operator = JSONSerializerExecute.Deserialize <WfClientUser>(dictionary.GetValue("operator", (object)null)); result.FromTransitionDescriptor = JSONSerializerExecute.Deserialize <WfClientTransitionDescriptor>(dictionary.GetValue("fromTransitionDescriptor", (object)null)); result.ToTransitionDescriptor = JSONSerializerExecute.Deserialize <WfClientTransitionDescriptor>(dictionary.GetValue("toTransitionDescriptor", (object)null)); JSONSerializerExecute.FillDeserializedCollection(dictionary.GetValue("assignees", (object)null), result.Assignees); JSONSerializerExecute.FillDeserializedCollection(dictionary.GetValue("associatedActivities", (object)null), result.AssociatedActivities); return(result); }
public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer) { WfClientMainStreamActivityDescriptor clientMSActDesp = (WfClientMainStreamActivityDescriptor)obj; Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary.AddNonDefaultValue("activityInstanceID", clientMSActDesp.ActivityInstanceID); dictionary.AddNonDefaultValue("level", clientMSActDesp.Level); dictionary.AddNonDefaultValue("elapsed", clientMSActDesp.Elapsed); dictionary.AddNonDefaultValue("activity", clientMSActDesp.Activity); dictionary.AddNonDefaultValue("branchProcessGroupsCount", clientMSActDesp.BranchProcessGroupsCount); dictionary["status"] = clientMSActDesp.Status; dictionary["operator"] = clientMSActDesp.Operator; dictionary.Add("fromTransitionDescriptor", clientMSActDesp.FromTransitionDescriptor); dictionary.Add("toTransitionDescriptor", clientMSActDesp.ToTransitionDescriptor); dictionary.Add("assignees", clientMSActDesp.Assignees); dictionary.Add("associatedActivities", clientMSActDesp.AssociatedActivities); return(dictionary); }
public void ServerToClient(IWfMainStreamActivityDescriptor server, ref WfClientMainStreamActivityDescriptor client) { server.NullCheck("server"); WfClientActivityDescriptor clientActDesp = null; WfClientActivityDescriptorConverter.Instance.ServerToClient((WfActivityDescriptor)server.Activity, ref clientActDesp); if (client == null) client = new WfClientMainStreamActivityDescriptor(clientActDesp); client.Level = server.Level; foreach (WfActivityDescriptor actDesp in server.AssociatedActivities) { WfClientActivityDescriptor cad = null; WfClientActivityDescriptorConverter.Instance.ServerToClient(actDesp, ref cad); client.AssociatedActivities.Add(cad); } FillStatusAndAssignees(client, server); }