This code defines a method `getEMSOutMsgs` which retrieves EMS (Enterprise...

December 30, 2024 at 07:21 AM

public List getEMSOutMsgs(String jndiName, HashMap params, String jobName, String p_logReq) throws FCSchedulerException, Exception { flushResources(); DataSource ds = null; Connection conn = null; StringBuffer l_msg_str = null; String paramNode = ""; String paramMcs = ""; String branchCode = ""; Object moduleGroupID = null; int updCnt = 0; ResultSet rs = null; ResultSet rs1 = null; String DCN = ""; String allDCN = ""; String dlyMsgOutColumQry = null; String emsOutQuery = null; String emsOutQueryLck = null; String sModuleGroup = null; FCEMSUtil fcemsUtil = new FCEMSUtil(); if (jobName.indexOf("EMS_OUT_PM") != -1) { emsOutQuery = "SELECT distinct DCN,mm.media_priority MEDIA_PRIORITY,DLY_MSG_OUT.priority MSG_PRIORITY FROM PMTB_MSG_DLY_MSG_OUT DLY_MSG_OUT, MSTM_MEDIA mm WHERE DLY_MSG_OUT.MSG_STATUS = 'G' AND DLY_MSG_OUT.TESTING_STATUS <> 'I' AND DLY_MSG_OUT.TESTING_STATUS <> 'R' AND DLY_MSG_OUT.AUTH_STAT = 'A' AND NVL(DLY_MSG_OUT.COPY,'N') <> 'Y' AND DLY_MSG_OUT.message is not null AND NVL(DLY_MSG_OUT.SUPPRESS_FLAG,'N') = 'N' AND NVL(DLY_MSG_OUT.PDE_FLAG,'N') IN ('N','R') AND mm.MEDIA=DLY_MSG_OUT.MEDIA AND To_Date(to_char(NVL(RELEASE_DATE,fn_getDatesForPMEMS(DLY_MSG_OUT.HOST_CODE,DLY_MSG_OUT.BRANCH)), 'DD-MON-YYYY hh24:mi'),'DD-MON-YYYY hh24:mi') <= To_Date(to_char(fn_getDatesForPMEMS(DLY_MSG_OUT.HOST_CODE,DLY_MSG_OUT.BRANCH), 'DD-MON-YYYY hh24:mi'),'DD-MON-YYYY hh24:mi')AND NVL(DLY_MSG_OUT.INTER_BRANCH,'N') = 'N'"; emsOutQueryLck = "SELECT * FROM PMTB_MSG_DLY_MSG_OUT WHERE MSG_STATUS = 'G' AND TESTING_STATUS <> 'I' AND TESTING_STATUS <> 'R' AND AUTH_STAT = 'A' AND NVL(COPY,'N') <> 'Y' AND message is not null AND NVL(SUPPRESS_FLAG,'N') = 'N' AND NVL(PDE_FLAG,'N') IN ('N','R') AND DCN = ? AND ARCHIVAL_DATE = ? "; dlyMsgOutColumQry = "select column_name from user_tab_columns where table_name='PMTB_MSG_DLY_MSG_OUT'"; sModuleGroup = "FCPMTS"; } else if (jobName.indexOf("EMS_OUT_CL") != -1) { emsOutQuery = "SELECT distinct DCN,mm.media_priority MEDIA_PRIORITY,DLY_MSG_OUT.priority MSG_PRIORITY FROM OLTB_DLY_MSG_OUT DLY_MSG_OUT, MSTM_MEDIA mm WHERE DLY_MSG_OUT.MSG_STATUS = 'G' AND DLY_MSG_OUT.TESTING_STATUS <> 'I' AND DLY_MSG_OUT.TESTING_STATUS <> 'R' AND DLY_MSG_OUT.AUTH_STAT = 'A' AND NVL(DLY_MSG_OUT.COPY,'N') <> 'Y' AND DLY_MSG_OUT.message is not null AND NVL(DLY_MSG_OUT.SUPPRESS_FLAG,'N') = 'N' AND NVL(DLY_MSG_OUT.PDE_FLAG,'N') IN ('N','R') AND mm.MEDIA=DLY_MSG_OUT.MEDIA "; emsOutQueryLck = "SELECT * FROM OLTB_DLY_MSG_OUT WHERE MSG_STATUS = 'G' AND TESTING_STATUS <> 'I' AND TESTING_STATUS <> 'R' AND AUTH_STAT = 'A' AND NVL(COPY,'N') <> 'Y' AND message is not null AND NVL(SUPPRESS_FLAG,'N') = 'N' AND NVL(PDE_FLAG,'N') IN ('N','R') AND DCN = ? "; dlyMsgOutColumQry = "select column_name from user_tab_columns where table_name='OLTB_DLY_MSG_OUT'"; sModuleGroup = "FCCPLN"; } else if (jobName.indexOf("EMS_OUT_TR") != -1) { emsOutQuery = "SELECT distinct DCN,mm.media_priority MEDIA_PRIORITY,DLY_MSG_OUT.priority MSG_PRIORITY FROM MSTB_TR_DLY_MSG_OUT DLY_MSG_OUT, MSTM_MEDIA mm WHERE DLY_MSG_OUT.MSG_STATUS = 'G' AND DLY_MSG_OUT.TESTING_STATUS <> 'I' AND DLY_MSG_OUT.TESTING_STATUS <> 'R' AND DLY_MSG_OUT.AUTH_STAT = 'A' AND NVL(DLY_MSG_OUT.COPY,'N') <> 'Y' AND DLY_MSG_OUT.message is not null AND NVL(DLY_MSG_OUT.SUPPRESS_FLAG,'N') = 'N' AND NVL(DLY_MSG_OUT.PDE_FLAG,'N') IN ('N','R') AND mm.MEDIA=DLY_MSG_OUT.MEDIA AND NVL(DLY_MSG_OUT.HOLD_STATUS,'N') <> 'Y'"; emsOutQueryLck = "SELECT * FROM MSTB_TR_DLY_MSG_OUT WHERE MSG_STATUS = 'G' AND TESTING_STATUS <> 'I' AND TESTING_STATUS <> 'R' AND AUTH_STAT = 'A' AND NVL(COPY,'N') <> 'Y' AND message is not null AND NVL(SUPPRESS_FLAG,'N') = 'N' AND NVL(PDE_FLAG,'N') IN ('N','R') AND NVL(HOLD_STATUS,'N') <> 'Y' AND DCN = ? "; dlyMsgOutColumQry = "select column_name from user_tab_columns where table_name='MSTB_TR_DLY_MSG_OUT'"; sModuleGroup = "OBTR"; } else if (jobName.indexOf("EMS_OUT_TF") != -1) { emsOutQuery = "SELECT distinct DCN,mm.media_priority MEDIA_PRIORITY,DLY_MSG_OUT.priority MSG_PRIORITY FROM MSTB_TF_DLY_MSG_OUT DLY_MSG_OUT, MSTM_MEDIA mm WHERE DLY_MSG_OUT.MSG_STATUS = 'G' AND DLY_MSG_OUT.TESTING_STATUS <> 'I' AND DLY_MSG_OUT.TESTING_STATUS <> 'R' AND DLY_MSG_OUT.AUTH_STAT = 'A' AND NVL(DLY_MSG_OUT.COPY,'N') <> 'Y' AND DLY_MSG_OUT.message is not null AND NVL(DLY_MSG_OUT.SUPPRESS_FLAG,'N') = 'N' AND NVL(DLY_MSG_OUT.PDE_FLAG,'N') IN ('N','R') AND mm.MEDIA=DLY_MSG_OUT.MEDIA AND NVL(DLY_MSG_OUT.HOLD_STATUS,'N') <> 'Y'"; emsOutQueryLck = "SELECT * FROM MSTB_TF_DLY_MSG_OUT WHERE MSG_STATUS = 'G' AND TESTING_STATUS <> 'I' AND TESTING_STATUS <> 'R' AND AUTH_STAT = 'A' AND NVL(COPY,'N') <> 'Y' AND message is not null AND NVL(SUPPRESS_FLAG,'N') = 'N' AND NVL(PDE_FLAG,'N') IN ('N','R') AND NVL(HOLD_STATUS,'N') <> 'Y' AND DCN = ? "; dlyMsgOutColumQry = "select column_name from user_tab_columns where table_name='MSTB_TF_DLY_MSG_OUT'"; sModuleGroup = "OBTF"; } else { emsOutQuery = "SELECT distinct DCN,mm.media_priority MEDIA_PRIORITY,DLY_MSG_OUT.priority MSG_PRIORITY FROM MSTB_DLY_MSG_OUT DLY_MSG_OUT, MSTM_MEDIA mm WHERE DLY_MSG_OUT.MSG_STATUS = 'G' AND DLY_MSG_OUT.TESTING_STATUS <> 'I' AND DLY_MSG_OUT.TESTING_STATUS <> 'R' AND DLY_MSG_OUT.AUTH_STAT = 'A' AND NVL(DLY_MSG_OUT.COPY,'N') <> 'Y' AND DLY_MSG_OUT.message is not null AND NVL(DLY_MSG_OUT.SUPPRESS_FLAG,'N') = 'N' AND NVL(DLY_MSG_OUT.PDE_FLAG,'N') IN ('N','R') AND mm.MEDIA=DLY_MSG_OUT.MEDIA AND NVL(DLY_MSG_OUT.HOLD_STATUS,'N') <> 'Y'"; emsOutQueryLck = "SELECT * FROM MSTB_DLY_MSG_OUT WHERE MSG_STATUS = 'G' AND TESTING_STATUS <> 'I' AND TESTING_STATUS <> 'R' AND AUTH_STAT = 'A' AND NVL(COPY,'N') <> 'Y' AND message is not null AND NVL(SUPPRESS_FLAG,'N') = 'N' AND NVL(PDE_FLAG,'N') IN ('N','R') AND NVL(HOLD_STATUS,'N') <> 'Y' AND DCN = ? "; dlyMsgOutColumQry = "select column_name from user_tab_columns where table_name='MSTB_DLY_MSG_OUT'"; sModuleGroup = "FCROFC"; }

This code defines a method getEMSOutMsgs which retrieves EMS (Enterprise Messaging System) outgoing messages from various database tables based on specific filtering criteria and configurations. Here's what it does:

1. Parameters:

  • jndiName: Likely a JNDI (Java Naming and Directory Interface) name used to get the DataSource for database access.
  • params: A HashMap containing additional parameters that might affect query filters or configurations.
  • jobName: Specifies the type of job to determine which database table and query to use.
  • p_logReq: Logging-related information (purpose not explicitly clear from this snippet).
  • Throws: Exceptions like FCSchedulerException and generic Exception.

2. Initialization:

  • Variables such as ds (datasource), conn (database connection), emsOutQuery, and emsOutQueryLck are initialized. These will be used for database operations.

3. Job-Specific Behavior:

The method differentiates the query logic based on the passed jobName:

  • If jobName contains specific identifiers (e.g., EMS_OUT_PM, EMS_OUT_CL, etc.), different hardcoded SQL SELECT queries are assigned to emsOutQuery, emsOutQueryLck, and dlyMsgOutColumQry.
  • SQL queries aim to retrieve messages based on certain criteria, such as:
    • Message status (MSG_STATUS = 'G').
    • Testing and authorization status.
    • Copy and suppression flags.
    • Time constraints (RELEASE_DATE and ARCHIVAL_DATE).
    • Media type and priority from the MSTM_MEDIA table.
    • Module groups (FCPMTS, FCCPLN, etc.).

4. Queries in Detail:

Primary Query (emsOutQuery):

  • Selects distinct DCN, media priority, and message priority from tables like:
    • PMTB_MSG_DLY_MSG_OUT, OLTB_DLY_MSG_OUT, MSTB_TR_DLY_MSG_OUT, MSTB_TF_DLY_MSG_OUT, or MSTB_DLY_MSG_OUT.
  • Filters data based on conditions (NON-NULL, flags, and various statuses).

Locking Query (emsOutQueryLck):

  • A separate query to retrieve specific message details for further processing by locking records with placeholders (DCN and ARCHIVAL_DATE).

Column Metadata Query (dlyMsgOutColumQry):

  • Fetches column names from the table being queried, useful for dynamic processing of query results.

5. Module Groups (sModuleGroup):

  • Determines the high-level module group to which the outgoing messages belong based on the jobName.

6. Unknown Behavior:

  • The behavior of database interaction (flushResources or usage of FCEMSUtil) and the remaining implementation within the method are not visible in the code snippet provided.

Purpose:

This method is part of an application handling outgoing message data (based on EMS) by dynamically querying database tables, applying filters based on job metadata (jobName), and preparing data for processing or transmission.

Generate your own explanations
Download our vscode extension
Read other generated explanations

Built by @thebuilderjr
Sponsored by beam analytics
Read our terms and privacy policy
Forked from openai-quickstart-node