Package com.volantis.mcs.repository.jdbc

Examples of com.volantis.mcs.repository.jdbc.JDBCRepositoryException


      }
      stmt.executeUpdate (sql);
    }
    catch (SQLException sqle) {
      logger.error("sql-exception", sqle);
      throw new JDBCRepositoryException (sqle);
    }
    finally {
        close(stmt);
    }

      // update VMPOLICY_LANG
      // Resolve table name.
      String vmPolicyLangTable = resolveTableName(jdbcConnection, VMPOLICY_LANG);
      try {
          stmt = sqlConnection.createStatement();

          // resolve field names
          String project = resolveFieldName(jdbcConnection, PROJECT_COLUMN_NAMES);
          String policy = resolveFieldName(jdbcConnection, POLICY_COLUMN_NAMES);

          String sql =
              "update " + vmPolicyLangTable
              + " set " + policy + " = " + JDBCAccessorHelper.quoteValue(newPolicyName)
              + " where "
              + project + " = " + JDBCAccessorHelper.quoteValue(projectName)
              + " and " + policy + "  = " + JDBCAccessorHelper.quoteValue(oldPolicyName);

          if(logger.isDebugEnabled()){
              logger.debug (sql);
          }
          stmt.executeUpdate (sql);
      }
      catch (SQLException sqle) {
        logger.error("sql-exception", sqle);
        throw new JDBCRepositoryException (sqle);
      }
      finally {
          close(stmt);
      }

      // update VMPOLICY_TYPE
      // Resolve table name.
      String vmPolicyTypeTable = resolveTableName(jdbcConnection, VMPOLICY_TYPE);
      try {
          stmt = sqlConnection.createStatement();

          // resolve field names
          String project = resolveFieldName(jdbcConnection, PROJECT_COLUMN_NAMES);
          String policy = resolveFieldName(jdbcConnection, POLICY_COLUMN_NAMES);

          String sql =
              "update " + vmPolicyTypeTable
              + " set " + policy + " = " + JDBCAccessorHelper.quoteValue(newPolicyName)
              + " where "
              + project + " = " + JDBCAccessorHelper.quoteValue(projectName)
              + " and " + policy + "  = " + JDBCAccessorHelper.quoteValue(oldPolicyName);

          if(logger.isDebugEnabled()){
              logger.debug (sql);
          }
          stmt.executeUpdate (sql);
      }
      catch (SQLException sqle) {
        logger.error("sql-exception", sqle);
        throw new JDBCRepositoryException (sqle);
      }
      finally {
          close(stmt);
      }
  }
View Full Code Here


            return new StringEnumeration(rs);

        } catch (SQLException sqle) {
            logger.error("sql-exception", sqle);
            close(pstmt);
            throw new JDBCRepositoryException(sqle);
        }
    }
View Full Code Here

            return new StringEnumeration(rs);

        } catch (SQLException sqle) {
            logger.error("sql-exception", sqle);
            close(pstmt);
            throw new JDBCRepositoryException(sqle);
        }
    }
View Full Code Here

                descriptor = new DefaultPolicyDescriptor();
                descriptor.setPolicyType(policyType);
            }
        } catch (SQLException sqle) {
            logger.error("sql-exception", sqle);
            throw new JDBCRepositoryException(sqle);
        } finally {
            close(pstmt);
        }
        if (descriptor != null) {
            Statement stmt = null;
            try {
                stmt = sqlConnection.createStatement();
                final String sql =
                    "select " + languageField + " , " + policyDescNameField + " , " +
                        policyHelpField +
                    " from " + vmPolicyLangTable +
                    " where " +
                    policyField + " = " +
                        JDBCAccessorHelper.quoteValue(policyName) +
                    " and " +
                    projectField + " = " +
                        JDBCAccessorHelper.quoteValue(getProjectName());

                if (logger.isDebugEnabled()){
                    logger.debug(sql);
                }

                rs = stmt.executeQuery(sql);
                final String[] values = getBestMatchingValues(jdbcConnection,
                    rs, new String[]{policyDescNameField, policyHelpField}, locale);
                descriptor.setPolicyDescriptiveName(values[0]);
                descriptor.setPolicyHelp(values[1]);
                descriptor.setLanguage(values[2]);
                rs.close();
            }
            catch (SQLException sqle) {
                logger.error("sql-exception", sqle);
                throw new JDBCRepositoryException(sqle);
            }
            finally {
                close(stmt);
            }
        }
View Full Code Here

            // Close the result set.
            rs.close();

        } catch (SQLException sqle) {
            logger.error("sql-exception", sqle);
            throw new JDBCRepositoryException(sqle);
        } finally {
            close(pstmt);
        }
        return policyType;
    }
View Full Code Here

                policyType = getPolicyType(jdbcConnection, projectName, type,
                        typeInstanceID);
            }
        } catch (SQLException sqle) {
            logger.error("sql-exception", sqle);
            throw new JDBCRepositoryException(sqle);
        } finally {
            close(pstmt);
        }
        return policyType;
    }
View Full Code Here

                        getReferencedType(jdbcConnection, projectName,
                                memberTypeID));
            }
        } catch (SQLException sqle) {
            logger.error("sql-exception", sqle);
            throw new JDBCRepositoryException(sqle);
        } finally {
            close(pstmt);
        }
        return policyType;
    }
View Full Code Here

                        getReferencedType(jdbcConnection, projectName,
                                memberTypeID));
            }
        } catch (SQLException sqle) {
            logger.error("sql-exception", sqle);
            throw new JDBCRepositoryException(sqle);
        } finally {
            close(pstmt);
        }
        return policyType;
    }
View Full Code Here

                policyType = new DefaultRangePolicyType(min, max);
            }
        } catch (SQLException sqle) {
            logger.error("sql-exception", sqle);
            throw new JDBCRepositoryException(sqle);
        } finally {
            close(pstmt);
        }
        return policyType;
    }
View Full Code Here

            // Close the result set.
            rs.close();

        } catch (SQLException sqle) {
            logger.error("sql-exception", sqle);
            throw new JDBCRepositoryException(sqle);
        } finally {
            close(pstmt);
        }
        return policyType;
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.repository.jdbc.JDBCRepositoryException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.