Commit 9f6ecc2e authored by Jérome Perrin's avatar Jérome Perrin

Create business links when some connections are added in the graph editor

parent 4ddc5d73
...@@ -51,11 +51,31 @@ ...@@ -51,11 +51,31 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>import json\n <value> <string>import json\n
graph = sci[\'object\'].getProperty(\'jsplumb_graph\')\n business_process = sci[\'object\']\n
graph = business_process.getProperty(\'jsplumb_graph\')\n
\n \n
#if graph:\n trade_state_dict = dict(start=None, end=None)\n
# graph = json.loads(graph)\n for trade_state in business_process.getPortalObject().portal_categories.trade_state.getCategoryChildValueList():\n
context.log(graph)\n # XXX I hope no duplicates\n
trade_state_dict[trade_state.getReference() or trade_state.getId()] = trade_state\n
\n
from pprint import pformat\n
\n
if graph:\n
graph = json.loads(graph)[\'graph\']\n
\n
for edge_id, edge_data in graph[\'edge\'].items():\n
# Create the business link if it does not exist yet.\n
if not edge_data.get(\'business_process_relative_url\'):\n
business_process.newContent(\n
portal_type=\'Business Link\',\n
predecessor_value=trade_state_dict[edge_data[\'source\']],\n
successor_value=trade_state_dict[edge_data[\'destination\']],\n
title=edge_data.get(\'name\'),\n
trade_phase=edge_data.get(\'trade_phase\'),\n
)\n
\n
if not graph: bam\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
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