@Override public void removeNotes(Note notes) { fireOnPreWrite(PROPERTY_NOTES, notes, null); if (this.notes == null || !this.notes.remove(notes)) { throw new IllegalArgumentException("List does not contain given element"); } notes.setEleveur(null); fireOnPostWrite(PROPERTY_NOTES, this.notes.size() + 1, notes, null); }
NoteDAO dao = SandraDAOHelper.getNoteDAO(transaction); Note noteByNom = dao.findByNom(note.getNom()); if (noteByNom != null) { throw new LogicException("error.service.note.exist"); String topiaId = note.getTopiaId(); if (topiaId == null || "".equals(topiaId)) { log.info("has created note " + note2.getTopiaId()); log.info("update note " + note2.getTopiaId()); 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);
if (entity.equals(item.getEleveur())) { item.setEleveur(null);
@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"); String topiaId = note.getTopiaId(); if (topiaId == null || "".equals(topiaId)) { log.info("has created note " + note2.getTopiaId()); log.info("update note " + note2.getTopiaId()); 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 public void addNotes(Note notes) { fireOnPreWrite(PROPERTY_NOTES, null, notes); if (this.notes == null) { this.notes = new ArrayList<Note>(); } notes.setEleveur(this); this.notes.add(notes); fireOnPostWrite(PROPERTY_NOTES, this.notes.size(), null, notes); }
@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 public void clearNotes() { if (this.notes == null) { return; } for (Note item : this.notes) { item.setEleveur(null); } Collection<Note> oldValue = new ArrayList<Note>(this.notes); fireOnPreWrite(PROPERTY_NOTES, oldValue, this.notes); this.notes.clear(); fireOnPostWrite(PROPERTY_NOTES, oldValue, this.notes); }
@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; }
eleveur.addAllNotes(notes); for (Note noteDuplicated : notes) { noteDuplicated.setEleveur(eleveur);
eleveur.addAllNotes(notes); for (Note noteDuplicated : notes) { noteDuplicated.setEleveur(eleveur);