Web Dynpro API Documentation

com.sap.tc.webdynpro.progmodel.api
Class WDCopyService

java.lang.Object
  |
  +--com.sap.tc.webdynpro.progmodel.api.WDCopyService

public abstract class WDCopyService
extends java.lang.Object

This class implements the well known ABAP feature "MOVE_CORRESPONDING".

See Also:
copyCorresponding(Object, Object)

Inner Class Summary
static interface WDCopyService.IWDCopyService
          Describes the features required from the internal copy service implementation.
 
Constructor Summary
WDCopyService()
           
 
Method Summary
static void copyCorresponding(java.lang.Object source, java.lang.Object target)
          The Web Dynpro equivalent for the well know abap feature "MOVE_CORRESPONDING".
static void copyElements(IWDNode source, IWDNode target)
          Copies all elements from source to target.
static void copySubtree(IWDNode source, IWDNode target)
          Copies all elements from to complete subtree of source to target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WDCopyService

public WDCopyService()
Method Detail

copyCorresponding

public static void copyCorresponding(java.lang.Object source,
                                     java.lang.Object target)
The Web Dynpro equivalent for the well know abap feature "MOVE_CORRESPONDING". It intentionally has been renamed because the term "move", although always being used in Cobol and ABAP, is not quite correct and unusual in Java.

The method inspects all attributes of source, searches a compatible attribute in target and copies the value if it finds one. Values are considered compatible if their Java class matches:

Currently, both source and target may be either an IWDNodeElement or an ICMIGenericModelClass. If any object is of another class, it is simply ignored. These both classes have been chosen, because they can tell about their structure at run time without the need of Java reflection.

Parameters:
source - The source object
target - The target object

copyElements

public static void copyElements(IWDNode source,
                                IWDNode target)
Copies all elements from source to target. Afterwards source contains as much elements as target, each one either copied via copyCorresponding(Object, Object) (if target is a value node) or holding the same model instance (if source and target both are model nodes holding the same class). The lead selection will be copied, too.

Note: If you copy a model node to another model node, only the reference to the model instance is copied, but not additional value attributes. Copying a model node to a value node works fine.

Parameters:
source - The source node
target - The target node
Throws:
WDRuntimeException - if target is a model node and source is not a model node holding the same class.

copySubtree

public static void copySubtree(IWDNode source,
                               IWDNode target)
Copies all elements from to complete subtree of source to target. This is done by applying copyElements(IWDNode, IWDNode) to the nodes and then searching for equally named subnodes and recursively applying copySubtree to them.
Parameters:
source - The source node
target - The target node
Throws:
WDRuntimeException - if copyElements(IWDNode, IWDNode) fails for a node in the subtree.

Web Dynpro API Documentation

Copyright © 2004 SAP AG. Automatically generated Thu Mar 3 2005, 22:15