cancel
Showing results for 
Search instead for 
Did you mean: 

Copy ModelNode to another ValueNode

Former Member
0 Kudos

Copy Model Node to another Value Node

the structure like this

-NodeOutput (ModelNode)

-NodeMgr

-NodeOU

-NodeCalendar

-NewNodeOutput (ValueNode)

-NewNodeMgr

-NewNodeOU

-NewNodeCalendar

pls advice how to i copy the NodeOutput to NewNodeOutput same structure and same attribute.......

Message was edited by:

yzme yzme

Accepted Solutions (1)

Accepted Solutions (1)

former_member186016
Active Contributor
0 Kudos

Use :

WDCopyService.copyElements(NodeOutput, newNodeOutput );

for each node you want to copy.

Regards,

Ashwani Kr Sharma

Answers (3)

Answers (3)

former_member751941
Active Contributor
0 Kudos

Hi yzme,

You can use this also.

try

{

IPrivate<put View Name>.INewNodeOutputNode NewNodeOutputNode = wdContext.nodeNewNodeOutput();

IPrivate<put View Name>.INodeOutputNode masterNode = wdContext.nodeNodeOutput();

int size = masterNode.size();

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

{

IPrivate<put View Name>.INodeOutputElement masterElement = (IPrivate<put View Name>.INodeOutputElement)wdContext.nodeNodeOutput().getElementAt(i);

IPrivate<put View Name>.INewNodeOutputNode targetNode = wdContext.nodeNewNodeOutput();

IPrivate<put View Name>.INewNodeOutputElement targetElement = targetNode.createNewNodeOutputElement();

WDCopyService.copyCorresponding(masterElement, targetElement);

targetNode.addElement(targetElement);

}

}

catch(Exception e)

{

e.printStackTrace();

}

Or

try

{

WDCopyService.copyElements(wdContext.nodeNodeOutput(),wdContext.nodeNewNodeOutput ());

}

catch(Exception e)

{

e.printStackTrace();

}

Regards,

Mithu

Former Member
0 Kudos

Hi,

1)First context map your model to component controller....

2)then u copy from componentcontroller to view....

Use this code in wdDoInit();

{

IWDNode srcNode = (IWDNode)wdThis.wdGetFlightCompController().wdGetContext().nodeOutput();

IWDNode destNode = (IWDNode)wdContext.nodeNewNodeOutput();

WDCopyService.copySubtree(srcNode,destNode);

}

former_member186016
Active Contributor
0 Kudos

If there is subnode under a node, you have call the

WDCopyService.copyElements(); for each subnode also

OR use the method

WDCopyService.copySubtree(NodeOutput , newNodeOutput , true);

Read the javadoc also for these methods by pressing F2 on the method. Will be useful while using them.

Regards,

Ashwani Kr Sharma

Former Member
0 Kudos

there is a subnode as i said

the top Node OutputNode underneath are 3 others subnode

former_member186016
Active Contributor
0 Kudos

Hi,

Then i think method WDCopyService.copySubtree(NodeOutput , newNodeOutput , true);

must be used by you.

I havn't used it but by javadoc it refers that subnodes will also be copied.

Regards,

Ashwani Kr Sharma

former_member365727
Active Contributor
0 Kudos

Hi,

I have used this WDCopyService.copySubtree, this will copy the subnodes also...

Its always better to use copySubtree, but do remember that the node and subnode names should be same in both source and target, then only it will copy.

Regards

Srikanth

former_member365727
Active Contributor
0 Kudos

Hi,

Please close this thread, if the issue is resolved.

Regards

Srikanth