Thursday, September 3, 2015

OIM 11g R2 Creating EntitleMent Using OIM Java API's


  1. package oimclient;

  2. import java.util.Hashtable;
  3. import java.util.List;

  4. import oracle.iam.platform.OIMClient;
  5. import oracle.iam.provisioning.api.EntitlementService;
  6. import oracle.iam.provisioning.vo.Entitlement;


  7. public class CreateEntitlement {
  8. public static void main(String[] args) throws Exception {

  9.         Hashtable env = new Hashtable();
  10.         env.put("java.naming.provider.url", "t3://localhost:14000/");
  11.         env.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");
  12.         System.setProperty("java.security.auth.login.config","G:/Oracle/Middleware/Oracle_IDM1/server/config/authwl.conf");
  13.         System.setProperty("APPSERVER_TYPE","wls");

  14.         OIMClient oimClient = new OIMClient(env);
  15.         oimClient.login("xelsysadm", "Welcome1".toCharArray();
  16. System.out.println("Connection Successfull");

  17.         EntitlementService entSvc = oimClient.getService(EntitlementService.class);
  18.         
  19.         Entitlement ent = new Entitlement();
  20.                 ent.setObjectKey(4);
  21.                 ent.setFormKey(9);
  22.                 ent.setFormFieldKey(29);
  23.                 ent.setItResourceKey(4);
  24.                 ent.setEntitlementCode("4~TestEntitle");
  25.                 ent.setEntitlementValue("TestEntitle");
  26.                 ent.setDisplayName("TestEntitle");
  27.                 ent.setDescription("TestEntitle");
  28.                 ent.setLookupValueKey(2479);
  29.                 ent.setValid(true);
  30. System.out.println("Entitlement Created");
  31.         
  32.         entSvc.addEntitlement(ent);
  33.     
  34. }
  35. }


No comments:

Post a Comment

Other Posts