@Override @Transaction public void deleteNote(TopiaContext transaction, String topiaId) throws TopiaException, LogicException { NoteDAO dao = SandraDAOHelper.getNoteDAO(transaction); Note note = dao.findByTopiaId(topiaId); if (note == null) { throw new LogicException("error.service.note.unfound"); } dao.delete(note); String name = SandraConfigHelper.getNoteDir(SandraConfig.getConfig()) + File.separator + note.getNom(); boolean deleted = new File(name).delete(); if (!deleted) { log.error("Cant delete note : " + name); } }
@Override @Transaction public void deleteNote(TopiaContext transaction, String topiaId) throws TopiaException, LogicException { NoteDAO dao = SandraDAOHelper.getNoteDAO(transaction); Note note = dao.findByTopiaId(topiaId); if (note == null) { throw new LogicException("error.service.note.unfound"); } dao.delete(note); String name = SandraConfigHelper.getNoteDir(SandraConfig.getConfig()) + File.separator + note.getNom(); boolean deleted = new File(name).delete(); if (!deleted) { log.error("Cant delete note : " + name); } }
NoteDAO dao = SandraDAOHelper.getNoteDAO(transaction); Note noteByNom = dao.findByNom(note.getNom()); if (noteByNom != null) { throw new LogicException("error.service.note.exist"); note2.setNom(note.getNom()); note2.setDescription(note.getDescription()); note2.setContentType(note.getContentType()); String name = SandraConfigHelper.getNoteDir(SandraConfig.getConfig()) + File.separator + note2.getNom(); try { OutputStream outputStream = new FileOutputStream(name);
NoteDAO dao = SandraDAOHelper.getNoteDAO(transaction); Note noteByNom = dao.findByNom(note.getNom()); if (noteByNom != null) { throw new LogicException("error.service.note.exist"); note2.setNom(note.getNom()); note2.setDescription(note.getDescription()); note2.setContentType(note.getContentType()); String name = SandraConfigHelper.getNoteDir(SandraConfig.getConfig()) + File.separator + note2.getNom(); try { OutputStream outputStream = new FileOutputStream(name);
@Override @Transaction public InputStream getFileNote(TopiaContext transaction, String topiaId) throws TopiaException, LogicException { NoteDAO dao = SandraDAOHelper.getNoteDAO(transaction); Note note = dao.findByTopiaId(topiaId); if (note == null) { throw new LogicException("error.service.note.unfound"); } String name = SandraConfigHelper.getNoteDir(SandraConfig.getConfig()) + File.separator + note.getNom(); InputStream inputStream; try { inputStream = new FileInputStream(name); } catch (FileNotFoundException ex) { throw new LogicException("error.service.file.unfound", ex); } return inputStream; }
@Override @Transaction public InputStream getFileNote(TopiaContext transaction, String topiaId) throws TopiaException, LogicException { NoteDAO dao = SandraDAOHelper.getNoteDAO(transaction); Note note = dao.findByTopiaId(topiaId); if (note == null) { throw new LogicException("error.service.note.unfound"); } String name = SandraConfigHelper.getNoteDir(SandraConfig.getConfig()) + File.separator + note.getNom(); InputStream inputStream; try { inputStream = new FileInputStream(name); } catch (FileNotFoundException ex) { throw new LogicException("error.service.file.unfound", ex); } return inputStream; }