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;
       
    }
}

1 comment:

  1. Sample_Field is the display label of the udf which you can see in a sand box or during mapping the adapters

    ReplyDelete