-
- Connection con = null;
- Statement st = null;
- ResultSet rs = null;
-
- /*
- * Retrieve the property values for db access from the xacml.pap.properties
- */
- papDbDriver = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_DRIVER);
- papDbUrl = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_URL);
- papDbUser = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_USER);
- papDbPassword = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_PASSWORD);
-
- String ruleTemplate=null;
-
- try {
- //Get DB Connection
- Class.forName(papDbDriver);
- con = DriverManager.getConnection(papDbUrl,papDbUser,papDbPassword);
- st = con.createStatement();
-
- String queryString="select rule from BRMSParamTemplate where param_template_name=\"";
- queryString=queryString+templateName+"\"";
-
- rs = st.executeQuery(queryString);
- if(rs.next()){
- ruleTemplate=rs.getString("rule");
- }
- rs.close();
- }catch (ClassNotFoundException e) {
- PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "CreateBrmsParamPolicy", "Exception querying BRMSParamTemplate");
- } catch (SQLException e) {
- PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "CreateBrmsParamPolicy", "Exception querying BRMSParamTemplate");
- } finally {
- try{
- if (con!=null) con.close();
- if (rs!=null) rs.close();
- if (st!=null) st.close();
- } catch (Exception ex){
- PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, ex, "CreateBrmsParamPolicy", "Exception querying BRMSParamTemplate");
- }
+ String ruleTemplate = null;
+ CommonClassDaoImpl dbConnection = new CommonClassDaoImpl();
+ String queryString="from BRMSParamTemplate where param_template_name= '"+templateName+"'";
+ List<Object> result = dbConnection.getDataByQuery(queryString);
+ if(!result.isEmpty()){
+ BRMSParamTemplate template = (BRMSParamTemplate) result.get(0);
+ ruleTemplate = template.getRule();