Search in sources :

Example 1 with CampoDTO

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

the class CurriculosMinimosController method initializeSelectableCampos.

public Map<Long, String> initializeSelectableCampos() {
    Map<Long, String> selectableCampos = new HashMap<Long, String>();
    CampoDTO[] campos = teachingDocumentsService.findAllCampos();
    for (CampoDTO campo : campos) {
        selectableCampos.put(campo.getId(), campo.getDescricao());
    }
    return selectableCampos;
}
Also used : HashMap(java.util.HashMap) CampoDTO(com.tomasio.projects.trainning.dto.CampoDTO)

Example 2 with CampoDTO

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

the class CurriculosMinimosController method saveDisciplina.

public void saveDisciplina(DisciplinaCMForm disciplinaCMForm) {
    RequestContext requestContext = RequestContextHolder.getRequestContext();
    CurriculoMinimoForm cmForm = requestContext.getFlowScope().get("cMForm", CurriculoMinimoForm.class);
    CurriculoMinimoDTO curriculoMinimo = teachingDocumentsService.findCurriculoMinimo(cmForm.getId());
    DisciplinaDTO disciplina = new DisciplinaDTO();
    disciplina.setNumeroDisciplina(disciplinaCMForm.getNumero());
    disciplina.setId(disciplinaCMForm.getId());
    disciplina.setDescricao(disciplinaCMForm.getDescricao());
    disciplina.setQuantidadeTemposAula(disciplinaCMForm.getCargaHorariaInstrucao());
    disciplina.setQuantidadeTemposAvaliacao(disciplinaCMForm.getCargaHorariaAvaliacao());
    disciplina.setCurriculoMinimo(curriculoMinimo);
    AreaEnsinoDTO area = teachingDocumentsService.findAreaConhecimento(disciplinaCMForm.getAreaEnsinoId());
    disciplina.setAreaEnsino(area);
    CampoDTO campo = teachingDocumentsService.findCampo(disciplinaCMForm.getCampoId());
    disciplina.setCampo(campo);
    disciplinaCMForm.setCampoLabel(campo.getDescricao());
    disciplinaCMForm.setAreaEnsinoLabel(area.getNome());
    if (disciplina.getId() == null) {
        Long id = teachingDocumentsService.createDisciplina(disciplina);
        disciplinaCMForm.setId(id);
        List<DisciplinaCMForm> disciplinasDataList = cmForm.getDisciplinasDataList();
        disciplinasDataList.add(disciplinaCMForm);
    } else {
        teachingDocumentsService.updateDisciplina(disciplina);
    }
}
Also used : DisciplinaDTO(com.tomasio.projects.trainning.dto.DisciplinaDTO) ObjetivoDisciplinaDTO(com.tomasio.projects.trainning.dto.ObjetivoDisciplinaDTO) CampoDTO(com.tomasio.projects.trainning.dto.CampoDTO) DisciplinaCMForm(com.tomasio.projects.trainning.form.cm.DisciplinaCMForm) CurriculoMinimoDTO(com.tomasio.projects.trainning.dto.CurriculoMinimoDTO) RequestContext(org.springframework.webflow.execution.RequestContext) CurriculoMinimoForm(com.tomasio.projects.trainning.form.cm.CurriculoMinimoForm) AreaEnsinoDTO(com.tomasio.projects.trainning.dto.AreaEnsinoDTO)

Example 3 with CampoDTO

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

the class TeachingDocumentsServiceSimpleImpl method findAllCampos.

@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public CampoDTO[] findAllCampos() {
    CampoDAO dao = factory.getCampoDAO();
    CampoDTO[] camposArray = null;
    try {
        List<Campo> campos = dao.findAll();
        camposArray = new CampoDTO[campos.size()];
        for (int i = 0; i < camposArray.length; i++) {
            camposArray[i] = campos.get(i).createDTO();
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    } catch (Exception ex) {
        throw new CoreException("Erro de sistema: " + ex.toString());
    }
    return camposArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Campo(com.tomasio.projects.trainning.model.Campo) CoreException(com.tomasio.projects.trainning.exeption.CoreException) CampoDTO(com.tomasio.projects.trainning.dto.CampoDTO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DAOException(com.tomasio.projects.trainning.exception.DAOException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with CampoDTO

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

the class Campo method createDTO.

public CampoDTO createDTO() {
    CampoDTO dto = new CampoDTO();
    dto.setDescricao(descricao);
    dto.setId(id);
    dto.setSigla(sigla);
    return dto;
}
Also used : CampoDTO(com.tomasio.projects.trainning.dto.CampoDTO)

Aggregations

CampoDTO (com.tomasio.projects.trainning.dto.CampoDTO)4 AreaEnsinoDTO (com.tomasio.projects.trainning.dto.AreaEnsinoDTO)1 CurriculoMinimoDTO (com.tomasio.projects.trainning.dto.CurriculoMinimoDTO)1 DisciplinaDTO (com.tomasio.projects.trainning.dto.DisciplinaDTO)1 ObjetivoDisciplinaDTO (com.tomasio.projects.trainning.dto.ObjetivoDisciplinaDTO)1 DAOException (com.tomasio.projects.trainning.exception.DAOException)1 CoreException (com.tomasio.projects.trainning.exeption.CoreException)1 CurriculoMinimoForm (com.tomasio.projects.trainning.form.cm.CurriculoMinimoForm)1 DisciplinaCMForm (com.tomasio.projects.trainning.form.cm.DisciplinaCMForm)1 Campo (com.tomasio.projects.trainning.model.Campo)1 HashMap (java.util.HashMap)1 Transactional (org.springframework.transaction.annotation.Transactional)1 RequestContext (org.springframework.webflow.execution.RequestContext)1