Ejemplo n.º 1
0
 public static AttachmentBuilder attachment(File file) {
   AttachmentBuilder builder = new AttachmentBuilder();
   builder.fileName = file.getName();
   FileDataSource fileDataSource = new FileDataSource(file);
   builder.fileContent = new DataHandler(fileDataSource);
   return builder;
 }
Ejemplo n.º 2
0
 public static AttachmentBuilder attachment(String uri) {
   AttachmentBuilder builder = new AttachmentBuilder();
   File fileToUpload = new File(uri);
   FileDataSource fileDataSource = new FileDataSource(fileToUpload);
   builder.fileName = fileToUpload.getName();
   builder.fileContent = new DataHandler(fileDataSource);
   return builder;
 }
Ejemplo n.º 3
0
 public static AttachmentBuilder attachment(Attachment attach) {
   AttachmentBuilder builder = new AttachmentBuilder();
   builder.fileName = attach.getFileName();
   builder.contentType = attach.getContentType();
   builder.thumbnail = attach.getThumbnail();
   builder.fileSize = attach.getFileSize();
   return builder;
 }
Ejemplo n.º 4
0
 @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);
 }