Start of Content Area

Procedure documentation Importing a WD Model of the Type JavaBean for a Local WD Project  Locate the document in its SAP Library structure

Prerequisites

You have defined a Web Dynpro project, as described under Creating a Project.

Import Procedure

To make the bean classes available to the Web Dynpro application, proceed as follows:

...

       1.      For this purpose, start the import wizard by placing the cursor on the subdirectory This graphic is explained in the accompanying textModels of the Web Dynpro project in the Web Dynpro Explorer view. Then choose the context menu option This graphic is explained in the accompanying textCreate Model .

       2.      Select the option This graphic is explained in the accompanying textJava Bean Model and choose Next.

       3.      Enter a name for the model and select the model package or specify a new package by entering the package name in the input field. The model package represents the storage location for the Web Dynpro model and thus does not affect the package of the original Java classes. Condition: The package must be empty. The model classes created in the import are then given the names of the original JavaBean classes and are assigned to the package.

       4.      You can choose between the options Project(source folder) and Local JAR file.

 

                            a.      Option Project (source folder)

Caution

To be able to use this option, you must make the complete JavaBean project available to the Web Dynpro project using the function Import File System. Select the top project folder and confirm the prompt as to whether the class path entries can be overwritten. After the import, the contents of the JavaBean project become part of the /src/packages folder of the Web Dynpro project; goto the Navigator view to see this.

If you check the option Include associated projects, the subsequent wizard windows allow you to select from all classes and interfaces of the assigned projects – for example, from the Web Dynpro runtime (_webdynpro_clientserver.jar, _webdynpro_services.jar, and so on) or the Java runtime environment (rt.jar in java.util.jar of the JDK directory) of the current installation – in addition to the objects of the JavaBean project.

 

                                                  i.       In the next window, select the required classes individually and choose Add -->. Soon after, the classes are displayed in the right column for the model objects. Choose Next.

                                                ii.       You must now define details for the model class properties. In the default tab ModelClass View, select one of the classes to be imported and choose  Add. In this dialog box, you can select properties from other JavaBeans and add them to your imported class.

In the tab ModelRelation View of the same wizard window, you can check the relations of the classes again before import.. It is especially important to specify the target model classes for model relations flagged with a warning and thus prevent the occurrence of import conflicts: Dissolve the relations as necessary. The Assistant provides support, for example, when dissolving relations of the type java.util.Collection. Only when all relations have been broken down or marked as non-relevant by the importer, can the model import begin.

                                               iii.       Choose Next to proceed to the import log window, which displays the current status of the model import. If there are design time errors in the import definitions, the import cannot be started. In this case, choose Back to return to the preceding wizard windows and make the necessary corrections.

                                               iv.       Choose Finish to initiate the final import step.

 

                            b.      Option Local JAR file

                                                  i.       In the next wizard window, choose Add JAR … followed by Next.

                                                ii.       In this window, you must now specify the path of the locally available .jar file; choose Browse to do so. The directory of the  .jar file is irrelevant.

                                               iii.       The option Design Time (compile time dependency only, JAR will be deployed using a different deployable unit) is selected by default.

                                               iv.       Choose OK; the JAR path and JAR dependency – that is, whether there is a design time (DESIGN_TIME) or runtime (DEPLOY_TIME) dependency – are displayed in a table. Choose Next.

                                                 v.       Select the Java classes for the import. After selecting the classes and assigning them to the model via Add ->, the display for the specified classes is transferred from the left JARs window to the right Model window, thus removing the display in the left frame. If you also want to transfer the superclass and the interfaces for the model, select the relevant option. Choose Next.

                                               vi.       The window containing the model class details shows the properties of the class, any inheritance that exists, and the relations (separate tab). At this point, you can still deselect individual classes or properties so that these are not included in the import. Choose Next.

                                              vii.       The last window shows the import log and supplies detailed information on the model object. Note that the import cannot be completed if error messages occur in the log.

                                            viii.       Choose Finish to close the wizard and thus initiate the model generation.

                                              ix.       In the case of a deploy time dependency of the .jarfile, the system displays a dialog box with the success message The Jar is successfully imported to the lib folder of the project; choose OK.

 

Result

The logical Web Dynpro model object is displayed with its model classes under the Models node in the Web Dynpro Explorer and is thus available for use – for example, for processing individual model classes. To display the imported model classes in the model editor, double-click the relevant class. The model editor contains general information on the model class and its properties and relations.

To use the model in the Java Web Dynpro application, you must – if you have not already done so –define a Web Dynpro component (see Creating a Component), followed by an explicit model use, as described under Referencing a Model. Afterwards, you can process the model objects as described in the chapters Model Binding and Context Structure.

 

End of Content Area