2 * ============LICENSE_START=======================================================
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
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=========================================================
21 package org.onap.so.adapters.requestsdb;
23 import java.util.List;
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;
37 public class InfraActiveRequestsRepositoryCustomController {
40 InfraActiveRequestsRepository infraActiveRequestsRepository;
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);
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);
55 @RequestMapping(method = RequestMethod.GET,
56 value = "/infraActiveRequests/checkVnfIdStatus/{operationalEnvironmentId}")
57 public InfraActiveRequests checkVnfIdStatus(
58 @PathVariable("operationalEnvironmentId") String operationalEnvironmentId) {
59 return infraActiveRequestsRepository.checkVnfIdStatus(operationalEnvironmentId);
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());
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);