Developing with SAP NetWeaver Developer Studio | AWT First Steps | Structure of the MDK Examples | AWT Configuration API Example

AWT Persistence Example

Displaying configuration information

This example uses the configuration API to get information about the MI client. This information is displayed with navigation buttons. We recommend to import the example into your SAP NetWeaver Developer Studio / Eclipse workbench. To download the example program, click here.

Result of the example:

Using the Example

The example has a command line that contain All and groups (A-D, E-H and so on). When you click on All, all models in the database are displayed, if you clicke for example on I-M only cars of make starting with I, J, K, L and M are displayed.

The icon on the right hand side of the command line with the + sign is to add additional cars.

To view car details, you have to click on the car itself (for example, Opel-Vectra). Details like engine, cylinders and so on are displayed. In the detail view you can also delete the entry.

The navigation buttons on the bottom of the list are to navigate in the list forward and backward. The input field right of Page can be used to directly jump to a specific page.

Components

The example uses following packages:

import com.sap.ip.me.api.persist.app.*;
import com.sap.ip.me.api.persist.core.*;
import com.sap.ip.me.api.persist.query.*;
import com.sap.ip.me.api.runtime.awt.AwtApplication;

The following classes use the MI API:

Java

Description
PersistenceExample.java Implementation of the AwtApplication.
Constants.java Interface defining all text strings and constants used in the application.
BasicDataHandler.java This class handles the data. It is directly connected to the persistence classes in the datafactory package. When the user navigates to another page the BasicDataHandler takes care to get the proper data in a vector. This data is than displayed with the JSP.
ReadWriteEntities.java Methods to add, read and delete entities.
ExamplePackagePersistenceMaster.java Implementation of the PackagePersistenceMaster to define the data structure.
Car.java Implementation of the car object.
License.java Implementation of the license object.

 

The classes that create the user interface and handle the events can be seen on your SAP NetWeaver Developer Studio / Eclipse workbench. If you did not import the example so far download the example and import it into your workbench. Please refer to the document Structure of the MDK Examples for more details about the com.sap.ip.me.mdk.api.awt.gui.* package.

Implemented Classes

The class configExampleAWT implements AwtApplication and Constants. Constants is an interface in which we define all relevant variables for the application including the name of the MI application.

The class SystemInfo extends AbstractMEHttpServlet which extends javax.servlet.http.HttpServlet itself. The method doHandleEvent does:

The class BasicDataHandler uses the configuration and user API to fill a vector with data. It also includes methods to access this vector. You can get all available entries in the vector or parts of it, specified by the beginning index and the number of entries needed.

datafactory package