Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGBackendException


            if (key != null) {
                message = "Error retrieving content with key '" + key.toString() + "'.";
            } else {
                message = "Error retrieving content with key 'null'";
            }
      throw new WGBackendException(message, e);
    }
    finally {
      closeResultSet(resultSet);
    }
   
View Full Code Here


       
        // Execute Statement
        PreparedStatement stmt = getInsertStatement(folder, allColumns);
        int rows = stmt.executeUpdate();
        if (rows != 1) {
            throw new WGBackendException("Insert failed. Wrong number of inserted rows returned: " + rows);
        }

        if (keyToGenerate == null) {
            return true;
        }

        // Try to retrieve generated key and store it at the bean and the key map
        if (!stmt.getConnection().getMetaData().supportsGetGeneratedKeys()) {
            throw new WGBackendException("Row was inserted but JDBC Driver does not support returning of generated keys. Usage of a table with generated key is not possible with this driver.");
        }
        ResultSet generatedKeys = stmt.getGeneratedKeys();
        generatedKeys.first();
        Object generatedKey = generatedKeys.getObject(1);
        valuesMap.put(keyToGenerate, generatedKey);
        keyMap.put(keyToGenerate, generatedKey);
       
        if (getConnection().getAutoCommit() == false) {
          getConnection().commit();
      }
       
        return true;
     
        /*String whereClause = getWhereClause(folder, key);
      resultSet = getTableResultSet(folder, whereClause, true);

      if (resultSet != null) {
                startResultSet(resultSet);
        if (!resultSet.next()) {
          resultSet.moveToInsertRow();
          pushRowData(resultSet, (Map) bean);
          resultSet.insertRow();
          if (getConnection().getAutoCommit() == false) {
              getConnection().commit();
          }
          return true;
        }
        else {
          throw new WGBackendException("The key '" + key + "' already exists in table '" + folder + "'");
        }
      }
      else {
        return false;
      }*/

    }
    catch (SQLException e) {
      try {
                if (getConnection().getAutoCommit() == false) {
                    getConnection().rollback();
                }
            } catch (SQLException e1) {
                Logger.getLogger(LOGGER_NAME).error("Error rolling back content insertion", e);
            }
      throw new WGBackendException("Error inserting row", e);
    }
    finally {
      closeResultSet(resultSet);
    }

View Full Code Here

          if (getConnection().getAutoCommit() == false) {
              getConnection().commit();
          }
        }
                else {
                    throw new WGBackendException("Cannot remove row '" + key + "' of table '" + folder + "' because it cannot be retrieved");
                }
      }
    }
    catch (SQLException e) {
      try {
                if (getConnection().getAutoCommit() == false) {
                    getConnection().rollback();
                }
            } catch (SQLException e1) {
                Logger.getLogger(LOGGER_NAME).error("Error rolling back content deletion", e);
            }
            throw new WGBackendException("Error removing row '" + key + "' of table '" + folder + "'", e);
    }
    finally {
      closeResultSet(resultSet);
    }
 
View Full Code Here

        return null;
      }

    }
    catch (SQLException e) {
      throw new WGBackendException("Error browsing JDBC source", e);
    }
    finally {
      closeResultSet(resultSet);
    }
View Full Code Here

              getConnection().commit();
          }
          return true;
        }
        else {
          throw new WGBackendException("Unretrievable row '" + key + "' in table '" + folder + "'");
        }
      }
      else {
                throw new WGBackendException("Unretrievable table result set '" + folder + "'");
      }
    }
    catch (SQLException e) {
            try {
                if (getConnection().getAutoCommit() == false) {
                    getConnection().rollback();
                }
            } catch (SQLException e1) {
                Logger.getLogger(LOGGER_NAME).error("Error rolling back content storage", e);
            }
            throw new WGBackendException("Error storing jdbc row", e);
    }
    finally {
      closeResultSet(resultSet);
    }
  }
View Full Code Here

    public Object getNativeObject() throws WGBackendException {
        try {
            return getConnection();
        }
        catch (SQLException e) {
            throw new WGBackendException("Error retrieving native object form JDBCSource", e);
        }
    }
View Full Code Here

       
        WGACore wgaCore = (WGACore) _registry.getContextObjects().get(WGACore.class);
        File dir = new File(wgaCore.getWgaDataDir(), "#dbs");
        if (!dir.exists()) {
            if (!dir.mkdirs()) {
                throw new WGBackendException("Unable to create hsql default directory " + dir.getPath());
            }
        }
       
        return dir;
View Full Code Here

            }

            return null;
        }
        catch (Exception e) {
            throw new WGBackendException("Exception retrieving design document '" + name + "' of type " + WGDocument.doctypeNumberToName(type), e);
        }

    }
View Full Code Here

            }

            return null;
        }
        catch (Exception e) {
            throw new WGBackendException("Exception retrieving design document list of type " + WGDocument.doctypeNumberToName(type), e);
        }

    }
View Full Code Here

            else {
                return new Date(getCodeFile().getContent().getLastModifiedTime());
            }
        }
        catch (Exception e) {
            throw new WGBackendException("Exception retrieving created date", e);
        }
    }
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.WGBackendException

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.