@Override public LogEntry findLogEntry(Object logId) throws Exception { Log log = reader.getLog((Long) logId); if (log != null) { LogBuilder logBuilder = LogBuilder.log(log); for (edu.msu.nscl.olog.api.Attachment attachments : reader.listAttachments(log.getId())) { logBuilder.attach(AttachmentBuilder.attachment(attachments)); } return new OlogEntry(logBuilder.build()); } return new OlogEntry(log); }
@Override public Collection<Attachment> listAttachments(final Object logId) throws Exception { return Collections.unmodifiableCollection( Collections2.transform( reader.listAttachments((Long) logId), new Function<edu.msu.nscl.olog.api.Attachment, Attachment>() { @Override public Attachment apply(edu.msu.nscl.olog.api.Attachment input) { // TODO (shroffk) n/w call try { return new OlogAttachment(input, getAttachment(logId, input.getFileName())); } catch (IOException e) { } return null; } })); }