fixing backEnd local workflow type
[vid.git] / vid-app-common / src / main / java / org / onap / vid / services / LocalWorkflowsServiceImpl.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2019 Nokia 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 package org.onap.vid.services;
21
22 import com.google.common.collect.ImmutableList;
23 import com.google.common.collect.ImmutableMap;
24 import java.util.Map;
25 import org.onap.vid.model.LocalWorkflowParameterDefinition;
26 import org.onap.vid.model.LocalWorkflowParameterDefinitions;
27 import org.onap.vid.model.LocalWorkflowType;
28 import org.springframework.stereotype.Service;
29
30 @Service
31 public class LocalWorkflowsServiceImpl implements LocalWorkflowsService {
32
33     Map<String, LocalWorkflowParameterDefinitions> WORKFLOWS_WITH_PARAMETERS = ImmutableMap.<String, LocalWorkflowParameterDefinitions>builder()
34         .put("VNF Scale Out", new LocalWorkflowParameterDefinitions(
35             ImmutableList.of(
36                 new LocalWorkflowParameterDefinition(1, "Configuration Parameters", true, LocalWorkflowType.text,".*")
37             )
38         ))
39         .put("VNF In Place Software Update", new LocalWorkflowParameterDefinitions(
40             ImmutableList.of(
41                 new LocalWorkflowParameterDefinition(2, "Operations timeout",true, LocalWorkflowType.text,"[0-9]+"),
42                 new LocalWorkflowParameterDefinition(3, "Existing software version", true, LocalWorkflowType.text, "[-a-zA-Z0-9.]+"),
43                 new LocalWorkflowParameterDefinition(4, "New software version", true, LocalWorkflowType.text, "[-a-zA-Z0-9.]+")
44             )
45         ))
46         .put("VNF Config Update", new LocalWorkflowParameterDefinitions(
47             ImmutableList.of(
48                 new LocalWorkflowParameterDefinition(5, "Attach configuration file", true, LocalWorkflowType.FILE, ".*", "Invalid file type. Please select a file with a CSV extension.", "Invalid file structure.", ".csv")
49             )
50         ))
51         .build();
52
53     @Override
54     public LocalWorkflowParameterDefinitions getWorkflowParameterDefinitions(String workflowName) {
55         return WORKFLOWS_WITH_PARAMETERS.get(workflowName);
56     }
57
58 }