Friday, June 20, 2008

Direct Streaming in VBS

You can use XMLHTTP in vbs also to do direct streaming.

Dim msXHttp
Set msXHttp = CreateObject("MSXML2.ServerXMLHTTP")
msXHttp.Open "GET", "http://www.google.com/", False
'msXHttp.Open "GET", " http://www.google.com/", False, Username, Password
msXHttp.send

If msXHttp.Status <> 200 Then
'Error
msgbox msXHttp.Status
Else
Dim downloadedData
downloadedData = msXHttp.responseText
msgbox downloadedData
End If

Direct Streaming in ASP

You can use XMLHttp in ASP as well to create asynchronous requests.

<%
Dim msXHttp

Set msXHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
msXHttp.Open "GET", "http://www.google.com/", False
'msXHttp.Open "GET", " http://www.google.com/", False, Username, Password
msXHttp.send

If msXHttp.Status <> 200 Then
'Error
Response.Write ("Error")
Else
Dim downloadedData
downloadedData = msXHttp.responseText
Response.Write("Result : "+downloadedData)
End If

%>

Thursday, June 19, 2008

Direct Streaming in .NET

Here is a console application to have web feed directly into your application.By default, the .NET Framework supports URIs that begin with http:, https:, ftp:, and file: scheme identifiers.

===========================
Program.cs
===========================

using System;
using System.IO;
using System.Net;
namespace Extract_Direct_WebData
{
class Program
{
void Execute()
{
try
{
WebClient client = new WebClient();
//If you need to add headers
//client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
Stream data = client.OpenRead("http://www.google.com");
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
Console.WriteLine(s);
Console.ReadLine();
data.Close();
reader.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + ex.StackTrace.ToString());
Console.ReadLine();
}
}
static void Main(string[] args)
{
Program p=new Program();
p.Execute();
}
}
}
=========================
Result
=========================

Tuesday, June 17, 2008

Reset a forgotten admin password on OVD

Go to OVD_HOME\conf and open server.os_xml

Find the <rootUser> node and replace with following

<rootUser>
<name>cn=admin</name>
<password>{SSHA}qLzLcgk/WLpCE6Z72OmQ7zXfCp4nTvj7</password>
</rootUser>


This will set cn=admin and password as "secret" for super User.

Wednesday, June 11, 2008

Schedule Task Up

To make sure if your schedule task is up and running, you may go to http://localhost:8080/xlScheduler

This url will tell you if scheduler is up or not. It should look like this:

Saturday, June 7, 2008

requestApprovalDetailTiles.jsp

This modified file includes the customization that were done to supplement my other blog post http://rajnishbhatia19.blogspot.com/2008/06/oim-customization-for-resource.html . Please refer to that post before you dig through this code.

<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/struts-nested.tld" prefix="nested"%>
<%@ page import="com.thortech.xl.webclient.util.FormField"%>
<%@ page import="com.thortech.xl.webclient.bean.*"%>
<%@ page import="com.thortech.xl.webclient.util.tcMessageResourcesUtil" %>
<%@ page import="com.thortech.xl.webclient.util.*" %>
<%@ page import="Thor.API.Operations.*" %>
<%@ page import="Thor.API.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="javax.naming.*" %>
<%@ page import="java.util.*"%>

<bean:define id="requestApprovalBean" name="requestApprovalDetailForm" property="requestItemListBean" />
<bean:define id="entityKey" name="requestApprovalDetailForm" property="requestKey"/>
<script>
function submitPage(pageAction){
for(var i = 0; i < document.forms[0].elements.length; i++) {
if(document.forms[0].elements[i].name=='approveDeny' && document.forms[0].elements[i].type=='hidden'){
document.forms[0].elements[i].value=pageAction;
}
}
document.forms[0].submit();
return false;
}
function getRequestDetail(htmlFormId, actionClassReference, methodName,
entityKey) {
// loop through all the forms on the page to find a match for the htmlFormId
for(var i = 0; i < document.forms.length; i++) {
if(document.forms[i].id == htmlFormId) {
document.forms[i].action=actionClassReference;
document.forms[i].entityKey.value=entityKey;
for(var j = 0; j < document.forms[i].elements.length; j++) {
if(document.forms[i].elements[j].name=='method'
&& document.forms[i].elements[j].type=='hidden') {
document.forms[i].elements[j].value=methodName;
break;
}
}
document.forms[i].submit();
return false;
}

}
}



</script>

<%!


public String getFormDataByObjectInstanceKey(String objectInstanceKey, String resourceName){
Context ctx = null;
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;

try{
String [] temp = null;
String name = "";
ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:jdbc/xlDS");
con = ds.getConnection();
con.setAutoCommit(false);
String stmt="select upper(lkv_encoded), lkv_decoded from lkv where upper(lkv_encoded)='"+resourceName.toUpperCase()+"' and lku_key =(select lku_key from lku where lku_type_string_key='Lookup.Resources.ObjectForm.FieldMappings') ";
System.out.println(stmt);
pstmt=con.prepareStatement(stmt);

rs=pstmt.executeQuery();
if(rs!=null && rs.next())
{
temp = rs.getString("LKV_DECODED").split(";");
pstmt=null;
rs=null;

String columns="";
System.out.println("------------");
for (int i = 1 ; i < temp.length ; i++) {
if(i>1)
columns=columns+" , ";
columns=columns+temp[i];
System.out.println("temp["+i+"] is "+temp[i]);
}
System.out.println("------------");

stmt="select "+columns+" from "+temp[0]+ " where obi_key= "+objectInstanceKey;
System.out.println(stmt);
pstmt = con.prepareStatement(stmt);
rs = pstmt.executeQuery();
while (rs.next()) {

for (int i = 1 ; i < temp.length ; i++) {
name =name+ " - "+rs.getString(temp[i]);
}
break;
}
System.out.println("out name : "+ name);
}
return name;
}catch(Exception exp){
exp.printStackTrace();
}finally{
try {
if(rs != null)
rs.close();

if(pstmt != null)
pstmt.close();

if(con != null )
con.close();
}catch(Exception ex)
{
ex.printStackTrace();
}
}

return "";

}



public String getResourceDetails(String requestKey, HttpSession session, String row, String resourceName){
String retVal="";
try {

retVal="Error - No Value Found for row : "+row+ " , request key : "+requestKey;
sessionContainer sessioncontainer;
sessioncontainer = (sessionContainer)session.getAttribute("Xellerate.Session");
tcRequestOperationsIntf tcrequestoperationsintf = sessioncontainer.getRequestOperationsIntf();
HashMap hashmap = new HashMap();
hashmap.put("Requests.Key", requestKey);
tcResultSet tcresultset1 = tcrequestoperationsintf.getRequestObjects(Long.parseLong(requestKey));

//System.out.println("First loop - i count = "+tcresultset1.getRowCount());

for(int i=0; i<tcresultset1.getRowCount(); i++)
{
String x=Integer.toString(i);
if ( x.equals(row)) {
tcresultset1.goToRow(i);
String value = tcresultset1.getStringValue("Object Instance.Key");
System.out.println("Object instance key is = " + value);
retVal = getFormDataByObjectInstanceKey(value, resourceName);
//System.out.println(" form data is = " + retVal);
}
}

}catch(Exception ex)
{
ex.printStackTrace();
}
return retVal;
}



%>


<html:form action="/requestApprovalDetail.do" styleId="requestAppDetail">
<TABLE height=66 cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD>
<TABLE>
<TR>
<TD class="PageTitle"><A class="Linktext" href="javascript:getRequestDetail('requestAppDetail','requestDetail.do','<bean:message key="request.requestDetail"/>','<%=entityKey%>')">
<bean:message key="requests.requestDetail.label.pageTitle" /> </A>
</TD>
<TD class="PageTitle"><bean:message bundle="xlDefaultAdmin" key="global.label.twoRightArrows" /></TD>
<TD class="PageTitle"><bean:message key="requests.approvalTasks.label.pageTitle" /></TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD class=PageTitle height=28><bean:message key="requests.approvalTasks.label.pageTitle" /></TD>
</TR>
<TR>
<TD class=InstructionText align=left height=18><bean:message key="requests.approvalTasks.message.instruction" /></TD>
</TR>
<TR>
<TD width=1044> </TD>
<TR>
<TD width=1044>
<P class=InstructionText align=left><B><bean:message key="request.requestID" /></B>     
<A class="Linktext" href="javascript:getRequestDetail('requestAppDetail','requestDetail.do','<bean:message key="request.requestDetail"/>','<%=entityKey%>')"> <nested:write property="requestID" /> </A></P>
</TD>
</TR>
</TBODY>
</TABLE>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>  
</td>
</tr>
</table>






<table width="100%" border="0" cellspacing="0" cellpadding="0" class="backgroundcolor">
<tr>
<td colSpan="3" width="48%" height="20" class="td_tab_header_body_fill">  
<span class="SectionTitles"><bean:message key="requests.approvalTasks.label.requestApprovalTasks" /></span>
<td>
</tr>
<tr class="backgroundcolor">
<td solSpan="3">   </td>
</tr>
<tr class="backgroundcolor">
<td>   </td>
<td>
<%
if (hasTask(requestApprovalBean)) {
%>
<TABLE class=object_list_table cellSpacing=1 width="100%" border=0>
<TBODY>
<TR vAlign=top>
<nested:iterate indexId="indexId" id="field" property="requestItemListBean.viewTableForm.formFieldList" length="4">
<TD class=object_list_td_header><nested:message property="labelCode" /></TD>
</nested:iterate>
</TR>
<nested:iterate indexId="rowId" id="row" property="requestItemListBean.viewTableForm.formList">
<TR>
<nested:iterate id="column" indexId="columnId" name="row" length="5">
<%
if((columnId.intValue() != 3)&&(columnId.intValue() != 2)){
%>
<TD class=object_list_td_align_center vAlign=center>
<%
if (columnId.intValue() == 4){
%>
<html:multibox name="requestApprovalDetailForm" property="approvalDenyList" disabled="<%=getCheckBoxStatusValue(rowId, requestApprovalBean,request)%>">
<nested:write name="column" />
</html:multibox>
<%
}
else {
%>
<%=getValue(rowId, columnId, requestApprovalBean,column)%>
<%
}
%>
</TD>
<%
}
else {
if(columnId.intValue() == 2){
%>
<TD class=object_list_td_align_center vAlign=center>
<%=getValue(rowId, columnId, requestApprovalBean,column)%>
<%
}
else {
%>

</TD>
<%
}
}
%>
</nested:iterate>
</TR>
</nested:iterate>
<nested:iterate indexId="rowId" id="row" property="requestItemListBean.viewTableForm.formList" length="1">
<TR>
<nested:iterate id="column" indexId="columnId" name="row" length="4">
<TD class=object_list_td_align_center vAlign=center>
<%
if (columnId.intValue() == 3) {
%>
<input type="hidden" name="method" value="<bean:message key="request.requestAssignDetail"/>">
<input type="hidden" name="approveDeny" value="">
<input type="submit" class="Commandbutton" name="method" value="<bean:message key="approvals.button.approve"/>" onclick="return submitPage('approve')" />
<input type="submit" class="Commandbutton" name="method" value="<bean:message key="approvals.button.deny"/>" onclick="return submitPage('deny')" /> <input type="submit" class="Commandbutton" name="method" value="<bean:message key="approvals.button.reassign"/>" onclick="return submitPage('reassign')" />
<html:hidden property="entitySelected" value="TasksUser" />
<html:hidden property="userAction" value="new" />
<%
}
%>
</TD>
</nested:iterate>
</TR>
</nested:iterate>
</TABLE>
</td>
<td>   </td>
</tr>
<tr class="backgroundcolor">
<td solSpan="3">   </td>
</tr>
<%
}
else {
%>
<TR>
<TD class=InstructionText align=left height=18><bean:message key="requests.approvalTasks.label.noApprovalTasks" /></TD>
</TR>
</table>
<%
}
%>

<bean:define id="objectListBean" name="requestApprovalDetailForm" property="resourceList"/>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>  <td>
</tr>
</table>
<%
if(hasApprovalTask(objectListBean)){
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="backgroundcolor">
<tr>
<td colSpan="3" width="48%" height="20" class="td_tab_header_body_fill">
  <span class="SectionTitles"><bean:message key="requests.approvalTasks.label.resourceApprovalTasks" /></span>
<td>
</tr>
<%
int index = 0;
%>
<nested:iterate indexId="indexId" id="resource" property="resourceList">
<tr class="backgroundcolor">
<td solSpan="3">   </td>
</tr>
<tr class="backgroundcolor">
<td>   </td>
<td>
<%// Integer indexIdInteger = new Integer(indexId);
//System.out.println("New thing");
//System.out.println("Index ID " + indexId);
//System.out.println("Integer indexIdInteger"+ indexIdInteger);
%>
<nested:iterate id="resourceName" name="requestApprovalDetailForm" property="resourceNameList" length="1" offset="<%=indexId.toString()%>">
<% String resName= (String) resourceName; %>
<P class=InstructionText align=left><B><nested:write name="resourceName"/> <%= getResourceDetails(entityKey.toString(), session,indexId.toString(), resName) %></B></P>
</nested:iterate>
</td>
<td>   </td>
</tr>
<tr class="backgroundcolor">
<td>   </td>
<td>
<TABLE class=object_list_table cellSpacing=1 width="100%" border=0 >
<TBODY>
<%
if(hasApprovalTask(objectListBean, index)){
%>
<TR vAlign=top>
<nested:iterate id="field" name="resource" property="viewTableForm.formFieldList" length="4">
<TD class=object_list_td_header>
<nested:message property="labelCode"/>
</TD>
</nested:iterate>
</TR>
<nested:iterate indexId="rowId" id="row" name="resource" property="viewTableForm.formList" >
<TR>
<nested:iterate id="column" indexId="columnId" name="row" length="5">
<%
if((columnId.intValue() != 3)&&(columnId.intValue() != 2)){
%>
<TD class=object_list_td_align_center vAlign=center>
<%
if (columnId.intValue() == 4){
%>
<html:multibox name="requestApprovalDetailForm" property="approvalDenyList" disabled="<%=getCheckBoxStatusValue(rowId, resource,request)%>">
<nested:write name="column" />
</html:multibox>
<%
}
else {
%>
<%=getValue(rowId,columnId,resource,column)%>
<%
}
%>
</TD>
<%
}
else {
if(columnId.intValue() == 2){
%>
<TD class=object_list_td_align_center vAlign=center>
<%=getValue(rowId,columnId,resource,column)%>
<%
}
else {
%>

</TD>
<%
}
}
%>
</nested:iterate>
</TR>
</nested:iterate>
<nested:iterate indexId="rowId" id="row" property="viewTableForm.formList" length="1">
<TR>
<nested:iterate id="column" indexId="columnId" name="row" length="4">
<TD class=object_list_td_align_center vAlign=center>
<%
if (columnId.intValue() == 3) {
%>
<input type="hidden" name="method" value="<bean:message key="request.requestAssignDetail"/>">
<input type="hidden" name="approveDeny" value="">
<input type="submit" class="Commandbutton" name="method" value="<bean:message key="approvals.button.approve"/>" onclick="return submitPage('approve')" />
<input type="submit" class="Commandbutton" name="method" value="<bean:message key="approvals.button.deny"/>" onclick="return submitPage('deny')" /> <input type="submit" class="Commandbutton" name="method" value="<bean:message key="approvals.button.reassign"/>" onclick="return submitPage('reassign')" />
<html:hidden property="entitySelected" value="TasksUser" />
<html:hidden property="userAction" value="new" />
<%
}
%>
</TD>
</nested:iterate>
</TR>
</nested:iterate>
</TABLE>
</td>
<td>   </td>
</tr>
<tr class="backgroundcolor">
<td solSpan="3">   </td>
</tr>
<%
}
else{
%>
<TABLE height=66 cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=InstructionText align=left height=18><bean:message key="requests.approvalTasks.label.noApprovalTasks" />
</TD>
</TR>
</TBODY>
</TABLE>
<%
}
index++;
%>
</nested:iterate>
</table>
<%
}
%>
<input type="hidden" name="method" value=""/>
<input type="hidden" name="entityKey" value=""/>
<html:hidden property="requestKey"/>
<html:hidden property="requestID"/>

</html:form>

<%!
public String getValue(Integer rowId, Integer columnId,
Object itemListBean, Object columnValueBean) {

String returnValue = (String) columnValueBean;

int rowIdx = rowId.intValue();
int columnIdx = columnId.intValue();
tcItemListBean itemList = (tcItemListBean) itemListBean;
String columnValue = (String) columnValueBean;

FormField formField = (FormField) itemList.getViewTableForm()
.getFormFieldList().get(columnIdx);
String type = formField.getType();
String assignType = ((String[]) itemList.getViewTableForm()
.getFormList().get(rowIdx))[3];
if (type != null) {
if (type.equals("IMG")) {

if (returnValue.equals("C")) {
returnValue = "<img src='images/checkw.gif'/>";
} else if (returnValue.equals("R")) {
returnValue = "<img src='images/stoppedw.gif'/>";
} else if (returnValue.equals("W")) {
returnValue = "<img src='images/pausedw.gif'/>";
} else if (returnValue.equals("P")) {
returnValue = "<img src='images/runningtrans.gif'/>";
}
} else if (type.equals("IMG_VALUE")) {
if (columnValueBean != null) {
if (assignType.equals("User")) {
returnValue = "<img src='images/user.gif'/>"
+ returnValue;
} else if (assignType.equals("Group")) {
returnValue = "<img src='images/user_group.gif'/>"
+ returnValue;
} else if (assignType.equals("UserProxy")) {
returnValue = "<img src='images/assign_to_proxy_user.gif'/>"
+ returnValue;
} else if (assignType.equals("GroupProxy")) {
returnValue = "<img src='images/assign_to_proxy_group.gif'/>"
+ returnValue;
}
}
}
}

itemList.getViewTableForm().getFormList().get(rowIdx);
return returnValue;
}
public boolean getCheckBoxStatusValue(Integer rowId,
Object itemListBean, HttpServletRequest request) {

int rowIdx = rowId.intValue();

tcItemListBean itemList = (tcItemListBean) itemListBean;

String status = ((String[]) itemList.getViewTableForm()
.getFormList().get(rowIdx))[1];
String statusAdminRole = ((String[]) itemList.getViewTableForm()
.getFormList().get(rowIdx))[5];

java.util.Locale locale = (java.util.Locale)request.getSession(true).getAttribute(org.apache.struts.Globals.LOCALE_KEY);
org.apache.struts.util.MessageResources message = (org.apache.struts.util.MessageResources) request.getAttribute(org.apache.struts.Globals.MESSAGES_KEY);
if(status.equalsIgnoreCase(tcMessageResourcesUtil.getMessage(message,locale, "global.Lookup.WebClient.Open-Task.Status.Pending")) && statusAdminRole.equalsIgnoreCase("true"))
{
return false;
}
else return true;
}

public boolean hasTask(Object requestApprovalBean) {
boolean hasTask = false;
tcItemListBean itemList = (tcItemListBean) requestApprovalBean;
if (itemList.getViewTableForm().getFormList().size() != 0) {
hasTask = true;
}
return hasTask;

}

public boolean hasApprovalTask(Object objectListBean) {
boolean hasTask = false;

ArrayList resourceList = (ArrayList) objectListBean;
if (resourceList.size() != 0) {
hasTask = true;
}

return hasTask;

}

public boolean hasApprovalTask(Object objectListBean, int objIndex) {
boolean hasTask = false;

ArrayList resourceList = (ArrayList) objectListBean;

tcItemListBean itemList = (tcItemListBean) resourceList.get(objIndex);

ArrayList taskList = itemList.getViewTableForm().getFormList();

if (taskList.size() > 0) {
hasTask = true;
}

return hasTask;

}
%>

Friday, June 6, 2008

OIM Customization for Resource Distinction

I came across a typical problem in OIM that the approver could not make a distinction of what resource he is approving when multiple resources of the same type are put in one request. Here is the snapshot:




So, here I present you with a customization that would allow your approvers to view the object form details on approval screen. My modifications will allow you to put multiple fields values right on the approval pages seperated by a ";". Please note that the first value will be the object form name itself following by all the multiple fields you want to display the values of. It will even work with Date attribute fields. I have created 2 resources Employee and Manual Application. In one request, I'm going to fill values for these object forms. Then we are going to modify one page in xlWebApp.war file and put in some customization code with a custom lookup. Once this is done, you will get around this issue.

Lets get started and I'll firstly reproduce the problem:



















So, now you see how there is no distinction in what resource the approver is approving.

1. Firstly, Backup your xlWebApp.war in some safe place.

2. Copy this xlWebApp.war in some location say : C:\eclipse\workspace

3. Extract this jar file by using the following command:
jar -xvf xlWebApp.war .

4. Next, lets dig right to the file that needs modification. Look for the following file:
C:\eclipse\workspace\xlWebApp\tiles\requestApprovalDetailTiles.jsp

5. Open this file in a Textpad and add the following lines of code:







<%!


public String getFormDataByObjectInstanceKey(String objectInstanceKey, String resourceName){
Context ctx = null;
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;

try{
String [] temp = null;
String name = "";
ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:jdbc/xlDS");
con = ds.getConnection();
con.setAutoCommit(false);
String stmt="select upper(lkv_encoded), lkv_decoded from lkv where upper(lkv_encoded)='"+resourceName.toUpperCase()+"' and lku_key =(select lku_key from lku where lku_type_string_key='Lookup.Resources.ObjectForm.FieldMappings') ";
System.out.println(stmt);
pstmt=con.prepareStatement(stmt);

rs=pstmt.executeQuery();
if(rs!=null && rs.next())
{
temp = rs.getString("LKV_DECODED").split(";");
pstmt=null;
rs=null;

String columns="";
System.out.println("------------");
for (int i = 1 ; i < temp.length ; i++) {
if(i>1)
columns=columns+" , ";
columns=columns+temp[i];
System.out.println("temp["+i+"] is "+temp[i]);
}
System.out.println("------------");

stmt="select "+columns+" from "+temp[0]+ " where obi_key= "+objectInstanceKey;
System.out.println(stmt);
pstmt = con.prepareStatement(stmt);
rs = pstmt.executeQuery();
while (rs.next()) {

for (int i = 1 ; i < temp.length ; i++) {
name =name+ " - "+rs.getString(temp[i]);
}
break;
}
System.out.println("out name : "+ name);
}
return name;
}catch(Exception exp){
exp.printStackTrace();
}finally{
try {
if(rs != null)
rs.close();

if(pstmt != null)
pstmt.close();

if(con != null )
con.close();
}catch(Exception ex)
{
ex.printStackTrace();
}
}

return "";

}



public String getResourceDetails(String requestKey, HttpSession session, String row, String resourceName){
String retVal="";
try {

retVal="Error - No Value Found for row : "+row+ " , request key : "+requestKey;
sessionContainer sessioncontainer;
sessioncontainer = (sessionContainer)session.getAttribute("Xellerate.Session");
tcRequestOperationsIntf tcrequestoperationsintf = sessioncontainer.getRequestOperationsIntf();
HashMap hashmap = new HashMap();
hashmap.put("Requests.Key", requestKey);
tcResultSet tcresultset1 = tcrequestoperationsintf.getRequestObjects(Long.parseLong(requestKey));

//System.out.println("First loop - i count = "+tcresultset1.getRowCount());

for(int i=0; i<tcresultset1.getRowCount(); i++)
{
String x=Integer.toString(i);
if ( x.equals(row)) {
tcresultset1.goToRow(i);
String value = tcresultset1.getStringValue("Object Instance.Key");
System.out.println("Object instance key is = " + value);
retVal = getFormDataByObjectInstanceKey(value, resourceName);
//System.out.println(" form data is = " + retVal);
}
}

}catch(Exception ex)
{
ex.printStackTrace();
}
return retVal;
}



%>

6. Update the following lines of code:

<nested:iterate id="resourceName" name="requestApprovalDetailForm" property="resourceNameList" length="1" offset="<%=indexId.toString()%>">
<% String resName= (String) resourceName; %>
<P class=InstructionText align=left><B><nested:write name="resourceName"/> <%= getResourceDetails(entityKey.toString(), session,indexId.toString(), resName) %></B></P>
</nested:iterate>



7. For your convenience, I am going to put the full modified source in a seperate blog. You may access this whole file here: http://rajnishbhatia19.blogspot.com/2008/06/requestapprovaldetailtilesjsp.html


8. Here is how the object forms looks for these Resource Objects.





9. I have created c.bat and written all the regular useful commands in a batch file. So, you can do the same and run c.bat from your command prompt.



10. Run c.bat and make sure your application is compiled successfully and deployed. Restart your app server.



11. In the design console, add a lookup Lookup.Resources.ObjectForm.FieldMappings that would have a resource name and the field names from the Object Forms.



12. Once you restart the server, here is now how it looks. It displays values from the object form right on the approval screen.





13. If you see the logs, you will see all the queries that are being created and run on the fly against the oim database.



14. When you run this query in the sqlplus, you see the values I am printing on the approval oim customized page.

Tuesday, June 3, 2008

Playing with System Configurations

Sometimes you need to modify the system attributes to make OIM behave according to your organizational needs. So, here I show you how to tweak these values. I am going to show you two simple changes and you can play more with it yourself.

1. Here, I am going to change login page to not display "User Registration".











2. Next, I am showing you how to display more custom questions than out of the box. You can obviously do more things from system configuration, like how many correct questions a user has to reply before resetting their credentials.







Additionally:

If you want to change the OIM text or web settings, such as number of results to be displayed during search (like 10 are by default and you can increase them to whatever number you like) or modifying logo etc - you need to modify the xlWebApp. Look into http://rajnishbhatia19.blogspot.com/2008/03/changing-oracle-logo-in-oim.html blog for details. Generally, you may change xlWebAdmin.properties file to incorporated such changes. Look for "global.displayrecordNum.value" and change it from 10 to 20 (or whatever you wish). You may change other text like Previous Next etc also from this file.

Monday, June 2, 2008

Running OIM Design Console from Linux / Unix

Here are a few scripts you can use to run OIM Design Console from *nux flavors.
You would need to download and setup xming ( http://sourceforge.net/projects/xming ) or cygwin/x.

[root@oim ~]# cd /opt/oracle/xlclient/xlclient/

Create the following 2 script files using vi.

[root@oim xlclient]# vi classpath.sh
CLASSPATH=.:./lib/XellerateClient.jar:./lib/XellerateServer.jar:./ext/jakarta-oro-2.0.8.jar:./ext/bsh.jar:./ext/jhall.jar:./ext/mail.jar:./ext/log4j-1.2.8.jar:./ext/jboss-j2ee.jar:./ext/jboss-jaas.jar:./ext/jbosssx.jar:./ext/jts.jar:./ext/jbossall-client.jar:./ext/concurrent.jar:./ext/getopt.jar:./ext/gnu-regexp.jar:./ext/jacorb.jar:./ext/jboss-client.jar:./ext/jboss-common-client.jar:./ext/jbosscx-client.jar:./ext/jbossha-client.jar:./ext/jboss-iiop-client.jar:./ext/jbossjmx-ant.jar:./ext/jboss-jsr77-client.jar:./ext/jbossmq-client.jar:./ext/jboss-net-client.jar:./ext/jbosssx-client.jar:./ext/jboss-system-client.jar:./ext/jboss-transaction-client.jar:./ext/jcert.jar:./ext/jmx-connector-client-factory.jar:./ext/jmx-ejb-connector-client.jar:./ext/xdoclet-module-jboss-net.jar:./ext/jsse.jar:./ext/jnet.jar:./ext/jmx-rmi-connector-client.jar:./ext/jmx-invoker-adapter-client.jar:./ext/jnp-client.jar:./ext/log4j.jar:./ext/jocache.jar:./lib/xlAPI.jar:./lib/xlLogger.jar:./lib/xlVO.jar:./lib/xlUtils.jar:./lib/xlCrypto.jar:./lib/xlAuthentication.jar:./lib/xlDataObjectBeans.jar:./ext/weblogic.jar:./lib/xlCopyUtil.jar:./ext/xalan.jar:./ext/xerces.jar:./ext/xercesImpl.jar:./ext/oc4jclient.jar:./ext/ejb.jar
export $CLASSPATH

[root@oim xlclient]# vi xlclient.sh
. ./classpath.sh

#export DEBUG_OPTS="-classic -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5001 -DXL.RedirectSysOutErrToFile=TRUE -DXL.SysOutErrLogFile=./logs/Client.System.Out.Err.log"

export DEBUG_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5001 -DXL.RedirectSysOutErrToFile=TRUE -DXL.SysOutErrLogFile=./logs/Client.System.Out.Err.log"

export DEBUG_OPTS

#Make sure to remove java.naming.provider.url and read it from the configuration
#once the JNDI Profiles are implemented.
#make sure you are using j2sdk1.4.2_04

/opt/j2sdk1.4.2_16/jre/bin/java $DEBUG_OPTS -DXL.ExtendedErrorOptions=TRUE \
-DXL.HomeDir=. -Djava.security.policy=config/xl.policy \
-Djava.security.manager -Djava.security.auth.login.config=config/auth.conf \
-Dlog4j.configuration=config/log.properties \
-cp $CLASSPATH com.thortech.xl.client.base.tcAppWindow -server server &

[root@oim xlclient]# chmod +x xlclient.sh

[root@oim xlclient]# chmod +x classpath.sh

[root@oim ~]# cd ~

[root@oim ~]# vi launchclient.sh
#!/bin/bash
cd /opt/oracle/xlclient/xlclient
./xlclient.sh &

[root@oim ~]# chmod +x launchclient.sh

[root@oim ~]# ./launchclient.sh