bdao.addBundle(bundle, multiStatementConnection);
if (parentId != -1) {
ContentType parentIdType = DAOFactory.getHelperDAO()
.getContentTypeById(parentId);
if (parentIdType == null) {
throw new NoSuchBundleException(
"No such parent ID exists in the database.");
}
bdao.addBundleMapping(bundle.getBundleId(), parentId,
parentIdType, multiStatementConnection);
}
mman.updateMetadataVBOMapping(bundle, multiStatementConnection);
multiStatementConnection.commit();
AuditLogManager alm = new AuditLogManager();
alm.addRecord(bundle.getProjectId(), ContentType.BUNDLE, bundle
.getBundleId(), user.getUserName(), "{created}");
} catch (SQLException e) {
multiStatementConnection.rollback();
throw e;
} catch (NoSuchBundleException e) {
multiStatementConnection.rollback();
throw e;
} catch (NoAvailableDAOException e) {
multiStatementConnection.rollback();
Logger.fatal("Couldn't get a bundle DAO", e);
throw new NoSuchBundleException("Couldn't get the bundle DAO: "
+ e.getMessage());
} finally {
multiStatementConnection.setAutoCommit(true);
Configuration.getConnectionPool().returnConnection(
multiStatementConnection);