use of com.tomasio.projects.trainning.form.AnaliseForm in project trainning by fernandotomasio.
the class MainPlanejamentoController method analiseAjax.
@RequestMapping("/analise_ajax")
public String analiseAjax(Model model, WebRequest request) {
String itemPlanejamentoId = request.getParameter("itemPlanejamentoId");
String organizacaoId = request.getParameter("organizacaoId");
String responsavelId = request.getParameter("responsavelId");
StripItemPlanejamentoDTO strip = planningService.findStripItemPlanejamento(Long.parseLong(itemPlanejamentoId), Long.parseLong(organizacaoId));
OrganizacaoDTO responsavel = organizationalService.findOrganizacao(Long.parseLong(responsavelId));
AnaliseDTO analiseResponsavel;
Map<String, AnaliseDTO> analises = strip.getAnalises();
if (analises == null) {
analiseResponsavel = null;
} else {
analiseResponsavel = analises.get(responsavelId);
}
AnaliseForm analiseForm = new AnaliseForm();
if (null == analiseResponsavel) {
analiseForm.setItemPlanejamentoId(Long.parseLong(itemPlanejamentoId));
analiseForm.setOrganizacaoId(Long.parseLong(organizacaoId));
analiseForm.setResponsavelId(Long.parseLong(responsavelId));
} else {
analiseForm.setId(analiseResponsavel.getId());
analiseForm.setItemPlanejamentoId(Long.parseLong(itemPlanejamentoId));
analiseForm.setOrganizacaoId(Long.parseLong(organizacaoId));
analiseForm.setResponsavelId(Long.parseLong(responsavelId));
analiseForm.setQuantidade(analiseResponsavel.getQuantidade());
analiseForm.setFundamentacao(analiseResponsavel.getFundamentacao());
}
model.addAttribute("responsavel", responsavel);
model.addAttribute("strip", strip);
model.addAttribute(analiseForm);
return "planejamento/analise_ajax";
}
Aggregations