Search in sources :

Example 6 with OlogLog

use of org.phoebus.olog.es.api.model.OlogLog in project phoebus by ControlSystemStudio.

the class AttachmentsViewControllerTest method testRemoveImageMarkup.

@Test
public void testRemoveImageMarkup() {
    AttachmentsViewController attachmentsViewController = new AttachmentsViewController(new OlogLog());
    String markup = "![](attachment/123456789){width=100 height=100}";
    String result = attachmentsViewController.removeImageMarkup(markup, "123456789");
    assertTrue(result.isEmpty());
    markup = "ABC ![](attachment/123456789){width=100 height=100} DEF";
    result = attachmentsViewController.removeImageMarkup(markup, "123456789");
    assertEquals("ABC  DEF", result);
    markup = "![](attachment/ABCDE){width=100 height=100}\n![](attachment/123456789){width=100 height=100}\n![](attachment/abcde){width=100 height=100}";
    result = attachmentsViewController.removeImageMarkup(markup, "123456789");
    assertEquals("![](attachment/ABCDE){width=100 height=100}\n\n![](attachment/abcde){width=100 height=100}", result);
    markup = "![](attachment/123456789){width=100 height=100}";
    result = attachmentsViewController.removeImageMarkup(markup, "abcde");
    assertEquals("![](attachment/123456789){width=100 height=100}", result);
    markup = "whatever";
    result = attachmentsViewController.removeImageMarkup(markup, "123456789");
    assertEquals("whatever", result);
}
Also used : OlogLog(org.phoebus.olog.es.api.model.OlogLog) Test(org.junit.Test)

Example 7 with OlogLog

use of org.phoebus.olog.es.api.model.OlogLog in project phoebus by ControlSystemStudio.

the class LogEntryDisplayController method reply.

@FXML
public void reply() {
    LogEntry logEntry = logEntryProperty.get();
    OlogLog ologLog = new OlogLog();
    ologLog.setTitle(logEntry.getTitle());
    ologLog.setTags(logEntry.getTags());
    ologLog.setLogbooks(logEntry.getLogbooks());
    ologLog.setProperties(logEntry.getProperties());
    ologLog.setLevel(logEntry.getLevel());
    // Show a new editor dialog. When user selects to save the reply entry, update the original log entry
    // to ensure that it contains the log group property.
    new LogEntryEditorStage(DockPane.getActiveDockPane(), ologLog, logEntry, null).show();
}
Also used : LogEntryEditorStage(org.phoebus.logbook.olog.ui.write.LogEntryEditorStage) OlogLog(org.phoebus.olog.es.api.model.OlogLog) LogEntry(org.phoebus.logbook.LogEntry) FXML(javafx.fxml.FXML)

Example 8 with OlogLog

use of org.phoebus.olog.es.api.model.OlogLog in project phoebus by ControlSystemStudio.

the class SendLogbookAction method submitLogEntry.

private void submitLogEntry(final Node parent, final String title, final String body, final File image_file) {
    OlogLog ologLog = new OlogLog();
    ologLog.setTitle(title != null ? title : "");
    ologLog.setDescription(body != null ? body : "");
    if (image_file != null) {
        try {
            final Attachment attachment = AttachmentImpl.of(image_file, "image", false);
            List<Attachment> attachments = new ArrayList<>();
            attachments.add(attachment);
            ologLog.setAttachments(attachments);
        } catch (FileNotFoundException ex) {
            logger.log(Level.WARNING, "Cannot attach " + image_file, ex);
        }
    }
    new LogEntryEditorStage(parent, ologLog).show();
}
Also used : ArrayList(java.util.ArrayList) FileNotFoundException(java.io.FileNotFoundException) Attachment(org.phoebus.logbook.Attachment) LogEntryEditorStage(org.phoebus.logbook.olog.ui.write.LogEntryEditorStage) OlogLog(org.phoebus.olog.es.api.model.OlogLog)

Aggregations

OlogLog (org.phoebus.olog.es.api.model.OlogLog)8 LogEntry (org.phoebus.logbook.LogEntry)4 LogbookException (org.phoebus.logbook.LogbookException)4 LogEntryEditorStage (org.phoebus.logbook.olog.ui.write.LogEntryEditorStage)4 FXML (javafx.fxml.FXML)3 Attachment (org.phoebus.logbook.Attachment)3 LogClient (org.phoebus.logbook.LogClient)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Scene (javafx.scene.Scene)2 Logbook (org.phoebus.logbook.Logbook)2 Property (org.phoebus.logbook.Property)2 Tag (org.phoebus.logbook.Tag)2 OlogAttachment (org.phoebus.olog.es.api.model.OlogAttachment)2 ClientHandlerException (com.sun.jersey.api.client.ClientHandlerException)1 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)1 MultivaluedMapImpl (com.sun.jersey.core.util.MultivaluedMapImpl)1 FormDataBodyPart (com.sun.jersey.multipart.FormDataBodyPart)1 FormDataMultiPart (com.sun.jersey.multipart.FormDataMultiPart)1