Skip to content

Commit

Permalink
Merge pull request #1 from AToMPM/workflows
Browse files Browse the repository at this point in the history
Fix workflows code.
  • Loading branch information
BentleyJOakes authored May 16, 2018
2 parents 44b1eef + 6111385 commit 2150779
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion mt/ptcal/dapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def configure(self,graph,type,pl2gi,ex,pLabel=None,attr=None,journal=None) :
for the caller to do with them what he wants... '''
def __raise(self,msg) :
self._ex['$err'] = msg
print("Error: " + str(msg))
raise RuntimeError(msg)


Expand Down Expand Up @@ -212,7 +213,9 @@ def _getAllNodes(self,fulltypes=None) :
pLabels.append(pLabel)
return pLabels


def _getNodesFromLabels(self, pLabels):
nodes = [self._graph.vs[self._pl2gi[pLabel]] for pLabel in pLabels]
return nodes

def _getNeighbors(self,dir,type,pLabel) :
if not self._type.startswith('pattern') :
Expand Down
1 change: 1 addition & 0 deletions mt/ptcal/dcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def __init__(self,dAPI) :
'getAttrNames' : dAPI._getAttrNames,
'setAttr' : dAPI._setAttr,
'getAllNodes' : dAPI._getAllNodes,
'getNodesFromLabels' : dAPI._getNodesFromLabels,
'getNeighbors' : dAPI._getNeighbors,
'isConnectionType' : dAPI._isConnectionType,
'httpReq' : dAPI._httpReq,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4892,7 +4892,7 @@
"0": {
"parameterList": {
"type": "string",
"value": ""
"value": "{2:/Formalisms/__LanguageSyntax__/SimpleClassDiagram/SimpleClassDiagram.umlIcons.metamodel,4:.model,7:/Formalisms/__LanguageSyntax__/ConcreteSyntax/ConcreteSyntax.defaultIcons.metamodel,9:Icons.model,3:Create the metamodel,8:Create the Concret Syntax,10:Icons.model,11:.model,13:Icons.model}"
},
"$type": "/Formalisms/Workflows/Workflows/Parameters"
},
Expand All @@ -4906,7 +4906,7 @@
"2": {
"Location@2": {
"type": "string",
"value": ""
"value": "/Formalisms/__LanguageSyntax__/SimpleClassDiagram/SimpleClassDiagram.uml"
},
"extension": {
"type": "string",
Expand Down Expand Up @@ -4978,7 +4978,7 @@
"7": {
"Location@2": {
"type": "string",
"value": ""
"value": "/Formalisms/__LanguageSyntax__/ConcreteSyntax/ConcreteSyntax.default"
},
"extension": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,7 @@
"108": {
"Action": {
"type": "code",
"value": "data = ''\nc = 0\nmsg = ''\ntxt = ''\nParameterId = 0\nwidgets = '{\"widgets\":['\nnodes = getAllNodes()\nnodes = sorted(nodes, key=lambda a:int(getAttr('$atompmId', a)))\n#print nodes\n\nfor n in nodes:\n\tif getAttr('$type', n) != u'/Formalisms/Workflows/Workflows/Parameters' :\n\t\text = ''\n\t\tlabel = ''\t\t\n\t\tfor a in sorted(getAttrNames(n),reverse=True):\n\t\t\tif a[0] != '$' and a not in ['parameterList','current','Duration','Executing','Message','Name','Mode','tarParam','srcParam','id','chosen','iterations','isTrue','condition'] and str(getAttr(a, n))!= '%' :\n\t\t\t\ts = str(getAttr('$ft__', n))\n\t\t\t\tb = s.split('/')\n\t\t\t\tif b[-1] not in ['InitialNode','FinalNode','ForkNode','JoinNode','DecisionNode','IterationNode','Link','Flow','Alternative','Dependency','ExecTransformation','GenerateAS','GenerateCS', 'EditModel','VerifyAS']:\n\t\t\t\t\tif data and a != 'extension': \n\t\t\t\t\t\tdata += ','\n\t\t\t\t\tif c > 0 and a != 'name': \n\t\t\t\t\t\twidgets += ','\n\t\t\t\t\tc +=1\n\t\t\t\t\tif a == 'extension' and str(getAttr(a, n)) != '':\n\t\t\t\t\t\text = str(getAttr(a, n))\n\t\t\t\t\t\tc = c-1\n\t\t\t\t\t\twidgets = widgets.rstrip(',')\n\t\t\t\t\telif a == 'name' :\n\t\t\t\t\t\tif str(getAttr(a, n))!= '':\n\t\t\t\t\t\t\tlabel = str(getAttr(a, n))\n\t\t\t\t\t\tc = c-1\t\n\t\t\t\t\t\tdata = data.rstrip(',')\n\t\t\t\t\telse:\n\t\t\t\t\t\tdata += getAttr('$atompmId', n)+':'+ext\n\t\t\t\t\t\t#print str(getAttr('$atompmId', n))+str(a)+b[-1]+':'+str(getAttr(a, n))+ext\n\t\t\t\t\t\twidgets += '{\"id\":\"'+getAttr('$atompmId', n)+'\",\"type\":\"input\",\"label\":\"'+label+'('+b[-1]+')'+str(a)+'\",\"default\":\"'+getAttr(a, n)+'\"}'\n\t\t\t\t\t\t#print widgets\n\t\t\telif a == 'Message':\n\t\t\t\tif getAttr(a, n) is not None :\t\t\t\t\n\t\t\t\t\ttxt = str(getAttr(a, n))\n\t\t\t\t\ttxt = txt.replace(',', ';')\n\t\t\t\t\tmsg += getAttr('$atompmId', n)+':'+txt+','\n\telse:\n\t\tParameterId = str(getAttr('$atompmId', n))\n\t\t#print ParameterId\nwidgets += '],\"title\":\"Parameters\"}'\n#print '=========================================================' + widgets\ndata = '{'+data\ndata += '}'\nmsg = msg.rstrip(',')\n#print data\n#print msg\n#label += widgets\nhttpReq(\n 'PUT',\n None,\n '/GET/console',\n {'text':'CLIENT_BDAPI :: {\"func\":\"_openNewDialog\",\"args\":{\"args\":'+widgets+',\"labels\":\"'+data+'\",\"paramId\":\"'+ParameterId+'\",\"msg\":\"'+msg+'\"}}'})"
"value": "data = ''\nc = 0\nmsg = ''\ntxt = ''\nParameterId = 0\nwidgets = '{\"widgets\":['\n\npLabels = getAllNodes()\nnodes = getNodesFromLabels(pLabels)\nnodes = sorted(nodes, key=lambda a:int(a['$atompmId']))\n\nfor i, n in enumerate(nodes):\n\t#print(\"Node: \" + str(n))\n\n\tif n['$type'] != u'/Formalisms/Workflows/Workflows/Parameters' :\n\t\text = ''\n\t\tlabel = ''\n\n\t\tpLabel = pLabels[i]\n\t\tfor a in sorted(getAttrNames(pLabel),reverse=True):\n\n\t\t\tif a[0] != '$' and a not in ['parameterList','current','Duration','Executing','Message','Name','Mode','tarParam','srcParam','id','chosen','iterations','isTrue','condition'] and str(n[a])!= '%' :\n\t\t\t\ts = str(n['$ft__'])\n\t\t\t\tb = s.split('/')\n\t\t\t\tif b[-1] not in ['InitialNode','FinalNode','ForkNode','JoinNode','DecisionNode','IterationNode','Link','Flow','Alternative','Dependency','ExecTransformation','GenerateAS','GenerateCS', 'EditModel','VerifyAS']:\n\t\t\t\t\tif data and a != 'extension':\n\t\t\t\t\t\tdata += ','\n\t\t\t\t\tif c > 0 and a != 'name':\n\t\t\t\t\t\twidgets += ','\n\t\t\t\t\tc +=1\n\t\t\t\t\tif a == 'extension' and str(n[a]) != '':\n\t\t\t\t\t\text = str(n[a])\n\t\t\t\t\t\tc = c-1\n\t\t\t\t\t\twidgets = widgets.rstrip(',')\n\t\t\t\t\telif a == 'name' :\n\t\t\t\t\t\tif str(n[a])!= '':\n\t\t\t\t\t\t\tlabel = str(n[a])\n\t\t\t\t\t\tc = c-1\n\t\t\t\t\t\tdata = data.rstrip(',')\n\t\t\t\t\telse:\n\t\t\t\t\t\tdata += n['$atompmId']+':'+ext\n\t\t\t\t\t\t#print str(n['$atompmId'])+str(a)+b[-1]+':'+str(n[a])+ext\n\t\t\t\t\t\twidgets += '{\"id\":\"'+n['$atompmId']+'\",\"type\":\"input\",\"label\":\"'+label+'('+b[-1]+')'+str(a)+'\",\"default\":\"'+n[a]+'\"}'\n\t\t\t\t\t\t#print widgets\n\t\t\telif a == 'Message':\n\n\t\t\t\tif n[a] is not None :\n\t\t\t\t\ttxt = n[a]\n\t\t\t\t\ttxt = txt.replace(',', ';')\n\t\t\t\t\tmsg += n['$atompmId']+':'+txt+','\n\telse:\n\n\t\tParameterId = str(n['$atompmId'])\n\t\t#print(ParameterId)\nwidgets += '],\"title\":\"Parameters\"}'\n#print '=========================================================' + str(widgets)\ndata = '{'+data\ndata += '}'\nmsg = msg.rstrip(',')\n#print data\n#print msg\n#label += widgets\nhttpReq(\n\t'PUT',\n\tNone,\n\t'/GET/console',\n\t{'text':'CLIENT_BDAPI :: {\"func\":\"_openNewDialog\",\"args\":{\"args\":'+widgets+',\"labels\":\"'+data+'\",\"paramId\":\"'+ParameterId+'\",\"msg\":\"'+msg+'\"}}'})"
},
"$type": "/Formalisms/__Transformations__/TransformationRule/TransformationRule/RHS"
},
Expand Down

0 comments on commit 2150779

Please sign in to comment.