2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 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.vid.controller;
23 import java.util.List;
24 import org.onap.vid.model.LocalWorkflowParameterDefinitions;
25 import org.onap.vid.model.SOWorkflow;
26 import org.onap.vid.model.SOWorkflowParameterDefinitions;
27 import org.onap.vid.services.ExternalWorkflowsService;
28 import org.onap.vid.services.LocalWorkflowsService;
29 import org.springframework.beans.factory.annotation.Autowired;
30 import org.springframework.web.bind.annotation.PathVariable;
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 @RequestMapping(WorkflowsController.WORKFLOWS_MANAGEMENT)
38 public class WorkflowsController extends VidRestrictedBaseController {
39 static final String WORKFLOWS_MANAGEMENT = "workflows-management";
41 private ExternalWorkflowsService externalWorkflowsService;
42 private LocalWorkflowsService localWorkflowsService;
45 public WorkflowsController(ExternalWorkflowsService externalWorkflowsService, LocalWorkflowsService localWorkflowsService) {
46 this.externalWorkflowsService = externalWorkflowsService;
47 this.localWorkflowsService = localWorkflowsService;
50 @RequestMapping(value = "workflows", method = RequestMethod.GET)
51 public List<SOWorkflow> getWorkflows(@RequestParam(value = "vnfName") String vnfName){
52 return externalWorkflowsService.getWorkflows(vnfName);
55 @RequestMapping(value = "remote-workflow-parameters/{id}", method = RequestMethod.GET)
56 SOWorkflowParameterDefinitions getParameters(@PathVariable Long id) {
57 return externalWorkflowsService.getWorkflowParameterDefinitions(id);
60 @RequestMapping(value = "local-workflow-parameters/{name}", method = RequestMethod.GET)
61 LocalWorkflowParameterDefinitions getParameters(@PathVariable String name) {
62 return localWorkflowsService.getWorkflowParameterDefinitions(name);