Search in sources :

Example 1 with AnaliseDTO

use of com.tomasio.projects.trainning.dto.AnaliseDTO in project trainning by fernandotomasio.

the class Analise method createDTOMinimal.

public AnaliseDTO createDTOMinimal() {
    AnaliseDTO dto = new AnaliseDTO();
    dto.setId(id);
    dto.setQuantidade(quantidade);
    dto.setFundamentacao(fundamentacao);
    dto.setObjectId(this.getObjectId());
    return dto;
}
Also used : AnaliseDTO(com.tomasio.projects.trainning.dto.AnaliseDTO)

Example 2 with AnaliseDTO

use of com.tomasio.projects.trainning.dto.AnaliseDTO in project trainning by fernandotomasio.

the class Analise method createDTOWithoutDependencies.

public AnaliseDTO createDTOWithoutDependencies() {
    AnaliseDTO dto = createDTOMinimal();
    if (organizacao != null) {
        dto.setOrganizacao(organizacao.createDTOMinimal());
    }
    if (responsavel != null) {
        dto.setResponsavel(responsavel.createDTOMinimal());
    }
    if (itemPlanejamento != null) {
        dto.setItemPlanejamento(itemPlanejamento.createDTOMinimal());
    }
    dto.setId(id);
    dto.setQuantidade(quantidade);
    dto.setObjectId(this.getObjectId());
    return dto;
}
Also used : AnaliseDTO(com.tomasio.projects.trainning.dto.AnaliseDTO)

Example 3 with AnaliseDTO

use of com.tomasio.projects.trainning.dto.AnaliseDTO in project trainning by fernandotomasio.

the class MainPlanejamentoController method saveAnaliseAjax.

@RequestMapping("/save_analise")
@ResponseBody
public boolean saveAnaliseAjax(Model model, WebRequest request) {
    String itemPlanejamentoIdParam = request.getParameter("itemPlanejamentoId");
    String quantidadeParam = request.getParameter("quantidade");
    String organizacaoIdParam = request.getParameter("organizacaoId");
    String fundamentacao = request.getParameter("fundamentacao");
    String responsavelIdParam = request.getParameter("responsavelId");
    String idParam = request.getParameter("id");
    Long id = null;
    try {
        id = Long.parseLong(idParam);
    } catch (NumberFormatException e) {
    }
    Long itemPlanejamentoId = Long.parseLong(itemPlanejamentoIdParam);
    int quantidade = Integer.parseInt(quantidadeParam);
    Long organizacaoId = Long.parseLong(organizacaoIdParam);
    Long responsavelId = Long.parseLong(responsavelIdParam);
    AnaliseDTO dto = new AnaliseDTO();
    dto.setQuantidade(quantidade);
    dto.setFundamentacao(fundamentacao);
    dto.setItemPlanejamento(planningService.findItemPlanejamento(itemPlanejamentoId));
    dto.setOrganizacao(organizationalService.findOrganizacao(organizacaoId));
    dto.setResponsavel(organizationalService.findOrganizacao(responsavelId));
    if (id != null) {
        dto.setId(id);
        // try {
        // dto.setId(treinamentoPlanejadoForm.getId());
        planningService.updateAnalise(dto);
    // model.addAttribute("message", "Treinamento planejado atualizado com sucesso.");
    // } catch (CoreException e) {
    // model.addAttribute("errMessage", e.getMessage());
    // }
    } else {
        planningService.createAnalise(dto);
    }
    return true;
}
Also used : AnaliseDTO(com.tomasio.projects.trainning.dto.AnaliseDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with AnaliseDTO

use of com.tomasio.projects.trainning.dto.AnaliseDTO in project trainning by fernandotomasio.

the class MainPlanejamentoController method saveAnalise.

@RequestMapping("/save_analise_ajax")
public String saveAnalise(Model model, @Valid AnaliseForm analiseForm, BindingResult bindingResult, WebRequest request) {
    if (bindingResult.hasErrors()) {
        StripItemPlanejamentoDTO strip = planningService.findStripItemPlanejamento(analiseForm.getItemPlanejamentoId(), analiseForm.getOrganizacaoId());
        OrganizacaoDTO responsavel = organizationalService.findOrganizacao(analiseForm.getResponsavelId());
        model.addAttribute("responsavel", responsavel);
        model.addAttribute("strip", strip);
        return "planejamento/analise_ajax";
    }
    AnaliseDTO dto = new AnaliseDTO();
    dto.setQuantidade(analiseForm.getQuantidade());
    dto.setFundamentacao(analiseForm.getFundamentacao());
    dto.setItemPlanejamento(planningService.findItemPlanejamento(analiseForm.getItemPlanejamentoId()));
    dto.setOrganizacao(organizationalService.findOrganizacao(analiseForm.getOrganizacaoId()));
    dto.setResponsavel(organizationalService.findOrganizacao(analiseForm.getResponsavelId()));
    if (analiseForm.getId() > 0) {
        try {
            dto.setId(analiseForm.getId());
            planningService.updateAnalise(dto);
            model.addAttribute("message", "AnĂ¡lise atualizada com sucesso.");
        } catch (CoreException e) {
            model.addAttribute("errMessage", e.getMessage());
        }
    } else {
        try {
            planningService.createAnalise(dto);
            model.addAttribute("message", "AnĂ¡lise criada com sucesso.");
        } catch (CoreException e) {
            model.addAttribute("errMessage", e.getMessage());
        }
    }
    return "planejamento/analise_ajax";
}
Also used : CoreException(com.tomasio.projects.trainning.exeption.CoreException) StripItemPlanejamentoDTO(com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) AnaliseDTO(com.tomasio.projects.trainning.dto.AnaliseDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with AnaliseDTO

use of com.tomasio.projects.trainning.dto.AnaliseDTO in project trainning by fernandotomasio.

the class MainPlanejamentoController method findAnalise.

@RequestMapping("/find_analise")
@ResponseBody
public Map findAnalise(Model model, WebRequest request) {
    String analiseIdParam = request.getParameter("analiseId");
    Long analiseId = Long.parseLong(analiseIdParam);
    AnaliseDTO analise = planningService.findAnalise(analiseId);
    Map result = new HashMap();
    result.put("organizacaoId", analise.getOrganizacao().getId());
    result.put("itemPlanejamentoId", analise.getItemPlanejamento().getId());
    result.put("quantidade", analise.getQuantidade());
    result.put("id", analise.getId());
    result.put("responsavelId", analise.getResponsavel().getId());
    result.put("fundamentacao", analise.getFundamentacao());
    return result;
}
Also used : HashMap(java.util.HashMap) AnaliseDTO(com.tomasio.projects.trainning.dto.AnaliseDTO) Map(java.util.Map) HashMap(java.util.HashMap) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

AnaliseDTO (com.tomasio.projects.trainning.dto.AnaliseDTO)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 StripItemPlanejamentoDTO (com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO)4 Map (java.util.Map)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 ItemPlanejamentoDTO (com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO)2 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)2 ResponsavelAreaDTO (com.tomasio.projects.trainning.dto.ResponsavelAreaDTO)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 AcaoDTO (com.tomasio.projects.trainning.dto.AcaoDTO)1 AreaDTO (com.tomasio.projects.trainning.dto.AreaDTO)1 DecisaoDTO (com.tomasio.projects.trainning.dto.DecisaoDTO)1 ItemAtaDTO (com.tomasio.projects.trainning.dto.ItemAtaDTO)1 PlanejamentoDTO (com.tomasio.projects.trainning.dto.PlanejamentoDTO)1 CoreException (com.tomasio.projects.trainning.exeption.CoreException)1 AnaliseForm (com.tomasio.projects.trainning.form.AnaliseForm)1 AtaService (com.tomasio.projects.trainning.interfaces.AtaService)1 PlanningService (com.tomasio.projects.trainning.interfaces.PlanningService)1 TrainningService (com.tomasio.projects.trainning.interfaces.TrainningService)1