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; ...@@ -16,6 +16,7 @@ import ibase.webitm.utility.ITMException;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
...@@ -27,6 +28,7 @@ import java.util.regex.Pattern; ...@@ -27,6 +28,7 @@ import java.util.regex.Pattern;
import ibase.webitm.utility.TransIDGenerator; import ibase.webitm.utility.TransIDGenerator;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import ibase.utility.UserInfoBean;
public class ManageSqlConf extends ActionHandlerEJB { public class ManageSqlConf extends ActionHandlerEJB {
int reUpdateCnt = 0; int reUpdateCnt = 0;
...@@ -83,7 +85,6 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -83,7 +85,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
selectedEnterprise = checkNull(rs.getString("enterprises")); selectedEnterprise = checkNull(rs.getString("enterprises"));
confirmed = checkNull(rs.getString("confirmed")); confirmed = checkNull(rs.getString("confirmed"));
} }
if (rs != null) { if (rs != null) {
rs.close(); rs.close();
...@@ -94,8 +95,8 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -94,8 +95,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
pstmt = null; pstmt = null;
} }
if(confirmed.trim().equalsIgnoreCase("Y")){ if (confirmed.trim().equalsIgnoreCase("Y")) {
BaseLogger.log("3", null, null, "Transaction is already confirmed Tran ID:: "+tranId); BaseLogger.log("3", null, null, "Transaction is already confirmed Tran ID:: " + tranId);
errString = itmdbAccessLocal.getErrorString("confirmed", "VTCICONF1", "", "", con); errString = itmdbAccessLocal.getErrorString("confirmed", "VTCICONF1", "", "", con);
return errString; return errString;
} }
...@@ -225,7 +226,6 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -225,7 +226,6 @@ public class ManageSqlConf extends ActionHandlerEJB {
String confirmedFlag = checkNull(rs.getString("CONFIRMED")); String confirmedFlag = checkNull(rs.getString("CONFIRMED"));
String depTranId = checkNull(rs.getString("TRAN_ID")); String depTranId = checkNull(rs.getString("TRAN_ID"));
// If any dependent (D or Q) is not confirmed → block confirmation // If any dependent (D or Q) is not confirmed → block confirmation
if (!"Y".equalsIgnoreCase(confirmedFlag)) { if (!"Y".equalsIgnoreCase(confirmedFlag)) {
unconfirmedFound = true; unconfirmedFound = true;
...@@ -242,19 +242,23 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -242,19 +242,23 @@ public class ManageSqlConf extends ActionHandlerEJB {
pstmt = null; 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 execAprv = "";
String execAprvSql = "SELECT EXEC_APRV FROM SQL_CHANGES " + String wfStatus = "";
String execAprvSql = "SELECT EXEC_APRV, WF_STATUS FROM SQL_CHANGES " +
"WHERE TRAN_ID = ?"; "WHERE TRAN_ID = ?";
pstmt = con.prepareStatement(execAprvSql); pstmt = con.prepareStatement(execAprvSql);
pstmt.setString(1, tranIdRef); pstmt.setString(1, tranIdRef);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
while(rs.next()){ while (rs.next()) {
execAprv = checkNull(rs.getString("EXEC_APRV")); execAprv = checkNull(rs.getString("EXEC_APRV"));
wfStatus = checkNull(rs.getString("WF_STATUS"));
} }
System.out.println("execAprv: " + execAprv); System.out.println("execAprv: " + execAprv);
System.out.println("wfStatus: " + wfStatus);
if (rs != null) { if (rs != null) {
rs.close(); rs.close();
...@@ -265,17 +269,20 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -265,17 +269,20 @@ public class ManageSqlConf extends ActionHandlerEJB {
pstmt = null; 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 // 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 // Added the condition if executive approval value is "Y" then only check the
if(execAprv.trim().equalsIgnoreCase("Y")){ // workflow weather approved or not 21-APRIL
if (!recordFound) { if (execAprv.trim().equalsIgnoreCase("Y")) {
if (!wfStatus.trim().equalsIgnoreCase("A")) {
System.out.println("Cannot confirm. Workflow not approved for tran_id: " + tranId); System.out.println("Cannot confirm. Workflow not approved for tran_id: " + tranId);
errString = itmdbAccessLocal.getErrorString("confirmed", "WRKFNA", "", "", con); errString = itmdbAccessLocal.getErrorString("confirmed", "WRKFNA", "", "", con);
return errString; return errString;
} }
} }
// Dependent D or Q exists but NOT confirmed → return error // Dependent D or Q exists but NOT confirmed → return error
...@@ -430,7 +437,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -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)) { || "P".equalsIgnoreCase(execRights)) {
BaseLogger.log( BaseLogger.log(
"3", "3",
...@@ -441,14 +448,32 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -441,14 +448,32 @@ public class ManageSqlConf extends ActionHandlerEJB {
String QcDevEnterprise = ""; String QcDevEnterprise = "";
String mainEnterprise = ""; String mainEnterprise = "";
String dbMainForPilot = ""; String dbMainForPilot = "";
String dbClientDev = "";
BaseLogger.log("3", null, null, "execRights [" + execRights + "]");
if ("Q".equalsIgnoreCase(execRights)) { if ("Q".equalsIgnoreCase(execRights)) {
QcDevEnterprise = "APPVISQC"; QcDevEnterprise = "APPVISQC";
} else if ("D".equalsIgnoreCase(execRights)) { BaseLogger.log(
QcDevEnterprise = "APPVISDEV"; "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 // For PILOT, look up DB_PILOT from enterprise table using the main
// transaction's enterprise (via TRAN_ID__REF) // 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 // First, get the enterprise from the main (A) transaction
String mainEntSql = "SELECT ENTERPRISES FROM SQL_CHANGES WHERE TRAN_ID = ?"; String mainEntSql = "SELECT ENTERPRISES FROM SQL_CHANGES WHERE TRAN_ID = ?";
try (PreparedStatement mainEntPstmt = con.prepareStatement(mainEntSql)) { try (PreparedStatement mainEntPstmt = con.prepareStatement(mainEntSql)) {
...@@ -459,18 +484,31 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -459,18 +484,31 @@ public class ManageSqlConf extends ActionHandlerEJB {
} }
} }
} }
BaseLogger.log("3", null, null, "mainEnterprise [" + mainEnterprise + "]");// Added
if (mainEnterprise.isEmpty()) { if (mainEnterprise.isEmpty()) {
throw new ITMException(new Exception( throw new ITMException(new Exception(
"Main transaction enterprise not found for TRAN_ID__REF: " + tranIdRef)); "Main transaction enterprise not found for TRAN_ID__REF: " + tranIdRef));
} }
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 // 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 = ?"; String pilotDbLookupSql = "SELECT DB_PILOT, DB_MAIN, DB_DEV FROM ENTERPRISE WHERE ENTERPRISE IN (?)";
try (PreparedStatement pilotLookupPstmt = con.prepareStatement(pilotDbLookupSql)) { try (PreparedStatement pilotLookupPstmt = con.prepareStatement(pilotDbLookupSql)) {
pilotLookupPstmt.setString(1, mainEnterprise);
pilotLookupPstmt.setString(1, enterpriser);
try (ResultSet pilotLookupRs = pilotLookupPstmt.executeQuery()) { try (ResultSet pilotLookupRs = pilotLookupPstmt.executeQuery()) {
if (pilotLookupRs.next()) { while (pilotLookupRs.next()) {
QcDevEnterprise = checkNull(pilotLookupRs.getString("DB_PILOT")); QcDevEnterprise = checkNull(pilotLookupRs.getString("DB_PILOT"));
dbMainForPilot = checkNull(pilotLookupRs.getString("DB_MAIN")); dbMainForPilot = checkNull(pilotLookupRs.getString("DB_MAIN"));
dbClientDev = checkNull(pilotLookupRs.getString("DB_DEV"));
} }
} }
} }
...@@ -480,7 +518,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -480,7 +518,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
} }
BaseLogger.log("3", null, null, "PILOT execution: using DB_PILOT [" + QcDevEnterprise BaseLogger.log("3", null, null, "PILOT execution: using DB_PILOT [" + QcDevEnterprise
+ "] from main enterprise [" + mainEnterprise + "]"); + "] from main enterprise [" + mainEnterprise + "]");
}
Savepoint entSavepoint = null; Savepoint entSavepoint = null;
try { try {
...@@ -513,24 +551,48 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -513,24 +551,48 @@ public class ManageSqlConf extends ActionHandlerEJB {
QcDevEnterprise, // DB_PILOT schema name (target schema for SQL) QcDevEnterprise, // DB_PILOT schema name (target schema for SQL)
pilotInputSql, pilotInputSql,
tranId, tranId,
mainEnterprise, // main enterprise code (for connection lookup and logging) enterpriser, // main enterprise code (for connection lookup and logging)
linNo, linNo,
requestID, requestID,
userId, userId,
chgTerm, chgTerm,
dbMainForPilot, // DB_MAIN (for synonym/grant references) dbMainForPilot, // DB_MAIN (for synonym/grant references)
"P",
false); false);
} else { } else if ("C".equalsIgnoreCase(execRights)) {
// D/Q: enterprise code matches ENTERPRISE table directly // CLIENT DEV: DB_DEV is a schema name, not an enterprise code,
processSqlForEnterprise( // so processSqlForEnterprise cannot look it up. Instead, apply
con, // schema injection and call executeAndLog directly using the
QcDevEnterprise, // main enterprise for connection lookup and DB_DEV as target schema.
oracleStatment, 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, tranId,
enterpriser, // main enterprise code (for connection lookup and logging)
linNo, linNo,
requestID, requestID,
userId, userId,
chgTerm); chgTerm,
dbMainForPilot, // DB_MAIN (for synonym/grant references)
"C",
false);
} }
// commit enterprise success // commit enterprise success
...@@ -552,6 +614,10 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -552,6 +614,10 @@ public class ManageSqlConf extends ActionHandlerEJB {
// continue next enterprise // continue next enterprise
} }
} }
} else {
}
}
if ("A".equalsIgnoreCase(execRights)) { if ("A".equalsIgnoreCase(execRights)) {
BaseLogger.log( BaseLogger.log(
...@@ -688,7 +754,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -688,7 +754,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
BaseLogger.log("1", null, null, "Txn Status update count is [" + updCntRef + "]"); 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"); 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 = ?"; String updateClosedDetailsSql = "update sql_changes set CLOSED_YN = 'Y',TXN_STATUS = 'C', CLOSED_BY = ?, CLOSED_DATE = SYSDATE where tran_id = ?";
...@@ -1128,7 +1194,9 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1128,7 +1194,9 @@ public class ManageSqlConf extends ActionHandlerEJB {
String status = ""; String status = "";
String refTranId = ""; String refTranId = "";
String profileId = ""; String profileId = "";
UserInfoBean userInfo;
try { try {
userInfo = getUserInfo();
itmdbAccessLocal = new ITMDBAccessEJB(); itmdbAccessLocal = new ITMDBAccessEJB();
GenericUtility genericUtility = GenericUtility.getInstance(); GenericUtility genericUtility = GenericUtility.getInstance();
...@@ -1137,28 +1205,14 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1137,28 +1205,14 @@ public class ManageSqlConf extends ActionHandlerEJB {
con = getConnection(); con = getConnection();
con.setAutoCommit(false); con.setAutoCommit(false);
profileId = checkNull(userInfo.getProfileId());
//Feting profileId of logged in user // Added condition if profileId is not MSADMIN return a validation
String getProfileId = "select profile_id from users where code = ?"; if (!profileId.trim().equalsIgnoreCase("MSADMIN")) {
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."); BaseLogger.log("3", getUserInfo(), null, "Only Admin can close this transaction.");
return itmdbAccessLocal.getErrorString("", "MSQLCNA", "", "", con); return itmdbAccessLocal.getErrorString("", "MSQLCNA", "", "", con);
} }
String sql = "SELECT STATUS, REF_TRAN_ID FROM SQL_EXEC_LOG WHERE TRAN_ID=?"; String sql = "SELECT STATUS, REF_TRAN_ID FROM SQL_EXEC_LOG WHERE TRAN_ID=?";
pstmt = con.prepareStatement(sql); pstmt = con.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
...@@ -1181,7 +1235,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1181,7 +1235,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
System.out.println("errString is " + errString); System.out.println("errString is " + errString);
} else if ("X".equalsIgnoreCase(status)) { } else if ("X".equalsIgnoreCase(status)) {
errString = itmdbAccessLocal.getErrorString("confirmed", "VTMCANL1", "", "", con); errString = itmdbAccessLocal.getErrorString("confirmed", "VTMCANL1", "", "", con);
System.out.println("errString is " + errString); System.out.println("errString is:: " + errString);
} else { } else {
String upSql = "UPDATE SQL_EXEC_LOG SET STATUS='X' WHERE TRAN_ID=?"; String upSql = "UPDATE SQL_EXEC_LOG SET STATUS='X' WHERE TRAN_ID=?";
pstmt = con.prepareStatement(upSql); pstmt = con.prepareStatement(upSql);
...@@ -1198,22 +1252,23 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1198,22 +1252,23 @@ public class ManageSqlConf extends ActionHandlerEJB {
PreparedStatement getTranIdRefPs = con.prepareStatement(getTranIdRef); PreparedStatement getTranIdRefPs = con.prepareStatement(getTranIdRef);
getTranIdRefPs.setString(1, refTranId); getTranIdRefPs.setString(1, refTranId);
ResultSet getTranIdRefRs = getTranIdRefPs.executeQuery(); ResultSet getTranIdRefRs = getTranIdRefPs.executeQuery();
while(getTranIdRefRs.next()) { while (getTranIdRefRs.next()) {
tranIdRef = checkNull(getTranIdRefRs.getString("tran_id__ref")); tranIdRef = checkNull(getTranIdRefRs.getString("tran_id__ref"));
} }
if (getTranIdRefPs != null) getTranIdRefPs.close(); if (getTranIdRefPs != null)
if (getTranIdRefRs != null) getTranIdRefRs.close(); getTranIdRefPs.close();
if (getTranIdRefRs != null)
getTranIdRefRs.close();
BaseLogger.log("3", getUserInfo(), null, "ManageSqlClose --> tranIdRef [" + tranIdRef + "]"); 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); PreparedStatement updateClosedDetailsPs = con.prepareStatement(updateClosedDetailsSql);
updateClosedDetailsPs.setString(1, userId); updateClosedDetailsPs.setString(1, userId);
updateClosedDetailsPs.setString(2, tranIdRef); updateClosedDetailsPs.setString(2, tranIdRef);
int updateClosedDetailsCount = updateClosedDetailsPs.executeUpdate(); int updateClosedDetailsCount = updateClosedDetailsPs.executeUpdate();
BaseLogger.log("1", null, null, "updateClosedDetailsCount:: [" + updateClosedDetailsCount + "]"); BaseLogger.log("1", null, null, "updateClosedDetailsCount:: [" + updateClosedDetailsCount + "]");
if (updateClosedDetailsPs != null) updateClosedDetailsPs.close(); if (updateClosedDetailsPs != null)
updateClosedDetailsPs.close();
System.out.println("update count is[" + updCnt + "]"); System.out.println("update count is[" + updCnt + "]");
if (updCnt > 0) { if (updCnt > 0) {
...@@ -1612,7 +1667,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1612,7 +1667,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
String query = "SELECT DB_DEV, DB_MAIN, DB_READ, DB_PILOT " + String query = "SELECT DB_DEV, DB_MAIN, DB_READ, DB_PILOT " +
"FROM enterprise WHERE enterprise = ?"; "FROM enterprise WHERE enterprise = ?";
String dbDev, dbMain, dbRead, dbPilot; String dbMain, dbRead;
try (PreparedStatement ps = conn.prepareStatement(query)) { try (PreparedStatement ps = conn.prepareStatement(query)) {
ps.setString(1, enterpriseCode); ps.setString(1, enterpriseCode);
...@@ -1620,10 +1675,8 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1620,10 +1675,8 @@ public class ManageSqlConf extends ActionHandlerEJB {
if (!rs.next()) { if (!rs.next()) {
throw new Exception("No enterprise found for: " + enterpriseCode); throw new Exception("No enterprise found for: " + enterpriseCode);
} }
dbDev = rs.getString("DB_DEV");
dbMain = rs.getString("DB_MAIN"); dbMain = rs.getString("DB_MAIN");
dbRead = rs.getString("DB_READ"); dbRead = rs.getString("DB_READ");
dbPilot = rs.getString("DB_PILOT");
} }
} }
...@@ -1649,9 +1702,9 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1649,9 +1702,9 @@ public class ManageSqlConf extends ActionHandlerEJB {
*/ */
Map<String, String> schemaRules = new LinkedHashMap<>(); Map<String, String> schemaRules = new LinkedHashMap<>();
schemaRules.put(dbMain, "ALL"); schemaRules.put(dbMain, "ALL");
schemaRules.put(dbDev, "ALL"); //schemaRules.put(dbDev, "ALL");
schemaRules.put(dbRead, "SYN"); schemaRules.put(dbRead, "SYN");
schemaRules.put(dbPilot, "SYN"); //schemaRules.put(dbPilot, "SYN");
String createObjectType = getCreateObjectType(inputSql); String createObjectType = getCreateObjectType(inputSql);
boolean isCreateObject = createObjectType != null; boolean isCreateObject = createObjectType != null;
...@@ -1692,6 +1745,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1692,6 +1745,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
userId, userId,
chgTerm, chgTerm,
dbMain, dbMain,
"",
true); true);
} else if ("SYN".equals(rule)) { } else if ("SYN".equals(rule)) {
...@@ -1722,6 +1776,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1722,6 +1776,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
userId, userId,
chgTerm, chgTerm,
dbMain, dbMain,
"",
false); false);
/* /*
...@@ -1758,6 +1813,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1758,6 +1813,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
userId, userId,
chgTerm, chgTerm,
dbMain, dbMain,
"",
false); false);
} }
} }
...@@ -1786,6 +1842,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1786,6 +1842,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
userId, userId,
chgTerm, chgTerm,
dbMain, dbMain,
"",
false); false);
} }
...@@ -1810,6 +1867,7 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1810,6 +1867,7 @@ public class ManageSqlConf extends ActionHandlerEJB {
String userId, String userId,
String chgTerm, String chgTerm,
String dbMainSchema, String dbMainSchema,
String execRights,
boolean rethrow) throws Exception { boolean rethrow) throws Exception {
Connection conn = null; Connection conn = null;
Connection connForQueryExec = null; Connection connForQueryExec = null;
...@@ -1859,6 +1917,11 @@ public class ManageSqlConf extends ActionHandlerEJB { ...@@ -1859,6 +1917,11 @@ public class ManageSqlConf extends ActionHandlerEJB {
while (connForExecRs.next()) { while (connForExecRs.next()) {
connForExec = connForExecRs.getString("schema_name"); connForExec = connForExecRs.getString("schema_name");
} }
if(execRights.trim().equalsIgnoreCase("P") || execRights.trim().equalsIgnoreCase("C")){
connForExec = schemaName;
}
System.out.println("connForExec:: " + connForExec); System.out.println("connForExec:: " + connForExec);
// Connect to the specific schema // Connect to the specific schema
......
...@@ -129,18 +129,54 @@ public class ManageSqlReleaseFromQC extends ActionHandlerEJB { ...@@ -129,18 +129,54 @@ public class ManageSqlReleaseFromQC extends ActionHandlerEJB {
String qcConfirmed = ""; String qcConfirmed = "";
String tranIdReference = ""; 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); PreparedStatement getAprvLvlPs = conn.prepareStatement(getAprvLvlSql);
getAprvLvlPs.setString(1, tranID); getAprvLvlPs.setString(1, tranID);
ResultSet getAprvLvlRs = getAprvLvlPs.executeQuery(); ResultSet getAprvLvlRs = getAprvLvlPs.executeQuery();
while (getAprvLvlRs.next()) { while (getAprvLvlRs.next()) {
qcConfirmed = checkNull(getAprvLvlRs.getString("confirmed")); 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; tranID = tranIdReference;
if (!qcConfirmed.trim().equalsIgnoreCase("Y")) { if (!qcConfirmed.trim().equalsIgnoreCase("Y")) {
return itmDBAccessEJB.getErrorString("", "QCNOTC", "", "", conn); return itmDBAccessEJB.getErrorString("", "QCNOTC", "", "", conn);
} }
String msqlDetSql = "SELECT TRAN_ID, TRAN_DATE, REQ_ID, REQ_DATE, CUST_CODE, EMP_CODE__GIVEN, EMP_CODE__MERGE, " 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' ...@@ -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_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'); 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