0% found this document useful (0 votes)
56 views

Complex Hierarchy - Java

This document contains code for a rule engine that takes in a user's country, city, and address and outputs a hierarchical string with those details separated by semicolons. It first checks that the country, city, and address are not null, and if not null, concatenates them into a string separated by semicolons. If any of the inputs are null, it simply outputs "World".

Uploaded by

Kailas Padawale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Complex Hierarchy - Java

This document contains code for a rule engine that takes in a user's country, city, and address and outputs a hierarchical string with those details separated by semicolons. It first checks that the country, city, and address are not null, and if not null, concatenates them into a string separated by semicolons. If any of the inputs are null, it simply outputs "World".

Uploaded by

Kailas Padawale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

/**

import com.engiweb.profilemanager.common.bean.UserBean
import com.crossideas.certification.common.bean.data.ResultBean
import com.engiweb.profilemanager.common.ruleengine.action.UtilAction
import java.util.ArrayList
import com.engiweb.profilemanager.common.ruleengine.action.reorganize._UserAction
import com.engiweb.profilemanager.common.bean.ExternalInfo;

global com.engiweb.pm.dao.db.DAO sql


global com.engiweb.logger.impl.Log4JImpl logger
*/
when
userBean : UserBean( )
resultBean : ResultBean( )
then
/**
####################################
Name: Complex Hierarchy
Configuration Type: Advanced
Rule: COMPLEX_HIERARCHY
Value: Hierarchy
Separator Char: Semi-Colon (;)
####################################
World
- United Kingdom
- - Belfast
- - - 1 Main Street
- - London
- - - 2 High Street
- - - 3 Oxford Street
- - - 4 Piccadilly
- France
- - Paris
- - - 5 Rue de Provence
####################################
*/
/* Country>City>Office */
String country = userBean.getCountry();
String city = userBean.getLocality();
String office = userBean.getAddress();

if (country != null && city != null && office != null) {


resultBean.setResultString("World;" + country + ";" + city + ";" + office);

} else {
resultBean.setResultString("World");
}

You might also like