/* (non-Javadoc)
  * @see it.eng.spagobi.monitoring.dao.IAuditDAO#loadAuditByID(java.lang.Integer)
  */
 public SbiAudit loadAuditByID(Integer id) throws EMFUserError {
   logger.debug("IN");
   Session aSession = null;
   Transaction tx = null;
   SbiAudit aSbiAudit = null;
   try {
     aSession = getSession();
     tx = aSession.beginTransaction();
     aSbiAudit = (SbiAudit) aSession.load(SbiAudit.class, id);
     aSbiAudit.getSbiObject();
     aSbiAudit.getDocumentLabel();
     aSbiAudit.getDocumentId();
     aSbiAudit.getDocumentName();
     aSbiAudit.getDocumentParameters();
     aSbiAudit.getDocumentState();
     aSbiAudit.getDocumentType();
     aSbiAudit.getSbiSubObject();
     aSbiAudit.getSubObjId();
     aSbiAudit.getSubObjName();
     aSbiAudit.getSubObjOwner();
     aSbiAudit.getSubObjIsPublic();
     aSbiAudit.getSbiEngine();
     aSbiAudit.getEngineClass();
     aSbiAudit.getEngineDriver();
     aSbiAudit.getEngineId();
     aSbiAudit.getEngineLabel();
     aSbiAudit.getEngineName();
     aSbiAudit.getEngineType();
     aSbiAudit.getEngineUrl();
     aSbiAudit.getExecutionModality();
     aSbiAudit.getRequestTime();
     aSbiAudit.getId();
     aSbiAudit.getUserName();
     aSbiAudit.getUserGroup();
     aSbiAudit.getExecutionStartTime();
     aSbiAudit.getExecutionEndTime();
     aSbiAudit.getExecutionTime();
     aSbiAudit.getExecutionState();
     aSbiAudit.getError();
     aSbiAudit.getErrorMessage();
     aSbiAudit.getErrorCode();
     tx.commit();
   } catch (HibernateException he) {
     logger.error(he);
     if (tx != null) tx.rollback();
     throw new EMFUserError(EMFErrorSeverity.ERROR, 100);
   } finally {
     if (aSession != null) {
       if (aSession.isOpen()) aSession.close();
     }
     logger.debug("OUT");
   }
   return aSbiAudit;
 }
 /**
  * Insert audit.
  *
  * @param aSbiAudit the a sbi audit
  * @throws EMFUserError the EMF user error
  * @see it.eng.spagobi.monitoring.dao.IAuditDAO#insertAudit(it.eng.spagobi.bo.SbiAudit)
  */
 public void insertAudit(SbiAudit aSbiAudit) throws EMFUserError {
   logger.debug("IN");
   Session session = null;
   Transaction tx = null;
   try {
     session = getSession();
     ;
     tx = session.beginTransaction();
     if (aSbiAudit.getSbiObject() == null) {
       Integer objectId = aSbiAudit.getDocumentId();
       SbiObjects sbiObject = (SbiObjects) session.load(SbiObjects.class, objectId);
       aSbiAudit.setSbiObject(sbiObject);
     }
     if (aSbiAudit.getSbiSubObject() == null) {
       Integer subObjId = aSbiAudit.getSubObjId();
       if (subObjId != null) {
         SbiSubObjects subObj = (SbiSubObjects) session.load(SbiSubObjects.class, subObjId);
         aSbiAudit.setSbiSubObject(subObj);
       }
     }
     if (aSbiAudit.getSbiEngine() == null) {
       Integer engineId = aSbiAudit.getEngineId();
       SbiEngines sbiEngine = (SbiEngines) session.load(SbiEngines.class, engineId);
       aSbiAudit.setSbiEngine(sbiEngine);
     }
     updateSbiCommonInfo4Insert(aSbiAudit);
     session.save(aSbiAudit);
     session.flush();
     tx.commit();
   } catch (HibernateException he) {
     logger.error(he);
     if (tx != null) tx.rollback();
     throw new EMFUserError(EMFErrorSeverity.ERROR, 100);
   } finally {
     if (session != null) {
       if (session.isOpen()) session.close();
     }
     logger.debug("OUT");
   }
 }