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;
}
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);
}
}
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;
}
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;
}
Aggregations