NonRT-RIC A1 Northbound API
[nonrtric.git] / sdnc-a1-controller / oam / SdncReports / SdncReportsDao / src / main / java / com / onap / sdnc / reports / repository / PreTestConfigRepository.java
1 /*
2 * ============LICENSE_START=======================================================
3 * ONAP : SDNC-FEATURES
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
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
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=========================================================
19 */
20 package com.onap.sdnc.reports.repository;
21
22 import java.util.Date;
23
24 import java.util.List;
25
26 import javax.transaction.Transactional;
27
28 import org.springframework.data.jpa.repository.JpaRepository;
29 import org.springframework.data.jpa.repository.Modifying;
30 import org.springframework.data.jpa.repository.Query;
31 import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
32 import org.springframework.data.repository.query.Param;
33 import org.springframework.stereotype.Repository;
34
35 import com.onap.sdnc.reports.model.PreTestConfig;
36
37
38 @Repository
39 public interface PreTestConfigRepository extends JpaRepository<PreTestConfig, Long> {
40
41         @Query(value= " from PreTestConfig where timestamp >= :startDate and timestamp <= :endDate  and device.deviceIP = :deviceIP" )
42         List<PreTestConfig> findReportByDeviceIP(@Param("startDate") Date startDate, @Param("endDate")Date endDate, @Param("deviceIP")String deviceIP);
43         
44         @Modifying
45     @Query(value = "insert into PreTestConfig (testName,result,execuationDetails,timestamp,deviceId) VALUES (:testName,:result,:execuationDetails,:timestamp,:deviceId)", nativeQuery = true)
46     @Transactional
47     void logPreTestReport(@Param("testName") String testName,@Param("result") String result, @Param("execuationDetails") String  execuationDetails,@Param("timestamp") String  timestamp,@Param("deviceId") long  deviceId);
48 }