Author Topic: Roundtrip Engineering with Collection Classes  (Read 387 times)

Andre Eckardt

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Roundtrip Engineering with Collection Classes
« on: October 27, 2010, 11:10:31 pm »
Hello,

I am trying to model a class with a collection of another class. But I am not able to get the inteded result in the class diagram. I hope someone can tell me the missing step.
What I did in a new project (Java):

- Set the default Collection Class to "Vector<#TYPE#>" as described in the User Guide.  (http://www.sparxsystems.com/enterprise_architect_user_guide/software_development/settingcollectionclasses.html)
- Added two classes in a class diagramm (Class1 and Class2)

- Added an attribute to Class1: Name: v1, Type: Class2, Multiplicity: 1..*, set the flag "Attribute is a Collection"
Result: new Attribute in Class1, but no association to Class2 visible in the diagram, (shouldn't it be added automatically?), generated source code only contains a 'usual' variable v1:Class2 instead of a collection

- Added an attribute to Class1: Name: v2, Type: Vector<Class2>, Multiplicity: 1..*, set the flag "Attribute is a Collection"
Result: new Attribute in Class1, but again no association to Class2 visible in the diagram, generated source code contains variable v2:Vector<Class2>

Here is the (simple) generated code:
public class Class1 {
      private Class2 v1;
      private Vector<Class2> v2;
      public Class1(){}
      }
public class Class2 {
      public Class2(){}
      }

Reverse Engineering of the two classes into a new project gives the following result:
A diagram with the two classes, including only one association (v1).
But both attributes have lost the information for Multiplicity and the Collection Flag. Generated from this code I expected two associations v1[1..1] and v2[1..*].

What am I doing wrong? Which is the missing step or option setting?

Same topic: How can I define more/different classes as Collection Classes for doing Reverse Engineering?

Thanks for your help.
André



Andre Eckardt

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Roundtrip Engineering with Collection Classes
« Reply #1 on: November 19, 2010, 02:43:05 am »
FYI: After sending this request via email to the Sparx support they replied:

Quote
Thanks for the note.
 
Support for reverse engineering generic/templated attributes has been implemented and will be available in the next major release of EA.
 
If you have any further questions please let us know.