idao.addItem(item, multiStatementConnection);
if (parentId != -1) {
ContentType parentIdType = DAOFactory.getHelperDAO()
.getContentTypeById(parentId);
if (parentIdType == null) {
throw new NoSuchItemException(
"No such parent ID exists in the database.");
}
idao.addItemMapping(item.getItemId(), parentId, parentIdType,
multiStatementConnection);
}
mman.updateMetadataVBOMapping(item, multiStatementConnection);
multiStatementConnection.commit();
AuditLogManager alm = new AuditLogManager();
alm
.addRecord(item.getProjectId(), ContentType.ITEM,
item.getItemId(), user.getUserName(),
"{created}");
} catch (SQLException e) {
multiStatementConnection.rollback();
throw e;
} catch (NoSuchItemException e) {
multiStatementConnection.rollback();
throw e;
} catch (NoAvailableDAOException e) {
multiStatementConnection.rollback();
Logger.fatal("Couldn't get an item DAO", e);
throw new NoSuchItemException("Couldn't get the item DAO: "
+ e.getMessage());
} finally {
multiStatementConnection.setAutoCommit(true);
Configuration.getConnectionPool().returnConnection(
multiStatementConnection);