Package edu.uga.galileo.voci.exception

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


    try {
      Configuration.getConnectionPool().executeQuery(qp);
    } catch (SQLException e) {
      Logger.fatal("Couldn't execute query", e);
      throw new NoSuchCollectionException(
          "A SQLException was the cause: " + e.getMessage());
    }

    if (qp.getResultCount() > 0) {
      return createObjectFromQueryParser(Collection.class, qp);
    } else {
      throw new NoSuchCollectionException("The requested collection ID ("
          + collectionId + ") doesn't exist.");
    }
  }
View Full Code Here


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

    qp.addPreparedStmtElementDefinition(collection.getCollectionId());
    qp.addPreparedStmtElementDefinition(collection.getProjectId());

    try {
      if (!Configuration.getConnectionPool().executeInsertOrUpdate(qp)) {
        throw new NoSuchCollectionException("Collection "
            + collection.getId() + " in project "
            + collection.getProjectId()
            + " couldn't be found to update.");
      }
    } catch (SQLException e) {
      Logger.error("Collection record couldn't be updated.", e);
      throw new NoSuchCollectionException(
          "SQLException prevented collection record update: "
              + e.getMessage());
    }
  }
View Full Code Here

    qp.addPreparedStmtElementDefinition(collection.getCollectionId());
    qp.addPreparedStmtElementDefinition(collection.getCollectionId());

    try {
      if (!Configuration.getConnectionPool().executeInsertOrUpdate(qp)) {
        throw new NoSuchCollectionException("Childless collection "
            + collection.getId() + " in project "
            + collection.getProjectId()
            + " couldn't be found to delete.");
      }
    } catch (SQLException e) {
      Logger.error("Collection record couldn't be deleted", e);
      throw new NoSuchCollectionException(
          "SQLException prevented collection record deletion: "
              + e.getMessage());
    }
  }
View Full Code Here

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

    int projectId;
    try {
      projectId = (new ProjectManager()).getProjectID(command
          .getProject());
    } catch (NoSuchProjectException e) {
      throw new NoSuchCollectionException(
          "The project associated with this "
              + "collection couldn't be found.");
    }

    if (collectionId == -1) {
      collection = new Collection();
      collection.setCollectionId(-1);
      collection.setProjectId(projectId);
    } else {
      collection = cldao.getCollection(collectionId, projectId);
    }

    if ((mustBeActive) && (!collection.isActive())) {
      throw new NoSuchCollectionException(
          "No matching, active collection found.");
    }

    if (addMetadata) {
      metadataManager.populateVBOWithMetadata(collection);
View Full Code Here

      cldao.addCollection(collection, multiStatementConnection);
      if (parentId != -1) {
        ContentType parentIdType = DAOFactory.getHelperDAO()
            .getContentTypeById(parentId);
        if (parentIdType == null) {
          throw new NoSuchCollectionException(
              "No such parent ID exists in the database.");
        }
        cldao.addCollectionMapping(collection.getCollectionId(),
            parentId, parentIdType, multiStatementConnection);
      }
      mman.updateMetadataVBOMapping(collection, multiStatementConnection);
      multiStatementConnection.commit();

      AuditLogManager alm = new AuditLogManager();
      alm.addRecord(collection.getProjectId(), ContentType.COLLECTION,
          collection.getCollectionId(), user.getUserName(),
          "{created}");
    } catch (SQLException e) {
      multiStatementConnection.rollback();
      throw e;
    } catch (NoSuchCollectionException e) {
      multiStatementConnection.rollback();
      throw e;
    } catch (NoAvailableDAOException e) {
      multiStatementConnection.rollback();
      Logger.fatal("Couldn't get a helper DAO", e);
      throw new NoSuchCollectionException("Couldn't get the helper DAO: "
          + e.getMessage());
    } finally {
      multiStatementConnection.setAutoCommit(true);
      Configuration.getConnectionPool().returnConnection(
          multiStatementConnection);
View Full Code Here

TOP

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

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.