/** * 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; }
@Override Map<String, List<String>> initializeKeyValueMap() { try { Map<String, List<String>> keyValueMap = new HashMap<String, List<String>>(); LogbookClient logbookClient = LogbookClientManager.getLogbookClientFactory().getClient(); List<String> logbooks = new ArrayList<String>(); for (Logbook logbook : logbookClient.listLogbooks()) { logbooks.add(logbook.getName()); } List<String> tags = new ArrayList<String>(); for (Tag tag : logbookClient.listTags()) { tags.add(tag.getName()); } List<String> properties = new ArrayList<String>(); for (Property property : logbookClient.listProperties()) { properties.add(property.getName()); } List<String> timeOptions = new ArrayList<String>( Arrays.asList( "lastMin", "1minAgo", "lastHour", "1hourAgo", "lastDay", "1dayAgo", "lastWeek", "1weekAgo")); keyValueMap.put(LogEntrySearchUtil.SEARCH_KEYWORD_LOGBOOKS, logbooks); keyValueMap.put(LogEntrySearchUtil.SEARCH_KEYWORD_TAGS, tags); keyValueMap.put(LogEntrySearchUtil.SEARCH_KEYWORD_PROPERTIES, properties); keyValueMap.put(LogEntrySearchUtil.SEARCH_KEYWORD_START, timeOptions); keyValueMap.put(LogEntrySearchUtil.SEARCH_KEYWORD_END, timeOptions); return keyValueMap; } catch (Exception e1) { return Collections.emptyMap(); } }