cancel
Showing results for 
Search instead for 
Did you mean: 

Remove model objects from context model node

Former Member
0 Kudos

Hi, all!

By now if I want to remove all the model objects from a context model node which I previously added with .add, I loop over the node removing each model object.

Is there probably a more convenient one method call which gets me rid of those model objects?

Regards,

Thomas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thomas,

Yes and no.

"Yes" for creatin scenarios with Adaptive RFC and ESF models. "No" for WebService & JavaBean model.

For scenarios that it works, you have to get some collection of related objects you whant to remove, and then clear it:


final <YourParentModelClass> object 
  = wdContext
      .current<YourNodeName>Element()
        .modelObject();
final Collection related  
  = object.get<RelationName>();
related.clear();

This will have some neat side effect, that if your relation was mapped to child node, then child node will reflect changes automatically.

However, with ESF model for certain relations this will cause persistent objects on back-end to be deleted with module.commit() call. So use code above with care for this type of model.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Answers (0)