Skip to Content
author's profile photo
Former Member

binding business methods to model

hi there,

how does it work to be able to bind several business methods to a model? i know how it works for one method, but up to now i found it impossible to use more than one method through the model of a web dynpro project.

how can i address two or more request_ ... nodes of a model (i.e. methods of a webservice) in the component controller?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • May 14, 2004 at 02:57 PM

    Hi Ilse,

    if you have more than one mehtod in your Web Service the model generator will create one Request_... and one Response_... class for each method of the Web Service.

    Regards

    Helmut

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Ilse,

      i didn't recognize the restriction in case of model nodes, i used this for value nodes so far. There's a more generic approach using the method inserted below.

      This method copies all attributes of node A into the attributes with the same name of node B, regardless if A and B are different model classes, if they are compatible. But it does not create elements like copyElements() and does not recurse into child nodes like copySubtree(), you would have to do this by yourself if necessary.

        /**
         * 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.
         * <p>
         * The method inspects all attributes of <code>source</code>, searches a
         * compatible attribute in <code>target</code> and copies the value if it 
         * finds one. Values are considered compatible if their Java class matches:
         * <ul>
         *   <li> All numeric classes (Byte, Short, Integer, Long, Float, Double,
         *        BigInteger and BigDecimal) and primitives (byte, short, int, long,
         *        float, double) are compatible.
         *   <li> Boolean class and primitive are compatible.
         *   <li> Character (class) and char (primitive) are compatible.
         *   <li> Otherwise source and target attribute must be based on the same class.
         * </ul>
         * <p>
         * Currently, both <code>source</code> and <code>target</code> may be either
         * an {@link IWDNodeElement} or an {@link com.sap.tc.cmi.model.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.
         * <p>
         * @param source The source object
         * @param target The target object
         */
        public static void copyCorresponding(Object source, Object target) {
          instance.copyCorresponding(source, target);
        }
      

      Hope that helps anyway.

      Regards

      Stefan