Book a Demo

Author Topic: Import java not generating toMany relationships  (Read 3635 times)

klarson

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Import java not generating toMany relationships
« on: April 16, 2011, 07:32:26 am »
Importing java source code is not generating toMany relationships. For example having a class LodgingQuery with member
    protected List<LodgingType> lodgingTypes;
does not create a relatationship from LodgingQuery to LodgingType.

Is there something I need to set up for EA to recognize these generic containers?

I did spend quite a bit of time searching the forums as I'm sure this has been asked many times, but couldn't find anything.

thanks in advance.... great tool!

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Import java not generating toMany relationship
« Reply #1 on: April 18, 2011, 09:06:48 am »
Which version of EA are you running?  Try using the EA 9 beta if possible.  It has many improvements to the handling of generics/templates.
http://www.sparxsystems.com/products/betas.html

Markus W

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Import java not generating toMany relationship
« Reply #2 on: April 18, 2011, 06:46:33 pm »
I am using Enterprise Architect 9 Beta Prerelease (9.0.902).
In this version it doesn't work.

But the release notes contain the following:
Code Engineering: Reverse Engineering of Associations from Attributes with instantiated template type added.

Why doesn't it work in this version? In which version will it work?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Import java not generating toMany relationship
« Reply #3 on: April 19, 2011, 08:30:32 am »
Go to Tools | Options | Source Code Engineering | Java.

Add 'List<#TYPE#>' to the 'Additional Collection Classes' option.

I'm not sure why it isn't in there by default, but will see that it gets added.
« Last Edit: April 19, 2011, 08:30:54 am by simonm »

klarson

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Import java not generating toMany relationship
« Reply #4 on: April 19, 2011, 11:21:20 am »
Thanks for helping... I don't see an ''Additional Collection Classes' option. I tried adding List<#TYPE#> everywhere else but no dice. There is a 'Default Collection Class' setting as well as a Collection Classes button with brings up a panel with three entries inside a 'static' box... These are labeled:
  • Default Collection Class
  • Collection Class for Ordered multiplicity
  • Collection Class for Qualified Multiplicity

As I said setting these has no impact to the imported JAVA code. Smells like these only affect code generation?

I'm using EA8

Thanks

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: Import java not generating toMany relationship
« Reply #5 on: April 19, 2011, 11:54:33 am »
[Edit: Thanks Aaron - yes, KLarson needs to try the latest EA 9.0 trial, as MarcusW is already doing.]

Select the Tools | Options menu option, then on the Options dialog select the Source Code Engineering | Java option.

This shows the Java Specifications page of the dialog. There are two sets of fields here, the top set being under the heading: Options for the current model. The last field in this set is Additional Collection Classes.

For Help, go to Software Engineering > Other Settings > Set Collection Classes and Software Engineering > Other Settings > Language Options > Java Options
« Last Edit: April 19, 2011, 01:30:59 pm by RoyC »
Best Regards, Roy

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Import java not generating toMany relationship
« Reply #6 on: April 19, 2011, 11:59:20 am »
Quote
I'm using EA8
The Additional Collection Classes field is only in Enterprise Architect 9.  You'll need to install the EA 9 beta to use these new options.

Markus W

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Import java not generating toMany relationship
« Reply #7 on: April 19, 2011, 06:36:13 pm »
Thanks, now it works.
But I have another question.
If I add a collection class , that has more than one template parameter , I can only set #TYPE# for only one template parameter.
e.g. Map<String,#TYPE#>.
Is it possible to define something like Map<#TYPE1#,#TYPE2#>?