Commit c1dbadaa authored by pbhosale's avatar pbhosale

Updated on[24-01-2020][To assign connection to exprsEngine]

AllowDednSalComp.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@215648 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 599cd9be
......@@ -57,7 +57,7 @@ public class AllowDednSalComp
// Modified By Poonam B[26/11/2019][START]
//if(varValue != null && varValue.trim().length() > 0 && varValue.indexOf("[") > 0 && varValue.indexOf("]") > 0)
if(varValue != null && varValue.trim().length() > 0 && varValue.indexOf("[") != -1 && varValue.indexOf("]") != -1)
{
//String[] syntaxStr = varValue.split("[");
String[] syntaxStr = varValue.split("\\[");
......@@ -124,7 +124,7 @@ public class AllowDednSalComp
{
pbToJavaSyntaxKeySize = -1;
String filePath = CommonConstants.JBOSSHOME + File.separator + "server" + File.separator + "default" + File.separator + "deploy" + File.separator + "ibase.ear" + File.separator + "ibase.war" + File.separator + "setting" + File.separator +"ADCompFormulaSyntax.xml";
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
while ((isCurrentLine = bufferedReader.readLine()) != null)
{
if (isCurrentLine.trim().length() > 0)
......@@ -193,11 +193,11 @@ public class AllowDednSalComp
if(input.indexOf("IF(")>=0)
input = input.replace("IF(", "iif(");
if(input.indexOf("ISNULL(")>=0)
input = input.replace("ISNULL(", "isnull(");
if(input.indexOf("ISNULL (")>=0)
input = input.replace("ISNULL (", "isnull(");
System.out.println(input);
if(input.indexOf("ISNULL(")>=0)
input = input.replace("ISNULL(", "isnull(");
if(input.indexOf("ISNULL (")>=0)
input = input.replace("ISNULL (", "isnull(");
System.out.println(input);
}
catch(Exception e)
{
......@@ -205,7 +205,7 @@ public class AllowDednSalComp
}
return input;
}
//Modified by Rohini T on [09/08/19][Start]
public LinkedHashMap getAdCompInfo(String processType, Connection conn) throws ITMException
{
......@@ -275,7 +275,7 @@ public class AllowDednSalComp
strBaseFormula = replaceIF(strBaseFormula.trim().toUpperCase());
System.out.println("strBaseFormula::::inside getAdCompInfo after"+strBaseFormula);
}
*/
*/
//Added by Varsha V on 28-11-19
/*if(strBaseFormula != null && strBaseFormula.trim().length() > 0 && !strBaseFormula.startsWith("SELECT "))
{
......@@ -305,7 +305,7 @@ public class AllowDednSalComp
strSlabFormula = replaceIF(strSlabFormula.trim().toUpperCase());
System.out.println("strSlabFormula::::inside getAdCompInfo after"+strSlabFormula);
}
*/
*/
//Added by Varsha V on 28-11-19
/*if(strSlabFormula != null && strSlabFormula.trim().length() > 0 && !strSlabFormula.startsWith("SELECT "))
{
......@@ -335,7 +335,7 @@ public class AllowDednSalComp
strResFormula = replaceIF(strResFormula.trim().toUpperCase());
System.out.println("strResFormula::::inside getAdCompInfo after"+strResFormula);
}
*/
*/
//Added by Varsha V on 28-11-19
/*if(strResFormula != null && strResFormula.trim().length() > 0 && ! strResFormula.startsWith("SELECT "))
{
......@@ -902,7 +902,7 @@ public class AllowDednSalComp
+ "var res = obj.gfCallPayrollDdf(a,b,c,d,e,f);"
+ "return res;}");*/
//Commented by Poonam B[16-12-2019][To avoid nullPointer][END]
//Ended by Varsha V on 02-12-19
//Ended by Varsha V on 02-12-19
//Commented by Poonam B[16-12-2019][To avoid nullPointer][START]
//AdmCommon admCommon = new AdmCommon();
//Commented by Poonam B[16-12-2019][To avoid nullPointer][END]
......@@ -931,16 +931,30 @@ public class AllowDednSalComp
try
{
//Added below line by Varsha V on 02-12-19
admCommonConn = argConn;
//Modified By Poonam B[24-01-2020][To assign argConn to exprsEngine][START]
//admCommonConn = argConn;
exprsEngine.put("conn", argConn);
System.out.println("argConn inside exprsEngine is::::" +exprsEngine.get("conn").toString()+"\nargConn is ::::" +argConn);
//added by Poonam B[16-12-2019][To avoid nullPointer][START]
exprsEngine.eval("function GF_GETENV(a,b) {var compName = Packages.ibase.webitm.ejb.adm.AllowDednSalComp;"
/*exprsEngine.eval("function GF_GETENV(a,b) {var compName = Packages.ibase.webitm.ejb.adm.AllowDednSalComp;"
+ "var obj = new Packages.ibase.webitm.ejb.adm.AllowDednSalComp();"
+ "var res = obj.getEnv(a,b);"
+ "return res;}");
exprsEngine.eval("function GF_CALL_PYRL_DDF(a,b,c,d,e,f) {var compName = Packages.ibase.webitm.ejb.adm.AllowDednSalComp;"
+ "var obj = new Packages.ibase.webitm.ejb.adm.AllowDednSalComp();"
+ "var res = obj.gfCallPayrollDdf(a,b,c,d,e,f);"
+ "return res;}");
+ "return res;}");*/
exprsEngine.eval("function GF_GETENV(a,b) {var compName = Packages.ibase.webitm.ejb.adm.AllowDednSalComp;"
+ "var obj = new Packages.ibase.webitm.ejb.adm.AllowDednSalComp();"
+ "var res = obj.getEnv(a,b,conn);"
+ "return res;}");
exprsEngine.eval("function GF_CALL_PYRL_DDF(a,b,c,d,e,f) {var compName = Packages.ibase.webitm.ejb.adm.AllowDednSalComp;"
+ "var obj = new Packages.ibase.webitm.ejb.adm.AllowDednSalComp();"
+ "var res = obj.gfCallPayrollDdf(a,b,c,d,e,f,conn);"
+ "return res;}");
//Modified By Poonam B[24-01-2020][To assign argConn to exprsEngine][END]
//added by Poonam B[16-12-2019][To avoid nullPointer][END]
/*sql = "select date_join, relieve_date, retirement_date from employee where emp_code = ? ";
pstmt = argConn.prepareStatement(sql);*/
......@@ -1082,18 +1096,18 @@ public class AllowDednSalComp
{
System.out.println("exprsEngine::::"+exprsEngine.toString());
System.out.println("strBaseFormula:::123:"+strBaseFormula);
String strResult = String.valueOf(exprsEngine.eval(strBaseFormula));
System.out.println("strResult::::123"+strResult);
if(strResult == null || strResult.trim().length() == 0)
{
dBaseAmt = 0d;
}
else
{
String strResult = String.valueOf(exprsEngine.eval(strBaseFormula));
System.out.println("strResult::::123"+strResult);
if(strResult == null || strResult.trim().length() == 0)
{
dBaseAmt = 0d;
}
else
{
if ("NaN".equalsIgnoreCase(strResult))
{
errorCode = "VPPAYPRC01\tResult is non numeric - Error in base formula of AD Code [" + strCompCode + "]";
break;
errorCode = "VPPAYPRC01\tResult is non numeric - Error in base formula of AD Code [" + strCompCode + "]";
break;
}
else
{
......@@ -1104,14 +1118,14 @@ public class AllowDednSalComp
}
catch(Exception dsParseEx)
{
//Modified By Poonam B[23-12-2019][START]
//Modified By Poonam B[23-12-2019][START]
//errorCode = "VPPAYPRC01\tException in converting base formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + dsParseEx.getMessage();
errorCode = "VPPAYPRC01\tException in converting base formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + dsParseEx.getMessage().replace('"' , ' ').replace('<', ' ');
//Modified By Poonam B[23-12-2019][END]
break;
break;
}
}
}
}
}
catch(Exception bEvalEx)
{
......@@ -1136,17 +1150,17 @@ public class AllowDednSalComp
{
try
{
String strResult = String.valueOf(exprsEngine.eval(strSlabFormula));
if(strResult == null || strResult.trim().length() == 0)
{
dSlabAmt = 0d;
}
else
{
String strResult = String.valueOf(exprsEngine.eval(strSlabFormula));
if(strResult == null || strResult.trim().length() == 0)
{
dSlabAmt = 0d;
}
else
{
if ("NaN".equalsIgnoreCase(strResult))
{
errorCode = "VPPAYPRC01\tResult is non numeric - Error in slab formula of AD Code [" + strCompCode + "]";
break;
errorCode = "VPPAYPRC01\tResult is non numeric - Error in slab formula of AD Code [" + strCompCode + "]";
break;
}
else
{
......@@ -1157,11 +1171,11 @@ public class AllowDednSalComp
}
catch(Exception dsParseEx)
{
errorCode = "VPPAYPRC01\tException in converting slab formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + dsParseEx.getMessage();
break;
errorCode = "VPPAYPRC01\tException in converting slab formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + dsParseEx.getMessage();
break;
}
}
}
}
}
catch(Exception bEvalEx)
{
......@@ -1443,17 +1457,17 @@ public class AllowDednSalComp
{
try
{
String strResult = String.valueOf(exprsEngine.eval(strResFormula));
if(strResult == null || strResult.trim().length() == 0)
{
dResAmt = 0d;
}
else
{
String strResult = String.valueOf(exprsEngine.eval(strResFormula));
if(strResult == null || strResult.trim().length() == 0)
{
dResAmt = 0d;
}
else
{
if ("NaN".equalsIgnoreCase(strResult))
{
errorCode = "VPPAYPRC01\tResult is non numeric - Error in result formula of AD Code [" + strCompCode + "]";
break;
errorCode = "VPPAYPRC01\tResult is non numeric - Error in result formula of AD Code [" + strCompCode + "]";
break;
}
else
{
......@@ -1463,11 +1477,11 @@ public class AllowDednSalComp
}
catch(Exception rsParseEx)
{
errorCode = "VPPAYPRC01\tException in converting slab formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + rsParseEx.getMessage();
break;
errorCode = "VPPAYPRC01\tException in converting slab formula result [" + strResult + "] of AD Code [" + strCompCode + "]\r\n" + rsParseEx.getMessage();
break;
}
}
}
}
}
catch(Exception bEvalEx)
{
......@@ -2337,9 +2351,12 @@ public class AllowDednSalComp
System.out.println("retMap from GbfGetSplitAttd :: ["+retMap+"]");
return retMap;
}
//Added by Varsha V on 2-12-19
public String getEnv(String prdCode, String varName) throws ITMException
//Modified by Poonam B[24-01-2020][to add connection to method][START]
//public String getEnv(String prdCode, String varName) throws ITMException
public String getEnv(String prdCode, String varName, Connection conn) throws ITMException
//Modified by Poonam B[24-01-2020][to add connection to method][END]
{
String retValue = "";
String sql = "";
......@@ -2348,7 +2365,11 @@ public class AllowDednSalComp
try
{
System.out.println("prd_code: "+prdCode+ " varName: "+varName);
retValue = admCommon.getEnv(prdCode, varName, admCommonConn);
//Modified by Poonam B[24-01-2020][to add connection to method][START]
//retValue = admCommon.getEnv(prdCode, varName, admCommonConn);
retValue = admCommon.getEnv(prdCode, varName, conn);
System.out.println("retValue: "+retValue);
//Modified by Poonam B[24-01-2020][to add connection to method][END]
}
catch (Exception e)
{
......@@ -2358,13 +2379,20 @@ public class AllowDednSalComp
}
return retValue;
}
public double gfCallPayrollDdf(String empcode, String prdcode, String proctype, String calctype, double acNewamt, String adcode) throws SQLException, ITMException
//Modified by Poonam B[24-01-2020][to add connection to method][START]
//public double gfCallPayrollDdf(String empcode, String prdcode, String proctype, String calctype, double acNewamt, String adcode) throws SQLException, ITMException
public double gfCallPayrollDdf(String empcode, String prdcode, String proctype, String calctype, double acNewamt, String adcode , Connection conn) throws SQLException, ITMException
//Modified by Poonam B[24-01-2020][to add connection to method][END]
{
double retAmt = 0.0;
System.out.println("gfCallPayrollDdf Method called");
try
{
retAmt = admCommon.gfCallPayrollDdf(empcode, prdcode, proctype, calctype, acNewamt, adcode, admCommonConn);
//Modified by Poonam B[24-01-2020][to add connection to method][START]
//retAmt = admCommon.gfCallPayrollDdf(empcode, prdcode, proctype, calctype, acNewamt, adcode, admCommonConn);
System.out.println("conn inside AllowDednSalComp::::" +conn);
retAmt = admCommon.gfCallPayrollDdf(empcode, prdcode, proctype, calctype, acNewamt, adcode, conn);
//Modified by Poonam B[24-01-2020][to add connection to method][END]
}
catch(Exception e)
{
......@@ -2372,7 +2400,7 @@ public class AllowDednSalComp
e.printStackTrace();
throw new ITMException(e);
}
return retAmt;
}
//Ended by Varsha V on 2-12-19
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment