Tuesday 15 January 2019

USE OF JAVA TRANSFORMATION IN INFORMATICA INTELLIGENT CLOUD SERVICES(IICS)

INTRODUCTION:
     Java is one of the most popular programming language particularly for client server web applications. We can extend java functionality in Informatica cloud to implement simple, moderate or  complex scenarios. We can define transformation logic with basic knowledge of java.
PRE-REQUISITES:

  Ø  JDK_HOME environment variable should be created in the secure agent where selected run time environment is same for compiling java code.

SCENARIO:

Consider the scenario that source contains null or numeric fields in which string data is expected. Using java transformation, we can find out the data discrepancy of each records with multiple errors.

Data flow of java transformation for the above scenario:

                             
  

                   (Figure:1): Mapping flow for the scenario    
        
SOURCE:  


first_name

last_name
company_name
city
country
state
James
Butt
Benton, John B Jr

Orleans
LA
Josephine
Darakjy
Chanay, Jeffrey A Esq
Brighton
Orleans
MI
Art

Chemel, James L Cpa
Bridgeport
Gloucester
NJ
Lenna
Paprocki
Feltz Printing Service
5
Ashland

Donette
Tollner
Commercial Press
San Jose
Cook
20
Simona
Dilliard
Truhlar And Truhlar Attys
San Jose
Santa Clara

Mitsue
Wieser

Sioux Falls
Minnehaha
10







             


TARGET:   


Error message
City is null
Last _ name is null
City is numeric _ state is null
State is numeric
State is null
Company _ name is null_ state is numeric
                 








JDK_HOME CLASS PATH:

  Ø  Install JDK and set JDK_HOME as a system variable and set java class path where the secure agent of Informatica cloud is up and running.  After enabling the class path, restart the secure agent.

SOURCE:

  Ø  In data integration extract the records from flatfile as csv file which have some of the errors as null values and numeric values.



(Figure:2): source object as csv file

JAVA TRANSFORMATION:

  Ø  In JAVA transformation select the active connection which executes user logic coded in java. 
  Ø  Select the “on input row” tab in java transformation to receive an input row. This java code in this tab executes one time for each row.
  Ø   Create the variable output filed which has written in the code. we can take input variable from the on input row tab comes from the source.
  Ø After completion of the code use the function generate row at the end of the code the java transformation will generate an output row using current value of output variable.
  Ø  Informatica cloud has java run time environment which is inbuilt application where as to run the java code for third party and existing packages we need to install the jdk and set that jar file in the runtime environment where java code has been compiled.



(Figure:3):Mapping for the above scenario


JAVA CODE ON "ON INPUT ROW" FOR FINDING  ERROR MESSAGE :

if (isNull("first_name"))
{
 error_message=("first_name is null");
}
else if(first_name.matches("[0-9]+"))
{
 error_message=("first_name is numeric")+error_message;
}
{
if (isNull("last_name"))
{
  error_message=("last_name is null")+error_message;
}
else if(last_name.matches("[0-9]+"))
{
error_message=("last_name is numeric" )+error_message;
}
{
if (isNull("company_name"))
{
  error_message=("company_name is null")+error_message;
}
else if (company_name.matches("[0-9]+"))
{
error_message=("company_name is numeric" )+error_message;
}
{
if (isNull("city"))
{
  error_message=("city is null")+error_message;
}
else if (city.matches("[0-9]+"))
{
error_message=("city is numeric" )+error_message;
}
{
if (isNull("county"))
{
  error_message=("county is null")+error_message;
else if (county.matches("[0-9]+"))
{
error_message=("county is numeric" )+error_message;
}
  {
    if (isNull("state"))
{
  error_message=("state is null")+error_message;
}
else if (state.matches("[0-9]+"))
{
error_message=("state is numeric" )+error_message;
} }} }}
  generateRow();
}   


Compile the above code by selecting run time environment where JDK_HOME environment variable has placed




(Figure:4): Java transformation “on input row” for code compilation

TARGET:




(Figure:5):Target incoming fields with excluding some fields
  
  Ø  In target we are getting the output as error message and remaining fields which are not required should be excluded in the incoming fields in the target.
  Ø  Create a target as csv file at run time, save and publish the mapping

      Output:

Error message
City is null
Last _ name is null
City is numeric _ state is null
State is numeric
State is null
Company _ name is null_ state is numeric









CONCLUSION:

 Ø  In this scenario we concluded that the use of java transformation in IICS with the basic scenario that was implemented using java code.


Further, any queries reach me,

Thank you,
HIMAJA Y,
himajareddy237@gmail.com