(self)
return 'Event workflow migration on %s : %s -> %s' % (
      self.getPath(), current_state, new_state)
Migrate event_workflow history to event_simulation_workflow history.
Migrate event_workflow history to event_simulation_workflow history.
Migrate event_workflow history to event_simulation_workflow history .
def migrateEventWorkflowHistory(self):
  """
  Migrate event_workflow history to event_simulation_workflow history.
  """
  portal_type = self.getPortalType()
  portal = self.getPortalObject()
  if portal_type not in portal.getPortalEventTypeList():
    return
  workflow_history = getattr(self, 'workflow_history', None)
  if workflow_history is None:
    return
  event_workflow = workflow_history.get('event_workflow', None)
  if event_workflow is None:
    return
  event_simulation_workflow = workflow_history.get('event_simulation_workflow', None)
  if event_simulation_workflow is not None:
    # already migrated.
    return
  self.workflow_history['event_simulation_workflow'] = \
      WorkflowHistoryList(event_workflow[:])
  migrate_state_dict = {
    'acknowledged':'delivered',
    'assigned':'stopped',
    'expired':'delivered',
    'new':'stopped',
    'ordered':'confirmed',
    'responded':'delivered',
  }
  current_state = event_workflow[-1]['simulation_state']
  new_state = migrate_state_dict.get(current_state, None)
  if new_state is None:
    # no need to change the state.
    return
  workflow_tool = portal.portal_workflow
  workflow_tool._jumpToStateFor(self, new_state)
  self.reindexObject()
  return 'Event workflow migration on %s : %s -> %s' % (
      self.getPath(), current_state, new_state)
def migrateEventWorkflowHistory ( self ) : portal_type = self . getPortalType ( ) portal = self . getPortalObject ( ) if portal_type not in portal . getPortalEventTypeList ( ) : return workflow_history = getattr ( self , 'workflow_history' , None ) if workflow_history is None : return event_workflow = workflow_history . get ( 'event_workflow' , None ) if event_workflow is None : return event_simulation_workflow = workflow_history . get ( 'event_simulation_workflow' , None ) if event_simulation_workflow is not None : # already migrated. return self . workflow_history [ 'event_simulation_workflow' ] = WorkflowHistoryList ( event_workflow [ : ] ) migrate_state_dict = { 'acknowledged' : 'delivered' , 'assigned' : 'stopped' , 'expired' : 'delivered' , 'new' : 'stopped' , 'ordered' : 'confirmed' , 'responded' : 'delivered' , } current_state = event_workflow [ - 1 ] [ 'simulation_state' ] new_state = migrate_state_dict . get ( current_state , None ) if new_state is None : # no need to change the state. return workflow_tool = portal . portal_workflow workflow_tool . _jumpToStateFor ( self , new_state ) self . reindexObject ( ) return 'Event workflow migration on %s : %s -> %s' % ( self . getPath ( ) , current_state , new_state )