History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: BPM-256
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Wouter Zoons
Reporter: Igor Kuzmitshov
Votes: (View)
Watchers: (View)
Operations

If you were logged in you would be able to see more operations.
Bpm4Struts Cartridge

Dummy list should use a factory, not "new"

Created: 19/Sep/05 11:01 AM   Updated: 01/Nov/05 03:03 PM
Component/s: None
Affects Version/s: 3.1-RC1
Fix Version/s: None


 Description   
Currently generated dummy list uses "new" to create dummy data:

private static final com.my.data.Phone[] phoneListDummyList =
        new com.my.data.Phone[]
        {
            new com.my.data.Phone(null, "number-1"),
            new com.my.data.Phone(null, "number-2"),
            new com.my.data.Phone(null, "number-3"),
            new com.my.data.Phone(null, "number-4"),
            new com.my.data.Phone(null, "number-5")
        };

resulting in compilation error (because entity representing class is com.my.data.PhoneImpl):

.../PhoneControllerImpl.java:56: com.my.data.Phone is abstract; cannot be instantiated
            new com.my.data.Phone(null, "number-5")
            ^

A factory could be created to populate the list.


 All   Comments   Change History      Sort Order:
Comment by Wouter Zoons [19/Sep/05 12:17 PM]
would it be possible to attach a patch to this issue ? the dummy implementation is supposed to be replaced by a manual implementation, I have too many higher priorities on my todo list so any help would be appreciated, thanks!

Comment by Igor Kuzmitshov [19/Sep/05 07:57 PM]
OK, I will try in a few days (I have never tried to modify a cartridge before :) ).

Comment by Wouter Zoons [19/Sep/05 08:17 PM]
there is documentation regarding this kind of stuff, basically you would just need to use the cartridge but override one or more templates, see this documentation: http://docs.andromda.org/andromda-cartridges/index.html#mergeLocation

to learn what properties you can call on the Velocity variables see these JavaDocs:
(generic: http://galaxy.andromda.org/docs/andromda-metafacades-uml/apidocs/index.html)
(bpm4struts: http://galaxy.andromda.org/docs/andromda-bpm4struts-cartridge/apidocs/index.html)

for example, if you see $action in a bpm4struts template it's most likely an instance of StrutsAction (http://galaxy.andromda.org/docs/andromda-bpm4struts-cartridge/apidocs/org/andromda/cartridges/bpm4struts/metafacades/StrutsAction.html)

good luck! (btw, you'll see it's actually fun to play ith a cartridge like that)

Comment by Wouter Zoons [01/Nov/05 03:03 PM]
hi Igor,

I'm afraid that detecting all possible cases of value objects would be a bit overkill here .. IMO it's okay to have the generate webapp code not compile in the implementation (you can always safely edit this file), the feature of having the fully deployable webapp is a nice extra for when you want to give a quick demo, but using it on applications that would go into production is bit much I think

handling all possible cases of collections/arrays would overly complicate the template(s)

for that reason I'm closing this issue .. please comment if you disagree or if you think there's a practical solution to this problem