MyEclipse: Generate Java from UML: Default values are missing

myeclipse_user_1 - Nov 25, 2011 - 08:30 PM
Post subject: Generate Java from UML: Default values are missing
When generating Java from a UML class diagram by following these steps:

Select abc.uml, right click, MyEclipse, Generate Java ...

Default values of class attributes are missing from generated Java class.

Exmaple:
=======

UML:
STUBTYPE : String = EJBStub

Java:
- Generated:
private static String STUBTYPE;

- Expected:
private static String STUBTYPE = "EJBStub";

*** Date:
Friday, November 25, 2011 3:17:05 PM EST

** System properties:
OS=WindowsXP
OS version=5.1.0
Java version=1.6.0_21

Installation Summary:
=================

*** MyEclipse details:
MyEclipse Enterprise Workbench
Version: 9.1
Build id: 9.1-20110701


*** Eclipse details:
Eclipse Java EE IDE for Web Developers.

Version: Helios Service Release 2
Build id: 20110218-0911




Eclipse Platform

Version: 3.6.2.r362_v20110210-9gF78Gs1FrIGnHDHWkEcopoN8AmxeZflGDGKQi
Build id: M20110210-1200


Eclipse Java Development Tools

Version: 3.6.2.r362_v20101117-0800-7z8XFW6FLFlmjJcvz03jyeFBLS_F
Build id: M20110210-1200


Eclipse Graphical Editing Framework GEF

Version: 3.6.1.v20100908-1100-777B181A3Bz-6B663E7974242
Build id: 201009132020


Eclipse RCP

Version: 3.6.2.r362_v20101104-9SAxFMKFkSAqi8axkv1ZjegmiBLY
Build id: M20110210-1200


Eclipse Plug-in Development Environment

Version: 3.6.2.r362_v20110203-7b7mFL2FET3dhHalh1iNZtL
Build id: M20110210-1200




Eclipse startup command=-os
win32
-ws
win32
-arch
x86
-showsplash
-launcher
C:\Chordiant_6_6\eclipse\eclipse.exe
-name
Eclipse
--launcher.library
C:\Chordiant_6_6\eclipse\plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222\eclipse_1312.dll
-startup
C:\Chordiant_6_6\eclipse\plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
-exitdata
aa4_40
-product
org.eclipse.epp.package.jee.product
-showlocation
-data
C:\POC_Project_9_0
-vm
C:/Chordiant_6_6/Oracle/Middleware/jdk160_21/bin/javaw.exe
support-swapna - Nov 28, 2011 - 10:47 AM
Post subject:
myeclipse_user_1 ,

Sorry that you are seeing this issue with MyEclipse.

Can you answer some more questions for us ?

1) How did you install MyEclipse ? Is it through All-In-One Installer/Pulse/ Archived Update Site ?

2) Also share your Operating System and version details.

3) Can you give us detail steps on how you are creating the uml class diagram and adding the Stubtype to it for us to be able to replicate it at our end ?
myeclipse_user_1 - Nov 28, 2011 - 02:25 PM
Post subject:
1)
I installed eclipse JEE helios SR2 first:
File Name: eclipse-jee-helios-SR2-win32.zip

Then installed myeclipse (Help -> Install New Software). Installed everything except for "MyEclipse Spring Optional Modules".
File Name: myeclipse-9.1-archived-update-site.zip

Also, I was able to recreate this in MyEclipse 10:
File Name: myeclipse-10.0-offline-installer-windows.exe

2)
Operating System:
Windows XP - Service Pack 3

3)
- Create test.uml (New -> MyEclipse -> UML -> UML2 Model -> test.uml)
- Create TestClass in test.umldi
- Select TestClass -> right click -> Add Property -> add new property called STUBTYPE
- Goto Outline -> Select <Model> test -> Rigth Click -> Generate Primitive Types -> UML
- Select STUBTYPE -> right click -> Show Properties -> Model -> Type -> String
- Select STUBTYPE -> right click -> Show Properties -> Advanced -> Default -> enter EJBStub (I tried "EJBStub" as well)
- Save all changes
- Goto Package Explorer -> Select test.uml -> Right Click -> MyEclipse -> Generate Java -> select /src of an existing Java Project -> Finish
- Open TestClass.java in that /src folder
- Default value we entered (EJBStub) is missing
support-swapna - Nov 29, 2011 - 05:45 AM
Post subject:
myeclipse_user_1,

Thank you for the detailed steps. I could replicate the issue at my end.
I have filed a PR for the dev team to work on it.
Sorry for any inconvenience caused.
support-swapna - Dec 09, 2011 - 09:07 AM
Post subject:
myeclipse_user_1 ,

I could get the default value in the generated class by selecting the isReadOnly option.
Select STUBTYPE -> right click -> Show Properties -> Model > Check the isReadOnly

Attached is the screenshot for your reference.

Let us know how it works for you.
myeclipse_user_1 - Dec 12, 2011 - 01:42 PM
Post subject:
Thanks for your reply.

I tried the steps you mentioned and it works fine. But it generated "final" attribute which is correct since we wanted it to be read only.

In our case, we do not want the attribute to be "final".
support-swapna - Dec 13, 2011 - 06:18 AM
Post subject:
myeclipse_user_1 ,

Our dev team is working on this issue. You can see it fixed in the next release.
Sorry for any inconvenience caused.
All times are GMT - 6 Hours
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits