当前位置: 首页>>代码示例>>C#>>正文


C# DataObject.GetArray方法代码示例

本文整理汇总了C#中DataObject.GetArray方法的典型用法代码示例。如果您正苦于以下问题:C# DataObject.GetArray方法的具体用法?C# DataObject.GetArray怎么用?C# DataObject.GetArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataObject的用法示例。


在下文中一共展示了DataObject.GetArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RestoreState

 /// <summary>
 /// Restore process state from a DataObject (obtained by calling SaveProcessState).
 /// This is the preferred way of storing process state in NGinn. Of course
 /// process instance can be binary serialized and saved, but the binary format
 /// causes problems when upgrading class versions.
 /// </summary>
 /// <param name="dob"></param>
 public void RestoreState(DataObject dob)
 {
     if (this._activated) throw new ApplicationException("Restore is not possible after activation");
     string v = (string) dob["APIVersion"];
     if (!APIVERSION.Equals(v))
     {
         log.Warn("Trying to restore process state from version {0}. API version is {1}", v, APIVERSION);
     }
     _instId = (string) dob["InstanceId"];
     _definitionId = (string) dob["ProcessDefinitionId"];
     _status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), (string) dob["Status"]);
     _persistedVersion = Convert.ToInt32(dob["PersistedVersion"]);
     _processInstanceData = (DataObject) dob["InstanceData"];
     _correlationId = (string)dob["CorrelationId"];
     _tokenNumber = Convert.ToInt32(dob["TokenNumber"]);
     _transitionNumber = Convert.ToInt32(dob["TransitionNumber"]);
     IList l = dob.GetArray("Token");
     _tokens = new Dictionary<string, Token>();
     if (l != null)
     {
         foreach (DataObject dob2 in l)
         {
             Token tok = new Token();
             tok.RestoreState(dob2);
             _tokens[tok.TokenId] = tok;
         }
     }
     _activeTransitions = new Dictionary<string, TaskShell>();
     l = dob.GetArray("Transition");
     if (l != null)
     {
         foreach (DataObject dob2 in l)
         {
             TaskShell ts = TaskShell.RestoreTaskShell(dob2);
             _activeTransitions[ts.CorrelationId] = ts;
         }
     }
     foreach (Token tok in _tokens.Values)
     {
         if (tok.Status != TokenStatus.CONSUMED &&
             tok.Status != TokenStatus.CANCELLED)
         {
             foreach (string atid in tok.ActiveTransitions)
             {
                 if (!_activeTransitions.ContainsKey(atid)) throw new Exception("Invalid transition id: " + atid);
             }
         }
     }
     foreach (TaskShell ts in _activeTransitions.Values)
     {
         if (ts.Status == TransitionStatus.ENABLED ||
             ts.Status == TransitionStatus.STARTED)
         {
             foreach (string tokid in ts.Tokens)
             {
                 if (!_tokens.ContainsKey(tokid)) throw new Exception("Invalid token: " + tokid);
             }
         }
     }
 }
开发者ID:alasdairhurst,项目名称:nginn,代码行数:67,代码来源:ProcessInstance_081002.cs

示例2: RestoreState

 /// <summary>
 /// Restore process state from a DataObject (obtained by calling SaveProcessState).
 /// This is the preferred way of storing process state in NGinn. Of course
 /// process instance can be binary serialized and saved, but the binary format
 /// causes problems when upgrading class versions.
 /// </summary>
 /// <param name="dob"></param>
 public void RestoreState(DataObject dob)
 {
     if (this._activated) throw new ApplicationException("Restore is not possible after activation");
     string v = (string) dob["APIVersion"];
     if (!APIVERSION.Equals(v))
     {
         log.Warn("Trying to restore process state from version {0}. API version is {1}", v, APIVERSION);
     }
     DateTime dt = DateTime.MinValue;
     _instId = (string) dob["InstanceId"];
     _definitionId = (string) dob["ProcessDefinitionId"];
     _status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), (string) dob["Status"]);
     _persistedVersion = Convert.ToInt32(dob["PersistedVersion"]);
     _startedBy = (string)dob["StartedBy"];
     dob.TryGet("StartDate", ref _startDate);
     if (dob.TryGet("FinishDate", ref dt)) FinishDate = dt;
     DataObject vars = (DataObject)dob["InstanceData"];
     _processInstanceData = new DataObject();
     _processInstanceData["variables"] = vars;
     _correlationId = (string)dob["CorrelationId"];
     _transitionNumber = Convert.ToInt32(dob["TransitionNumber"]);
     _currentMarking = new Dictionary<string, int>();
     IList l = dob.GetArray("Marking");
     if (l != null)
     {
         foreach (DataObject d2 in l)
         {
             string plid = (string)d2["Place"];
             int n = Convert.ToInt32(d2["Tokens"]);
             _currentMarking[plid] = n;
         }
     }
     _activeTransitions = new Dictionary<string, TaskShell>();
     IList l2 = dob.GetArray("Transition");
     if (l2 != null)
     {
         foreach (DataObject dob2 in l2)
         {
             TaskShell ts = TaskShell.RestoreTaskShell(dob2);
             _activeTransitions[ts.CorrelationId] = ts;
         }
     }
 }
开发者ID:alasdairhurst,项目名称:nginn,代码行数:50,代码来源:ProcessInstance.cs

示例3: RestoreState

 /// <summary>
 /// Restore task shell's state
 /// </summary>
 /// <param name="state"></param>
 public virtual void RestoreState(DataObject state)
 {
     RequireActivation(false);
     CorrelationId = (string)state["CorrelationId"];
     TaskId = (string)state["TaskId"];
     _status = (TransitionStatus)Enum.Parse(typeof(TransitionStatus), (string)state["Status"]);
     SharedId = (string)state["SharedId"];
     IList lst = state.GetArray("AllocatedPlaces");
     if (lst != null)
     {
         List<string> ls = new List<string>();
         foreach (string s in lst) ls.Add(s);
         SetAllocatedPlaces(ls);
     }
     _taskState = (DataObject)state["Task"];
 }
开发者ID:alasdairhurst,项目名称:nginn,代码行数:20,代码来源:TaskShell.cs


注:本文中的DataObject.GetArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。