Commit 4d62fd91 authored by Fabiano Sluzarski's avatar Fabiano Sluzarski
Browse files

Fixed bug on listing committee and update on travel requisition not

putting the selected person. Added on TicketKind new enum and filtered
list on the travel requisition. Renamed package
br.ufpr.c3sl.sapos.models.report to br.ufpr.c3sl.sapos.models.util and
added PropertyUtil.
parent b9a159ab
package br.ufpr.c3sl.sapos.models.customization;
import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import javax.validation.constraints.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.MailSender;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
......@@ -15,6 +17,7 @@ import br.ufpr.c3sl.sapos.models.scholar.Registration;
import br.ufpr.c3sl.sapos.models.scholar.StudentGrant;
import br.ufpr.c3sl.sapos.models.scholar.Transcript;
import br.ufpr.c3sl.sapos.models.scholar.TravelRequisition;
import br.ufpr.c3sl.sapos.models.util.PropertyUtil;
@RooJavaBean
@RooToString
......
......@@ -2,6 +2,7 @@ package br.ufpr.c3sl.sapos.models.people;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
......@@ -107,7 +108,13 @@ public class Person {
private Set<ResearchField> researchFields = new HashSet<ResearchField>();
@OneToMany(cascade = CascadeType.ALL, mappedBy = "person")
private Set<Title> titles = new HashSet<Title>();
private Set<Title> titles = new HashSet<Title>();
/*public static List<Person> findAllPeopleWithType() {
List<Person> l = entityManager().createNativeQuery("select id, name || ' - ' || case dtype when 'Student' then 'Aluno1' when 'Staff' then 'Funcionario1' else 'Professor1' end as name from person order by name", Person.class).getResultList();
System.out.println(l.get(0).getName());
return l;
}*/
}
......@@ -20,12 +20,12 @@ import org.springframework.roo.addon.tostring.RooToString;
import br.ufpr.c3sl.sapos.models.customization.Configuration;
import br.ufpr.c3sl.sapos.models.entities.Organization;
import br.ufpr.c3sl.sapos.models.people.enums.ProfessorKind;
import br.ufpr.c3sl.sapos.models.report.ReportUtil;
import br.ufpr.c3sl.sapos.models.scholar.Committee;
import br.ufpr.c3sl.sapos.models.scholar.Registration;
import br.ufpr.c3sl.sapos.models.scholar.SectionPos;
import br.ufpr.c3sl.sapos.models.scholar.Transcript;
import br.ufpr.c3sl.sapos.models.scholar.enums.RegistrationKind;
import br.ufpr.c3sl.sapos.models.util.ReportUtil;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
......
......@@ -26,10 +26,10 @@ import org.springframework.roo.addon.tostring.RooToString;
import br.ufpr.c3sl.sapos.models.customization.Configuration;
import br.ufpr.c3sl.sapos.models.people.Professor;
import br.ufpr.c3sl.sapos.models.people.Student;
import br.ufpr.c3sl.sapos.models.report.ReportUtil;
import br.ufpr.c3sl.sapos.models.scholar.enums.LanguageKind;
import br.ufpr.c3sl.sapos.models.scholar.enums.RegistrationKind;
import br.ufpr.c3sl.sapos.models.scholar.enums.RegistrationStatus;
import br.ufpr.c3sl.sapos.models.util.ReportUtil;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
......
......@@ -17,8 +17,8 @@ import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import br.ufpr.c3sl.sapos.models.customization.Configuration;
import br.ufpr.c3sl.sapos.models.report.ReportUtil;
import br.ufpr.c3sl.sapos.models.scholar.enums.RegistrationKind;
import br.ufpr.c3sl.sapos.models.util.ReportUtil;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
......
......@@ -21,12 +21,12 @@ import org.springframework.roo.addon.tostring.RooToString;
import br.ufpr.c3sl.sapos.models.customization.Configuration;
import br.ufpr.c3sl.sapos.models.people.Professor;
import br.ufpr.c3sl.sapos.models.people.Student;
import br.ufpr.c3sl.sapos.models.report.ReportUtil;
import br.ufpr.c3sl.sapos.models.scholar.enums.CommitteeKind;
import br.ufpr.c3sl.sapos.models.scholar.enums.ConceptTranscript;
import br.ufpr.c3sl.sapos.models.scholar.enums.LanguageKind;
import br.ufpr.c3sl.sapos.models.scholar.enums.RegistrationKind;
import br.ufpr.c3sl.sapos.models.scholar.enums.SituationTranscript;
import br.ufpr.c3sl.sapos.models.util.ReportUtil;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
......
......@@ -22,11 +22,11 @@ import br.ufpr.c3sl.sapos.models.people.Person;
import br.ufpr.c3sl.sapos.models.people.Professor;
import br.ufpr.c3sl.sapos.models.people.Staff;
import br.ufpr.c3sl.sapos.models.people.Student;
import br.ufpr.c3sl.sapos.models.report.ReportUtil;
import br.ufpr.c3sl.sapos.models.scholar.enums.RequestStatus;
import br.ufpr.c3sl.sapos.models.scholar.enums.RequesterKind;
import br.ufpr.c3sl.sapos.models.scholar.enums.TicketKind;
import br.ufpr.c3sl.sapos.models.scholar.enums.TripKind;
import br.ufpr.c3sl.sapos.models.util.ReportUtil;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Chunk;
......@@ -90,6 +90,20 @@ public class TravelRequisition {
private String observations;
public static Object findTravelRequisitions(String requestStatus, String year) {
String sql = "";
if (!requestStatus.isEmpty())
sql += "WHERE t.request_status = '"+requestStatus+"'";
if (!year.isEmpty()) {
if (sql.isEmpty())
sql = "WHERE extract(YEAR from t.start_date) = "+year;
else
sql += " and extract(YEAR from t.start_date) = "+year;
}
return entityManager().createNativeQuery(
"SELECT * FROM travel_requisition t "+sql+" order by t.start_date", TravelRequisition.class).getResultList();
}
public static void requisitionPdf(TravelRequisition tr, HttpServletResponse response) {
response.setContentType("application/pdf");
//left,right,top,bottom margins
......
......@@ -2,5 +2,5 @@ package br.ufpr.c3sl.sapos.models.scholar.enums;
public enum TicketKind {
Aerea, Rodoviaria, Convencional, Executivo, Leito, NaoAplica;
NaoAplica, Aerea, Rodoviaria, Convencional, Executivo, Leito;
}
package br.ufpr.c3sl.sapos.models.util;
import java.io.IOException;
import java.util.Properties;
import org.springframework.core.io.support.PropertiesLoaderUtils;
public class PropertyUtil {
public static void getInstance() throws IOException {
Properties props = PropertiesLoaderUtils.loadAllProperties("WEB-INF/i18n/messages.properties");
System.out.println(props);
}
}
package br.ufpr.c3sl.sapos.models.report;
package br.ufpr.c3sl.sapos.models.util;
import java.awt.Font;
import java.io.IOException;
......
package br.ufpr.c3sl.sapos.web;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
......@@ -8,6 +10,7 @@ import org.springframework.roo.addon.web.mvc.controller.RooWebScaffold;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -70,6 +73,16 @@ public class TravelRequisitionController {
return "redirect:/travelrequisitions/" + encodeUrlPathSegment(travelRequisition.getId().toString(), httpServletRequest);
}
@ModelAttribute("requeststatusesblank")
public java.util.Collection<String> populateRequestStatusesBlank() {
ArrayList<String> l = new ArrayList<String>();
l.add("");
for (int i=0 ; i < RequestStatus.class.getEnumConstants().length ; i++)
l.add(RequestStatus.class.getEnumConstants()[i].toString());
return l/*Arrays.asList(RequestStatus.class.getEnumConstants())*/;
}
@RequestMapping(value="travelrequisitionpdf",method = RequestMethod.GET)
public void travelRequisitionPdf(@RequestParam(value = "id", required = true) String id, Model model, HttpServletResponse response) {
TravelRequisition tr = TravelRequisition.findTravelRequisition(new Long(id));
......@@ -84,4 +97,22 @@ public class TravelRequisitionController {
TravelRequisition.registrationRequisitionPdf(tr,response);
}
@RequestMapping(method = RequestMethod.GET)
public String listChoice() {
return "travelrequisitions/listchoice";
}
@RequestMapping(value="list", method = RequestMethod.GET)
public String list(@RequestParam(value = "requestStatus", required = false) String requestStatus,
@RequestParam(value = "year", required = false) String year,
Model model) {
model.addAttribute("travelrequisitions", TravelRequisition.findTravelRequisitions(requestStatus, year));
return "travelrequisitions/list";
}
/*@ModelAttribute("peopletype")
public java.util.Collection<Person> populatePeopleType() {
return Person.findAllPeopleWithType();
}*/
}
......@@ -57,18 +57,18 @@ privileged aspect TravelRequisitionController_Roo_Controller {
return "travelrequisitions/show";
}
@RequestMapping(method = RequestMethod.GET)
public String TravelRequisitionController.list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
if (page != null || size != null) {
int sizeNo = size == null ? 10 : size.intValue();
uiModel.addAttribute("travelrequisitions", TravelRequisition.findTravelRequisitionEntries(page == null ? 0 : (page.intValue() - 1) * sizeNo, sizeNo));
float nrOfPages = (float) TravelRequisition.countTravelRequisitions() / sizeNo;
uiModel.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
} else {
uiModel.addAttribute("travelrequisitions", TravelRequisition.findAllTravelRequisitions());
}
return "travelrequisitions/list";
}
// @RequestMapping(method = RequestMethod.GET)
// public String TravelRequisitionController.list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
// if (page != null || size != null) {
// int sizeNo = size == null ? 10 : size.intValue();
// uiModel.addAttribute("travelrequisitions", TravelRequisition.findTravelRequisitionEntries(page == null ? 0 : (page.intValue() - 1) * sizeNo, sizeNo));
// float nrOfPages = (float) TravelRequisition.countTravelRequisitions() / sizeNo;
// uiModel.addAttribute("maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages));
// } else {
// uiModel.addAttribute("travelrequisitions", TravelRequisition.findAllTravelRequisitions());
// }
// return "travelrequisitions/list";
// }
// @RequestMapping(method = RequestMethod.PUT)
// public String TravelRequisitionController.update(@Valid TravelRequisition travelRequisition, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
......
......@@ -7,7 +7,7 @@
<table:column id="c_br_ufpr_c3sl_sapos_models_scholar_Committee_student" property="student" z="GvO7JdvlG2YpGZwJsmvpH14s7X8=" navigation = "true"/>
<table:column id="c_br_ufpr_c3sl_sapos_models_scholar_Committee_kind" property="kind" z="y+wOjPZ6KCENRSI6xj1h8lpxFzg="/>
<table:column id="c_br_ufpr_c3sl_sapos_models_scholar_Registration_thesisTitle" property="registration.thesisTitle" z="GvO7JdvlG2YpGZwJsmvpH14s7X8=" navigation = "true"/>
<table:column id="c_br_ufpr_c3sl_sapos_models_scholar_Registration_thesisTitle" property="student.thesisTitle" z="GvO7JdvlG2YpGZwJsmvpH14s7X8=" navigation = "true"/>
<table:column id="c_br_ufpr_c3sl_sapos_models_scholar_Committee_participants" property="participants" z="EceBPGWSPGScveThhwlzD/8oqfM=" navigation="true"/>
<table:column id="c_br_ufpr_c3sl_sapos_models_scholar_Committee_date" property="date" z="pcGiMZqozmv+2wHdxA0oVbtk66U="/>
<table:column id="c_br_ufpr_c3sl_sapos_models_scholar_Committee_observations" property="observations" z="IgB7ojsAYLsc5FVA8qgyBljf3V0="/>
......
......@@ -5,7 +5,7 @@
<form:create id="fc_br_ufpr_c3sl_sapos_models_scholar_TravelRequisition" modelAttribute="travelRequisition" path="/travelrequisitions" render="${empty dependencies}" z="user-managed">
<b>Requirente</b>
<p/>
<field:select disableFormBinding="true" field="person" id="c_br_ufpr_c3sl_sapos_models_scholar_TravelRequisition_person" itemValue="id" items="${people}" path="/people" z="user-managed"/>
<field:select field="person" id="c_br_ufpr_c3sl_sapos_models_scholar_TravelRequisition_person" itemValue="id" items="${people}" path="/people" z="user-managed"/>
<field:select field="requesterKind" id="c_br_ufpr_c3sl_sapos_models_scholar_TravelRequisition_requesterKind" items="${requesterkinds}" path="requesterkinds" z="user-managed"/>
<field:input field="profession" id="c_br_ufpr_c3sl_sapos_models_scholar_TravelRequisition_profession" z="user-managed"/>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<div xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:field="urn:jsptagdir:/WEB-INF/tags/form/fields" xmlns:form="urn:jsptagdir:/WEB-INF/tags/form" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:spring="http://www.springframework.org/tags" version="2.0">
<jsp:output omit-xml-declaration="yes"/>
<b>Listagem Requisições de Viagem</b> <p/>
<p/>
<form name="listchoice" action="travelrequisitions/list" method="get">
<field:select disableFormBinding="true" field="requestStatus" id="c_br_ufpr_c3sl_sapos_models_scholar_TravelRequisition_requestStatus" items="${requeststatusesblank}" path="requeststatusesblank" z="user-managed"/>
<field:input disableFormBinding="true" field="year" id="c_br_ufpr_c3sl_sapos_models_scholar_SectionPos_sectionYear"
validationMessageCode="field_invalid_integer" z="user-managed"/>
<input type="submit" value="Enviar"/>
</form>
<form:dependency dependencies="${dependencies}" id="d_br_ufpr_c3sl_sapos_models_people_Student" render="${not empty dependencies}" z="gW+juyJp3mRm7nWlqYbCfkbtYVo="/>
</div>
......@@ -5,7 +5,7 @@
<form:update id="fu_br_ufpr_c3sl_sapos_models_scholar_TravelRequisition" modelAttribute="travelRequisition" path="/travelrequisitions" versionField="Version" z="user-managed">
<b>Requirente</b>
<p/>
<field:select disableFormBinding="true" field="person" id="c_br_ufpr_c3sl_sapos_models_scholar_TravelRequisition_person" itemValue="id" items="${people}" path="/people" z="user-managed"/>
<field:select field="person" id="c_br_ufpr_c3sl_sapos_models_scholar_TravelRequisition_person" itemValue="id" items="${people}" path="/people" z="user-managed"/>
<field:select field="requesterKind" id="c_br_ufpr_c3sl_sapos_models_scholar_TravelRequisition_requesterKind" items="${requesterkinds}" path="requesterkinds" z="user-managed"/>
<field:input field="profession" id="c_br_ufpr_c3sl_sapos_models_scholar_TravelRequisition_profession" z="user-managed"/>
......
......@@ -13,4 +13,7 @@
<definition extends="default" name="travelrequisitions/update">
<put-attribute name="body" value="/WEB-INF/views/travelrequisitions/update.jspx"/>
</definition>
<definition extends="default" name="travelrequisitions/listchoice">
<put-attribute name="body" value="/WEB-INF/views/travelrequisitions/listchoice.jspx"/>
</definition>
</tiles-definitions>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment