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 = "{width=100 height=100}";
String result = attachmentsViewController.removeImageMarkup(markup, "123456789");
assertTrue(result.isEmpty());
markup = "ABC {width=100 height=100} DEF";
result = attachmentsViewController.removeImageMarkup(markup, "123456789");
assertEquals("ABC DEF", result);
markup = "{width=100 height=100}\n{width=100 height=100}\n{width=100 height=100}";
result = attachmentsViewController.removeImageMarkup(markup, "123456789");
assertEquals("{width=100 height=100}\n\n{width=100 height=100}", result);
markup = "{width=100 height=100}";
result = attachmentsViewController.removeImageMarkup(markup, "abcde");
assertEquals("{width=100 height=100}", result);
markup = "whatever";
result = attachmentsViewController.removeImageMarkup(markup, "123456789");
assertEquals("whatever", result);
}
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();
}
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();
}
Aggregations