Beispiel #1
0
 public override void RestoreState(DataObject dob)
 {
     base.RestoreState(dob);
     if (dob.ContainsKey("DelayAmount"))
         DelayAmount = (string)dob["DelayAmount"];
     if (dob.ContainsKey("CompletedDate"))
     {
         _actualExpiration = (DateTime) Convert.ChangeType(dob["CompletedDate"], typeof(DateTime));
     }
     dob.TryGet("ExpirationDate", ref _setExpiration);
 }
Beispiel #2
0
 /// <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;
         }
     }
 }
 public override void RestoreState(DataObject dob)
 {
     base.RestoreState(dob);
     if (!dob.TryGet("Url", ref _url)) throw new Exception("Missing Url");
 }
 public override void RestoreState(DataObject dob)
 {
     base.RestoreState(dob);
     dob.TryGet("msgid", ref _msgid);
 }
 public override void RestoreState(DataObject dob)
 {
     base.RestoreState(dob);
     if (!dob.TryGet("MessageCorrelationId", ref _messageCorrelationId)) throw new Exception("MessageCorrelationId required");
 }
 public override void RestoreState(DataObject dob)
 {
     base.RestoreState(dob);
     Title = (string)dob["Title"];
     Description = (string)dob["Description"];
     AssigneeGroup = (string)dob["AssigneeGroup"];
     AssigneeId = (string)dob["AssigneeId"];
     CompletedBy = (string)dob["CompletedBy"];
     dob.TryGet("CompletedDate", ref _completedDate);
 }