[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.mdt.uml2.uml] Re: UML Interactions via the API

Hi Paul,

Have a look at
http://www.eclipse.org/modeling/mdt/uml2-uml/docs/guides/UML2_2.0_Migration_Guide/guide.html
for a description of the changes between the older and newer versions of
UML.

Some of the metaclasses have been renamed i.e. OccurrenceSpecifications
replace older EventOccurrence's and the metamodel has changed significantly
in the area of interactions.

If you are trying to get an exact sequence of all
ExecutionOccurrenceSpecifications in a sequence diagram,  I don't think the
algorithm below would be sufficient to handle all cases ( there is a long
discussion in previous postings as Kenn has pointed out ).

Hope this helps a bit.

Regards,

- James.



"Paul Smith" <paul.t.smith@xxxxxxxxx> wrote in message
news:1fd7e77dccfc1be3c6cbc7895f417176$1@xxxxxxxxxxxxxxxxxx
> Ken,
>
> you were right, it has been discussed earlier but no code example. Just in
> case anyone else needs to know how, the following code snippet is how you
> do it off the version 1.03 API (Using IBM RSA6 hence the old API)
>
> Object collaborationElement = iterator.next();
>     if(collaborationElement instanceof Interaction) {
>          Interaction interaction = (Interaction) collaborationElement;
>          EList fragments = interaction.getFragments();
>          for (Iterator fragmentIterator = fragments.iterator();
> fragmentIterator.hasNext();) {
>              Object fragment = fragmentIterator.next();
>              if(fragment instanceof ExecutionOccurrence) {
>                  ExecutionOccurrence eo = (ExecutionOccurrence) fragment;
>              } else if(fragment instanceof EventOccurrence) {
>                  EventOccurrence eo = (EventOccurrence) fragment;
>                  if(eo.getSendMessage() != null) {
>                     logger.trace("Message " +
> eo.getSendMessage().getName());
>                  }
>              }
>          }
>