use of com.tomasio.projects.trainning.dao.TurmaDAO in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method createPreMatricula.
@Override
@Transactional
public Long createPreMatricula(PreMatriculaDTO preMatricula) {
PreMatriculaDAO preMatriculaDAO = factory.getPreMatriculaDAO();
IndicacaoDAO indicacaoDAO = factory.getIndicacaoDAO();
TurmaDAO turmaDAO = factory.getTurmaDAO();
PreMatricula _preMatricula = null;
if (preMatricula instanceof PreMatriculaAlunoDTO) {
_preMatricula = new PreMatriculaAluno((PreMatriculaAlunoDTO) preMatricula);
} else {
_preMatricula = new PreMatriculaInstrutor((PreMatriculaInstrutorDTO) preMatricula);
}
Long id = null;
try {
Indicacao _indicacao = _preMatricula.getIndicacao();
TurmaEfetiva _turma = _preMatricula.getTurma();
id = preMatriculaDAO.create(_preMatricula);
_indicacao.setPreMatriculado(true);
_turma.setPreAtivado(true);
indicacaoDAO.update(_indicacao);
turmaDAO.update(_turma);
} catch (DAOException ex) {
ex.printStackTrace();
throw new CoreException(ex.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
}
return id;
}
use of com.tomasio.projects.trainning.dao.TurmaDAO in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method removePreMatricula.
@Override
@Transactional
public void removePreMatricula(Long preMatriculaId) {
PreMatriculaDAO preMatriculaDAO = factory.getPreMatriculaDAO();
IndicacaoDAO indicacaoDAO = factory.getIndicacaoDAO();
TurmaDAO turmaDAO = factory.getTurmaDAO();
try {
PreMatricula preMatricula = preMatriculaDAO.find(preMatriculaId);
Indicacao indicacao = preMatricula.getIndicacao();
TurmaEfetiva turma = preMatricula.getTurma();
preMatriculaDAO.remove(preMatriculaId);
indicacao.setPreMatriculado(false);
indicacaoDAO.update(indicacao);
if (hasPreMatriculas(turma.getId())) {
turma.setPreAtivado(true);
} else {
turma.setPreAtivado(false);
}
turmaDAO.update(turma);
} catch (DAOException ex) {
ex.printStackTrace();
throw new CoreException(ex.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
}
}
use of com.tomasio.projects.trainning.dao.TurmaDAO in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method findAllOrganizacoesGestoras.
@Override
@Transactional(readOnly = true)
public OrganizacaoDTO[] findAllOrganizacoesGestoras() {
TurmaDAO dao = factory.getTurmaDAO();
List<OrganizacaoDTO> organizacoes;
OrganizacaoDTO[] organizacoesArray = null;
try {
organizacoes = dao.findAllOrganizacoesGestoras();
organizacoesArray = new OrganizacaoDTO[organizacoes.size()];
for (int i = 0; i < organizacoes.size(); i++) {
organizacoesArray[i] = organizacoes.get(i);
}
return organizacoesArray;
} catch (DAOException ex) {
ex.printStackTrace();
throw new CoreException(ex.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
throw new CoreException(ex.getMessage());
}
}
use of com.tomasio.projects.trainning.dao.TurmaDAO in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method findAllTurmasEfetivasIds.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public Long[] findAllTurmasEfetivasIds(Date exercicio, Long organizacaoGestoraId) {
TurmaDAO dao = factory.getTurmaDAO();
try {
List<Long> turmasIds = dao.findAllTurmasEfetivasIds(exercicio, organizacaoGestoraId);
Long[] turmasIdsArray = new Long[turmasIds.size()];
turmasIds.toArray(turmasIdsArray);
return turmasIdsArray;
} catch (DAOException ex) {
throw new CoreException(ex.getMessage());
} catch (Exception ex) {
throw new CoreException(ex.getMessage());
}
}
use of com.tomasio.projects.trainning.dao.TurmaDAO in project trainning by fernandotomasio.
the class ImportTurmasImplEfetivasFromTabelao method recuperarDocumentos.
private void recuperarDocumentos(String codCurso, String numeroTurma, TurmaEfetiva turmaCriada, Connection conn) {
SimpleDateFormat df = new SimpleDateFormat("yyyy");
ContentDAO contentDAO = new AlfrescoContentDAO();
TurmaDAO turmaDAO = new HibernateTurmaDAO();
String documentsRoot = "SGC/Documentos de Treinamentos/testes";
String oldFolderName = "D-CTP/Documentos de Treinamentos/2013/" + codCurso + "-" + numeroTurma;
String newFolderName = df.format(turmaCriada.getExercicio()) + "_" + turmaCriada.getCurso().getCodigo() + "_" + turmaCriada.getNumeroTurma() + "_" + turmaCriada.getId();
try {
WebServiceFactory.setEndpointAddress("http://dctp.decea.intraer:8080/ecm/api");
boolean existsOldFolder = contentExistsByPath(oldFolderName);
if (existsOldFolder) {
WebServiceFactory.setEndpointAddress("http://10.32.63.32:8080/alfresco/api");
FolderDTO folder = new FolderDTO();
folder.setName(newFolderName);
String folderId = contentDAO.createFolder(folder, documentsRoot);
turmaCriada.setFolderId(folderId);
turmaDAO.update(turmaCriada);
WebServiceFactory.setEndpointAddress("http://dctp.decea.intraer:8080/ecm/api");
ContentDTO[] contents = findAllContentByPath(oldFolderName);
for (ContentDTO content : contents) {
WebServiceFactory.setEndpointAddress("http://dctp.decea.intraer:8080/ecm/api");
DocumentDTO document = findDocumentByUUID(content.getUid());
document.setMimeType("application/pdf");
WebServiceFactory.setEndpointAddress("http://10.32.63.32:8080/alfresco/api");
contentDAO.createDocumentWithUUIDParent(document, folderId);
}
}
} catch (Exception ex) {
Logger.getLogger(ImportTurmasImplEfetivasFromTabelao.class.getName()).log(Level.SEVERE, null, ex);
}
}
Aggregations