use of com.tomasio.projects.trainning.exeption.CoreException in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method createApostila.
@Override
@Transactional
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public Long createApostila(ApostilaDTO apostila) {
ApostilaDAO dao = factory.getApostilaDAO();
ContentDAO contentDAO = factory.getContentDAO();
String documentsRoot = "SGC/Material Didático/Apostilas";
Apostila model = new Apostila(apostila);
Long id = null;
try {
id = dao.create(model);
model = dao.find(id);
String folderName = apostila.getDisciplina().getCurriculoMinimo().getCurso().getCodigo() + "_" + model.getId() + "_" + apostila.getDisciplina().getNumeroGeral() + "_" + apostila.getDisciplina().getDescricao();
String finalPath = documentsRoot + "/" + folderName;
if (contentDAO.contentExistsByPath(finalPath) == false) {
FolderDTO folder = new FolderDTO();
folder.setName(folderName);
String folderId = contentDAO.createFolder(folder, documentsRoot);
FolderDTO assetsFolder = new FolderDTO();
assetsFolder.setName("assets");
String assetsFolderId = contentDAO.createFolderWithUUIDParent(assetsFolder, folderId);
model.setAssetsFolderId(assetsFolderId);
model.setFolderId(folderId);
dao.update(model);
}
} 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.getMessage());
}
return id;
}
use of com.tomasio.projects.trainning.exeption.CoreException in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method updateUnidadeDidatica.
@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public void updateUnidadeDidatica(UnidadeDidaticaDTO unidade) {
UnidadeDidaticaDAO dao = factory.getUnidadeDidaticaDAO();
UnidadeDidatica model = new UnidadeDidatica(unidade);
try {
dao.update(model);
} 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.getMessage());
}
}
use of com.tomasio.projects.trainning.exeption.CoreException in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findConceituacao.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public ConceituacaoDTO findConceituacao(Long id) {
ConceituacaoDAO dao = factory.getConceituacaoDAO();
Conceituacao conceituacao = null;
try {
conceituacao = dao.find(id);
} 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.getMessage());
}
if (conceituacao != null) {
return conceituacao.createDTO();
} else {
return null;
}
}
use of com.tomasio.projects.trainning.exeption.CoreException in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findReferencia.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public ReferenciaDTO findReferencia(Long id) {
ReferenciaDAO dao = factory.getReferenciaDAO();
Referencia referencia = null;
try {
referencia = dao.find(id);
} 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.getMessage());
}
if (referencia != null) {
return referencia.createDTO();
} else {
return null;
}
}
use of com.tomasio.projects.trainning.exeption.CoreException in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findAllCurriculosMinimos.
@Override
@Transactional(readOnly = true)
public CurriculoMinimoDTO[] findAllCurriculosMinimos() {
CurriculoMinimoDAO dao = factory.getCurriculoMinimoDAO();
CurriculoMinimoDTO[] curriculosArray = null;
try {
List<CurriculoMinimo> curriculos = dao.findAllCurriculosMinimos();
if (curriculos != null) {
curriculosArray = new CurriculoMinimoDTO[curriculos.size()];
for (int i = 0; i < curriculos.size(); i++) {
curriculosArray[i] = curriculos.get(i).createDTO();
}
}
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
return curriculosArray;
}
Aggregations