Commit 71dcbb9d authored by iv's avatar iv

ERP5Workflow: rename Variable portal type to Workflow Variable

because Variables are only about Workflow
parent 6341787e
......@@ -6,7 +6,7 @@
<item>Configuration State</item>
<item>Configuration Transition</item>
<item>Embedded File</item>
<item>Variable</item>
<item>Workflow Variable</item>
<item>Worklist</item>
</portal_type>
<portal_type id="Interaction">
......@@ -14,8 +14,8 @@
</portal_type>
<portal_type id="Interaction Workflow">
<item>Interaction</item>
<item>Variable</item>
<item>Workflow Script</item>
<item>Workflow Variable</item>
</portal_type>
<portal_type id="State">
<item>PermissionRoles</item>
......@@ -26,8 +26,8 @@
<portal_type id="Workflow">
<item>State</item>
<item>Transition</item>
<item>Variable</item>
<item>Workflow Script</item>
<item>Workflow Variable</item>
<item>Worklist</item>
</portal_type>
<portal_type id="Workflow Module">
......
......@@ -51,7 +51,19 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Variable</string> </value>
<value> <string>Workflow Variable</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -59,7 +71,19 @@
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>Variable</string> </value>
<value> <string>WorkflowVariable</string> </value>
</item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>workflow_list</string> </key>
......
......@@ -275,7 +275,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(x.getTitle(), x.getRelativeUrl()) for x in here.getParentValue().getParentValue().contentValues(portal_type="Variable")]</string> </value>
<value> <string>python: [(x.getTitle(), x.getRelativeUrl()) for x in here.getParentValue().getParentValue().contentValues(portal_type="Workflow Variable")]</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -15,13 +15,13 @@ State | permission
State | view
Transition Variable | view
Transition | view
Variable | view
Workflow Module | contents
Workflow Script | proxy_role_view
Workflow Script | repository_history_view
Workflow Script | view
Workflow Tool | conversion
Workflow Tool | view
Workflow Variable | view
Workflow | configurator_settings
Workflow | configurator_settings
Workflow | launch_configuration
......
......@@ -2,11 +2,11 @@ Configuration Transition | Transition Variable
Configuration Workflow | Configuration State
Configuration Workflow | Configuration Transition
Configuration Workflow | Embedded File
Configuration Workflow | Variable
Configuration Workflow | Workflow Variable
Configuration Workflow | Worklist
Interaction Workflow | Interaction
Interaction Workflow | Variable
Interaction Workflow | Workflow Script
Interaction Workflow | Workflow Variable
Interaction | Transition Variable
State | PermissionRoles
Transition | Transition Variable
......@@ -16,7 +16,7 @@ Workflow Tool | Interaction Workflow
Workflow Tool | Workflow
Workflow | State
Workflow | Transition
Workflow | Variable
Workflow | Workflow Script
Workflow | Workflow Variable
Workflow | Worklist
Worklist | Worklist Variable
\ No newline at end of file
......@@ -7,10 +7,10 @@ PermissionRoles
State
Transition
Transition Variable
Variable
Workflow
Workflow Module
Workflow Script
Workflow Tool
Workflow Variable
Worklist
Worklist Variable
\ No newline at end of file
......@@ -458,7 +458,7 @@ class InteractionWorkflowDefinition (DCWorkflowDefinition, ActiveObject):
for vid in variable_id_list:
vdef = self.variables[vid]
variable = SubElement(variables, 'variable', attrib=dict(reference=vdef.getReference(),
portal_type='Variable'))
portal_type='Workflow Variable'))
for property_id in sorted(variable_prop_id_to_show):
if property_id == 'default_expr':
expression = getattr(vdef, property_id, None)
......
......@@ -968,7 +968,7 @@ def DCWorkflowDefinition_showAsXML(self, root=None):
for vid in variable_id_list:
vdef = self.variables[vid]
variable = SubElement(variables, 'variable', attrib=dict(reference=vdef.getReference(),
portal_type='Variable'))
portal_type='Workflow Variable'))
for property_id in sorted(variable_prop_id_to_show):
if property_id == 'default_expr':
expression = getattr(vdef, property_id, None)
......
......@@ -79,7 +79,7 @@ class ConfigurationTransition(XMLObject):
object = workflow.getStateChangeInformation(document, state_object, transition=self)
# Update all variables
for variable in workflow.contentValues(portal_type='Variable'):
for variable in workflow.contentValues(portal_type='Workflow Variable'):
if variable.getAutomaticUpdate():
# if we have it in form get it from there
# otherwise use default
......
......@@ -76,7 +76,7 @@ class ConfigurationWorkflow(XMLObject):
# Initialize workflow history
status_dict = {state_bc_id: self.getSource()}
variable_list = self.contentValues(portal_type='Variable')
variable_list = self.contentValues(portal_type='Workflow Variable')
for variable in variable_list:
status_dict[variable.getTitle()] = variable.getVariableValue(object=object)
self._updateWorkflowHistory(document, status_dict)
......
......@@ -130,7 +130,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
workflow. This method must perform its own security checks.
'''
vdef = getattr(self, name, _MARKER)
for x in self.objectValues(portal_type='Variable'):
for x in self.objectValues(portal_type='Workflow Variable'):
if x.getReference() == name:
vdef = x
break
......@@ -275,7 +275,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
if tdef_exprs is None: tdef_exprs = {}
status = {}
for vdef in self.objectValues(portal_type='Variable'):
for vdef in self.objectValues(portal_type='Workflow Variable'):
id = vdef.getId()
if not vdef.getForStatus():
continue
......@@ -467,7 +467,7 @@ class InteractionWorkflow(IdAsReferenceMixin("", "prefix"), Workflow):
# 2. Variable as XML
variable_reference_list = []
variable_list = self.objectValues(portal_type='Variable')
variable_list = self.objectValues(portal_type='Workflow Variable')
variable_prop_id_to_show = ['description', 'variable_expression',
'for_catalog', 'for_status', 'automatic_update']
for vdef in variable_list:
......
......@@ -481,13 +481,13 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
def getVariableValueDict(self):
variable_dict = {}
for vdef in self.objectValues(portal_type="Variable"):
for vdef in self.objectValues(portal_type="Workflow Variable"):
variable_dict[vdef.getReference()] = vdef
return variable_dict
def getVariableIdList(self):
id_list = []
for ob in self.objectValues(portal_type="Variable"):
for ob in self.objectValues(portal_type="Workflow Variable"):
id_list.append(ob.getReference())
return id_list
......@@ -647,7 +647,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
object.REQUEST.other.update(form_kw)
kwargs = form_kw
for vdef in self.objectValues(portal_type='Variable'):
for vdef in self.objectValues(portal_type='Workflow Variable'):
id = vdef.getId()
variable_reference = vdef.getReference()
if not vdef.getForStatus() or vdef.getForStatus() == 0:
......@@ -899,7 +899,7 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
# 3. Variable as XML
variable_reference_list = []
variable_list = self.objectValues(portal_type='Variable')
variable_list = self.objectValues(portal_type='Workflow Variable')
variable_prop_id_to_show = ['description', 'variable_expression',
'for_catalog', 'for_status', 'automatic_update']
for vdef in variable_list:
......
......@@ -33,13 +33,13 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.id_as_reference import IdAsReferenceMixin
from Products.ERP5Type.XMLObject import XMLObject
class Variable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
class WorkflowVariable(IdAsReferenceMixin("variable_", "prefix"), XMLObject):
"""
A ERP5 Variable.
"""
meta_type = 'ERP5 Variable'
portal_type = 'Variable'
portal_type = 'Workflow Variable'
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
......
......@@ -108,7 +108,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
def getAvailableCatalogVars(self):
res = []
res.append(self.getParentValue().getStateVariable())
for vdef in self.getParentValue().contentValues(portal_type="Variable"):
for vdef in self.getParentValue().contentValues(portal_type="Workflow Variable"):
if vdef.getForCatalog():
res.append(vdef.getId())
for vdef in self.objectValues():
......@@ -136,7 +136,7 @@ class Worklist(IdAsReferenceMixin("worklist_", "prefix"), XMLObject):
"""
Check workflow variables:
"""
for variable_value in self.getParentValue().objectValues(portal_type="Variable"):
for variable_value in self.getParentValue().objectValues(portal_type="Workflow Variable"):
variable_id = variable_value.getId()
workflow_variable_id_list.append(variable_id)
worklist_variable_value = self._getOb(variable_id, None)
......
......@@ -286,7 +286,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
# create transitions
if workflow_type_id == 'DCWorkflowDefinition':
# remove default state and variables
for def_var in workflow.objectValues(portal_type='Variable'):
for def_var in workflow.objectValues(portal_type='Workflow Variable'):
workflow._delObject(def_var.getId())
workflow._delObject('state_draft')
dc_workflow_transition_value_list = dc_workflow.transitions
......@@ -497,7 +497,7 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
workflow_script.setProxyRole(script._proxy_roles)
# create variables (portal_type = Variable)
for variable_id, variable_definition in dc_workflow.variables.items():
variable = workflow.newContent(portal_type='Variable', temp_object=is_temporary)
variable = workflow.newContent(portal_type='Workflow Variable', temp_object=is_temporary)
variable.setTitle(variable_definition.title)
variable.setReference(variable_id)
variable.setAutomaticUpdate(variable_definition.update_always)
......
......@@ -123,7 +123,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
t1.setReference('t1')
s1.setDestinationValue(t1)
v1 = workflow.newContent(portal_type='Variable',
v1 = workflow.newContent(portal_type='Workflow Variable',
title='actor')
v1.setReference('actor')
v1.variable_expression = 'user/getUserName'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment