package xxtest.oracle.apps.per.selfservice.specialinformation.webui;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import oracle.apps.fnd.flexj.KeyFlexfield;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.OAKeyFlexBean;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageDateFieldBean;
import oracle.apps.per.selfservice.specialinformation.webui.SitUpdateCO;
import oracle.apps.per.selfservice.common.SSHRParams;
public class XXKeyFlexFieldCO extends SitUpdateCO
{
publicXXKeyFlexFieldCO()
{
}
public void processRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
{
super.processRequest(oapagecontext, oawebbean);
}
public void processFormRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
{
OAApplicationModule am = oapagecontext.getRootApplicationModule();
SSHRParams sshrparams = new SSHRParams(am.getOADBTransaction());
String v_bg_id = sshrparams.getSelectedPersonBusinessGroupId();
String surl = oapagecontext.getCurrentUrl();
if (oapagecontext.isLoggingEnabled(1)) {
oapagecontext.writeDiagnostics(this, "URL" + surl, 1);
oapagecontext.writeDiagnostics(this,
"OAFunc Id" + oapagecontext.getFunctionId(),
1);
}
String OAFunc = null;
try {
OAFunc =
surl.substring(surl.indexOf("OAFunc")).split("&")[0].split("=")[1];
} catch (Exception e) {
try {
PreparedStatement pstmt =
am.getOADBTransaction().getJdbcConnection().prepareStatement("Select Function_name from fnd_form_functions where function_id=" +
oapagecontext.getFunctionId());
ResultSet rs = pstmt.executeQuery();
if (rs.next()) {
OAFunc = rs.getString(1);
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
if (oapagecontext.isLoggingEnabled(1)) {
oapagecontext.writeDiagnostics(this, "URL" + surl, 1);
oapagecontext.writeDiagnostics(this, "OAFunc" + OAFunc, 1);
}
if(oapagecontext.getParameter("HrNext") != null)
{
if(OAFunc.equalsIgnoreCase("XXOLNG_CAR_LOAN_SS")||OAFunc.equalsIgnoreCase("XXOLNG_LEAVE_ENCASH_SS")||OAFunc.equalsIgnoreCase("XXOLNG_STAFF_LOAN_SS"))
{
String From_Date = oapagecontext.getParameter("HrSitStartDate");
String To_Date = oapagecontext.getParameter("HrSitEndDate");
OAKeyFlexBean kffBean = (OAKeyFlexBean)oawebbean.findIndexedChildRecursive("HrSitKeyFlex");
KeyFlexfield keyflexfield = (KeyFlexfield)kffBean.getAttributeValue(OAWebBeanConstants.FLEXFIELD_REFERENCE);
oapagecontext.writeDiagnostics(this,"Segment Count:"+keyflexfield.getSegmentCount(),1);
String s_struc_code = keyflexfield.getStructureCode();
String str[] = new String[30];
for(int i = 0; i < keyflexfield.getSegmentCount(); i++) {
try
{
str[i] = keyflexfield.getSegment(i).getInputValue();
oapagecontext.writeDiagnostics(this, "segment"+i+"-"+keyflexfield.getSegment(i).getName()+"-"+str[i],1);
}
catch(Exception e)
{
str[i] = null;
}
}
//
String emp_id = (new StringBuilder()).append(oapagecontext.getEmployeeId()).append("").toString();
String query = "SELECT hr_sit_validation.validate_segments(:1,:2,:3,:4, :5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16,:17,:18,:19,:20,:21,:22,:23,:24,:25,:26,:27,:28,:29,:30,:31,:32,:33,:34,:35) from dual";
String rvalue = "N";
//
try
{
PreparedStatement pStmt = am.getOADBTransaction().createPreparedStatement(query, 1);
pStmt.setString(1, emp_id);
pStmt.setString(2, s_struc_code);
pStmt.setString(3, From_Date);
pStmt.setString(4, To_Date);
//
pStmt.setString(5, str[0]);
pStmt.setString(6, str[1]);
pStmt.setString(7, str[2]);
pStmt.setString(8, str[3]);
pStmt.setString(9, str[4]);
pStmt.setString(10, str[5]);
pStmt.setString(11, str[6]);
pStmt.setString(12, str[7]);
pStmt.setString(13, str[8]);
// oapagecontext.writeDiagnostics(this, "segment-"+keyflexfield.getSegment(8).getName()+"-"+str[8],1);
pStmt.setString(14, str[9]);
pStmt.setString(15, str[10]);
pStmt.setString(16, str[11]);
pStmt.setString(17, str[12]);
pStmt.setString(18, str[13]);
pStmt.setString(19, str[14]);
pStmt.setString(20, str[15]);
pStmt.setString(21, null);
pStmt.setString(22, null);
pStmt.setString(23, null);
pStmt.setString(24, null);
pStmt.setString(25, null);
pStmt.setString(26, null);
pStmt.setString(27, null);
pStmt.setString(28, null);
pStmt.setString(29, null);
pStmt.setString(30, null);
pStmt.setString(31, null);
pStmt.setString(32, null);
pStmt.setString(33, null);
pStmt.setString(34, null);
pStmt.setString(35, v_bg_id);
//
for(ResultSet rs = pStmt.executeQuery(); rs.next();)
if(rs != null)
{
rvalue = rs.getString(1);
}
oapagecontext.writeDiagnostics(this,"rvalue--"+rvalue,1);
pStmt.close();
}
catch(Exception e)
{
throw OAException.wrapperException(e);
}
//
if ( rvalue.equals("N") )
{
String sContinue = "Y";
}
else
{
throw new OAException("XXTEST",rvalue,null,OAException.ERROR,null);
}
}
}
super.processFormRequest(oapagecontext, oawebbean);
}
}
Hello Chiranjeevi,
ReplyDeleteCan you please share the code of "hr_sit_validation.validate_segments" ?