schemas/workflow.py
branchstable
changeset 3628 440931181322
parent 3529 87b5086fd6a7
child 3629 559cad62c786
child 3877 7ca53fc72a0a
child 3961 d1cbf77db999
equal deleted inserted replaced
3627:70dbba754c11 3628:440931181322
    90     """use to define a transition from one or multiple states to a destination
    90     """use to define a transition from one or multiple states to a destination
    91     states in workflow's definitions.
    91     states in workflow's definitions.
    92     """
    92     """
    93     __specializes_schema__ = True
    93     __specializes_schema__ = True
    94 
    94 
    95     destination_state = SubjectRelation('State', cardinality='1*',
    95     destination_state = SubjectRelation(
    96                                         constraints=[RQLConstraint('S transition_of WF, O state_of WF')],
    96         'State', cardinality='1*',
    97                                         description=_('destination state for this transition'))
    97         constraints=[RQLConstraint('S transition_of WF, O state_of WF')],
       
    98         description=_('destination state for this transition'))
    98 
    99 
    99 
   100 
   100 class WorkflowTransition(BaseTransition):
   101 class WorkflowTransition(BaseTransition):
   101     """special transition allowing to go through a sub-workflow"""
   102     """special transition allowing to go through a sub-workflow"""
   102     __specializes_schema__ = True
   103     __specializes_schema__ = True
   103 
   104 
   104     subworkflow = SubjectRelation('Workflow', cardinality='1*',
   105     subworkflow = SubjectRelation('Workflow', cardinality='1*',
   105                                   constraints=[RQLConstraint('S transition_of WF, WF workflow_of ET, O workflow_of ET')])
   106                                   constraints=[RQLConstraint('S transition_of WF, WF workflow_of ET, O workflow_of ET')])
   106     subworkflow_exit = SubjectRelation('SubWorkflowExitPoint', cardinality='+1',
   107     # XXX use exit_of and inline it
       
   108     subworkflow_exit = SubjectRelation('SubWorkflowExitPoint', cardinality='*1',
   107                                        composite='subject')
   109                                        composite='subject')
   108 
   110 
   109 
   111 
   110 class SubWorkflowExitPoint(EntityType):
   112 class SubWorkflowExitPoint(EntityType):
   111     """define how we get out from a sub-workflow"""
   113     """define how we get out from a sub-workflow"""
   112     subworkflow_state = SubjectRelation('State', cardinality='1*',
   114     subworkflow_state = SubjectRelation(
   113                                         constraints=[RQLConstraint('T subworkflow_exit S, T subworkflow WF, O state_of WF')],
   115         'State', cardinality='1*',
   114                                         description=_('subworkflow state'))
   116         constraints=[RQLConstraint('T subworkflow_exit S, T subworkflow WF, O state_of WF')],
   115     destination_state = SubjectRelation('State', cardinality='1*',
   117         description=_('subworkflow state'))
   116                                         constraints=[RQLConstraint('T subworkflow_exit S, T transition_of WF, O state_of WF')],
   118     destination_state = SubjectRelation(
   117                                         description=_('destination state'))
   119         'State', cardinality='?*',
       
   120         constraints=[RQLConstraint('T subworkflow_exit S, T transition_of WF, O state_of WF')],
       
   121         description=_('destination state. No destination state means that transition '
       
   122                       'should go back to the state from which we\'ve entered the '
       
   123                       'subworkflow.'))
   118 
   124 
   119 
   125 
   120 class TrInfo(EntityType):
   126 class TrInfo(EntityType):
   121     """workflow history item"""
   127     """workflow history item"""
   122     # 'add' security actually done by hooks
   128     # 'add' security actually done by hooks