cancel
Showing results for 
Search instead for 
Did you mean: 

Importing java beans with java.util.List properties

Former Member
0 Kudos

How do you import a simple Java Bean class which has List or Collection properties?

It's already fairly easy to import a java command bean which returns basic data types (int, boolean, String, ..). But as soon as the getter/setter inside the bean returns a java.util.List or other more complex data types, the Web Dynpro java bean importer will import that type as a Relationship. At that point, the import wizard forces us to select a model type but only the bean class itself is visible as a choice.

So, what's the mechanism to import simple java bean which have collection properties.

For instance, how to import this bean as a Model?

class MyBean_GetBooksCommand {

private java.util.ArrayList _books;

public void setBooks(java.util.ArrayList books) {

_books = books;

}

public java.util.ArrayList getBooks() {

return books;

}

}

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hello Bernard,

Did you check this ?

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Yes, I saw that thread and many others. The last posting in it pretty much sums things up...

"That tutorial doesn't tell you how to mannage with the java.util.List, which is the main problem here."

Answers (1)

Answers (1)

Former Member
0 Kudos

Bernard,

So you want a <i>property <b>books</b></i> with type java.util.ArrayList rather then relation?

Hmmm... Note, that you'll be unable to use it for sub-nodes in designer as it is possible with relation. If you need to display / edit it then you end up with hand-written supply functions. And models was designed (up to certain extent) exactly for opposite: to automate this process.

But, anyway:

1. Uncheck this <b>relation</b> during model import

2. Finish import

3. Open desired model class (MyBean_GetBooksCommand) in WebDynpro model class editor

4. Add property <b>books</b> with type java.util.ArrayList

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Thanks Valery, I was under the assumption that NDS would create the subnodes for a list natively (without having to resort to a relation).

So, I need to setup a relationship in order to see the sub-nodes. You mentionned these steps in the other post:

<i>1. You need getter / setter these expose someMembers variable

2. On the latest screen of model import wizard, you have to select concrete JavaBean class for relation (relation will be highlighted with "warning" icon) Note, that this JavaBean class should reside in the same model, i.e. you have to include it in model import</i>

I belive that the Java bean class for the relationship is called the ModelType class in the wizard. What would that ModelType class look like for the simple getBooks bean above?