Commit 64ae01f8 authored by Ajit Deshmukh's avatar Ajit Deshmukh

Resolved the issue reported by the QC regarding wrong validation message on...

Resolved the issue reported by the QC regarding wrong validation message on click of Release To Pilot button
parent 3d30d5af
......@@ -16,6 +16,7 @@ import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException;
import java.sql.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
......@@ -27,6 +28,7 @@ import java.util.regex.Pattern;
import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.utility.UserInfoBean;
public class ManageSqlConf extends ActionHandlerEJB {
int reUpdateCnt = 0;
......@@ -83,7 +85,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
selectedEnterprise = checkNull(rs.getString("enterprises"));
confirmed = checkNull(rs.getString("confirmed"));
}
if (rs != null) {
rs.close();
......@@ -94,10 +95,10 @@ public class ManageSqlConf extends ActionHandlerEJB {
pstmt = null;
}
if(confirmed.trim().equalsIgnoreCase("Y")){
BaseLogger.log("3", null, null, "Transaction is already confirmed Tran ID:: "+tranId);
errString = itmdbAccessLocal.getErrorString("confirmed", "VTCICONF1", "", "", con);
return errString;
if (confirmed.trim().equalsIgnoreCase("Y")) {
BaseLogger.log("3", null, null, "Transaction is already confirmed Tran ID:: " + tranId);
errString = itmdbAccessLocal.getErrorString("confirmed", "VTCICONF1", "", "", con);
return errString;
}
// Commented by Ajit D. on 03-DEC-25 -- START
// if ("Q".equalsIgnoreCase(execRights)) {
......@@ -224,7 +225,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
String confirmedFlag = checkNull(rs.getString("CONFIRMED"));
String depTranId = checkNull(rs.getString("TRAN_ID"));
// If any dependent (D or Q) is not confirmed → block confirmation
if (!"Y".equalsIgnoreCase(confirmedFlag)) {
......@@ -242,19 +242,23 @@ public class ManageSqlConf extends ActionHandlerEJB {
pstmt = null;
}
//Added the code to fetch the Executive Approval value for Main transaction on 21-APR[START]
// Added the code to fetch the Executive Approval value for Main transaction on
// 21-APR[START]
String execAprv = "";
String execAprvSql = "SELECT EXEC_APRV FROM SQL_CHANGES " +
String wfStatus = "";
String execAprvSql = "SELECT EXEC_APRV, WF_STATUS FROM SQL_CHANGES " +
"WHERE TRAN_ID = ?";
pstmt = con.prepareStatement(execAprvSql);
pstmt.setString(1, tranIdRef);
rs = pstmt.executeQuery();
while(rs.next()){
while (rs.next()) {
execAprv = checkNull(rs.getString("EXEC_APRV"));
}
System.out.println("execAprv: " + execAprv);
wfStatus = checkNull(rs.getString("WF_STATUS"));
}
System.out.println("execAprv: " + execAprv);
System.out.println("wfStatus: " + wfStatus);
if (rs != null) {
rs.close();
......@@ -265,17 +269,20 @@ public class ManageSqlConf extends ActionHandlerEJB {
pstmt = null;
}
//Added the code to fetch the Executive Approval value for Main transaction on 21-APR[END]
// Added the code to fetch the Executive Approval value for Main transaction on
// 21-APR[END]
// No dependent D/Q records found → workflow not yet approved
//Added the condition if executive approval value is "Y" then only check the workflow weather approved or not 21-APRIL
if(execAprv.trim().equalsIgnoreCase("Y")){
if (!recordFound) {
System.out.println("Cannot confirm. Workflow not approved for tran_id: " + tranId);
errString = itmdbAccessLocal.getErrorString("confirmed", "WRKFNA", "", "", con);
return errString;
}
// Added the condition if executive approval value is "Y" then only check the
// workflow weather approved or not 21-APRIL
if (execAprv.trim().equalsIgnoreCase("Y")) {
if (!wfStatus.trim().equalsIgnoreCase("A")) {
System.out.println("Cannot confirm. Workflow not approved for tran_id: " + tranId);
errString = itmdbAccessLocal.getErrorString("confirmed", "WRKFNA", "", "", con);
return errString;
}
}
// Dependent D or Q exists but NOT confirmed → return error
......@@ -430,7 +437,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
}
if ("Q".equalsIgnoreCase(execRights) || "D".equalsIgnoreCase(execRights)
if ("Q".equalsIgnoreCase(execRights) || "C".equalsIgnoreCase(execRights)
|| "P".equalsIgnoreCase(execRights)) {
BaseLogger.log(
"3",
......@@ -441,14 +448,32 @@ public class ManageSqlConf extends ActionHandlerEJB {
String QcDevEnterprise = "";
String mainEnterprise = "";
String dbMainForPilot = "";
String dbClientDev = "";
BaseLogger.log("3", null, null, "execRights [" + execRights + "]");
if ("Q".equalsIgnoreCase(execRights)) {
QcDevEnterprise = "APPVISQC";
} else if ("D".equalsIgnoreCase(execRights)) {
QcDevEnterprise = "APPVISDEV";
BaseLogger.log(
"1",
null,
null,
"Executing for QC ");
// D/Q: enterprise code matches ENTERPRISE table directly
processSqlForEnterprise(
con,
QcDevEnterprise,
oracleStatment,
tranId,
linNo,
requestID,
userId,
chgTerm);
}
// For PILOT, look up DB_PILOT from enterprise table using the main
// transaction's enterprise (via TRAN_ID__REF)
else if ("P".equalsIgnoreCase(execRights)) {
else if ("P".equalsIgnoreCase(execRights) || "C".equalsIgnoreCase(execRights)) {
// First, get the enterprise from the main (A) transaction
String mainEntSql = "SELECT ENTERPRISES FROM SQL_CHANGES WHERE TRAN_ID = ?";
try (PreparedStatement mainEntPstmt = con.prepareStatement(mainEntSql)) {
......@@ -459,97 +484,138 @@ public class ManageSqlConf extends ActionHandlerEJB {
}
}
}
BaseLogger.log("3", null, null, "mainEnterprise [" + mainEnterprise + "]");// Added
if (mainEnterprise.isEmpty()) {
throw new ITMException(new Exception(
"Main transaction enterprise not found for TRAN_ID__REF: " + tranIdRef));
}
// Use the main transaction's enterprise to look up DB_PILOT and DB_MAIN
String pilotDbLookupSql = "SELECT DB_PILOT, DB_MAIN FROM ENTERPRISE WHERE ENTERPRISE = ?";
try (PreparedStatement pilotLookupPstmt = con.prepareStatement(pilotDbLookupSql)) {
pilotLookupPstmt.setString(1, mainEnterprise);
try (ResultSet pilotLookupRs = pilotLookupPstmt.executeQuery()) {
if (pilotLookupRs.next()) {
QcDevEnterprise = checkNull(pilotLookupRs.getString("DB_PILOT"));
dbMainForPilot = checkNull(pilotLookupRs.getString("DB_MAIN"));
String[] enterprisesArr = mainEnterprise.split(",");
for (String enterpriser : enterprisesArr) {
// String placeholders = String.join(",",
// Collections.nCopies(enterprisesArr.length, "?"));
// Use the main transaction's enterprise to look up DB_PILOT and DB_MAIN
String pilotDbLookupSql = "SELECT DB_PILOT, DB_MAIN, DB_DEV FROM ENTERPRISE WHERE ENTERPRISE IN (?)";
try (PreparedStatement pilotLookupPstmt = con.prepareStatement(pilotDbLookupSql)) {
pilotLookupPstmt.setString(1, enterpriser);
try (ResultSet pilotLookupRs = pilotLookupPstmt.executeQuery()) {
while (pilotLookupRs.next()) {
QcDevEnterprise = checkNull(pilotLookupRs.getString("DB_PILOT"));
dbMainForPilot = checkNull(pilotLookupRs.getString("DB_MAIN"));
dbClientDev = checkNull(pilotLookupRs.getString("DB_DEV"));
}
}
}
}
if (QcDevEnterprise.isEmpty()) {
throw new ITMException(
new Exception("DB_PILOT not found for enterprise: " + mainEnterprise));
}
BaseLogger.log("3", null, null, "PILOT execution: using DB_PILOT [" + QcDevEnterprise
+ "] from main enterprise [" + mainEnterprise + "]");
}
Savepoint entSavepoint = null;
try {
// ENTERPRISE-LEVEL SAVEPOINT
entSavepoint = con.setSavepoint("SP_" + QcDevEnterprise);
if ("P".equalsIgnoreCase(execRights)) {
// PILOT: DB_PILOT is a schema name, not an enterprise code,
// so processSqlForEnterprise cannot look it up. Instead, apply
// schema injection and call executeAndLog directly using the
// main enterprise for connection lookup and DB_PILOT as target schema.
String pilotInputSql = oracleStatment;
String upperSqlP = checkNull(pilotInputSql).trim().toUpperCase();
boolean isPlSqlBodyP = upperSqlP.startsWith("CREATE OR REPLACE FUNCTION")
|| upperSqlP.startsWith("CREATE FUNCTION")
|| upperSqlP.startsWith("CREATE OR REPLACE PROCEDURE")
|| upperSqlP.startsWith("CREATE PROCEDURE")
|| upperSqlP.startsWith("CREATE OR REPLACE PACKAGE")
|| upperSqlP.startsWith("CREATE PACKAGE")
|| upperSqlP.startsWith("CREATE OR REPLACE TYPE")
|| upperSqlP.startsWith("CREATE TYPE")
|| upperSqlP.startsWith("CREATE OR REPLACE TRIGGER")
|| upperSqlP.startsWith("CREATE TRIGGER")
|| upperSqlP.contains("NONEDITIONABLE");
if (!isPlSqlBodyP) {
pilotInputSql = injectSchemaPlaceholderSafe(pilotInputSql);
if (QcDevEnterprise.isEmpty()) {
throw new ITMException(
new Exception("DB_PILOT not found for enterprise: " + mainEnterprise));
}
BaseLogger.log("3", null, null, "PILOT execution: using DB_PILOT [" + QcDevEnterprise
+ "] from main enterprise [" + mainEnterprise + "]");
executeAndLog(
QcDevEnterprise, // DB_PILOT schema name (target schema for SQL)
pilotInputSql,
tranId,
mainEnterprise, // main enterprise code (for connection lookup and logging)
linNo,
requestID,
userId,
chgTerm,
dbMainForPilot, // DB_MAIN (for synonym/grant references)
false);
} else {
// D/Q: enterprise code matches ENTERPRISE table directly
processSqlForEnterprise(
con,
QcDevEnterprise,
oracleStatment,
tranId,
linNo,
requestID,
userId,
chgTerm);
}
Savepoint entSavepoint = null;
// commit enterprise success
con.commit();
try {
// ENTERPRISE-LEVEL SAVEPOINT
entSavepoint = con.setSavepoint("SP_" + QcDevEnterprise);
if ("P".equalsIgnoreCase(execRights)) {
// PILOT: DB_PILOT is a schema name, not an enterprise code,
// so processSqlForEnterprise cannot look it up. Instead, apply
// schema injection and call executeAndLog directly using the
// main enterprise for connection lookup and DB_PILOT as target schema.
String pilotInputSql = oracleStatment;
String upperSqlP = checkNull(pilotInputSql).trim().toUpperCase();
boolean isPlSqlBodyP = upperSqlP.startsWith("CREATE OR REPLACE FUNCTION")
|| upperSqlP.startsWith("CREATE FUNCTION")
|| upperSqlP.startsWith("CREATE OR REPLACE PROCEDURE")
|| upperSqlP.startsWith("CREATE PROCEDURE")
|| upperSqlP.startsWith("CREATE OR REPLACE PACKAGE")
|| upperSqlP.startsWith("CREATE PACKAGE")
|| upperSqlP.startsWith("CREATE OR REPLACE TYPE")
|| upperSqlP.startsWith("CREATE TYPE")
|| upperSqlP.startsWith("CREATE OR REPLACE TRIGGER")
|| upperSqlP.startsWith("CREATE TRIGGER")
|| upperSqlP.contains("NONEDITIONABLE");
if (!isPlSqlBodyP) {
pilotInputSql = injectSchemaPlaceholderSafe(pilotInputSql);
}
executeAndLog(
QcDevEnterprise, // DB_PILOT schema name (target schema for SQL)
pilotInputSql,
tranId,
enterpriser, // main enterprise code (for connection lookup and logging)
linNo,
requestID,
userId,
chgTerm,
dbMainForPilot, // DB_MAIN (for synonym/grant references)
"P",
false);
} else if ("C".equalsIgnoreCase(execRights)) {
// CLIENT DEV: DB_DEV is a schema name, not an enterprise code,
// so processSqlForEnterprise cannot look it up. Instead, apply
// schema injection and call executeAndLog directly using the
// main enterprise for connection lookup and DB_DEV as target schema.
String pilotInputSql = oracleStatment;
String upperSqlP = checkNull(pilotInputSql).trim().toUpperCase();
boolean isPlSqlBodyP = upperSqlP.startsWith("CREATE OR REPLACE FUNCTION")
|| upperSqlP.startsWith("CREATE FUNCTION")
|| upperSqlP.startsWith("CREATE OR REPLACE PROCEDURE")
|| upperSqlP.startsWith("CREATE PROCEDURE")
|| upperSqlP.startsWith("CREATE OR REPLACE PACKAGE")
|| upperSqlP.startsWith("CREATE PACKAGE")
|| upperSqlP.startsWith("CREATE OR REPLACE TYPE")
|| upperSqlP.startsWith("CREATE TYPE")
|| upperSqlP.startsWith("CREATE OR REPLACE TRIGGER")
|| upperSqlP.startsWith("CREATE TRIGGER")
|| upperSqlP.contains("NONEDITIONABLE");
if (!isPlSqlBodyP) {
pilotInputSql = injectSchemaPlaceholderSafe(pilotInputSql);
}
executeAndLog(
dbClientDev, // DB_DEV schema name (target schema for SQL)
pilotInputSql,
tranId,
enterpriser, // main enterprise code (for connection lookup and logging)
linNo,
requestID,
userId,
chgTerm,
dbMainForPilot, // DB_MAIN (for synonym/grant references)
"C",
false);
}
} catch (Exception e) {
// commit enterprise success
con.commit();
// rollback ONLY this enterprise
if (entSavepoint != null) {
con.rollback(entSavepoint);
}
} catch (Exception e) {
BaseLogger.log(
"1",
null,
null,
"Enterprise execution failed :: " + QcDevEnterprise + " :: " + e.getMessage());
// rollback ONLY this enterprise
if (entSavepoint != null) {
con.rollback(entSavepoint);
}
BaseLogger.log(
"1",
null,
null,
"Enterprise execution failed :: " + QcDevEnterprise + " :: " + e.getMessage());
// continue next enterprise
// continue next enterprise
}
}
} else {
}
}
if ("A".equalsIgnoreCase(execRights)) {
......@@ -662,7 +728,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
}
BaseLogger.log("1", null, null, "TRAN_ID__REF :: " + tranIdRef);
BaseLogger.log("1", null, null, "execRights :: " + execRights);
BaseLogger.log("1", null, null, "execRights :: " + execRights);
String upSqlRef = "UPDATE SQL_CHANGES SET TXN_STATUS = CASE " +
" WHEN ? = 'Q' THEN 'X' " +
" WHEN ? = 'P' THEN 'Y' " +
......@@ -688,7 +754,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
BaseLogger.log("1", null, null, "Txn Status update count is [" + updCntRef + "]");
if(execRights.trim().equalsIgnoreCase("A")){
if (execRights.trim().equalsIgnoreCase("A")) {
BaseLogger.log("1", null, null, "Transaction confirmed for live");
String updateClosedDetailsSql = "update sql_changes set CLOSED_YN = 'Y',TXN_STATUS = 'C', CLOSED_BY = ?, CLOSED_DATE = SYSDATE where tran_id = ?";
......@@ -696,7 +762,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
updateClosedDetailsPs.setString(1, userId);
updateClosedDetailsPs.setString(2, tranIdRef);
int updateClosedDetailsCount = updateClosedDetailsPs.executeUpdate();
BaseLogger.log("1", null, null, "updateClosedDetailsCount:: [" + updateClosedDetailsCount + "]");
BaseLogger.log("1", null, null, "updateClosedDetailsCount:: [" + updateClosedDetailsCount + "]");
}
......@@ -1128,7 +1194,9 @@ public class ManageSqlConf extends ActionHandlerEJB {
String status = "";
String refTranId = "";
String profileId = "";
UserInfoBean userInfo;
try {
userInfo = getUserInfo();
itmdbAccessLocal = new ITMDBAccessEJB();
GenericUtility genericUtility = GenericUtility.getInstance();
......@@ -1137,27 +1205,13 @@ public class ManageSqlConf extends ActionHandlerEJB {
con = getConnection();
con.setAutoCommit(false);
profileId = checkNull(userInfo.getProfileId());
//Feting profileId of logged in user
String getProfileId = "select profile_id from users where code = ?";
PreparedStatement getProfileIdPs = con.prepareStatement(getProfileId);
getProfileIdPs.setString(1, userId);
ResultSet getProfileIdRs = getProfileIdPs.executeQuery();
while(getProfileIdRs.next()){
profileId = checkNull(getProfileIdRs.getString("profile_id"));
}
BaseLogger.log("3", getUserInfo(), null, "ManageSqlClose --> profileId [" + profileId + "]");
if (getProfileIdRs != null) getProfileIdRs.close();
if (getProfileIdPs != null) getProfileIdPs.close();
//Added condition if profileId is not MSADMIN return a validation
if(!profileId.trim().equalsIgnoreCase("MSADMIN")){
BaseLogger.log("3", getUserInfo(), null, "Only Admin can close this transaction.");
return itmdbAccessLocal.getErrorString("", "MSQLCNA", "", "", con);
}
// Added condition if profileId is not MSADMIN return a validation
if (!profileId.trim().equalsIgnoreCase("MSADMIN")) {
BaseLogger.log("3", getUserInfo(), null, "Only Admin can close this transaction.");
return itmdbAccessLocal.getErrorString("", "MSQLCNA", "", "", con);
}
String sql = "SELECT STATUS, REF_TRAN_ID FROM SQL_EXEC_LOG WHERE TRAN_ID=?";
pstmt = con.prepareStatement(sql);
......@@ -1181,7 +1235,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
System.out.println("errString is " + errString);
} else if ("X".equalsIgnoreCase(status)) {
errString = itmdbAccessLocal.getErrorString("confirmed", "VTMCANL1", "", "", con);
System.out.println("errString is " + errString);
System.out.println("errString is:: " + errString);
} else {
String upSql = "UPDATE SQL_EXEC_LOG SET STATUS='X' WHERE TRAN_ID=?";
pstmt = con.prepareStatement(upSql);
......@@ -1193,27 +1247,28 @@ public class ManageSqlConf extends ActionHandlerEJB {
pstmt = null;
}
String tranIdRef = "";
String getTranIdRef = "select tran_id__ref from sql_changes where tran_id = ?";
PreparedStatement getTranIdRefPs = con.prepareStatement(getTranIdRef);
getTranIdRefPs.setString(1, refTranId);
ResultSet getTranIdRefRs = getTranIdRefPs.executeQuery();
while(getTranIdRefRs.next()) {
tranIdRef = checkNull(getTranIdRefRs.getString("tran_id__ref"));
}
if (getTranIdRefPs != null) getTranIdRefPs.close();
if (getTranIdRefRs != null) getTranIdRefRs.close();
BaseLogger.log("3", getUserInfo(), null, "ManageSqlClose --> tranIdRef [" + tranIdRef + "]");
String tranIdRef = "";
String getTranIdRef = "select tran_id__ref from sql_changes where tran_id = ?";
PreparedStatement getTranIdRefPs = con.prepareStatement(getTranIdRef);
getTranIdRefPs.setString(1, refTranId);
ResultSet getTranIdRefRs = getTranIdRefPs.executeQuery();
while (getTranIdRefRs.next()) {
tranIdRef = checkNull(getTranIdRefRs.getString("tran_id__ref"));
}
if (getTranIdRefPs != null)
getTranIdRefPs.close();
if (getTranIdRefRs != null)
getTranIdRefRs.close();
BaseLogger.log("3", getUserInfo(), null, "ManageSqlClose --> tranIdRef [" + tranIdRef + "]");
String updateClosedDetailsSql = "update sql_changes set CLOSED_YN = 'Y',TXN_STATUS = 'C', CLOSED_BY = ?, CLOSED_DATE = SYSDATE where tran_id = ?";
String updateClosedDetailsSql = "update sql_changes set CLOSED_YN = 'Y',TXN_STATUS = 'C', CLOSED_BY = ?, CLOSED_DATE = SYSDATE where tran_id = ?";
PreparedStatement updateClosedDetailsPs = con.prepareStatement(updateClosedDetailsSql);
updateClosedDetailsPs.setString(1, userId);
updateClosedDetailsPs.setString(2, tranIdRef);
int updateClosedDetailsCount = updateClosedDetailsPs.executeUpdate();
BaseLogger.log("1", null, null, "updateClosedDetailsCount:: [" + updateClosedDetailsCount + "]");
if (updateClosedDetailsPs != null) updateClosedDetailsPs.close();
BaseLogger.log("1", null, null, "updateClosedDetailsCount:: [" + updateClosedDetailsCount + "]");
if (updateClosedDetailsPs != null)
updateClosedDetailsPs.close();
System.out.println("update count is[" + updCnt + "]");
if (updCnt > 0) {
......@@ -1612,7 +1667,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
String query = "SELECT DB_DEV, DB_MAIN, DB_READ, DB_PILOT " +
"FROM enterprise WHERE enterprise = ?";
String dbDev, dbMain, dbRead, dbPilot;
String dbMain, dbRead;
try (PreparedStatement ps = conn.prepareStatement(query)) {
ps.setString(1, enterpriseCode);
......@@ -1620,10 +1675,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
if (!rs.next()) {
throw new Exception("No enterprise found for: " + enterpriseCode);
}
dbDev = rs.getString("DB_DEV");
dbMain = rs.getString("DB_MAIN");
dbRead = rs.getString("DB_READ");
dbPilot = rs.getString("DB_PILOT");
}
}
......@@ -1649,9 +1702,9 @@ public class ManageSqlConf extends ActionHandlerEJB {
*/
Map<String, String> schemaRules = new LinkedHashMap<>();
schemaRules.put(dbMain, "ALL");
schemaRules.put(dbDev, "ALL");
//schemaRules.put(dbDev, "ALL");
schemaRules.put(dbRead, "SYN");
schemaRules.put(dbPilot, "SYN");
//schemaRules.put(dbPilot, "SYN");
String createObjectType = getCreateObjectType(inputSql);
boolean isCreateObject = createObjectType != null;
......@@ -1692,6 +1745,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
userId,
chgTerm,
dbMain,
"",
true);
} else if ("SYN".equals(rule)) {
......@@ -1722,6 +1776,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
userId,
chgTerm,
dbMain,
"",
false);
/*
......@@ -1758,6 +1813,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
userId,
chgTerm,
dbMain,
"",
false);
}
}
......@@ -1786,6 +1842,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
userId,
chgTerm,
dbMain,
"",
false);
}
......@@ -1810,6 +1867,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
String userId,
String chgTerm,
String dbMainSchema,
String execRights,
boolean rethrow) throws Exception {
Connection conn = null;
Connection connForQueryExec = null;
......@@ -1859,6 +1917,11 @@ public class ManageSqlConf extends ActionHandlerEJB {
while (connForExecRs.next()) {
connForExec = connForExecRs.getString("schema_name");
}
if(execRights.trim().equalsIgnoreCase("P") || execRights.trim().equalsIgnoreCase("C")){
connForExec = schemaName;
}
System.out.println("connForExec:: " + connForExec);
// Connect to the specific schema
......@@ -1932,7 +1995,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
psEnt.close();
} catch (Exception e) {
}
}
}
// --- END SYNONYM LOGIC ---
......
......@@ -129,18 +129,54 @@ public class ManageSqlReleaseFromQC extends ActionHandlerEJB {
String qcConfirmed = "";
String tranIdReference = "";
String getAprvLvlSql = "select confirmed,tran_id__ref from sql_changes where tran_id = ? and exec_rights = 'Q'";
String getAprvLvlSql = "select confirmed from sql_changes where tran_id = ? and exec_rights = 'Q'";
PreparedStatement getAprvLvlPs = conn.prepareStatement(getAprvLvlSql);
getAprvLvlPs.setString(1, tranID);
ResultSet getAprvLvlRs = getAprvLvlPs.executeQuery();
while (getAprvLvlRs.next()) {
qcConfirmed = checkNull(getAprvLvlRs.getString("confirmed"));
tranIdReference = checkNull(getAprvLvlRs.getString("tran_id__ref"));
}
String getTranIdRef = "select tran_id__ref, exec_rights from sql_changes where tran_id = ?";
PreparedStatement getTranIdRefPs = conn.prepareStatement(getTranIdRef);
getTranIdRefPs.setString(1, tranID);
ResultSet getTranIdRefPsRs = getTranIdRefPs.executeQuery();
while (getTranIdRefPsRs.next()) {
tranIdReference = checkNull(getTranIdRefPsRs.getString("tran_id__ref"));
execRights = checkNull(getTranIdRefPsRs.getString("exec_rights"));
}
BaseLogger.log("3", null, null, "tranID::: " + tranID);
String tranIdRedForAll = "";
int countOfAllTran = 0;
String checkTranIdRefSqlForAll = "select exec_rights from sql_changes where tran_id = ?";
PreparedStatement checkTranIdRefForAllPs = conn.prepareStatement(checkTranIdRefSqlForAll);
checkTranIdRefForAllPs.setString(1, tranID);
ResultSet checkTranIdRefForAllRs = checkTranIdRefForAllPs.executeQuery();
while (checkTranIdRefForAllRs.next()) {
executionRights = checkNull(checkTranIdRefForAllRs.getString("exec_rights"));
}
BaseLogger.log("3", null, null, " :: executionRights:: " + executionRights);
if (checkTranIdRefForAllPs != null) {
checkTranIdRefForAllPs.close();
}
if (checkTranIdRefForAllRs != null) {
checkTranIdRefForAllRs.close();
}
if (!executionRights.trim().equalsIgnoreCase("Q")) {
return itmDBAccessEJB.getErrorString("", "MSQLARRS", "", "", conn);
}
tranID = tranIdReference;
if (!qcConfirmed.trim().equalsIgnoreCase("Y")) {
if (!qcConfirmed.trim().equalsIgnoreCase("Y")) {
return itmDBAccessEJB.getErrorString("", "QCNOTC", "", "", conn);
}
String msqlDetSql = "SELECT TRAN_ID, TRAN_DATE, REQ_ID, REQ_DATE, CUST_CODE, EMP_CODE__GIVEN, EMP_CODE__MERGE, "
......
......@@ -325,3 +325,7 @@ update system_service_args set ARG_VALUE = 'ibase.webitm.ejb.sys.ManageSqlConf'
update system_service_args set ARG_VALUE = 'ibase.webitm.ejb.sys.ManageSqlConf' where service_code in ('pre_cancel_exec_log','prcm_sql_exec_log','prcm_headerdetail') and line_no = 2;
update system_events set COMP_NAME = 'ibase.webitm.ejb.sys.ManageSqlConf' where service_code in ('pre_cancel_exec_log','prcm_sql_exec_log');
Insert into MESSAGES (MSG_NO,MSG_STR,MSG_DESCR,MSG_TYPE,MSG_OPT,MSG_TIME,ALARM,ERR_SOURCE,CHG_DATE,CHG_USER,CHG_TERM,OVERRIDE_INPUT,MAIL_OPTION) values
('MSQLARRS','Transaction already released on the respective server.','The transaction has already been released on the respective server.','E','Y',null,null,null,to_date('25-DEC-13','DD-MON-RR'),'BASE ','BASE',null,null);
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