2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright 2018 TechMahindra
6 *=================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package com.onap.sdnc.reports.controller;
22 import java.util.Date;
23 import java.util.List;
25 import org.apache.logging.log4j.LogManager;
26 import org.apache.logging.log4j.Logger;
27 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.web.bind.annotation.PathVariable;
29 import org.springframework.web.bind.annotation.RequestMapping;
30 import org.springframework.web.bind.annotation.RequestMethod;
31 import org.springframework.web.bind.annotation.RestController;
33 import com.onap.sdnc.reports.rest.model.PreTestModel;
34 import com.onap.sdnc.reports.service.IReportService;
37 public class ReportController {
39 private static final Logger logger = LogManager.getLogger(ReportController.class);
42 IReportService reportService;
43 @RequestMapping(value="/findReportByDeviceIP/{startDate}/{endDate}/{deviceIP:.+}", produces = "application/json",method=RequestMethod.GET)
44 public List<PreTestModel> findReportByDeviceIP(@PathVariable("startDate") Date startDate,@PathVariable("endDate") Date endDate,@PathVariable("deviceIP") String deviceIP) {
47 logger.info("findReportByDeviceIP Started Working..");
48 if(logger.isDebugEnabled())
49 logger.debug("Received StartDate : "+startDate+" ,EndDate : "+endDate+" ,DeviceIP : "+deviceIP);
51 return reportService.findReportByDeviceIP(startDate,endDate,deviceIP);
55 logger.info("Exception Occured : "+ex.getLocalizedMessage());
56 return java.util.Collections.emptyList();