Replaced all tabs with spaces in java and pom.xml
[so.git] / adapters / mso-requests-db-adapter / src / main / java / org / onap / so / adapters / requestsdb / InfraActiveRequestsRepositoryCustomController.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
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
21 package org.onap.so.adapters.requestsdb;
22
23 import java.util.List;
24 import java.util.Map;
25 import org.onap.so.db.request.beans.InfraActiveRequests;
26 import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest;
27 import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
28 import org.springframework.beans.factory.annotation.Autowired;
29 import org.springframework.web.bind.annotation.PathVariable;
30 import org.springframework.web.bind.annotation.RequestBody;
31 import org.springframework.web.bind.annotation.RequestMapping;
32 import org.springframework.web.bind.annotation.RequestMethod;
33 import org.springframework.web.bind.annotation.RequestParam;
34 import org.springframework.web.bind.annotation.RestController;
35
36 @RestController
37 public class InfraActiveRequestsRepositoryCustomController {
38
39     @Autowired
40     InfraActiveRequestsRepository infraActiveRequestsRepository;
41
42     @RequestMapping(method = RequestMethod.POST,
43             value = "/infraActiveRequests/getCloudOrchestrationFiltersFromInfraActive")
44     public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(
45             @RequestBody Map<String, String> orchestrationMap) {
46         return infraActiveRequestsRepository.getCloudOrchestrationFiltersFromInfraActive(orchestrationMap);
47     }
48
49     @RequestMapping(method = RequestMethod.POST, value = "/infraActiveRequests/getOrchestrationFiltersFromInfraActive")
50     public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(
51             @RequestBody Map<String, List<String>> orchestrationMap) {
52         return infraActiveRequestsRepository.getOrchestrationFiltersFromInfraActive(orchestrationMap);
53     }
54
55     @RequestMapping(method = RequestMethod.GET,
56             value = "/infraActiveRequests/checkVnfIdStatus/{operationalEnvironmentId}")
57     public InfraActiveRequests checkVnfIdStatus(
58             @PathVariable("operationalEnvironmentId") String operationalEnvironmentId) {
59         return infraActiveRequestsRepository.checkVnfIdStatus(operationalEnvironmentId);
60     }
61
62     @RequestMapping(method = RequestMethod.POST, value = "/infraActiveRequests/checkInstanceNameDuplicate")
63     public InfraActiveRequests checkInstanceNameDuplicate(
64             @RequestBody InstanceNameDuplicateCheckRequest instanceNameDuplicateCheckRequest) {
65         return infraActiveRequestsRepository.checkInstanceNameDuplicate(
66                 instanceNameDuplicateCheckRequest.getInstanceIdMap(),
67                 instanceNameDuplicateCheckRequest.getInstanceName(),
68                 instanceNameDuplicateCheckRequest.getRequestScope());
69     }
70
71     @RequestMapping(method = RequestMethod.POST, value = "/infraActiveRequests/v1/getInfraActiveRequests")
72     public List<InfraActiveRequests> getInfraActiveRequests(@RequestBody Map<String, String[]> filters,
73             @RequestParam("from") long startTime, @RequestParam("to") long endTime,
74             @RequestParam(value = "maxResult", required = false) Integer maxResult) {
75         return infraActiveRequestsRepository.getInfraActiveRequests(filters, startTime, endTime, maxResult);
76     }
77 }