OIM API to Create Entitlements


  1. package com.oimacademy.provision;
  2. import java.sql.Connection;
  3. import java.sql.Statement;
  4. import com.oimacademy.connection.DataSource;
  5. public class CreateEntitlement {
  6.  public static void main(String[] args) throws Exception {
  7.   String codeValue="CODE_C";
  8.   String decodeValue="DECODE_D";
  9.   String lKU_Key="1621";  
  10.   String insertLKVQuery="INSERT INTO LKV (LKV_KEY,LKU_KEY,LKV_ENCODED,LKV_DECODED,LKV_LANGUAGE,LKV_COUNTRY,  LKV_VARIANT,LKV_DISABLED,LKV_DATA_LEVEL,LKV_CREATE,LKV_CREATEBY,LKV_UPDATE,"+
  11.         " LKV_UPDATEBY,LKV_NOTE,LKV_ROWVER)  select LKV_SEQ.NEXTVAL as LKV_KEY, LKU_KEY as LKU_KEY, '" + codeValue + "'||LKV_SEQ.NEXTVAL as LKV_ENCODED, '"+decodeValue+"'||LKV_SEQ.NEXTVAL as LKV_DECODED,"+
  12.         "LKV_LANGUAGE,LKV_COUNTRY,LKV_VARIANT,LKV_DISABLED,LKV_DATA_LEVEL,  LKV_CREATE,LKV_CREATEBY,LKV_UPDATE,LKV_UPDATEBY,NULL AS LKV_NOTE,LKV_ROWVER  from LKV"+
  13.         " where LKU_KEY= "+lKU_Key;  
  14.   System.out.println("Query -> " +insertLKVQuery);
  15.    Connection con= DataSource.getConnection();
  16.    Statement statement =con.createStatement();
  17.    for(int i=0;i<2;i++){
  18.     statement.execute(insertLKVQuery);
  19.    }
  20.    DataSource.closeConnection();      
  21.  }
  22. }

No comments:

Post a Comment