Tuesday, 2 June 2015

Update User Profile Attribute Value in OIM

Below code will update the User Profile attribute value.

===============================================================
For Client Code below JAR need to be added in Eclipse or JDeveloper.

1) commons-logging.jar
2) jrf-api.jar
3) oimclient.jar
4) spring.jar
5) wlfullclient.jar

==============================================================
Update User Profile Attribute Code-
==============================================================
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import javax.security.auth.login.LoginException;
import oracle.iam.identity.exception.NoSuchUserException;
import oracle.iam.identity.exception.SearchKeyNotUniqueException;
import oracle.iam.identity.exception.UserModifyException;
import oracle.iam.identity.exception.ValidationFailedException;
import oracle.iam.identity.usermgmt.api.UserManager;
import oracle.iam.identity.usermgmt.vo.User;
import oracle.iam.platform.OIMClient;
import oracle.iam.platform.authz.exception.AccessDeniedException;


public class UpdateProfileAttribute {

public static OIMClient oimClient;

public void OIMConnection(){

String oimInitialContextFactory = "weblogic.jndi.WLInitialContextFactory";
java.util.Hashtable<String, String> env = new java.util.Hashtable<String, String>();
env.put(oracle.iam.platform.OIMClient.JAVA_NAMING_FACTORY_INITIAL,oimInitialContextFactory);
env.put(oracle.iam.platform.OIMClient.JAVA_NAMING_PROVIDER_URL, "t3://10.2.78.11:14000");
System.setProperty("java.security.auth.login.config", "C:\\Software\\designconsole\\designconsole\\config\\authwl.conf");
System.setProperty("OIM.AppServerType", "wls");        
   System.setProperty("APPSERVER_TYPE", "wls");
   oimClient = new OIMClient(env);
   try {
oimClient.login("xelsysadm","Password".toCharArray());
System.out.println("Connected Successfully");
} catch (LoginException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void updateProfileAttribute() throws ValidationFailedException, UserModifyException, SearchKeyNotUniqueException{
System.out.println("<----Inside Assign Mail Method---->");
UserManager usrmgr=oimClient.getService(UserManager.class);

Set<String> resAttr=new HashSet<String>();
try {
HashMap<String, Object> userAttributeValueMap = new HashMap<String, Object>();
userAttributeValueMap.put("Email", "test@gmail.com");
System.out.println("User Attribute Map is"+userAttributeValueMap);
//Provide the user key for user which attribute need to be updated
String ukey="369";
User user = new User(ukey, userAttributeValueMap);
System.out.println("User  Map is"+user);
try {
usrmgr.modify(user);
System.out.println("User Modified Successfully");
} catch (NoSuchUserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

   
} catch (AccessDeniedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


}

public static void main(String args[]) throws ValidationFailedException, UserModifyException, SearchKeyNotUniqueException{
UpdateProfileAttribute upa=new UpdateProfileAttribute();
upa.OIMConnection();  //Calling the method for OIM Connection
upa.updateProfileAttribute();  //Calling the update method

}

}

2 comments:

  1. Thiss is a topic that's near too my heart... Best wishes!

    Where are your contact details though?

    ReplyDelete
  2. Drops for the destruction of extra kilos onetwoslim. Comments about the structure of vantuslim. Vantuslim falls to destroy unnecessary weight. Onetwoslim instructions. Otz drops of steam slim (uantuslim) reviews, price, buy onetslim. Onetwoslim day/night weight loss pills are an amazing delicious drink for everyone who has decided to lose extra pounds.. Onetwoslim24.Ru recommendations about drops for weight loss one капли ван ту слим one-two-slim-kapli.ru Drops one-two-slim-kapli.Ru. One single night.Ruonetwoslim is a drop for optimally fast maintenance of excess kilograms. Zhenskij-sajt-katerina.En/blokator-kaloriy-pbk-20-otzyvy-vrachey is a well-known calorie blocker pbk 20 reviews of doctors are not the most joyful.. Tutknow.Ru/diets/3628-onetwoslim-kapli-dlya-pohudeniya.Htmlсодержание overview: price list and will tell you how to purchase; useful effects; composition;, tips for use. Now you won't need tedious workouts, we are losing weight. Onetwoslim is a drop for a lift. The effectiveness of one two slim is clinically proven..

    ReplyDelete