<commit_before>package org.remus.cmdlinehero.controller;

import java.util.Collection;

import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;

import org.remus.cmdlinehero.controller.data.JobInfo;
import org.remus.cmdlinehero.service.ExecutionService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 
 * @author <NAME> - <EMAIL>
 * 
 * 
 */
@Controller
public class JobOverviewController {

	@Inject
	private ExecutionService executionService;

	@RequestMapping(value = "jobstatus/{jobId}/json", method = RequestMethod.GET)
	public @ResponseBody
	JobInfo findJobById(@PathVariable final String jobId,
			final HttpServletRequest request) {
		JobInfo returnValue = null;
		final JobInfo findJobById = executionService.findJobById(jobId);
		if (findJobById != null) {
			if (jobInfo.getStatus() == JobStatus.FINISHED) {
				executionService.generateOutputs(findJobById, request);
			}
			executionService.refreshStds(findJobById);
			returnValue = findJobById;
		}
		return returnValue;

	}

	@RequestMapping(value = "alljobs/json", method = RequestMethod.GET)
	public @ResponseBody
	JobInfo[] findAllJobs(final HttpServletRequest request) {
		final Collection<JobInfo> findAllJobs = executionService.findAllJobs();<commit_msg>bugfix<commit_after>package org.remus.cmdlinehero.controller;

import java.util.Collection;

import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;

import org.remus.cmdlinehero.controller.data.JobInfo;
import org.remus.cmdlinehero.service.ExecutionService;
import org.remus.cmdlinehero.service.JobStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 
 * @author <NAME> - <EMAIL>
 * 
 * 
 */
@Controller
public class JobOverviewController {

	@Inject
	private ExecutionService executionService;

	@RequestMapping(value = "jobstatus/{jobId}/json", method = RequestMethod.GET)
	public @ResponseBody
	JobInfo findJobById(@PathVariable final String jobId,
			final HttpServletRequest request) {
		JobInfo returnValue = null;
		final JobInfo findJobById = executionService.findJobById(jobId);
		if (findJobById != null) {
			if (findJobById.getStatus() == JobStatus.FINISHED) {
				executionService.generateOutputs(findJobById, request);
			}
			executionService.refreshStds(findJobById);
			returnValue = findJobById;
		}
		return returnValue;

	}

	@RequestMapping(value = "alljobs/json", method = RequestMethod.GET)
	public @ResponseBody
	JobInfo[] findAllJobs(final HttpServletRequest request) {
		final Collection<JobInfo> findAllJobs = executionService.findAllJobs();
{'fraction_non_alphanumeric': 0.1020006559527714, 'fraction_numerical': 0.0, 'mean_word_length': 5.916099773242631, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '7595276', 'n_tokens_mistral': 941, 'n_tokens_neox': 884, 'n_words': 163}