<commit_before>/**
 * 
 */
package org.csstudio.logbook.ui;

import java.util.ArrayList;
import java.util.List;

import org.csstudio.logbook.LogEntry;
import org.csstudio.logbook.LogbookClient;
import org.csstudio.logbook.ui.PeriodicLogQuery.LogResult;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;

/**
 * @author <NAME>
 *
 */
public class LogQueryJob extends Job {

	private final static String name = "LogQueryJob";

	private final String query;
	private final LogbookClient logbookClient;

	LogQueryJob(String query, LogbookClient logbookClient) {
	    super(name);
	    this.query = query;
	    this.logbookClient = logbookClient;
	}

	void completedQuery(LogResult result) {

	}

	@Override
	protected IStatus run(IProgressMonitor monitor) {
	    LogResult result = null;
	    try {
		List<LogEntry> logs = new ArrayList<LogEntry>(
			logbookClient.findLogEntries(query));
		result = new LogResult(logs, null);
	    } catch (Exception e) {
		result = new LogResult(null, e);
	    } finally {
		if (!monitor.isCanceled()) {
		    completedQuery(result);
		}
	    }
	    return Status.OK_STATUS;
	}

}<commit_msg>#441: Log Viewer Application bug fixes and upgrades<commit_after>/**
 * 
 */
package org.csstudio.logbook.ui;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

import org.csstudio.logbook.LogEntry;
import org.csstudio.logbook.LogbookClient;
import org.csstudio.logbook.ui.PeriodicLogQuery.LogResult;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;

/**
 * @author <NAME>
 * 
 */
public class LogQueryJob extends Job {

    private final static String name = "LogQueryJob";

    private final String query;
    private final LogbookClient logbookClient;

    LogQueryJob(String query, LogbookClient logbookClient) {
	super(name);
	this.query = query;
	this.logbookClient = logbookClient;
    }

    void completedQuery(LogResult result) {

    }

    @Override
    protected IStatus run(IProgressMonitor monitor) {
	LogResult result = null;
	try {
	    List<LogEntry> logs = new ArrayList<LogEntry>(
		    logbookClient.findLogEntries(query));
	    Collections.sort(logs, new Comparator<LogEntry>() {

		@Override
		public int compare(LogEntry o1, LogEntry o2) {
		    Date d1 = o1.getCreateDate();
		    Date d2 = o2.getCreateDate();
		    return d2.compareTo(d1);
		}

	    });
	    result = new LogResult(logs, null);
	} catch (Exception e) {
	    result = new LogResult(null, e);
	} finally {
	    if (!monitor.isCanceled()) {
		completedQuery(result);
	    }
	}
	return Status.OK_STATUS;
    }

}
{'fraction_non_alphanumeric': 0.11208406304728546, 'fraction_numerical': 0.003852889667250438, 'mean_word_length': 3.86541737649063, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6748586', 'n_tokens_mistral': 965, 'n_tokens_neox': 905, 'n_words': 201}