Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Sapphire » Connection Bindings
Connection Bindings [message #780065] Tue, 17 January 2012 05:27 Go to next message
Greg Amerson is currently offline Greg AmersonFriend
Messages: 119
Registered: March 2010
Senior Member
Is there any additional documentation explaining the different types of connection bindings. There seems to be 3 types, connections, embedded connections and implicit connections and I'm not exactly sure the differences are at least which one I should use for my model.

In my model I have two types of elements that can have connections, Tasks and States. These task or state elements will have an child node that contains the transition information linking it to another task or state, here is a snippet

<workflow>
   <state>
      <name>created</name>
      <transitions>
         <transition>
            <name>review</name>
            <target>review</target>
         </transition>
      </transitions>
   </state>
   <task>
      <name>review</name>
      <transitions>
         <transition>
            <name>reject</name>
            <target>update</target>
         </transition>
         <transition>
            <name>approve</name>
            <target>approved</target>
         </transition>
      </transitions>
   </task>
   <task>
      <name>update</name>
      ...
   </task>
   <state>
      <name>approved</name>
   </state>
</worksflow>


So for each Task or State, there will be a list of <transition> elements that have a <target> child that points to the name of another Task or State. In this scenario, I don't quite know how to set this up as either normal connection bindings, embedded or implicit.

Any thoughts?
Re: Connection Bindings [message #780651 is a reply to message #780065] Wed, 18 January 2012 21:50 Go to previous messageGo to next message
Shenxue Zhou is currently offline Shenxue ZhouFriend
Messages: 60
Registered: July 2009
Member
Hi Greg,

Sorry for the lack of documentation on connection bindings. Let me try to explain:

1. The difference between connections and embedded connections lies in how the endpoints of connections are attached. For connections, they are bound to a list in which both endpoints are explicitly specified. Using the Map sample, the high way routes explicitly define the endpoints to point to destinations:

<route>
<from-destination>New York</from-destination>
<to-destination>Washington DC</to-destination>
<distance>1000</distance>
</route>
<route>
<from-destination>New York</from-destination>
<to-destination>Chicago</to-destination>
<distance>1000</distance>
</route>

In the connection binding, you'd need to specify both endpoints explicitly:

<connection-binding>
<connection-id>highway_routes</connection-id>
<property>Routes</property>
<label>${Distance == null ? &quot;&lt;distance&gt;&quot; : Distance}</label>
<endpoint1>
<property>FromDestination</property>
<value>${Name}</value>
</endpoint1>
<endpoint2>
<property>ToDestination</property>
<value>${Name}</value>
</endpoint2>
<instance-id>${FromDestination}-${ToDestination}</instance-id>
</connection-binding>


For embedded connections, the connection list lies inside elements that are bound to diagram nodes. The railway routes in the map sample are embedded connections:

<destination>
<name>New York</name>
<railway-destinations>
<railway-destination>
<to-destination>Washington DC</to-destination>
<distance>1500</distance>
</railway-destination>
<railway-destination>
<to-destination>Chicago</to-destination>
<distance>1500</distance>
</railway-destination>
</railway-destinations>
</destination>

In connection binding for the embedded connections, the source endpoint is implicit. It assumes it's the element in which the embedded connection list is located. You'd only need to specify the target endpoint (endpoint2):

<connection-binding>
<connection-id>railway_routes</connection-id>
<property>RailwayRoutes</property>
<label>${Distance == null ? &quot;&lt;distance&gt;&quot; : Distance}</label>
<endpoint2>
<property>ToDestination</property>
<value>${Name}</value>
</endpoint2>
<instance-id>${ToDestination}</instance-id>
</connection-binding>

And the <connection-binding> element needs to be located inside the node specification in the sdef file.

2. Implicit connections are implied connections. They are bound to the diagram nodes. The semantics is for the list element which corresponds to a list of diagram nodes, if the elements of the list meets certain condition, then Sapphire Diagram will render implicit connections between the corresponding nodes on the diagram. Here is an example:

<implicit-connection-binding>
<connection-id>trainStops</connection-id>
<property>Activities</property>
<condition>${TrainStop != null &amp;&amp; parent().Train}</condition>
</implicit-connection-binding>

In the diagram, you can't edit the implicit connections directly. The implicit connections will refresh if the conditions on the corresponding nodes change.

Hope that helps. Let me know if you have more questions on connection bindings.

Shenxue
Re: Connection Bindings [message #780856 is a reply to message #780065] Thu, 19 January 2012 16:57 Go to previous message
Shenxue Zhou is currently offline Shenxue ZhouFriend
Messages: 60
Registered: July 2009
Member
I forgot to mention in my last reply that in your case, you'd need to use embedded connections to model your transitions.
Previous Topic:Feature suggestion: "Additional info" for tree labels
Next Topic:When is SapphireCondition.evaluate() executed?
Goto Forum:
  


Current Time: Wed Dec 07 01:30:21 GMT 2022

Powered by FUDForum. Page generated in 0.01862 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top