예제 #1
0
 /// <summary>
 /// Set Process State and update Actions
 /// </summary>
 /// <param name="WFState">WFState</param>
 public new void   SetWFState(String WFState)
 {
     if (_state == null)
     {
         _state = new StateEngine(GetWFState());
         _state.SetCtx(GetCtx());
     }
     if (_state.IsClosed())
     {
         return;
     }
     if (GetWFState().Equals(WFState))
     {
         return;
     }
     //
     if (_state.IsValidNewState(WFState))
     {
         log.Fine(ToString() + " => " + WFState);
         base.SetWFState(WFState);
         _state = new StateEngine(GetWFState());
         _state.SetCtx(GetCtx());
         if (_state.IsClosed() || _state.IsBackground())
         {
             SetProcessed(true);
         }
         Save();
         //	Force close to all Activities
         if (_state.IsClosed() || _state.IsBackground())
         {
             MWFActivity[] activities = GetActivities(true, true);       //	requery only active
             for (int i = 0; i < activities.Length; i++)
             {
                 if (!activities[i].IsClosed())
                 {
                     activities[i].SetTextMsg("Process:" + WFState);
                     activities[i].SetWFState(WFState);
                 }
                 if (!activities[i].IsProcessed())
                 {
                     activities[i].SetProcessed(true);
                 }
                 activities[i].Save();
             }
         }       //	closed
     }
     else
     {
         log.Log(Level.SEVERE, "Ignored Invalid Transformation " + ToString() + " => " + WFState);
     }
 }