Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes
DCWorkflow.States.StateDefinition Class Reference
Inheritance diagram for DCWorkflow.States.StateDefinition:
Inheritance graph
[legend]
Collaboration diagram for DCWorkflow.States.StateDefinition:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def getId
def getWorkflow
def getTransitions
def getTransitionTitle
def getAvailableTransitionIds
def getAvailableVarIds
def getManagedPermissions
def getAvailableRoles
def getPermissionInfo
def getGroupInfo
def manage_properties
def setProperties
def manage_variables
def getVariableValues
def getWorkflowVariables
def addVariable
def deleteVariables
def setVariables
def manage_permissions
def setPermissions
def setPermission
def setGroups

Public Attributes

 id
 title
 description
 transitions

Static Public Attributes

string meta_type = 'Workflow State'
tuple manage_options
string title = ''
string description = ''
tuple transitions = ()
 permission_roles = None
 group_roles = None
 var_values = None
tuple security = ClassSecurityInfo()
tuple manage_groups = PageTemplateFile('state_groups.pt', _dtmldir)

Static Private Attributes

tuple _properties_form = DTMLFile('state_properties', _dtmldir)
tuple _variables_form = DTMLFile('state_variables', _dtmldir)
tuple _permissions_form = DTMLFile('state_permissions', _dtmldir)

Detailed Description

State definition

Definition at line 33 of file States.py.


Constructor & Destructor Documentation

Definition at line 55 of file States.py.

00055 
00056     def __init__(self, id):
00057         self.id = id


Member Function Documentation

def DCWorkflow.States.StateDefinition.addVariable (   self,
  id,
  value,
  REQUEST = None 
)
Add a WorkflowVariable to State.

Definition at line 156 of file States.py.

00156 
00157     def addVariable(self,id,value,REQUEST=None):
00158         """Add a WorkflowVariable to State."""
00159         if self.var_values is None:
00160             self.var_values = PersistentMapping()
00161 
00162         self.var_values[id] = value
00163 
00164         if REQUEST is not None:
00165             return self.manage_variables(REQUEST, 'Variable added.')

Here is the call graph for this function:

def DCWorkflow.States.StateDefinition.deleteVariables (   self,
  ids = [],
  REQUEST = None 
)
Delete a WorkflowVariable from State.

Definition at line 166 of file States.py.

00166 
00167     def deleteVariables(self,ids=[],REQUEST=None):
00168         """Delete a WorkflowVariable from State."""
00169         vv = self.var_values
00170         for id in ids:
00171             if vv.has_key(id):
00172                 del vv[id]
00173 
00174         if REQUEST is not None:
00175             return self.manage_variables(REQUEST, 'Variables deleted.')

Here is the call graph for this function:

Definition at line 83 of file States.py.

00083 
00084     def getAvailableRoles(self):
00085         return self.getWorkflow().getAvailableRoles()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 74 of file States.py.

00074 
00075     def getAvailableTransitionIds(self):
00076         return self.getWorkflow().transitions.keys()

Here is the call graph for this function:

Definition at line 77 of file States.py.

00077 
00078     def getAvailableVarIds(self):
00079         return self.getWorkflow().variables.keys()

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the list of roles to be assigned to a group.

Definition at line 101 of file States.py.

00101 
00102     def getGroupInfo(self, group):
00103         """Returns the list of roles to be assigned to a group.
00104         """
00105         if self.group_roles:
00106             return self.group_roles.get(group, ())
00107         return ()

Here is the caller graph for this function:

Definition at line 58 of file States.py.

00058 
00059     def getId(self):
00060         return self.id

Definition at line 80 of file States.py.

00080 
00081     def getManagedPermissions(self):
00082         return list(self.getWorkflow().permissions)

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the list of roles to be assigned to a permission.

Definition at line 86 of file States.py.

00086 
00087     def getPermissionInfo(self, p):
00088         """Returns the list of roles to be assigned to a permission.
00089         """
00090         roles = None
00091         if self.permission_roles:
00092             roles = self.permission_roles.get(p, None)
00093         if roles is None:
00094             return {'acquired':1, 'roles':[]}
00095         else:
00096             if isinstance(roles, tuple):
00097                 acq = 0
00098             else:
00099                 acq = 1
00100             return {'acquired':acq, 'roles':list(roles)}

Definition at line 64 of file States.py.

