Commit cafd4f58 authored by wenjie.zheng's avatar wenjie.zheng

WorkflowTool.py: in asERP5Object only check old workflow types, because in...

WorkflowTool.py: in asERP5Object only check old workflow types, because in test conflict, it crashed by something else?
parent bfa70657
......@@ -254,294 +254,296 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
def dc_workflow_asERP5Object(self, container, dc_workflow, temp):
# convert DC Workflow to New Workflow
workflow_type_id = dc_workflow.__class__.__name__
if workflow_type_id == 'DCWorkflowDefinition':
if temp == 0:
new_id = 'converting_'+dc_workflow.id
else:
new_id = dc_workflow.id
uid = self.encodeWorkflowUid(new_id)
workflow = container.newContent(id=new_id, portal_type='Workflow', temp_object=temp)
workflow.setStateVariable(dc_workflow.state_var)
workflow.setWorkflowManagedPermission(dc_workflow.permissions)
elif workflow_type_id == 'InteractionWorkflowDefinition':
if temp == 0:
new_id = 'converting_'+dc_workflow.id
else:
new_id = dc_workflow.id
uid = self.encodeWorkflowUid(new_id)
workflow = container.newContent(id=new_id, portal_type='Interaction Workflow', temp_object=temp)
workflow.setManagerBypass(dc_workflow.manager_bypass)
if temp == 1:
# give temp workflow an uid for form_dialog.
workflow.uid = uid
workflow.default_reference = dc_workflow.id
workflow.setTitle(dc_workflow.title)
workflow.setDescription(dc_workflow.description)
if temp == 0:
# create transitions
if workflow_type_id in ['DCWorkflowDefinition', 'InteractionWorkflowDefinition']:
# Only convert old workflow objects.
if workflow_type_id == 'DCWorkflowDefinition':
# remove default state and variables
for def_var in workflow.objectValues(portal_type='Variable'):
workflow._delObject(def_var.getId())
workflow._delObject('state_draft')
dc_workflow_transition_value_list = dc_workflow.transitions
dc_workflow_transition_id_list = dc_workflow_transition_value_list.objectIds()
for tid in dc_workflow_transition_value_list:
tdef = dc_workflow_transition_value_list.get(tid)
transition = workflow.newContent(portal_type='Transition', temp_object=temp)
if tdef.title == '' or tdef.title is None:
tdef.title = UpperCase(tdef.id)
transition.setTitle(tdef.title)
transition.setReference(tdef.id)
transition.setTriggerType(tdef.trigger_type)
transition.setActboxCategory(tdef.actbox_category)
transition.setActboxIcon(tdef.actbox_icon)
transition.setActboxName(tdef.actbox_name)
transition.setActboxUrl(tdef.actbox_url)
transition.setDescription(tdef.description)
if tdef.after_script_name is not None:
# check after script is a Transion or a Script:
if tdef.after_script_name in dc_workflow_transition_id_list:
transition.setAfterScriptId('transition_'+tdef.after_script_name)
elif tdef.after_script_name in dc_workflow.scripts.objectIds():
# add a prefix if there is a script & method conflict
if hasattr(workflow, tdef.after_script_name):
transition.setAfterScriptId('ScriptPrefix_'+tdef.after_script_name)
else:
transition.setAfterScriptId(tdef.after_script_name)
if tdef.script_name is not None:
# check before script is a Transion or a Script:
if tdef.script_name in dc_workflow_transition_id_list:
transition.setBeforeScriptId('transition_'+tdef.script_name)
elif tdef.script_name in dc_workflow.scripts.objectIds():
if hasattr(workflow, tdef.script_name):
# add a prefix if there is a script & method conflict
transition.setBeforeScriptId('ScriptPrefix_'+tdef.script_name)
else:
transition.setBeforeScriptId(tdef.script_name)
# configure guard
if tdef.guard:
transition.setRoleList(tdef.guard.roles)
transition.setPermissionList(tdef.guard.permissions)
transition.setGroupList(tdef.guard.groups)
if tdef.guard.expr is not None:
transition.setExpression(tdef.guard.expr.text)
# create states (portal_type = State)
for sid in dc_workflow.states:
sdef = dc_workflow.states.get(sid)
state = workflow.newContent(portal_type='State', temp_object=temp)
if sdef.title == '' or sdef.title is None:
sdef.title = UpperCase(sdef.id)
if hasattr(sdef, 'type_list'): state.setStateType(sdef.type_list)
state.setTitle(sdef.title)
state.setReference(sdef.id)
state.setDescription(sdef.description)
permission_roles = sdef.permission_roles
state.setStatePermissionRoles(permission_roles)
if sdef.permission_roles is not None:
state.setCellRange(sorted(sdef.permission_roles.keys()),
sorted(workflow.getManagedRoleList()),
base_id='cell')
i = -1
for permission in sorted(workflow.getWorkflowManagedPermissionList()):
i = i + 1
j = -1
for role in workflow.getManagedRoleList():
j = j + 1
pr_cell = state.newContent(id='cell_%s_%s'%(i,j), portal_type='PermissionRoles')
if permission in permission_roles and role in permission_roles[permission]:
pr_cell.is_selected = 1
# Set Workflow default state using category setter
state_path = getattr(workflow, 'state_'+dc_workflow.initial_state).getPath()
state_path = 'source/' + '/'.join(state_path.split('/')[2:])
workflow.setCategoryList([state_path])
# set state's possible transitions:
for sid in dc_workflow.states:
sdef = workflow._getOb('state_'+sid)
new_category = []
for transition_id in dc_workflow.states.get(sid).transitions:
sdef.addPossibleTransition(transition_id)
# set transition's destination state:
for tid in dc_workflow_transition_value_list:
tdef = workflow._getOb('transition_'+tid)
state = getattr(workflow, 'state_'+dc_workflow_transition_value_list.get(tid).new_state_id, None)
if state is None:
# it's a remain in state transition.
continue
state_path = 'destination/' + '/'.join(state.getPath().split('/')[2:])
tdef.setCategoryList([state_path])
# create worklists (portal_type = Worklist)
for qid in dc_workflow.worklists:
qdef = dc_workflow.worklists.get(qid)
worklist = workflow.newContent(portal_type='Worklist', temp_object=temp)
worklist.setTitle(qdef.title)
worklist.setReference(qdef.id)
worklist.setDescription(qdef.description)
for key, values in qdef.var_matches.items():
if key == 'portal_type':
worklist.setMatchedPortalTypeList(values)
elif key == 'simulation_state':
state_id_list = []
for value in values:
state_id = 'state_'+value
state_id_list.append(state_id)
worklist.setMatchedSimulationStateList(state_id_list)
elif key == 'validation_state':
state_id_list = []
for value in values:
state_id = 'state_'+value
state_id_list.append(state_id)
worklist.setMatchedValidationStateList(state_id_list)
elif key == 'causality_state':
state_id_list = []
for value in values:
state_id = value
worklist.setMatchedCausalityState(state_id)
else:
# dynamic variable.
worklist_variable_value = worklist.newContent(portal_type='Worklist Variable')
worklist_variable_value.setReference(key)
if isinstance(values, Expression):
worklist_variable_value.setDefaultExpr(values.text)
else:
worklist_variable_value.InitialValue(value)
worklist.setActboxUrl(qdef.actbox_url)
worklist.setActboxCategory(qdef.actbox_category)
worklist.setActboxIcon(qdef.actbox_icon)
worklist.setActboxName(qdef.actbox_name)
# configure guard
if qdef.guard:
worklist.setRoleList(qdef.guard.roles)
worklist.setPermissionList(qdef.guard.permissions)
worklist.setGroupList(qdef.guard.groups)
if qdef.guard.expr is not None:
worklist.setExpression(qdef.guard.expr.text)
if temp == 0:
new_id = 'converting_'+dc_workflow.id
else:
new_id = dc_workflow.id
uid = self.encodeWorkflowUid(new_id)
workflow = container.newContent(id=new_id, portal_type='Workflow', temp_object=temp)
workflow.setStateVariable(dc_workflow.state_var)
workflow.setWorkflowManagedPermission(dc_workflow.permissions)
elif workflow_type_id == 'InteractionWorkflowDefinition':
dc_workflow_interaction_value_list = dc_workflow.interactions
for tid in dc_workflow_interaction_value_list:
interaction = workflow.newContent(portal_type='Interaction', temp_object=temp)
tdef = dc_workflow_interaction_value_list.get(tid)
if tdef.title == '' or tdef.title is None:
tdef.title = UpperCase(tdef.id)
interaction.setTitle(tdef.title)
interaction.setReference(tdef.id)
script_list = []
for script_name in tdef.activate_script_name:
# add a prefix if there is a script method conflict
if hasattr(workflow, script_name):
script_name = 'ScriptPrefix_' + script_name
script_list.append(script_name)
interaction.setActivateScriptNameList(tuple(script_list))
script_list = []
for script_name in tdef.after_script_name:
if hasattr(workflow, script_name):
script_name = 'ScriptPrefix_' + script_name
script_list.append(script_name)
interaction.setAfterScriptNameList(tuple(script_list))
script_list = []
for script_name in tdef.before_commit_script_name:
if hasattr(workflow, script_name):
script_name = 'ScriptPrefix_' + script_name
script_list.append(script_name)
interaction.setBeforeCommitScriptNameList(tuple(script_list))
script_list = []
for script_name in tdef.script_name:
if hasattr(workflow, script_name):
script_name = 'ScriptPrefix_' + script_name
script_list.append(script_name)
interaction.setBeforeScriptNameList(tuple(script_list))
# configure guard
if tdef.guard:
interaction.setRoleList(tdef.guard.roles)
interaction.setPermissionList(tdef.guard.permissions)
interaction.setGroupList(tdef.guard.groups)
if tdef.guard.expr is not None:
interaction.setExpression(tdef.guard.expr.text)
interaction.setPortalTypeFilter(tdef.portal_type_filter)
interaction.setPortalTypeGroupFilter(tdef.portal_type_group_filter)
if interaction.portal_type_filter == ():
interaction.portal_type_filter = None
if interaction.portal_type_group_filter == ():
interaction.portal_type_group_filter = None
interaction.setTemporaryDocumentDisallowed(tdef.temporary_document_disallowed)
#interaction.setTransitionFormId() # this is not defined in DC interaction?
interaction.setTriggerMethodId(tdef.method_id)
interaction.setTriggerOncePerTransaction(tdef.once_per_transaction)
interaction.setTriggerType(tdef.trigger_type)
interaction.setDescription(tdef.description)
# create scripts (portal_type = Workflow Script)
dc_workflow_script_list = dc_workflow.scripts
for script_id in dc_workflow_script_list:
script = dc_workflow_script_list.get(script_id)
# add a prefix if there is a script & method conflict
if hasattr(workflow, script_id):
workflow_script = workflow.newContent(id='ScriptPrefix_'+script_id, portal_type='Workflow Script', temp_object=temp)
if temp == 0:
new_id = 'converting_'+dc_workflow.id
else:
workflow_script = workflow.newContent(id=script_id ,portal_type='Workflow Script', temp_object=temp)
workflow_script.setTitle(script.title)
workflow_script.default_reference = script_id
workflow_script.setParameterSignature(script._params)
#workflow_script.setCallableType(script.callable_type)# not defined in python script?
workflow_script.setBody(script._body)
workflow_script.setProxyRole(script._proxy_roles)
# create variables (portal_type = Variable)
dc_workflow_variable_list = dc_workflow.variables
for vid in dc_workflow_variable_list:
vdef = dc_workflow_variable_list.get(vid)
variable = workflow.newContent(portal_type='Variable', temp_object=temp)
variable.setTitle(vdef.title)
variable.setReference(vdef.id)
variable.setAutomaticUpdate(vdef.update_always)
if getattr(vdef, 'default_expr', None) is not None:
# for a very specific case, action return the reference of transition
# in order to generation correct workflow history.
if vid == 'action':
variable.setDefaultExpr('transition/getReference|nothing')
else: variable.setDefaultExpr(vdef.default_expr.text)
variable.info_guard = vdef.info_guard
variable.setForCatalog(vdef.for_catalog)
variable.setForStatus(vdef.for_status)
variable.setInitialValue(vdef.default_value)
variable.setDescription(vdef.description)
# configure transition variable
if getattr(dc_workflow, 'transitions', None) is not None:
dc_workflow_transition_value_list = dc_workflow.transitions
for tid in dc_workflow_transition_value_list:
origin_tdef = dc_workflow_transition_value_list[tid]
transition = workflow._getOb('transition_'+tid)
new_category = []
if origin_tdef.var_exprs is None:
var_exprs = {}
else: var_exprs = origin_tdef.var_exprs
for key in var_exprs:
tr_var = transition.newContent(portal_type='Transition Variable', temp_object=temp)
tr_var.setDefaultExpr(var_exprs[key].text)
tr_var_path = getattr(workflow, 'variable_'+key).getPath()
tr_var_path = '/'.join(tr_var_path.split('/')[2:])
new_category.append(tr_var_path)
tr_var.setCausalityList(new_category)
if getattr(dc_workflow, 'interactions', None) is not None:
dc_workflow_interaction_value_list = dc_workflow.interactions
for tid in dc_workflow_interaction_value_list:
origin_tdef = dc_workflow_interaction_value_list[tid]
interaction = workflow._getOb('interaction_'+tid)
new_category = []
if origin_tdef.var_exprs is None:
var_exprs = {}
else: var_exprs = origin_tdef.var_exprs
for key in var_exprs:
tr_var = interaction.newContent(portal_type='Transition Variable', temp_object=temp)
tr_var.setDefaultExpr(var_exprs[key].text)
tr_var_path = getattr(workflow, 'variable_'+key).getPath()
tr_var_path = '/'.join(tr_var_path.split('/')[2:])
new_category.append(tr_var_path)
tr_var.setCausalityList(new_category)
self._finalizeWorkflowConversion(dc_workflow)
workflow.setId(workflow.default_reference)
return workflow
new_id = dc_workflow.id
uid = self.encodeWorkflowUid(new_id)
workflow = container.newContent(id=new_id, portal_type='Interaction Workflow', temp_object=temp)
workflow.setManagerBypass(dc_workflow.manager_bypass)
if temp == 1:
# give temp workflow an uid for form_dialog.
workflow.uid = uid
workflow.default_reference = dc_workflow.id
workflow.setTitle(dc_workflow.title)
workflow.setDescription(dc_workflow.description)
if temp == 0:
# create transitions
if workflow_type_id == 'DCWorkflowDefinition':
# remove default state and variables
for def_var in workflow.objectValues(portal_type='Variable'):
workflow._delObject(def_var.getId())
workflow._delObject('state_draft')
dc_workflow_transition_value_list = dc_workflow.transitions
dc_workflow_transition_id_list = dc_workflow_transition_value_list.objectIds()
for tid in dc_workflow_transition_value_list:
tdef = dc_workflow_transition_value_list.get(tid)
transition = workflow.newContent(portal_type='Transition', temp_object=temp)
if tdef.title == '' or tdef.title is None:
tdef.title = UpperCase(tdef.id)
transition.setTitle(tdef.title)
transition.setReference(tdef.id)
transition.setTriggerType(tdef.trigger_type)
transition.setActboxCategory(tdef.actbox_category)
transition.setActboxIcon(tdef.actbox_icon)
transition.setActboxName(tdef.actbox_name)
transition.setActboxUrl(tdef.actbox_url)
transition.setDescription(tdef.description)
if tdef.after_script_name is not None:
# check after script is a Transion or a Script:
if tdef.after_script_name in dc_workflow_transition_id_list:
transition.setAfterScriptId('transition_'+tdef.after_script_name)
elif tdef.after_script_name in dc_workflow.scripts.objectIds():
# add a prefix if there is a script & method conflict
if hasattr(workflow, tdef.after_script_name):
transition.setAfterScriptId('ScriptPrefix_'+tdef.after_script_name)
else:
transition.setAfterScriptId(tdef.after_script_name)
if tdef.script_name is not None:
# check before script is a Transion or a Script:
if tdef.script_name in dc_workflow_transition_id_list:
transition.setBeforeScriptId('transition_'+tdef.script_name)
elif tdef.script_name in dc_workflow.scripts.objectIds():
if hasattr(workflow, tdef.script_name):
# add a prefix if there is a script & method conflict
transition.setBeforeScriptId('ScriptPrefix_'+tdef.script_name)
else:
transition.setBeforeScriptId(tdef.script_name)
# configure guard
if tdef.guard:
transition.setRoleList(tdef.guard.roles)
transition.setPermissionList(tdef.guard.permissions)
transition.setGroupList(tdef.guard.groups)
if tdef.guard.expr is not None:
transition.setExpression(tdef.guard.expr.text)
# create states (portal_type = State)
for sid in dc_workflow.states:
sdef = dc_workflow.states.get(sid)
state = workflow.newContent(portal_type='State', temp_object=temp)
if sdef.title == '' or sdef.title is None:
sdef.title = UpperCase(sdef.id)
if hasattr(sdef, 'type_list'): state.setStateType(sdef.type_list)
state.setTitle(sdef.title)
state.setReference(sdef.id)
state.setDescription(sdef.description)
permission_roles = sdef.permission_roles
state.setStatePermissionRoles(permission_roles)
if sdef.permission_roles is not None:
state.setCellRange(sorted(sdef.permission_roles.keys()),
sorted(workflow.getManagedRoleList()),
base_id='cell')
i = -1
for permission in sorted(workflow.getWorkflowManagedPermissionList()):
i = i + 1
j = -1
for role in workflow.getManagedRoleList():
j = j + 1
pr_cell = state.newContent(id='cell_%s_%s'%(i,j), portal_type='PermissionRoles')
if permission in permission_roles and role in permission_roles[permission]:
pr_cell.is_selected = 1
# Set Workflow default state using category setter
state_path = getattr(workflow, 'state_'+dc_workflow.initial_state).getPath()
state_path = 'source/' + '/'.join(state_path.split('/')[2:])
workflow.setCategoryList([state_path])
# set state's possible transitions:
for sid in dc_workflow.states:
sdef = workflow._getOb('state_'+sid)
new_category = []
for transition_id in dc_workflow.states.get(sid).transitions:
sdef.addPossibleTransition(transition_id)
# set transition's destination state:
for tid in dc_workflow_transition_value_list:
tdef = workflow._getOb('transition_'+tid)
state = getattr(workflow, 'state_'+dc_workflow_transition_value_list.get(tid).new_state_id, None)
if state is None:
# it's a remain in state transition.
continue
state_path = 'destination/' + '/'.join(state.getPath().split('/')[2:])
tdef.setCategoryList([state_path])
# create worklists (portal_type = Worklist)
for qid in dc_workflow.worklists:
qdef = dc_workflow.worklists.get(qid)
worklist = workflow.newContent(portal_type='Worklist', temp_object=temp)
worklist.setTitle(qdef.title)
worklist.setReference(qdef.id)
worklist.setDescription(qdef.description)
for key, values in qdef.var_matches.items():
if key == 'portal_type':
worklist.setMatchedPortalTypeList(values)
elif key == 'simulation_state':
state_id_list = []
for value in values:
state_id = 'state_'+value
state_id_list.append(state_id)
worklist.setMatchedSimulationStateList(state_id_list)
elif key == 'validation_state':
state_id_list = []
for value in values:
state_id = 'state_'+value
state_id_list.append(state_id)
worklist.setMatchedValidationStateList(state_id_list)
elif key == 'causality_state':
state_id_list = []
for value in values:
state_id = value
worklist.setMatchedCausalityState(state_id)
else:
# dynamic variable.
worklist_variable_value = worklist.newContent(portal_type='Worklist Variable')
worklist_variable_value.setReference(key)
if isinstance(values, Expression):
worklist_variable_value.setDefaultExpr(values.text)
else:
worklist_variable_value.InitialValue(value)
worklist.setActboxUrl(qdef.actbox_url)
worklist.setActboxCategory(qdef.actbox_category)
worklist.setActboxIcon(qdef.actbox_icon)
worklist.setActboxName(qdef.actbox_name)
# configure guard
if qdef.guard:
worklist.setRoleList(qdef.guard.roles)
worklist.setPermissionList(qdef.guard.permissions)
worklist.setGroupList(qdef.guard.groups)
if qdef.guard.expr is not None:
worklist.setExpression(qdef.guard.expr.text)
elif workflow_type_id == 'InteractionWorkflowDefinition':
dc_workflow_interaction_value_list = dc_workflow.interactions
for tid in dc_workflow_interaction_value_list:
interaction = workflow.newContent(portal_type='Interaction', temp_object=temp)
tdef = dc_workflow_interaction_value_list.get(tid)
if tdef.title == '' or tdef.title is None:
tdef.title = UpperCase(tdef.id)
interaction.setTitle(tdef.title)
interaction.setReference(tdef.id)
script_list = []
for script_name in tdef.activate_script_name:
# add a prefix if there is a script method conflict
if hasattr(workflow, script_name):
script_name = 'ScriptPrefix_' + script_name
script_list.append(script_name)
interaction.setActivateScriptNameList(tuple(script_list))
script_list = []
for script_name in tdef.after_script_name:
if hasattr(workflow, script_name):
script_name = 'ScriptPrefix_' + script_name
script_list.append(script_name)
interaction.setAfterScriptNameList(tuple(script_list))
script_list = []
for script_name in tdef.before_commit_script_name:
if hasattr(workflow, script_name):
script_name = 'ScriptPrefix_' + script_name
script_list.append(script_name)
interaction.setBeforeCommitScriptNameList(tuple(script_list))
script_list = []
for script_name in tdef.script_name:
if hasattr(workflow, script_name):
script_name = 'ScriptPrefix_' + script_name
script_list.append(script_name)
interaction.setBeforeScriptNameList(tuple(script_list))
# configure guard
if tdef.guard:
interaction.setRoleList(tdef.guard.roles)
interaction.setPermissionList(tdef.guard.permissions)
interaction.setGroupList(tdef.guard.groups)
if tdef.guard.expr is not None:
interaction.setExpression(tdef.guard.expr.text)
interaction.setPortalTypeFilter(tdef.portal_type_filter)
interaction.setPortalTypeGroupFilter(tdef.portal_type_group_filter)
if interaction.portal_type_filter == ():
interaction.portal_type_filter = None
if interaction.portal_type_group_filter == ():
interaction.portal_type_group_filter = None
interaction.setTemporaryDocumentDisallowed(tdef.temporary_document_disallowed)
#interaction.setTransitionFormId() # this is not defined in DC interaction?
interaction.setTriggerMethodId(tdef.method_id)
interaction.setTriggerOncePerTransaction(tdef.once_per_transaction)
interaction.setTriggerType(tdef.trigger_type)
interaction.setDescription(tdef.description)
# create scripts (portal_type = Workflow Script)
dc_workflow_script_list = dc_workflow.scripts
for script_id in dc_workflow_script_list:
script = dc_workflow_script_list.get(script_id)
# add a prefix if there is a script & method conflict
if hasattr(workflow, script_id):
workflow_script = workflow.newContent(id='ScriptPrefix_'+script_id, portal_type='Workflow Script', temp_object=temp)
else:
workflow_script = workflow.newContent(id=script_id ,portal_type='Workflow Script', temp_object=temp)
workflow_script.setTitle(script.title)
workflow_script.default_reference = script_id
workflow_script.setParameterSignature(script._params)
#workflow_script.setCallableType(script.callable_type)# not defined in python script?
workflow_script.setBody(script._body)
workflow_script.setProxyRole(script._proxy_roles)
# create variables (portal_type = Variable)
dc_workflow_variable_list = dc_workflow.variables
for vid in dc_workflow_variable_list:
vdef = dc_workflow_variable_list.get(vid)
variable = workflow.newContent(portal_type='Variable', temp_object=temp)
variable.setTitle(vdef.title)
variable.setReference(vdef.id)
variable.setAutomaticUpdate(vdef.update_always)
if getattr(vdef, 'default_expr', None) is not None:
# for a very specific case, action return the reference of transition
# in order to generation correct workflow history.
if vid == 'action':
variable.setDefaultExpr('transition/getReference|nothing')
else: variable.setDefaultExpr(vdef.default_expr.text)
variable.info_guard = vdef.info_guard
variable.setForCatalog(vdef.for_catalog)
variable.setForStatus(vdef.for_status)
variable.setInitialValue(vdef.default_value)
variable.setDescription(vdef.description)
# configure transition variable
if getattr(dc_workflow, 'transitions', None) is not None:
dc_workflow_transition_value_list = dc_workflow.transitions
for tid in dc_workflow_transition_value_list:
origin_tdef = dc_workflow_transition_value_list[tid]
transition = workflow._getOb('transition_'+tid)
new_category = []
if origin_tdef.var_exprs is None:
var_exprs = {}
else: var_exprs = origin_tdef.var_exprs
for key in var_exprs:
tr_var = transition.newContent(portal_type='Transition Variable', temp_object=temp)
tr_var.setDefaultExpr(var_exprs[key].text)
tr_var_path = getattr(workflow, 'variable_'+key).getPath()
tr_var_path = '/'.join(tr_var_path.split('/')[2:])
new_category.append(tr_var_path)
tr_var.setCausalityList(new_category)
if getattr(dc_workflow, 'interactions', None) is not None:
dc_workflow_interaction_value_list = dc_workflow.interactions
for tid in dc_workflow_interaction_value_list:
origin_tdef = dc_workflow_interaction_value_list[tid]
interaction = workflow._getOb('interaction_'+tid)
new_category = []
if origin_tdef.var_exprs is None:
var_exprs = {}
else: var_exprs = origin_tdef.var_exprs
for key in var_exprs:
tr_var = interaction.newContent(portal_type='Transition Variable', temp_object=temp)
tr_var.setDefaultExpr(var_exprs[key].text)
tr_var_path = getattr(workflow, 'variable_'+key).getPath()
tr_var_path = '/'.join(tr_var_path.split('/')[2:])
new_category.append(tr_var_path)
tr_var.setCausalityList(new_category)
self._finalizeWorkflowConversion(dc_workflow)
workflow.setId(workflow.default_reference)
return workflow
def getChainDict(self):
"""Test if the given transition exist from the current state.
......
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