cancel
Showing results for 
Search instead for 
Did you mean: 

Making a node a collection

Former Member
0 Kudos

Hello,

Does anyone know of a easy way to make a model node a collection without having to iterate through all of the elements and add them manually?

Thanks,

Dustin Gronso

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Dustin,

What type of model are you using? I mean, if you are working with CMIModel instances (for example, DynamicRFC), then there are should be no problems: you can easly bind CMIObservableList (not sure about name) to node as a complete collection. And sub-nodes could be populated completely dynamically if you define supplying relation role when bind model.

Heck, even without CMIModel, 0..n-cardinality node has bind(Collection) method!

VS

Former Member
0 Kudos

I'm working with a model that was created from a XMI file. I'm not trying to bind a collection to a node - I'm trying to go the other way around. I want to get the data from the node to a collection.

Dustin

Former Member
0 Kudos

Hi Dustin,

using the ICMIObservableList makes it possible to use the context as collection. In other words the ICMI and the context use the same collection So when the context is changed, the ICMI is also changed. So you have the context as collection!

Best regards,

Christian

Former Member
0 Kudos

Christian, XMI import does not produce CMI-compatible models

So, Dustin, there is no way except to write utility class that iterate over generic IWDNode and collect every IWDNodeElement.model()

WBR,

VS

Former Member
0 Kudos

Hi Valery,

are you sure? The documentation in NDS of ICMIModelInfo tells that the type TYPE_REVERSEENGINEERED is created via xmi import.

For my understanding all the wd model use CMI.

Best regards,

Christian

Former Member
0 Kudos

Christian,

You are right about documentation about TYPE_REVERSEENGINEERED constant. But nevertheless, XMI import wizard produces no model implementation class (.java) only model declaration (.wdmodel + *.wdmodelclass). All info here and below is relevant for SP6-SP8

Therefore output you get IS NOT complete CMI-compatible model, only declaration that allows you to use model at design time (bind context nodes to it). The same is true for importing WebService -- even you get java model class, it does not implement ICMIModel.

Could anyone from WD team enlight us regarding this issue (i.e. not all NW model generation wizards produces CMI models)?

Regards,

VS

frank_weigel
Employee
Employee
0 Kudos

Hello VS,

to keep it short: "all NW model generation wizards indeed produce CMI models, even if these models don't implement the CMI interfaces".

To understand this, one must know, that Web Dynpro in NetWeaver 04 accepts two "flavors" of the Common Model Interface (CMI):

1) a typed flavor that defines rules how a (Java Bean like) model should look like so that Web Dynpro can use it for model nodes. For such a model, WD uses the design time metadata (*.wdmodel + *.wdmodelclass files) to learn about the available classes, attributes and relations. Accessor/Mutator methods must conform to the Java Beans spec, as the generated WD context nodes/elements call the corresponding methods directly.

2) a generic flavor that is based on the com.sap.tc.cmi interfaces. For theses models WD has the choice to call typed methods or to rely on the generic interfaces of CMI. The latter provide some additional functionality (e.g. metadata at runtime can be newer than metadata at designtime and WD adopts a model node automatically) not available from the typed interface.

The 2nd flavor is what you name a "complete CMI model". As you can see from the above, the XMI imported model is a complete CMI model as well, at least from the WD point of view.

It is true that XMI imported models don't necessarily implement the CMI interfaces. This is due to the fact that the XMI import is a reverse engineering tool only. It does not wrap the imported model with generated classes. But if the underlying Java classes already implement the CMI interfaces, fine.

Hope that helps a little bit to clarify the issue.

Kind Regards, Frank

Former Member
0 Kudos

Hi Dustin,

there is one special collection called ICMIObservableList. When you bind that one to the context it's actually directly bound without their elements beeing copied into to the context.

So with this collection you have the possibility to either use context or collection functions.

The only thing you have to do to get this running is to write your own implmentation of the ICMIObservableList. But this is a easy job as you can use e.g. an ArrayList in your implementation of the ICMIObservableList.

If you need more information just post a message.

Best regards,

Christian