Differences

This shows you the differences between two versions of the page.

Link to this comparison view

guide:presenter:presenter_data [2016/06/08 09:19]
cs_veg created
guide:presenter:presenter_data [2016/06/08 11:20] (current)
Line 3: Line 3:
 Firefly Professional Edition collects every trace data into a simple '​Presenter'​ database. Firefly Professional Edition collects every trace data into a simple '​Presenter'​ database.
  
-Current '​Presenter'​ data can be accessed from '​bpmn'​ programs via '​Scene', ​\\ e.g. ''​%%X.scene().presenter()%%''​+Current '​Presenter'​ data can be accessed from '​bpmn'​ programs via '​Scene', ​ 
 +<​code>​ 
 +var P=X.scene().presenter() 
 +</​code>​
  
 +\\
 +Using both Professional Edition (with trace presenter data) and Personal Edition (without trace presenter data), a conditional has to be used, e.g.,
 +<​code>​
 +var P=X.scene().presenter();​
 +if(P){
 +  // processing
 +}
 +</​code>​
  
 +The returned '​Presenter'​ data is for the current element.
 +It is important that tracing is asynchronous so it is not guaranteed that every tracing data of the //current// step is recorded; it is only guaranteed that trace lines of the //​previous//​ steps are recorded. ​
 +
 +There are cursor-like navigational functions:
 +  * **toUp**()
 +  * toDown()
 +  * toLeft()  ​
 +  * toRight() ​   ​
 +  * **toID**(pathAndID or ID)
 +  * toID(path, ID)
 +  * **toRoot**()
 +
 +Navigational functions return a boolean about their success, so they can be chained, e.g. 
 +  * ''​P.toUp() && P.toUp()'' ​
 +  * ''​P.toLeft() && P.toDown()'' ​
 +  * ''​%%P.toUp() && P.toID("​\\\\demo\\all4sale\\all4sale.firefly.bpmn\\#​SubProcess_1"​) // escaping \ %%''​
 +  * ''​P.toID("​SubProcess_1"​)''​
 +
 +Usually, toRoot() or toUp() is needed.
 +
 +The easiest way to check or process data is to convert it to '​Data'​ that also extracts JSON expressions.
 +
 +<​code>​
 +var P=X.scene().presenter();​
 +if(P && P.toUp()){
 +  print( P.toData().toXML() ) // print out to check
 +}
 +</​code>​
 +
 +The current cursor-point (the subtree) can be exported to XML or HTML format:
 +  * **toXML**(file)
 +  * **toHTML**(file)
 +
 +<​code>​
 +var P=X.scene().presenter();​
 +if(P && P.toRoot() && X.fileOf("","​!.doc"​).isDirectory()){
 +  P.toHTML( X.fileOf("","​!.doc/​guide.html"​) ) // HTML
 +  P.toXML( X.fileOf("","​!.doc/​trace.xml"​) )   // XML
 +}
 +</​code>​
 + 
 +\\
 +Writing out checks:
 +<​code>​
 +function traverse(x){
 +  if(x.getKey()=='​trace'​ && x['​@name'​]=='​check'​){
 +    print(x['​value'​]['​arg0'​]+" ​ "​+x['​value'​]['​arg1'​])
 +  }
 +  for each(var xx in x.content){
 +    traverse(xx)
 +  }
 +}
 +
 +var P=X.scene().presenter();​
 +if(P && P.toRoot()){
 +  traverse(P.toData())
 +}
 +</​code>​
  
guide/presenter/presenter_data.1465370355.txt.gz · Last modified: 2016/06/08 09:19 by cs_veg
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0