schemas/workflow.py
branchtls-sprint
changeset 1572 469787f6ea2b
parent 1398 5fe84a5f7035
child 1977 606923dff11b
equal deleted inserted replaced
1571:e9ad2724659d 1572:469787f6ea2b
    11     """
    11     """
    12     name = String(required=True, indexed=True, internationalizable=True,
    12     name = String(required=True, indexed=True, internationalizable=True,
    13                   maxsize=256)
    13                   maxsize=256)
    14     description = RichString(fulltextindexed=True, default_format='text/rest',
    14     description = RichString(fulltextindexed=True, default_format='text/rest',
    15                              description=_('semantic description of this state'))
    15                              description=_('semantic description of this state'))
    16     
    16 
    17     state_of = SubjectRelation('CWEType', cardinality='+*',
    17     state_of = SubjectRelation('CWEType', cardinality='+*',
    18                     description=_('entity types which may use this state'),
    18                     description=_('entity types which may use this state'),
    19                     constraints=[RQLConstraint('O final FALSE')])
    19                     constraints=[RQLConstraint('O final FALSE')])
    20     allowed_transition = SubjectRelation('Transition', cardinality='**',
    20     allowed_transition = SubjectRelation('Transition', cardinality='**',
    21                                          constraints=[RQLConstraint('S state_of ET, O transition_of ET')],
    21                                          constraints=[RQLConstraint('S state_of ET, O transition_of ET')],
    22                                          description=_('allowed transitions from this state'))
    22                                          description=_('allowed transitions from this state'))
    23     
    23 
    24     initial_state = ObjectRelation('CWEType', cardinality='?*',
    24     initial_state = ObjectRelation('CWEType', cardinality='?*',
    25                                    # S initial_state O, O state_of S
    25                                    # S initial_state O, O state_of S
    26                                    constraints=[RQLConstraint('O state_of S')],
    26                                    constraints=[RQLConstraint('O state_of S')],
    27                                    description=_('initial state for entities of this type'))
    27                                    description=_('initial state for entities of this type'))
    28 
    28 
    41                                 description=_('a RQL expression which should return some results, '
    41                                 description=_('a RQL expression which should return some results, '
    42                                               'else the transition won\'t be available. '
    42                                               'else the transition won\'t be available. '
    43                                               'This query may use X and U variables '
    43                                               'This query may use X and U variables '
    44                                               'that will respectivly represents '
    44                                               'that will respectivly represents '
    45                                               'the current entity and the current user'))
    45                                               'the current entity and the current user'))
    46     
    46 
    47     require_group = SubjectRelation('CWGroup', cardinality='**',
    47     require_group = SubjectRelation('CWGroup', cardinality='**',
    48                                     description=_('group in which a user should be to be '
    48                                     description=_('group in which a user should be to be '
    49                                                   'allowed to pass this transition'))
    49                                                   'allowed to pass this transition'))
    50     transition_of = SubjectRelation('CWEType', cardinality='+*',
    50     transition_of = SubjectRelation('CWEType', cardinality='+*',
    51                                     description=_('entity types which may use this transition'),
    51                                     description=_('entity types which may use this transition'),
    76         'delete': ('managers',), # RRQLExpression('U has_delete_permission O')
    76         'delete': ('managers',), # RRQLExpression('U has_delete_permission O')
    77         }
    77         }
    78     inlined = True
    78     inlined = True
    79     composite = 'object'
    79     composite = 'object'
    80     fulltext_container = composite
    80     fulltext_container = composite
    81     
    81 
    82 class state_of(MetaRelationType):
    82 class state_of(MetaRelationType):
    83     """link a state to one or more entity type"""
    83     """link a state to one or more entity type"""
    84 class transition_of(MetaRelationType):
    84 class transition_of(MetaRelationType):
    85     """link a transition to one or more entity type"""
    85     """link a transition to one or more entity type"""
    86     
    86 
    87 class initial_state(MetaRelationType):
    87 class initial_state(MetaRelationType):
    88     """indicate which state should be used by default when an entity using
    88     """indicate which state should be used by default when an entity using
    89     states is created
    89     states is created
    90     """
    90     """
    91     inlined = True
    91     inlined = True
    92 
    92 
    93 class destination_state(MetaRelationType):
    93 class destination_state(MetaRelationType):
    94     """destination state of a transition"""
    94     """destination state of a transition"""
    95     inlined = True
    95     inlined = True
    96     
    96 
    97 class allowed_transition(MetaRelationType):
    97 class allowed_transition(MetaRelationType):
    98     """allowed transition from this state"""
    98     """allowed transition from this state"""
    99 
    99 
   100 class in_state(UserRelationType):
   100 class in_state(UserRelationType):
   101     """indicate the current state of an entity"""
   101     """indicate the current state of an entity"""
   102     meta = True
   102     meta = True
   103     # not inlined intentionnaly since when using ldap sources, user'state
   103     # not inlined intentionnaly since when using ldap sources, user'state
   104     # has to be stored outside the CWUser table
   104     # has to be stored outside the CWUser table
   105     
   105 
   106     # add/delete perms given to managers/users, after what most of the job
   106     # add/delete perms given to managers/users, after what most of the job
   107     # is done by workflow enforcment
   107     # is done by workflow enforcment
   108     
   108