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);