00064 
00065     def getTransitions(self):
00066         return filter(self.getWorkflow().transitions.has_key,
00067                       self.transitions)

Here is the call graph for this function:

Definition at line 68 of file States.py.

00068 
00069     def getTransitionTitle(self, tid):
00070         t = self.getWorkflow().transitions.get(tid, None)
00071         if t is not None:
00072             return t.title
00073         return ''

Here is the call graph for this function:

Get VariableValues for management UI.

Definition at line 135 of file States.py.

00135 
00136     def getVariableValues(self):
00137         """Get VariableValues for management UI."""
00138         vv = self.var_values
00139         if vv is None:
00140             return []
00141         else:
00142             return vv.items()

Definition at line 61 of file States.py.

00061 
00062     def getWorkflow(self):
00063         return aq_parent(aq_inner(aq_parent(aq_inner(self))))

Here is the caller graph for this function:

Get all variables that are available from the workflow and
not handled yet.

Definition at line 143 of file States.py.

00143 
00144     def getWorkflowVariables(self):
00145         """Get all variables that are available from the workflow and
00146         not handled yet.
00147         """
00148         wf_vars = self.getAvailableVarIds()
00149         if self.var_values is None:
00150             return wf_vars
00151         ret = []
00152         for vid in wf_vars:
00153             if not self.var_values.has_key(vid):
00154                 ret.append(vid)
00155         return ret

Here is the call graph for this function:

def DCWorkflow.States.StateDefinition.manage_permissions (   self,
  REQUEST,
  manage_tabs_message = None 
)
Present TTW UI for managing this State's permissions.

Definition at line 193 of file States.py.

00193 
00194     def manage_permissions(self, REQUEST, manage_tabs_message=None):
00195         """Present TTW UI for managing this State's permissions."""
00196         return self._permissions_form(REQUEST,
00197                                      management_view='Permissions',
00198                                      manage_tabs_message=manage_tabs_message,
00199                                      )

Here is the caller graph for this function:

def DCWorkflow.States.StateDefinition.manage_properties (   self,
  REQUEST,
  manage_tabs_message = None 
)
Show state properties ZMI form.

Definition at line 110 of file States.py.

00110 
00111     def manage_properties(self, REQUEST, manage_tabs_message=None):
00112         """Show state properties ZMI form."""
00113         return self._properties_form(REQUEST,
00114                                      management_view='Properties',
00115                                      manage_tabs_message=manage_tabs_message,
00116                                      )

def DCWorkflow.States.StateDefinition.manage_variables (   self,
  REQUEST,
  manage_tabs_message = None 
)
Show State variables ZMI form.

Definition at line 128 of file States.py.

00128 
00129     def manage_variables(self, REQUEST, manage_tabs_message=None):
00130         """Show State variables ZMI form."""
00131         return self._variables_form(REQUEST,
00132                                      management_view='Variables',
00133                                      manage_tabs_message=manage_tabs_message,
00134                                      )

Here is the caller graph for this function:

def DCWorkflow.States.StateDefinition.setGroups (   self,
  REQUEST,
  RESPONSE = None 
)
Set the group to role mappings in REQUEST for this State.

Definition at line 234 of file States.py.

00234 
00235     def setGroups(self, REQUEST, RESPONSE=None):
00236         """Set the group to role mappings in REQUEST for this State.
00237         """
00238         map = self.group_roles
00239         if map is None:
00240             self.group_roles = map = PersistentMapping()
00241         map.clear()
00242         all_roles = self.getWorkflow().getRoles()
00243         for group in self.getWorkflow().getGroups():
00244             roles = []
00245             for role in all_roles:
00246                 if REQUEST.get('%s|%s' % (group, role), 0):
00247                     roles.append(role)
00248             roles.sort()
00249             roles = tuple(roles)
00250             map[group] = roles
00251         if RESPONSE is not None:
00252             RESPONSE.redirect(
00253                 "%s/manage_groups?manage_tabs_message=Groups+changed."
00254                 % self.absolute_url())
00255 
00256 InitializeClass(StateDefinition)
00257 

Here is the call graph for this function:

Here is the caller graph for this function:

def DCWorkflow.States.StateDefinition.setPermission (   self,
  permission,
  acquired,
  roles,
  REQUEST = None 
)
Set a permission for this State.

Definition at line 220 of file States.py.

