@Get @Path("/reports/edit") public void multipleEdit() { List<ErrorEntry> reports = errorEntryLogic.getAllReports(); if (LOG.isDebugEnabled()) { LOG.debug("Will list of size: " + reports.size()); } result .include("errorEntryList", reports) .include("priorities", Priority.values()) .include("states", State.values()); if (!loggedUser.isLogged()) { Calendar now = Calendar.getInstance(); now.add(Calendar.DATE, -7); result.include("oneWeekAgo", now.getTime()); } result .include("headerTitle", messages.getString("LIST_ERROR_REPORT_HEADER")) .include("headerDescription", messages.getString("LIST_ERROR_REPORT_DESCRIPTION")); }
@Get @Path("/reports/{errorEntry.id}") public void details(ErrorEntry errorEntry) { if (errorEntry == null) { result.redirectTo(getClass()).list(); return; } ErrorEntry errorEntryFromDB = errorEntryDAO.retrieve(new Long(errorEntry.getId())); LOG.debug("Details for: " + errorEntryFromDB); if (errorEntryFromDB == null) { result.notFound(); return; } result .include("errorEntry", errorEntryFromDB) .include("processResultList", cogrooFacade.cachedProcessText(errorEntryFromDB.getText())) .include("priorities", Priority.values()) .include("states", State.values()); String title = "Problema Nº. " + errorEntryFromDB.getId() + ": " + errorEntryFromDB.getText(); String sender = "Enviado por: " + errorEntryFromDB.getSubmitter().getName(); String version = "Versão: " + errorEntryFromDB.getVersion().getVersion(); String creationDate = "Criado em: " + DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG) .format(errorEntryFromDB.getCreation()); String changeDate = "Modificado em: " + DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG) .format(errorEntryFromDB.getModified()); String type = "Tipo: "; String details = null; if (errorEntryFromDB.getOmission() == null) { type += "Intervenção indevida"; String rule = "Regra: " + errorEntryFromDB.getBadIntervention().getRule(); String classification = "Erro: " + messages.getString( errorEntryFromDB.getBadIntervention().getClassification().toString()); details = rule + "; " + classification; } else { type += "Omissão"; String category = "Categoria" + (errorEntryFromDB.getOmission().getCategory() == null ? " (personalizada): " + errorEntryFromDB.getOmission().getCustomCategory() : ": " + errorEntryFromDB.getOmission().getCategory()); String replaceBy = "Substituir por: " + errorEntryFromDB.getOmission().getReplaceBy(); details = category + "; " + replaceBy; } String description = sender + "; " + version + "; " + type + "; " + details + "; " + creationDate + "; " + changeDate; result .include("headerTitle", StringEscapeUtils.escapeHtml(title)) .include("headerDescription", StringEscapeUtils.escapeHtml(description)); }