Show TOC

Procedure documentationAdding a Class Locate this document in the navigation structure

 

You can add Java classes to the rules composer DC and write rules using the classes.

Note Note

You use a Java DC to add classes to the rules composer DC.

End of the note.

Prerequisites

You should have created a rules composer DC

More Information: Creating a Rules Composer DC

Procedure

Creating a Java DC
  1. In the SAP NetWeaver Developer Studio, choose   File   New   Project.  

  2. In the wizard that appears, expand the Development Infrastructure node and choose Development Component. Choose Next.

  3. In the screen that appears, choose the Java node and choose Next.

  4. In the screen that appears, expand the development configuration node and choose the software component (SC) node where you want to create the DC. Choose Next.

  5. Enter a name for the development component in the Name field and choose Finish.

  6. In the Confirm Perspective Switch dialog that appears, choose Yes.

    The new DC is created in the Java perspective.

Creating Classes in a Java DC
  1. In the Package Explorer view, expand the Java DC node and in the context menu of the src node, choose   New   Package.  

  2. In the screen that appears, enter the name of the package in the Name field and choose Finish.

    A new Java package is created under the src node.

  3. In the context menu of the Java package node, choose   New   Class.  

  4. In the screen that appears, enter the name of the class in the Name field and choose Finish.

    A new Java class is created under the Java package node.

Note Note

You can also copy and paste the Java package:

  1. Copy the Java package from your file system.

  2. In the Package Explorer view, expand the Java DC node and choose Paste in the context menu of the src node.

End of the note.
Defining Public Parts

You need to define public parts of the dependent DC (Java) to include classes in a rules composer DC.

Note Note

You may have to open the development infrastructure perspective

To open the development infrastructure perspective:

  1. In the Developer Studio, choose   Window   Open Perspective   Other.  

  2. In the Open Perspective dialog that appears, choose Development Infrastructure and choose OK.

End of the note.
  1. In the Component Browser view, expand the development configuration node and the software component node and choose the Java DC node.

  2. In the Components Properties view, choose the Public Parts tab and choose Add.

  3. In the screen that appears, enter the name for the public part in the Name field. Choose Finish.

    You can view the new public part under the Defined Public Parts section.

  4. In the context menu of the new public part, choose Manage Entities.

  5. In the screen that appears, under the Entities section select the required classes and choose Finish.

Building the Java DC
  1. In the Component Browser view, expand the development configuration node and the software component node.

  2. In the context menu of the Java DC node, choose Build.

  3. In the screen that appears, select the DC checkbox and choose OK.

Adding Dependencies to the Rules Composer DC

You need to add the Java DC as a dependency to the rules composer DC.

Note Note

You may have to open the Development Infrastructure perspective

End of the note.
  1. In the Component Browser view, expand the development configuration node, the software component node and choose the rules composer DC node.

  2. In the Component Properties view, choose the Dependencies tab and choose Add.

  3. In the Adding Dependencies screen that appears, expand the software component node and select the Java DC checkbox. Choose Finish.

Adding Java Classes to the Rules Composer DC

To add Java classes to the rules composer DC, you need to open the Rules Composer perspective.

  1. In the Project Explorer view, expand the rules composer DC node and the Rules Modeling node and double-click the Aliases node.

  2. In the Project Aliases Editor that appears, choose the Class Aliases tab and choose the Add Classes button.

  3. In the Add Java Class dialog box that appears, under the Select Class to Add section, double-click the required Java classes.

    You can view all the added classes under the Selected Classes section. Choose Finish.

  4. Save the changes.