Commit 356150a8 authored by pbhosale's avatar pbhosale

Updated on[21/11/2019] changes done as suggested by Piyush Sir

AllowDednSalComp.java


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@212542 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 99dd032f
......@@ -3,12 +3,17 @@ AllowDednSalComp.java
HashMap adCompsInfo = new HashMap();
HashMap payCompInfo = new HashMap();
*/
*/
package ibase.webitm.ejb.adm;
import java.lang.reflect.Array;
import java.sql.*;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.LinkedHashMap;
......@@ -25,6 +30,60 @@ public class AllowDednSalComp
{
AdmCommon admCommon = new AdmCommon();
UtilMethods utilMethods = new UtilMethods();
//Modified By Poonam B[20/11/2019][START][New methods created to convert formula in java syntax with dynamic concept].Start
ArrayList<String> pbSyntaxKeyList = new ArrayList<String>();
ArrayList<String> pbToJavaSyntaxKeyList = new ArrayList<String>();
int pbToJavaSyntaxKeySize = 0;
private String convertFormulaInJava(String input, Connection conn) throws ITMException
{
try
{
if (pbToJavaSyntaxKeySize == 0)
{
String varValue = admCommon.getEnv("999999", "ADFORMULA_PB2JAVA", conn);
pbToJavaSyntaxKeySize = -1;
if(varValue != null && varValue.trim().length() > 0 && varValue.indexOf("[") > 0 && varValue.indexOf("]") > 0)
{
String[] syntaxStr = varValue.split("[");
int syntaxStrSize = syntaxStr.length;
for(int i = 0;i < syntaxStrSize; i++)
{
syntaxStr[i].replace("[", "");
syntaxStr[i].replace("]", "");
String[] syntaxKeyStr = ((String)syntaxStr[i]).split("{");
if(syntaxKeyStr.length != 2)
{
continue;
}
syntaxKeyStr[0].replace("{", "");
syntaxKeyStr[0].replace("}", "");
syntaxKeyStr[1].replace("{", "");
syntaxKeyStr[1].replace("}", "");
pbSyntaxKeyList.add(syntaxKeyStr[0]);
pbToJavaSyntaxKeyList.add(syntaxKeyStr[1]);
pbToJavaSyntaxKeySize = pbSyntaxKeyList.size();
}
}
}
if(pbToJavaSyntaxKeySize > 0)
{
for (int i = 0; i < pbToJavaSyntaxKeySize; i++)
{
String pbKeyStr = (String) pbSyntaxKeyList.get(i);
String javaKeyStr = (String) pbToJavaSyntaxKeyList.get(i);
input = input.replace(pbKeyStr, javaKeyStr);
}
}
}
catch(Exception e)
{
throw new ITMException(e);
}
return input;
}
//Modified By Poonam B[20/11/2019][START][New methods created to convert formula in java syntax with dynamic concept].End
private String replaceIF(String input) throws ITMException
{
try
......@@ -51,6 +110,7 @@ public class AllowDednSalComp
}
return input;
}
//Modified by Rohini T on [09/08/19][Start]
public LinkedHashMap getAdCompInfo(String processType, Connection conn) throws ITMException
{
......@@ -112,30 +172,61 @@ public class AllowDednSalComp
String strBaseFormula = rstAdCodes.getString("BASE_FORMULA");
//Added By Varsha V on 19-07-19 to replace IF with IIF
System.out.println("strBaseFormula::::inside getAdCompInfo before"+strBaseFormula);
//Modified By Poonam B[20/11/2019][method name is renamed and replace in other select statement].Start
/*
if(strBaseFormula != null && strBaseFormula.trim().length() > 0)
{
strBaseFormula = replaceIF(strBaseFormula.trim().toUpperCase());
System.out.println("strBaseFormula::::inside getAdCompInfo after"+strBaseFormula);
}
*/
if(strBaseFormula != null && strBaseFormula.trim().length() > 0 && !strBaseFormula.startsWith("SELECT "))
{
strBaseFormula = convertFormulaInJava(strBaseFormula.trim().toUpperCase(),conn);
System.out.println("strBaseFormula::::inside getAdCompInfo after"+strBaseFormula);
}
//Modified By Poonam B[20/11/2019][method name is renamed and replace in other select statement].End
//Ended By Varsha V on 19-07-19 to replace IF with IIF
String strSlabFormula = rstAdCodes.getString("SLAB_FORMULA");
System.out.println("strSlabFormula::::inside getAdCompInfo before"+strSlabFormula);
//Added By Varsha V on 19-07-19 to replace IF with IIF
//Modified By Poonam B[20/11/2019][method name is renamed and replace in other select statement].Start
/*
if(strSlabFormula != null && strSlabFormula.trim().length() > 0)
{
strSlabFormula = replaceIF(strSlabFormula.trim().toUpperCase());
System.out.println("strSlabFormula::::inside getAdCompInfo after"+strSlabFormula);
}
*/
if(strSlabFormula != null && strSlabFormula.trim().length() > 0 && !strSlabFormula.startsWith("SELECT "))
{
strSlabFormula = convertFormulaInJava(strSlabFormula.trim().toUpperCase(),conn);
System.out.println("strSlabFormula::::inside getAdCompInfo after"+strSlabFormula);
}
//Modified By Poonam B[20/11/2019][method name is renamed and replace in other select statement].End
//Ended By Varsha V on 19-07-19 to replace IF with IIF
String strResFormula = rstAdCodes.getString("RES_FORMULA");
System.out.println("strResFormula::::inside getAdCompInfo before"+strResFormula);
//Added By Varsha V on 19-07-19 to replace IF with IIF
//Modified By Poonam B[20/11/2019][method name is renamed and replace in other select statement].Start
/*
if(strResFormula != null && strResFormula.trim().length() > 0)
{
strResFormula = replaceIF(strResFormula.trim().toUpperCase());
System.out.println("strResFormula::::inside getAdCompInfo after"+strResFormula);
}
*/
if(strResFormula != null && strResFormula.trim().length() > 0 && ! strResFormula.startsWith("SELECT "))
{
strResFormula = convertFormulaInJava(strResFormula.trim().toUpperCase(),conn);
System.out.println("strResFormula::::inside getAdCompInfo after"+strResFormula);
}
//Modified By Poonam B[20/11/2019][method name is renamed and replace in other select statement].End
//Ended By Varsha V on 19-07-19 to replace IF with IIF
String strBalOpt = rstAdCodes.getString("BAL_OPT");
String strForCondn = rstAdCodes.getString("FOR_CONDN");
String strSqlExpr = rstAdCodes.getString("SQL_EXPR");
......@@ -2084,6 +2175,5 @@ public class AllowDednSalComp
return retMap;
}
}
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