dahomee_69

GOSIBatchSQL

Dec 21st, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.64 KB | None | 0 0
  1. package gosi.common.batch.util;
  2.  
  3. import java.util.HashMap;
  4.  
  5. /**
  6.  * @CLASS NAME               : BatchAuditBean
  7.  * @TYPE                     :
  8.  * @AUTHOR                  :
  9.  * @VERSION                 : 1
  10.  * @EXTENDS                 : Nil
  11.  * @INFORMATION             : This bean is used to store batch audit details
  12.  * @IMPLEMENTS              :
  13.  * @LAST MODIFIED BY        :
  14.  * @LAST MODIFIED DATE      :
  15.  **/
  16.  
  17. public class GOSIBatchSQL
  18. {
  19.     private static String appModuleName;
  20.     private static String appBatchIdentifier;
  21.  
  22.     public GOSIBatchSQL(String batchId)
  23.     {
  24.         appModuleName=batchId.substring(0,3);
  25.         appBatchIdentifier=batchId.substring(4,7);
  26.         commonSQL=GOSIBatchUtilities.
  27.         populateSQL(GOSIBatchConstants.COMMON, null);
  28.         interfaceSQL=GOSIBatchUtilities.
  29.         populateSQL(GOSIBatchConstants.INTERFACE, null);
  30.         moduleSQL=GOSIBatchUtilities.
  31.         populateSQL(appModuleName, appBatchIdentifier);
  32.     }
  33.     public static String sqlFileName         = null;
  34.     public static HashMap commonSQL=null;
  35.     public static HashMap moduleSQL=null;
  36.     public static HashMap interfaceSQL=null;
  37.  
  38. /**
  39.  * @METHOD NAME              : getSqlString
  40.  * @INFORMATION              : This method is to populate all SQL Strings
  41.  *                             in HashMap module-wise.
  42.  * @PARAM                    : sqlCode
  43.  * @RETURN                   : class java.lang.String
  44.  * @EXCEPTION                : class gosi.common.batch.util.GOSIBatchException
  45.  * @LAST MODIFIED BY         :
  46.  * @LAST MODIFIED DATE       :
  47. **/
  48.  
  49.     public static String getSqlString(String sqlCode)
  50.     throws GOSIBatchException
  51.     {
  52.         String sqlString = "";
  53.         String moduleName = "";
  54.         if(sqlCode != null)
  55.         {
  56.             moduleName = sqlCode.substring(0,3);
  57.         }
  58.  
  59.         try
  60.         {
  61.             if((GOSIBatchConstants.COMMON).equals(moduleName))
  62.             {
  63.              sqlString = (String)GOSIBatchSQL.commonSQL.get(sqlCode);
  64.             }
  65.             else if((GOSIBatchConstants.INTERFACE).equals(moduleName))
  66.             {
  67.                 sqlString = (String)GOSIBatchSQL.interfaceSQL.get(sqlCode);
  68.             }
  69.             else
  70.             {
  71.                 sqlString = (String)GOSIBatchSQL.moduleSQL.get(sqlCode);
  72.             }
  73.         }// end of try
  74.         catch(Exception e)
  75.         {
  76.             e.printStackTrace();
  77.              new GOSIBatchException(e,
  78.                     "BatchCore",
  79.                     "GOSIBatchSQL",
  80.                     "getSqlString",
  81.                     "CMN_001_ERR_1000",
  82.                     GOSIBatchConstants.SEVERITY_ONE);
  83.         }// end of catch
  84.  
  85.         return sqlString;
  86.     }// end of method getsqlString
  87.  
  88. }
Add Comment
Please, Sign In to add comment