package com.oimacademy.lookup;
import Thor.API.tcResultSet;
import Thor.API.tcUtilityFactory;
import Thor.API.Operations.tcLookupOperationsIntf;
import com.oimacademy.connection.OIMConnection;
import com.oimacademy.util.OIMUtils;
public class FindLookupValues {
public static void main(String[] args) throws Exception {
String lookupCode = "Lookup.OID.Group";
tcUtilityFactory factory = new tcUtilityFactory(OIMConnection.getEnvironment(), "xelsysadm","Welcome1");
tcLookupOperationsIntf lookupIntf = (tcLookupOperationsIntf) factory.getUtility("Thor.API.Operations.tcLookupOperationsIntf");
tcResultSet rs = lookupIntf.getLookupValues(lookupCode);
OIMUtils.printResultSet(rs);
factory.close();
System.exit(0);
}
}
Another way using SQL query :
package com.oimacademy.lookup;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import com.oimacademy.connection.DataSource;
public class GetLookUpValues {
public List getLookupCodes(String lkvKey){
List list = new ArrayList();
Connection con = DataSource.getConnection();
try {
Statement stmt = con.createStatement();
String query ="select * from LKV where lku_key="+lkvKey;
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
list.add(rs.getString("lkv_encoded"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Size"+ list.size());
return list;
}
public static void main(String[] args) throws Exception {
System.out.println(new GetLookUpValues().getLookupCodes("1592"));
}
}
import Thor.API.tcResultSet;
import Thor.API.tcUtilityFactory;
import Thor.API.Operations.tcLookupOperationsIntf;
import com.oimacademy.connection.OIMConnection;
import com.oimacademy.util.OIMUtils;
public class FindLookupValues {
public static void main(String[] args) throws Exception {
String lookupCode = "Lookup.OID.Group";
tcUtilityFactory factory = new tcUtilityFactory(OIMConnection.getEnvironment(), "xelsysadm","Welcome1");
tcLookupOperationsIntf lookupIntf = (tcLookupOperationsIntf) factory.getUtility("Thor.API.Operations.tcLookupOperationsIntf");
tcResultSet rs = lookupIntf.getLookupValues(lookupCode);
OIMUtils.printResultSet(rs);
factory.close();
System.exit(0);
}
}
Another way using SQL query :
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import com.oimacademy.connection.DataSource;
public class GetLookUpValues {
public List getLookupCodes(String lkvKey){
List list = new ArrayList();
Connection con = DataSource.getConnection();
try {
Statement stmt = con.createStatement();
String query ="select * from LKV where lku_key="+lkvKey;
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
list.add(rs.getString("lkv_encoded"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("Size"+ list.size());
return list;
}
public static void main(String[] args) throws Exception {
System.out.println(new GetLookUpValues().getLookupCodes("1592"));
}
}
No comments:
Post a Comment