1.Bug fixes on monitor api.

This commit is contained in:
Panagiotis Kanakakis 2018-02-12 11:33:51 +00:00
parent 5eb0717179
commit a08eee988f
2 changed files with 14 additions and 14 deletions

View File

@ -16,14 +16,14 @@ public interface MonitorApi {
@RequestMapping(value = "/getJobsOfUser" , method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
JobsOfUser getJobsOfUser(@RequestParam String user,
@RequestParam String jobType,
@RequestParam String offset,
@RequestParam String limit,
@RequestParam String dateFrom,
@RequestParam String dateTo,
@RequestParam String validationStatus,
@RequestParam String includeJobsTotal) throws JSONException, ValidatorServiceException;
JobsOfUser getJobsOfUser(String user,
String jobType,
String offset,
String limit,
String dateFrom,
String dateTo,
String validationStatus,
String includeJobsTotal) throws JSONException, ValidatorServiceException;
@RequestMapping(value = "/getJobsOfUserPerValidationStatus" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody

View File

@ -3,18 +3,16 @@ package eu.dnetlib.repo.manager.service.controllers;
import eu.dnetlib.api.functionality.ValidatorService;
import eu.dnetlib.api.functionality.ValidatorServiceException;
import eu.dnetlib.domain.functionality.validator.StoredJob;
import eu.dnetlib.repo.manager.shared.JobsOfUser;
import eu.dnetlib.repo.manager.shared.Constants;
import eu.dnetlib.repo.manager.shared.JobsOfUser;
import gr.uoa.di.driver.util.ServiceLocator;
import io.swagger.annotations.ApiParam;
import org.apache.log4j.Logger;
import org.json.JSONException;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.util.Date;
@Component
public class MonitorApiImpl implements MonitorApi {
@ -40,17 +38,19 @@ public class MonitorApiImpl implements MonitorApi {
@Override
public JobsOfUser getJobsOfUser(@RequestParam("user") @ApiParam(value = "User email", required = true) String user,
@RequestParam("jobType") @ApiParam(value = "Equals to filter job type on validation history page", required = true) String jobType,
@RequestParam(value = "jobType", required = false) @ApiParam(value = "Equals to filter job type on validation history page") String jobType,
@RequestParam("offset") @ApiParam(value = "Page number", required = true) String offset,
@RequestParam(value = "limit", required = false, defaultValue = "10") @ApiParam(value = "Null value") String limit,
@RequestParam(value = "dateFrom", required = false, defaultValue = "2018-02-08") @ApiParam(value = "Null value") String dateFrom,
@RequestParam(value = "dateTo", required = false, defaultValue = "2018-02-08") @ApiParam(value = "Null value") String dateTo,
@RequestParam(value = "dateFrom", required = false) @ApiParam(value = "Null value") String dateFrom,
@RequestParam(value = "dateTo", required = false) @ApiParam(value = "Null value") String dateTo,
@RequestParam("validationStatus") @ApiParam(value = "Equals to filter validation jobs", required = true) String validationStatus,
@RequestParam("includeJobsTotal") @ApiParam(value = "Always true", required = true) String includeJobsTotal) throws JSONException, ValidatorServiceException {
LOGGER.debug("Getting jobs of user : " + user);
LOGGER.debug(user + "/" + jobType + "/" + offset + "/" + dateFrom + "/" + dateTo + "/" + validationStatus + "/" + includeJobsTotal);
JobsOfUser retJobs = new JobsOfUser();
LOGGER.debug("Size fo jobs list -> " + getValidationService().getStoredJobsNew(user, jobType, Integer.parseInt(offset),
Integer.parseInt(limit), dateFrom, dateTo, validationStatus));
retJobs.setJobs(getValidationService().getStoredJobsNew(user, jobType, Integer.parseInt(offset),
Integer.parseInt(limit), dateFrom, dateTo, validationStatus));
if (Boolean.parseBoolean(includeJobsTotal)) {