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:
package com.oimacademy.users;import java.io.File;
import java.io.FileInputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Hashtable;
import javax.security.auth.login.LoginException;
import oracle.iam.identity.exception.NoSuchUserException;
import oracle.iam.identity.exception.SearchKeyNotUniqueException;
import oracle.iam.identity.exception.UserManagerException;
import oracle.iam.identity.usermgmt.api.UserManager;
import oracle.iam.identity.usermgmt.api.UserManagerConstants;
import oracle.iam.platform.OIMClient;
import oracle.iam.platform.authz.exception.AccessDeniedException;
import oracle.iam.platform.pluginframework.PluginException;
import oracle.iam.platformservice.api.PlatformService;
import oracle.iam.platformservice.exception.PlatformServiceAccessDeniedException;
import Thor.API.tcResultSet;
import Thor.API.Operations.tcFormInstanceOperationsIntf;
import com.bea.common.security.xacml.IOException;
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 getProcessFormData(long processInstanceKey){
System.out.println("getProcessFormData() : Start");
tcFormInstanceOperationsIntf formInstanceIntf = oimClient.getService(tcFormInstanceOperationsIntf.class);
try {
tcResultSet trs = formInstanceIntf.getProcessFormData(processInstanceKey);
int count = trs.getRowCount();
for (int i = 0; i < count; i++) {
trs.goToRow(i);
String columnNames[] = trs.getColumnNames();
for (String fieldName : columnNames) {
System.out.println(fieldName + " :: " + trs.getStringValue(fieldName));
}
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("getProcessFormData() : End");
}
public static void main(String[] args) {
ProcessFormDataOps processFormDataOps = new ProcessFormDataOps();
processFormDataOps.connect();
long proInsKey = 140683; //Process Instance Key
processFormDataOps.getProcessFormData(proInsKey);
}
}
No comments:
Post a Comment