Saturday, July 5, 2014

DBAT Connector & Flat file connector 11.1.1.5.0

The new ICF based DBAT connector and Flat file connector has been released. I think from now onwords  people will not use GTC. :)
 The document link for  new DBAT and Flat file connector is as below

Tuesday, July 1, 2014

Get user key in Event Handler

In the event handlers, we can get the user key using by the below ways:


  1.  orchestration.getTarget().getEntityId()                                                                                                              
  2. public long getUserKey(String userLogin) throws NoSuchUserException, UserLookupException, SearchKeyNotUniqueException, AccessDeniedException            {

               long usrKey=0;  
               UserManager usrService= oimClient.getService(UserManager.class);
                   User user = usrService.getDetails("User Login", userLogin, null);
                   HashMap mapAttrs = user.getAttributes();
                    usrKey= (Long) mapAttrs.get("usr_key");
                   System.out.println("key is is :" + usrKey);
             return usrKey;
     }  

Thursday, June 26, 2014

Get the logged in user id in eventhandler/ schedule task

we can get the logged in user id using AuthenticatedSelfService api or ContextManager api.:

ContextManager.getOIMUser()

AuthenticatedSelfService asfService = Platform.getService(AuthenticatedSelfService.class);
User currActor= asfService.getProfileDetails(null);

Monday, June 23, 2014

Execute DB query from scheduled task or event handlers

we can execute sql queries from scheduled task/ eventhandler  using getOperationalDS method.

API Reference:
 http://docs.oracle.com/cd/E27559_01/apirefs.1112/e28159/oracle/iam/platform/Platform.html

Sample code to fetch data from DB:

String query="sqlquery -select usr_login from usr ";
Connection con=Platform.getOperationalDS().getConnection();
Statement st=con.prepareStatement(query);  
ResultSet rs=st.executeQuery();
while(rs.next()){
String usrLogin=rs.getString("usr_login");
}