cancel
Showing results for 
Search instead for 
Did you mean: 

Command bean property of collection type is not geting set

Former Member
0 Kudos

I have a commandBean named UpdatePRCommandBean . It has 2 properties 1)headerDTO of type HeaderDTO 2)detailsDTO of type Collection . The bean has an execute method which executes an sql stored procedure . and its expects 2 parameters HeaderDTO and Collection .

While debugging , I can see that Collection object is null , even though the corresponding context node is filled with data (while debugging the data is verified )

The context structure of model nodes is as under

---root

---PRDetailsMainNode

-


PRDetailschildNode(X)

---UpdatePRMainNode

-


UpdatePRchildNode(Y)

Now I want to copy data from X node to Y . I have used following code

wdContext.nodeUpdatePRMainNode().invalidate();

UpdatePRMainNode upd = new UpdatePRMainNode();

wdContext.nodeUpdatePRMainNode().bind(upd);

IPRDetailschildNode srcNode = wdContext.node.nodePRDetailschildNode ();

IUpdatePRchildNode destNode = WdContext.nodeUpdatePRMainNode().nodeupdatePrChildNode();

int size = srcNode.size();

IPrDetailsChildNodeElement elemSrc;

IupdatePrchildnodeElement elemDest;

for (int i = 0; i < size; i++) {

elemSrc = srcNode.getPrDetailsChildNodeElementAt(i);

elemDest = destNode.createupdatePrchildnodeElement (elemSrc.modelObject());

destNode.addElement(elemDest);

WDCopyService.copyCorresponding(elemSrc, elemDest);

}

wdContext

.currentUpdatePRCommandElement()

.modelObject()

.execute_updatePR();

In debug mode , the value gets successfully copied to elemDest . However while debugging commandbean it is seen that the collection object is empty .

Can anyone help ?

Accepted Solutions (0)

Answers (1)

Answers (1)

snehal_kendre
Active Contributor
0 Kudos

HI,

everything seems to be correct, but

you create upd

UpdatePRMainNode upd = new UpdatePRMainNode();

and bind it with

wdContext.nodeUpdatePRMainNode().bind(upd);

then after copying everything into destNode..

you need ti add destnode into upd.

i.e.

like

upd.setUpdatePRchildNode(destnode);

then only your commandbean context will get your copied values. else right now destnode contains value, but it is not added into upd..

Former Member
0 Kudos

Thanks for the hint . I need to do this now ?

upd.setUpdatePRchildNode(destnode)

and rebind ?

wdContext.nodeUpdatePRMainNode().bind(upd);

Right ?

However upd.setUpdatePrchildNode( ) expects Collection object . How I have to cast destnode values to Collection ...Can you please help ?

Former Member
0 Kudos

Hi all,

I could not find an API to convert nodeelement to collection . I manually wrote a method in view which took IWDElement as input and return the required DTO . Inside the method , I wrote adding DTO elements through IWDelment .

Collection objet was creted as under

Collection vendorBillDetailsDTO=new ArrayList()

The items in collection weere added as under

vendorBillDetailsDTO.add(ConvertNodeElementToVendorBillDetailsDTO(elemDest));

The method ConvertNodeElementToVendorBillDetailsDTO is as under

public VendorBillDetailsDTO ConvertNodeElementToVendorBillDetailsDTO(IBillDetailsForBillIdElement ne){

VendorBillDetailsDTO dto=new VendorBillDetailsDTO();

dto.setBillDetailRef(ne.getBillDetailRef() );

dto.setBillId(ne.getBillId() );

dto.setCRN(ne.getCRN());

dto.setServiceCode(ne.getServiceCode() );

return dto;

}

If anyone knows api to convert nodeelement values to collection objects ..pl share

Edited by: Narasimha Bhat on Aug 25, 2008 1:30 PM