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