public Integer create(NotificationMessage notificationMessage) throws SystemException
{
logger.info("Creating a transactionHistory object...");
Database db = CastorDatabaseService.getDatabase();
TransactionHistory transactionHistory = null;
try
{
beginTransaction(db);
logger.info("Began transaction...");
TransactionHistoryVO transVO = new TransactionHistoryVO();
transactionHistory = new TransactionHistoryImpl();
transVO.setName(notificationMessage.getName());
transVO.setSystemUserName(notificationMessage.getSystemUserName());
transVO.setTransactionDateTime(java.util.Calendar.getInstance().getTime());
transVO.setTransactionTypeId(new Integer(notificationMessage.getType()));
transVO.setTransactionObjectId(notificationMessage.getObjectId().toString());
transVO.setTransactionObjectName(notificationMessage.getObjectName());
transactionHistory.setValueObject(transVO);
if(logger.isInfoEnabled())
{
logger.info("Created the transaction object and filled it with values...");
logger.info("transactionHistory.getId():" + transactionHistory.getId());
logger.info("transactionHistory.getName():" + transactionHistory.getName());
logger.info("transactionHistory.getSystemUserName():" + transactionHistory.getSystemUserName());
logger.info("transactionHistory.getTransactionDateTime():" + transactionHistory.getTransactionDateTime());
logger.info("transactionHistory.getTransactionObjectId():" + transactionHistory.getTransactionObjectId());
logger.info("transactionHistory.getTransactionObjectName():" + transactionHistory.getTransactionObjectName());
logger.info("transactionHistory.getTransactionTypeId():" + transactionHistory.getTransactionTypeId());
logger.info("isActive=" + db.isActive());
}
db.create(transactionHistory);
logger.info("Created the transaction object in the database..");
commitTransaction(db);
logger.info("Committed the transaction..");
}
catch(Exception e)
{
logger.info("An error occurred so we should not complete the transaction:" + e, e);
rollbackTransaction(db);
return null;
}
logger.info("TransactionHistory object all done..");
return transactionHistory.getValueObject().getTransactionHistoryId();
}