Exemplo n.º 1
0
 /**
  * A utility method to create a edu.msu.nscl.olog.api.LogBuilder from
  * org.csstudio.logbook.LogEntry
  *
  * @param logEntry
  * @return
  */
 private LogBuilder LogBuilder(LogEntry logEntry) {
   LogBuilder logBuilder = log().description(logEntry.getText()).level("Info");
   for (Tag tag : logEntry.getTags()) logBuilder.appendTag(tag(tag.getName(), tag.getState()));
   for (Logbook logbook : logEntry.getLogbooks())
     logBuilder.appendToLogbook(logbook(logbook.getName()).owner(logbook.getOwner()));
   for (Property property : logEntry.getProperties()) {
     PropertyBuilder propertyBuilder = property(property.getName());
     for (Entry<String, String> attribute : property.getAttributes()) {
       propertyBuilder.attribute(attribute.getKey(), attribute.getValue());
     }
     logBuilder.appendProperty(propertyBuilder);
   }
   return logBuilder;
 }
Exemplo n.º 2
0
 @Override
 public LogEntry createLogEntry(LogEntry logEntry) throws Exception {
   OlogEntry ologEntry = new OlogEntry(writer.set(LogBuilder(logEntry)));
   // creates the log entry and then adds all the attachments
   // TODO (shroffk) multiple network calls, one for each attachment, need
   // to improve
   for (Attachment attachment : logEntry.getAttachment()) {
     InputStream inputStream = attachment.getInputStream();
     if (inputStream != null) {
       addAttachment(ologEntry.getId(), inputStream, attachment.getFileName());
       inputStream.close();
     }
   }
   return ologEntry;
 }