bug #8366
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@66786 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
1f8674f41d
commit
d6da1c1879
|
@ -65,6 +65,8 @@ public class AuditInterceptor extends EmptyInterceptor {
|
||||||
|
|
||||||
private boolean getAuditModuleService() {
|
private boolean getAuditModuleService() {
|
||||||
|
|
||||||
|
Session session = null;
|
||||||
|
try {
|
||||||
if (!AuditManager.getINSTANCE().getCheckModuleAudit()) {
|
if (!AuditManager.getINSTANCE().getCheckModuleAudit()) {
|
||||||
return AuditManager.getINSTANCE().getCurrentService() != null ? true : false;
|
return AuditManager.getINSTANCE().getCurrentService() != null ? true : false;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +74,7 @@ public class AuditInterceptor extends EmptyInterceptor {
|
||||||
AuditService auditService = null;
|
AuditService auditService = null;
|
||||||
|
|
||||||
SessionFactory sessionFactory = DBUtil.getInstance().getSessionFactory();
|
SessionFactory sessionFactory = DBUtil.getInstance().getSessionFactory();
|
||||||
Session session = sessionFactory.openSession();
|
session = sessionFactory.openSession();
|
||||||
|
|
||||||
Criteria criteriaFuncionSistema = session.createCriteria(FuncionSistema.class);
|
Criteria criteriaFuncionSistema = session.createCriteria(FuncionSistema.class);
|
||||||
criteriaFuncionSistema.add(Restrictions.eq("descruta", AuditManager.getINSTANCE().getCurrentActionService()));
|
criteriaFuncionSistema.add(Restrictions.eq("descruta", AuditManager.getINSTANCE().getCurrentActionService()));
|
||||||
|
@ -96,6 +98,11 @@ public class AuditInterceptor extends EmptyInterceptor {
|
||||||
AuditManager.getINSTANCE().setCheckModuleAudit(Boolean.FALSE);
|
AuditManager.getINSTANCE().setCheckModuleAudit(Boolean.FALSE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
if (session != null)
|
||||||
|
session.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void genAudit(Object entity, EnumAuditAction action) {
|
private void genAudit(Object entity, EnumAuditAction action) {
|
||||||
|
@ -103,6 +110,8 @@ public class AuditInterceptor extends EmptyInterceptor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Session session = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/**
|
/**
|
||||||
* Ignorado caso a entidade for de auditoria e se não for encontrado o módulo no banco
|
* Ignorado caso a entidade for de auditoria e se não for encontrado o módulo no banco
|
||||||
|
@ -130,7 +139,7 @@ public class AuditInterceptor extends EmptyInterceptor {
|
||||||
audit.setUsuario(UsuarioLogado.getUsuarioLogado());
|
audit.setUsuario(UsuarioLogado.getUsuarioLogado());
|
||||||
|
|
||||||
SessionFactory sessionFactory = DBUtil.getInstance().getSessionFactory();
|
SessionFactory sessionFactory = DBUtil.getInstance().getSessionFactory();
|
||||||
Session session = sessionFactory.openSession();
|
session = sessionFactory.openSession();
|
||||||
|
|
||||||
session.persist(audit);
|
session.persist(audit);
|
||||||
session.flush();
|
session.flush();
|
||||||
|
@ -140,6 +149,9 @@ public class AuditInterceptor extends EmptyInterceptor {
|
||||||
|
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
log.error(exception.getStackTrace());
|
log.error(exception.getStackTrace());
|
||||||
|
} finally {
|
||||||
|
if (session != null)
|
||||||
|
session.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue