use of com.tomasio.projects.trainning.dto.LogDTO in project trainning by fernandotomasio.
the class Log method createDTO.
public LogDTO createDTO() {
LogDTO dto = new LogDTO();
dto.setId(id);
dto.setDataCriacao(dataCriacao);
dto.setObjectId(objectId);
dto.setTexto(texto);
dto.setUser(user);
return dto;
}
use of com.tomasio.projects.trainning.dto.LogDTO in project trainning by fernandotomasio.
the class CursosController method detailCurso.
@RequestMapping("/detail")
public String detailCurso(Model model, WebRequest request) {
String cursoId = request.getParameter("cursoId");
CursoDTO dto = trainningService.findCurso(Long.parseLong(cursoId));
LogDTO[] logs = systemService.findAllLogByObjectId(dto.getObjectId());
model.addAttribute("logs", logs);
model.addAttribute("curso", dto);
return "cursos/detail";
}
use of com.tomasio.projects.trainning.dto.LogDTO in project trainning by fernandotomasio.
the class SystemServiceSimpleImpl method findAllLogByObjectId.
@Override
@Transactional(readOnly = true)
public LogDTO[] findAllLogByObjectId(String objectId) {
LogDAO dao = factory.getLogDAO();
LogDTO[] logsArray = null;
try {
List<LogDTO> logs = dao.findAllByObjectId(objectId);
if (logs != null) {
logsArray = new LogDTO[logs.size()];
logs.toArray(logsArray);
}
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
return logsArray;
}
use of com.tomasio.projects.trainning.dto.LogDTO in project trainning by fernandotomasio.
the class MatriculasLoggerAdvice method logRemoveMatricula.
@Around("remove()")
public void logRemoveMatricula(ProceedingJoinPoint joinPoint) throws Throwable {
Long id = (Long) joinPoint.getArgs()[0];
MatriculaDAO matriculaDAO = factory.getMatriculaDAO();
Matricula matricula = matriculaDAO.find(id);
joinPoint.proceed();
LogDTO log = new LogDTO();
log.setDataCriacao(new Date());
log.setUser(getUser());
log.setTexto("EXCLUSÃO DE MATRÍCULA " + getDetails(matricula.createDTO()));
logger.create(log);
}
use of com.tomasio.projects.trainning.dto.LogDTO in project trainning by fernandotomasio.
the class MatriculasLoggerAdvice method logCreateMatricula.
@After("create()")
public void logCreateMatricula(JoinPoint joinPoint) {
MatriculaDTO[] matriculas = (MatriculaDTO[]) joinPoint.getArgs()[0];
if (matriculas != null && matriculas.length > 0) {
try {
LogDTO log = new LogDTO();
log.setDataCriacao(new Date());
log.setUser(getUser());
for (MatriculaDTO matriculaDTO : matriculas) {
String texto = "CRIAÇÃO DE MATRÍCULA " + getDetails(matriculaDTO);
log.setTexto(texto);
logger.create(log);
}
} catch (DAOException ex) {
Logger.getLogger(MatriculasLoggerAdvice.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Aggregations