Example of custom screen recognition

Following is an example of business logic that performs custom screen recognition. This business logic class takes a list of code page numbers, separated by blanks, as its settings, and recognizes the screen if its code page matches one of those listed in the settings. The tag syntax is:
<customreco id="company.project.customlogic.CodePageValidate::[settings]" optional="false" invertmatch="false" />
For example, you can insert the following tag into a description block:
<customreco id="company.project.customlogic.CodePageValidate::037 434 1138" optional="false" invertmatch="false" />

In this case the screen will be recognized if its code page is 037, 434, or 1138.

////////////////////////////////////////////////////////////////////////////////
//  This sample is provided AS IS.
//  Permission to use, copy and modify this software for any purpose and
//  without fee is hereby granted. provided that the name of IBM not be used in
//  advertising or publicity pertaining to distribution of the software without
//  specific written permission.
//
//  IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SAMPLE, INCLUDING ALL
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL IBM
//  BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
//  DAMAGES WZIETransOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
//  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
//  OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SAMPLE.
////////////////////////////////////////////////////////////////////////////////
package company.project.customlogic;

import java.util.StringTokenizer;
import java.lang.Integer;
import com.ibm.eNetwork.ECL.ECLPS;
import com.ibm.eNetwork.ECL.ECLScreenDesc;
import com.ibm.hats.common.IBusinessLogicInformation;
import com.ibm.hats.common.HostScreen;
import com.ibm.hats.common.customlogic.AbstractCustomScreenRecoListener;

public class CodePageValidate extends AbstractCustomScreenRecoListener {

/**
 * @see com.ibm.hats.common.customlogic.AbstractCustomScreenRecoListener
 * #isRecognized(java.lang.String, com.ibm.hats.common.IBusinessLogicInformation,
 *       com.ibm.eNetwork.ECL.ECLPS,  com.ibm.eNetwork.ECL.ECLScreenDesc)
	 */
	public boolean isRecognized(
		String settings,
		IBusinessLogicInformation bli,
		ECLPS ps,
		ECLScreenDesc screenDescription) {
		HostScreen hs=bli.getHostScreen();
		int int_codepage=hs.GetCodePage();
		if(settings!=null)
		{
			StringTokenizer tokenizer = new StringTokenizer(settings);
			while( tokenizer.hasMoreTokens() )
			{   
				int int_token= Integer.valueOf(tokenizer.nextToken()).intValue();
				if ( int_token==int_codepage )
				{    
					 return true;
				}
			}
		}
		return false;
	}

}