Search in sources :

Example 1 with AnaliseForm

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";
}
Also used : StripItemPlanejamentoDTO(com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) AnaliseDTO(com.tomasio.projects.trainning.dto.AnaliseDTO) AnaliseForm(com.tomasio.projects.trainning.form.AnaliseForm) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

AnaliseDTO (com.tomasio.projects.trainning.dto.AnaliseDTO)1 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)1 StripItemPlanejamentoDTO (com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO)1 AnaliseForm (com.tomasio.projects.trainning.form.AnaliseForm)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1