on 12-20-2007 5:12 PM
Hello,
in Component Controller I have the following Context Node:
RequestFindPerson
---ResponseFindPerson
------returnFindPerson
----
----
It's a Model Binding (EJB).
Now I want to create returnFindPerson-Node in a method of a View:
IReturnFindPersonElement returnFindPersonElement = wdThis.wdGetIncRecJcoCompController().wdGetContext().nodeReturnFindPerson().createAndAddReturnFindPersonElement();
But I get this exception
com.sap.tc.webdynpro.progmodel.context.ContextException: ModelElementList(IncRecJcoComp/IncRecJcoComp.RequestFindPerson.ResponseFindPerson.returnFindPerson): ModelObjectManager returned an unrelated object
How can I create a returnFindPerson-Node in the Component Controller Context?
Regards,
Armin
Hi,
Just open the context of your component controller and confirm that your returnFindPerson node type is mapped to a model class. If it is not mapped then try providing that mapping.
Regards,
Murtuza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If the view controller context is mapped to the component controller context, then just create the element in the view context. It will in fact be created in the mapping origin. Mapping does not copy elements but references them.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Armin,
as I write above I have the following Context Node in Component Controller.
RequestFindPerson
---ResponseFindPerson
------returnFindPerson
----
----
This I mapped to my view and create an element:
IReturnFindPersonElement returnFindPersonElement = wdContext.nodeReturnFindPerson().createAndAddReturnFindPersonElement();
But I get this exception:
com.sap.tc.webdynpro.progmodel.context.ContextException: Node(IncRecJcoComp/SelectedPersonsView.RequestFindPerson.ResponseFindPerson.returnFindPerson, class=de.td.increcjcoweb.increcjcoapp.comp.wdp.IPrivateSelectedPersonsView$IReturnFindPersonNode): cannot bind or add elements because the node has no valid parent
Regards,
Armin
Hi Ayyapparaj,
after I set the Collection Cardinality of the parent node to 1..1 I get this exception:
com.sap.tc.webdynpro.progmodel.context.ContextException: ModelElementList(IncRecJcoComp/IncRecJcoComp.RequestFindPerson.ResponseFindPerson.returnFindPerson): ModelObjectManager returned an unrelated object
Regards,
Armin
Hi Armin,
Create Element for ReponseFindPerson like
Iprivate<View>.IResponseFindPersonElement ele = wdContext.createResponseFindPersonElement();
wdContext.nodeResponseFindPerson().addElement(ele);
Then, create element for your returnFindPerson and then add your elements so that you will not get any errors and the values will be added to the returnFindPerson node.
Iprivate<View>.IreturnFindPersonElement ele1 = wdContext.createreturnFindPersonElement();
ele1.setname("Name");
wdContext.nodereturnFindPerson().addElement(ele1);
Hope this helps,
Regards,
Nagarajan
Hello Nagarajan,
there are only these methods to create an IResponseFindPersonElement element:
IResponseFindPersonElement createResponseFindPersonElement(Response_IncRecImplLocal_findPerson model) and
IResponseFindPersonElement createAndAddResponseFindPersonElement()
To create an IReturnFindPersonElement element there are:
createReturnFindPersonElement(Person model)
and
IReturnFindPersonElement createAndAddReturnFindPersonElement()
My method actually looks like this:
public void onActionRemovePersonButtonPressed(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tc.webdynpro.progmodel.api.IWDNodeElement nodeElement )
{
//@@begin onActionRemovePersonButtonPressed(ServerEvent)
IInjuredPersonsElement injuredPersonsElement = (IInjuredPersonsElement) nodeElement;
IReturnFindPersonElement returnFindPersonElement = wdContext.nodeReturnFindPerson().createAndAddReturnFindPersonElement();
WDCopyService.copyCorresponding(injuredPersonsElement, returnFindPersonElement);
wdContext.nodeInjuredPersons().removeElement(injuredPersonsElement);
//@@end
}
Regards,
Armin
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.