Package edu.uga.galileo.voci.exception

Examples of edu.uga.galileo.voci.exception.NoSuchMetadataException


    try {
      Configuration.getConnectionPool().executeQuery(qp);
      return createObjectsFromQueryParser(MetadataElement.class, qp);
    } catch (SQLException e) {
      Logger.warn("Metadata listing couldn't be retrieved", e);
      throw new NoSuchMetadataException(
          "SQLException prevented metadata listing retrieval: "
              + e.getMessage());
    }
  }
View Full Code Here


    try {
      Configuration.getConnectionPool().executeQuery(qp);
      if (qp.getResultCount() > 0) {
        return createObjectFromQueryParser(MetadataElement.class, qp);
      } else {
        throw new NoSuchMetadataException(
            "The requested community pID (" + id
                + ") doesn't exist.");
      }
    } catch (SQLException e) {
      Logger.warn("Metadata record couldn't be retrieved", e);
      throw new NoSuchMetadataException(
          "SQLException prevented metadata record retrieval: "
              + e.getMessage());
    }
  }
View Full Code Here

    try {
      Configuration.getConnectionPool().executeInsertOrUpdate(qp);
    } catch (SQLException e) {
      Logger.error("Metadata record couldn't be added", e);
      throw new NoSuchMetadataException(
          "SQLException prevented metadata record addition: "
              + e.getMessage());
    }
  }
View Full Code Here

    try {
      Configuration.getConnectionPool().executeInsertOrUpdate(qp);
    } catch (SQLException e) {
      Logger.error("Metadata record couldn't be updated", e);
      throw new NoSuchMetadataException(
          "SQLException prevented metadata record update: "
              + e.getMessage());
    }
  }
View Full Code Here

      try {
        Configuration.getConnectionPool().executeInsertOrUpdate(qp);
      } catch (SQLException e) {
        Logger.error("Metadata record couldn't be disabled", e);
        throw new NoSuchMetadataException(
            "SQLException prevented metadata record disabled: "
                + e.getMessage());
      }

      // ...then renumber the display order of subsequent elements
      sql = new StringBuffer();
      sql.append("update metadata_registry ");
      sql.append("set display_order=display_order-1 ");
      sql.append("where project_id=? ");
      sql.append("and content_type=? ");
      sql.append("and display_order>? ");

      qp.clearForNewSQL();
      qp.setSql(sql.toString());
      qp.addPreparedStmtElementDefinition(meta.getProjectId());
      qp.addPreparedStmtElementDefinition(meta.getContentType());
      qp.addPreparedStmtElementDefinition(currentDisplayOrder);

      Configuration.getConnectionPool().executeInsertOrUpdate(qp);
    } catch (SQLException e) {
      Logger.error("Metadata record couldn't be disabled", e);
      throw new NoSuchMetadataException(
          "SQLException prevented metadata record disabled: "
              + e.getMessage());
    }
  }
View Full Code Here

      qp.addPreparedStmtElementDefinition(moveTo);
      qp.addPreparedStmtElementDefinition(meta.getMetadataId());

      Configuration.getConnectionPool().executeInsertOrUpdate(qp);
    } catch (SQLException e) {
      throw new NoSuchMetadataException(
          "SQLException prevented getting current display order for "
              + meta.getMetadataId());
    }
  }
View Full Code Here

      Configuration.getConnectionPool().executeQuery(qp);
      return qp.getResult(Integer.class, "nextVal");
    } catch (SQLException e) {
      Logger.error(
          "Metadata ID couldn't be retrieved b/c of SQLException", e);
      throw new NoSuchMetadataException(
          "Couldn't get a metadata ID from the metadata_id_seq b/c of a SQLException: "
              + e.getMessage());
    } catch (DataTypeMismatchException e) {
      Logger.error("Metadata ID couldn't be retrieved", e);
      throw new NoSuchMetadataException(
          "Couldn't get a metadata ID from the metadata_id_seq: "
              + e.getMessage());
    }
  }
View Full Code Here

              .error("Your metadata_id column appears to not be an int");
        }
      }
    } catch (SQLException e) {
      Logger.warn("Metadata element ID couldn't be retrieved", e);
      throw new NoSuchMetadataException(
          "SQLException prevented metadata record retrieval: "
              + e.getMessage());
    }

    throw new NoSuchMetadataException(
        "Metadata ID couldn't be retrieved for " + element + "."
            + qualifier + " for project " + projectId
            + " and content type " + contentType);
  }
View Full Code Here

    // block
    Connection myConn = null;
    try {
      myConn = ConnectionPoolFactory.getConnectionPool().getConnection();
    } catch (NoAvailablePoolException e1) {
      throw new NoSuchMetadataException(
          "Couldn't get metadata b/c of a connection pool problem: "
              + e1.toString());
    }

    myConn.setAutoCommit(false);

    qp.setConnection(myConn);
    qp.addPreparedStmtElementDefinition(projectHandle);
    qp.addPreparedStmtElementDefinition(type.getValue());
    qp.addPreparedStmtElementDefinition(metadataId);

    try {
      if (!Configuration.getConnectionPool().executeInsertOrUpdate(qp)) {
        throw new NoSuchMetadataException(
            "No matching row was found to update");
      } else {
        // if that worked, then set the rest of the fields for
        // this projectId+contentType combination to false
        qp.clearForNewSQL();

        sql = new StringBuffer();
        sql.append("update metadata_registry ");
        sql.append("set is_key_field=false ");
        sql.append("where project_id=");
        sql.append("  (select project_id ");
        sql.append("   from projects ");
        sql.append("   where handle=?) ");
        sql.append("and content_type=? ");
        sql.append("and metadata_id!=? ");

        qp.setSql(sql.toString());
        qp.addPreparedStmtElementDefinition(projectHandle);
        qp.addPreparedStmtElementDefinition(type.getValue());
        qp.addPreparedStmtElementDefinition(metadataId);

        Configuration.getConnectionPool().executeInsertOrUpdate(qp);

        qp.getConnection().commit();
      }
    } catch (SQLException e) {
      Logger.error(
          "Metadata record couldn't be updated ... rolling back", e);
      qp.getConnection().rollback();
      throw new NoSuchMetadataException(
          "SQLException prevented metadata record update: "
              + e.getMessage());
    } finally {
      qp.setConnection(null);
      myConn.setAutoCommit(true); // reset to true before returning it
View Full Code Here

TOP

Related Classes of edu.uga.galileo.voci.exception.NoSuchMetadataException

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.