Monday, March 30, 2015

Validation Handler- getting error message from properties file

The way to read it from properties file is shown below.

1.     We need to create the custom  properties file  and upload it in MDS using UploadResourceBundles.sh and UploadResourceBundles.bat utility which are available in the OIM_HOME/server/bin/ directory as custom resource.

Enter OIM admin username :]ADMIN_login
[Enter the admin password :]admonpassword
[Enter serverURL :[ t3://localhost:14000 ]]t3://oimhost:14000
[Enter context Factory :[ weblogic.jndi.WLInitialContextFactory weblogic.jndi.WLInitialContextFactory
Enter the resource bundle type
 1.Custom Resource
 2.Connector Resource
 1
Enter the path/location of resource bundle file :
/prop/<custom_property_name>.properties
Do u want to load more resource bundles [y/n] :n


2.      In the validation handler do the following:

         PlatformService pltSrv = Platform.getService(PlatformService.class);
         Properties props = pltSrv.LoadResourceBundleFromDB("customResources", 
                                                                                                             "<custom_property_name>.properties");
                                                    String errorMsg = props.getProperty("ERRCODE");