Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Rule with Rule Composer: Defining proper Business rules is one of the most important aspects of a Business Process Development. Business rules are nothing but a set of user defined and business process specific constraints. These constraints or rules can be process centric and can vary. For example “Employee Performance Bonus Distribution”. If we consider this as a specific business process then we will see that this business process has its own business rules or constraints like What will be the bonus amount?, Is there any other criteria that should be considered while calculating the bonus? Etc. And the “Employee Performance Bonus Distribution” is a repetitive process and at the end of every year this process is initiated to distribute the bonus among the employees.

So while we are designing &  developing this process the first thing that comes into our mind is defining a set of rules based on which the bonus calculation process should run itself.

While using the previous releases of Netwaver CE7.1.1 most of us may thought of developing Business Rules but found it quite difficult to implement. But the latest release of Netwaver CE 7.1.1 makes our dream come true. Now we can compose our own Rule Set and for this SAP introduced a new perspective called “Rules Composer”. Using “Rules Composer” we can model and implement Business Rules.

 
Without going into any further details let’s see how we can compose our own Rule Set. Create a Development Component Project of type “Rules Composer”.

 
 

Basically you can write your Rules either on XML Schema or Java Class. Here I have shown the Java Class approach. So we need to create a class. Now create a DC type Web Module project and add a class. In the Java EE Perspective open your Java file and add the following Code.

 

 Now we will define public part specific to this project as show below.

 

And then add the Web Module project in the dependency list of Rule Composer DC.

Next we need to add the Rule class in the Rules Composer DC. Open the Project Explorer view, expand the rulescomp (project name) --> Rules Modeling node --> and double-click the Aliases node --> Aliases Window opens. Now select Class Aliases Tab from bottom and click on Add Classes.

From the Add Java Class window select your Java Class and click  and Finish. The Class appears in the Alias list with all its details.

 
Next create a Ruleset. Right Click on Rules Modeling --> New Ruleset-->Enter a Ruleset name.

After creating the Ruleset, double click and open the Ruleset. Now we will need to define our Rules inside the Ruleset. Click on New button(from the extreme right) and enter your Rule name in Create New Rule window.

 

Once you create your Rule the Rule will be displayed in the Outline view at the bottom left corner and the Rule Editor will open.

Click on the + symbol to add a new condition inside your rule. Once you click on the + symbol a default condition: Operation.isSuccessful Equals true appears.

We need to Modify the default condition. So choose the LValue: Operation.isSuccessful and in the drop down menu choose Testclass.getEmployeeDept as shown below:

 

After selecting your conditions you can select your Comparator and then choose the RValue:

In the next section, choose the icon that looks like a + sign and in the drop down menu that appears, choose Execute.

               

 Choose < Action Method > and in the drop down menu, choose as shown below:

 

That’s it. You have modeled your Business Rule Set. Now Build and Deploy. This Blog is all about introducing the New Rule Composer in CE 7.1.1. In my next Blog I will show in detail how we can reuse this Business Rule Set in different Applications.  So if you are also interested to explore the new features of CE 7.1.1 you can get the installer here.

2 Comments