To execute below code you have to add following jars in classpath:
- commons-logging.jar
- eclipselink.jar
- jrf-api.jar
- oimclient.jar
- spring.jar
- wlfullclient.jar
Stand Alone Code:
public class ProcessFormDataOps{
static OIMClient oimClient = null;
//identity self service details
String username = "xelsysadm";
String password = "<password>"; //xelsysadm password
String t3url = "t3://<hostname>:<port>"; //OIM HostName and Port
String authwl_location = "<location of authwl.conf file in your local machine>"; //eg. D:\\authwl.conf
public void getOIMConnection() {
System.out.println("getOIMConnection() : Start");
//set system properties
System.setProperty("java.security.auth.login.config", authwl_location);
System.setProperty("OIM.AppServerType", "wls");
System.setProperty("APPSERVER_TYPE", "wls");
Hashtable oimenv = new Hashtable();
oimenv.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, "weblogic.jndi.WLInitialContextFactory");
oimenv.put(OIMClient.JAVA_NAMING_PROVIDER_URL,t3url);
oimClient = new OIMClient(oimenv);
try {
oimClient.login(username, password.toCharArray());
System.out.println("Connected");
} catch (LoginException e) {
e.printStackTrace();
}
System.out.println("getOIMConnection() : End");
}
public void updateProcessFormData(long pkey, Map updateProFrmDataMap){
tcFormInstanceOperationsIntf formInstanceIntf = oimClient.getService(tcFormInstanceOperationsIntf.class);
try {
System.out.println("Update Process From Data Map :: " + updateProFrmDataMap);
formInstanceIntf.setProcessFormData(pkey, updateProFrmDataMap);
System.out.println("Process form data updated successfully");
} catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] args) {
ProcessFormDataOps processFormDataOps = new ProcessFormDataOps();
processFormDataOps.connect();
//Process Instance Key
long proInsKey = 140683;
//Add all attributes which need to be updated
Map updateProFrmDataMap = new HashMap();
//updateProFrmDataMap.put("<Column_Name>", "<Attribute_Value>");
updateProFrmDataMap.put("UD_ADUSER_FIRSTNAME", "Anand");
updateProFrmDataMap.put("UD_ADUSER_LASTNAME", "Badal");
processFormDataOps.updateProcessFormData(proInsKey, updateProFrmDataMap);
}
}
No comments:
Post a Comment