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