Saturday, 30 November 2013

Deleting UDF from USR table in OIM

package  oimimage;
import java.util.Hashtable;

import javax.security.auth.login.LoginException;

import oracle.iam.configservice.api.ConfigManager;
import oracle.iam.configservice.api.Constants;
import oracle.iam.configservice.exception.AccessDeniedException;
import oracle.iam.configservice.exception.ConfigManagerException;
import oracle.iam.configservice.exception.NoSuchEntityException;
import oracle.iam.platform.OIMClient;

public class deleteuserudf
{
    public deleteuserudf()
    {
        super();
    }
   
    public static OIMClient oimClient;
   

    public static void main(String[] args) throws LoginException
                                                   {
       
        oimClient = getOIMConnection();
       
        ConfigManager configMgrOps = oimClient.getService(ConfigManager.class);


        try {
            configMgrOps.deleteAttribute(Constants.Entity.USER, "Sample_Field");
        }
        catch (NoSuchEntityException e)
        {
            System.out.println(e.getErrorMessage());
        }
        catch (AccessDeniedException e)
        {
            System.out.println(e.getErrorMessage());
        }
        catch (ConfigManagerException e)
        {
            System.out.println(e.getErrorMessage());
        }
    }
   
   
    public static OIMClient getOIMConnection() throws LoginException {
    
        String PROVIDER_URL = "t3://server:port";  
       
      
        String USERNAME = "xelsysadm";
        String PASSWORD = "Password";
       
        System.setProperty("java.security.auth.login.config", "D:\\authwl.conf");
        System.setProperty("java.security.policy", "D:\\xl.policy");
        System.setProperty("APPSERVER_TYPE", "wls");
       
        
        
        Hashtable env = new Hashtable();
       
        env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, PROVIDER_URL);
        env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL,OIMClient.WLS_CONTEXT_FACTORY);
       
        oimClient = new OIMClient(env);
        oimClient.login(USERNAME, PASSWORD);


        System.out.println("connection established");
        return oimClient;
       
    }
}

Query to fetch the 'Resource History' in OIM



--Resource History
select osi.sch_key, osi.orc_key, osi.mil_key,
to_char(osi.osi_assigned_date,'dd-mon-rrrr hh24:mi:ss') ,to_char(OSI.OSI_UPDATE,'dd-mon-rrrr hh24:mi:ss')
,osi.rsc_key, sch.sch_status, sch.sch_data, mil.mil_name, SCH.sch_update,to_char(sysdate,'dd-mon-rrrr hh24:mi:ss')
from osi, sch, mil
where osi.sch_key = sch.sch_key
and osi.mil_key = mil.mil_key
and osi.orc_key in (ENTER THE ORC KEY HERE)
order by sch.sch_update desc;