Package com.baasbox.dao.exception

Examples of com.baasbox.dao.exception.InvalidCollectionException


    if (DbHelper.isInTransaction()) throw new OpenTransactionException("Cannot create a collection within an open transaction");
    if (Logger.isTraceEnabled()) Logger.trace("Method Start");
    try {
      if (existsCollection(collectionName)) throw new CollectionAlreadyExistsException("Collection " + collectionName + " already exists");
    }catch (SqlInjectionException e){
      throw new InvalidCollectionException(e);
    }
    if (Character.isDigit(collectionName.charAt(0))){
      throw new InvalidCollectionException("Collection names cannot start by a digit");
    }
    ODocument doc = super.create();
    doc.field("name",collectionName);
    if(collectionName.toUpperCase().startsWith("_BB_")){
      throw new InvalidCollectionException("Collection name is not valid: it can't be prefixed with _BB_");
    }
    save(doc);
   
    //create new class
    OClass documentClass = db.getMetadata().getSchema().getClass(CLASS_NODE_NAME);
View Full Code Here


    return db.load(record.getIdentity());
  }
 
  @Override
  public void delete(String name) throws Exception{
    if (!existsCollection(name)) throw new InvalidCollectionException("Collection " + name + " does not exists");
   
    //get the helper class
    GenericDao gdao = GenericDao.getInstance();
   
    //begin transaction
View Full Code Here

  public static void delete(String collectionName, String rid) throws Throwable {
    DocumentDao dao = DocumentDao.getInstance(collectionName);
    try {
      dao.delete(rid);
    } catch (InvalidModelException e) {
      throw new InvalidCollectionException("The document " + rid + " does no belong to the collection " + collectionName);
    }
  }
View Full Code Here

 
  protected DocumentDao(String collectionName) throws InvalidCollectionException {
    super(collectionName);
    collDao = CollectionDao.getInstance();
    try {
      if (!collDao.existsCollection(collectionName)) throw new InvalidCollectionException("The collection " + collectionName + " does not exists");
    } catch (SqlInjectionException e) {
      throw new InvalidCollectionException(e);
    }

  }
View Full Code Here

TOP

Related Classes of com.baasbox.dao.exception.InvalidCollectionException

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.