00220 
00221     def setPermission(self, permission, acquired, roles, REQUEST=None):
00222         """Set a permission for this State."""
00223         pr = self.permission_roles
00224         if pr is None:
00225             self.permission_roles = pr = PersistentMapping()
00226         if acquired:
00227             roles = list(roles)
00228         else:
00229             roles = tuple(roles)
00230         pr[permission] = roles

def DCWorkflow.States.StateDefinition.setPermissions (   self,
  REQUEST 
)
Set the permissions in REQUEST for this State.

Definition at line 201 of file States.py.

00201 
00202     def setPermissions(self, REQUEST):
00203         """Set the permissions in REQUEST for this State."""
00204         pr = self.permission_roles
00205         if pr is None:
00206             self.permission_roles = pr = PersistentMapping()
00207         pr.clear()
00208         for p in self.getManagedPermissions():
00209             roles = []
00210             acquired = REQUEST.get('acquire_' + p, 0)
00211             for r in self.getAvailableRoles():
00212                 if REQUEST.get('%s|%s' % (p, r), 0):
00213                     roles.append(r)
00214             roles.sort()
00215             if not acquired:
00216                 roles = tuple(roles)
00217             pr[p] = roles
00218         return self.manage_permissions(REQUEST, 'Permissions changed.')

Here is the call graph for this function:

Here is the caller graph for this function:

def DCWorkflow.States.StateDefinition.setProperties (   self,
  title = '',
  transitions = (),
  REQUEST = None,
  description = '' 
)
Set the properties for this State.

Definition at line 117 of file States.py.

00117 
00118     def setProperties(self, title='', transitions=(), REQUEST=None, description=''):
00119         """Set the properties for this State."""
00120         self.title = str(title)
00121         self.description = str(description)
00122         self.transitions = tuple(map(str, transitions))
00123         if REQUEST is not None:
00124             return self.manage_properties(REQUEST, 'Properties changed.')
00125 

def DCWorkflow.States.StateDefinition.setVariables (   self,
  ids = [],
  REQUEST = None 
)
Set values for Variables set by this State.

Definition at line 176 of file States.py.

00176 
00177     def setVariables(self, ids=[], REQUEST=None):
00178         """Set values for Variables set by this State."""
00179         if self.var_values is None:
00180             self.var_values = PersistentMapping()
00181 
00182         vv = self.var_values
00183 
00184         if REQUEST is not None:
00185             for id in vv.keys():
00186                 fname = 'varval_%s' % id
00187                 vv[id] = str(REQUEST[fname])
00188             return self.manage_variables(REQUEST, 'Variables changed.')
00189 
00190 

Here is the call graph for this function:


Member Data Documentation

tuple DCWorkflow.States.StateDefinition._permissions_form = DTMLFile('state_permissions', _dtmldir) [static, private]

Definition at line 191 of file States.py.

tuple DCWorkflow.States.StateDefinition._properties_form = DTMLFile('state_properties', _dtmldir) [static, private]

Definition at line 108 of file States.py.

tuple DCWorkflow.States.StateDefinition._variables_form = DTMLFile('state_variables', _dtmldir) [static, private]

Definition at line 126 of file States.py.

Definition at line 46 of file States.py.

Definition at line 120 of file States.py.

Definition at line 49 of file States.py.

Definition at line 56 of file States.py.

tuple DCWorkflow.States.StateDefinition.manage_groups = PageTemplateFile('state_groups.pt', _dtmldir) [static]

Definition at line 231 of file States.py.

Initial value:
(
        {'label': 'Properties', 'action': 'manage_properties'},
        {'label': 'Permissions', 'action': 'manage_permissions'},
        {'label': 'Groups', 'action': 'manage_groups'},
        {'label': 'Variables', 'action': 'manage_variables'},
        )

Definition at line 38 of file States.py.

string DCWorkflow.States.StateDefinition.meta_type = 'Workflow State' [static]

Definition at line 36 of file States.py.

Definition at line 48 of file States.py.

tuple DCWorkflow.States.StateDefinition.security = ClassSecurityInfo() [static]

Definition at line 52 of file States.py.

Definition at line 45 of file States.py.

Definition at line 119 of file States.py.

Definition at line 47 of file States.py.

Definition at line 121 of file States.py.

Definition at line 50 of file States.py.


The documentation for this class was generated from the following file: