summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java71
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java10
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java26
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/CategoryParameterOption.java40
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt53
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/properties/Features.java1
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsService.java (renamed from vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsService.java)2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsServiceImpl.java (renamed from vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsServiceImpl.java)4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsService.java26
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsServiceImpl.java58
10 files changed, 228 insertions, 63 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
index 126fbe8d3..6a8439fee 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
@@ -20,8 +20,26 @@
package org.onap.vid.aai;
+import static java.util.Collections.emptyList;
+import static java.util.stream.Collectors.toMap;
+import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
+import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase;
+import static org.apache.commons.lang3.StringUtils.isEmpty;
+
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URLEncoder;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.function.Function;
+import javax.inject.Inject;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.apache.http.client.utils.URIBuilder;
@@ -32,12 +50,28 @@ import org.json.simple.parser.JSONParser;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.vid.aai.exceptions.InvalidAAIResponseException;
import org.onap.vid.aai.model.AaiGetAicZone.AicZones;
-import org.onap.vid.aai.model.*;
-import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.*;
+import org.onap.vid.aai.model.AaiGetInstanceGroupsByCloudRegion;
+import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.AaiGetNetworkCollectionDetails;
+import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.AaiGetNetworkCollectionDetailsHelper;
+import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.AaiGetRelatedInstanceGroupsByVnfId;
+import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.CloudRegion;
+import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.InstanceGroup;
+import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Network;
import org.onap.vid.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;
+import org.onap.vid.aai.model.AaiGetPnfResponse;
import org.onap.vid.aai.model.AaiGetPnfs.Pnf;
import org.onap.vid.aai.model.AaiGetServicesRequestModel.GetServicesAAIRespone;
import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
+import org.onap.vid.aai.model.CustomQuerySimpleResult;
+import org.onap.vid.aai.model.GetServiceModelsByDistributionStatusResponse;
+import org.onap.vid.aai.model.LogicalLinkResponse;
+import org.onap.vid.aai.model.OwningEntityResponse;
+import org.onap.vid.aai.model.PortDetailsTranslator;
+import org.onap.vid.aai.model.ProjectResponse;
+import org.onap.vid.aai.model.Properties;
+import org.onap.vid.aai.model.ResourceType;
+import org.onap.vid.aai.model.ServiceRelationships;
+import org.onap.vid.aai.model.SimpleResult;
import org.onap.vid.aai.util.AAIRestInterface;
import org.onap.vid.aai.util.CacheProvider;
import org.onap.vid.aai.util.VidObjectMapperType;
@@ -51,23 +85,6 @@ import org.onap.vid.utils.Unchecked;
import org.springframework.http.HttpMethod;
import org.springframework.web.util.UriUtils;
-import javax.inject.Inject;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URLEncoder;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.function.Function;
-
-import static java.util.Collections.emptyList;
-import static java.util.stream.Collectors.toMap;
-import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
-
/**
* Created by Oren on 7/4/17.
@@ -233,7 +250,7 @@ public class AaiClient implements AaiClientInterface {
@Override
public boolean isNodeTypeExistsByName(String name, ResourceType type) {
- if (StringUtils.isEmpty(name)) {
+ if (isEmpty(name)) {
throw new GenericUncheckedException("Empty resource-name provided to searchNodeTypeByName; request is rejected as this will cause full resources listing");
}
@@ -697,7 +714,7 @@ public class AaiClient implements AaiClientInterface {
String propKey = checkForNull((String) innerObj.get("property-key"));
String propVal = checkForNull((String) innerObj.get("property-value"));
- if (propKey.equalsIgnoreCase("tenant.tenant-name")) {
+ if (equalsIgnoreCase(propKey, "tenant.tenant-name")) {
tenantNewObj.put("tenantName", propVal);
}
}
@@ -708,11 +725,11 @@ public class AaiClient implements AaiClientInterface {
String rShipKey = checkForNull((String) inner2Obj.get("relationship-key"));
String rShipVal = checkForNull((String) inner2Obj.get("relationship-value"));
- if (rShipKey.equalsIgnoreCase("cloud-region.cloud-owner")) {
+ if (equalsIgnoreCase(rShipKey, "cloud-region.cloud-owner")) {
tenantNewObj.put("cloudOwner", rShipVal);
- } else if (rShipKey.equalsIgnoreCase("cloud-region.cloud-region-id")) {
+ } else if (equalsIgnoreCase(rShipKey, "cloud-region.cloud-region-id")) {
tenantNewObj.put("cloudRegionID", rShipVal);
- } else if (rShipKey.equalsIgnoreCase("tenant.tenant-id")) {
+ } else if (equalsIgnoreCase(rShipKey, "tenant.tenant-id")) {
tenantNewObj.put("tenantID", rShipVal);
}
}
@@ -768,12 +785,12 @@ public class AaiClient implements AaiClientInterface {
@Override
public GetTenantsResponse getHomingDataByVfModule(String vnfInstanceId, String vfModuleId) {
- if (StringUtils.isEmpty(vnfInstanceId)||StringUtils.isEmpty(vfModuleId)){
+ if (isEmpty(vnfInstanceId)|| isEmpty(vfModuleId)){
throw new GenericUncheckedException("Failed to retrieve homing data associated to vfModule from A&AI, VNF InstanceId or VF Module Id is missing.");
}
Response resp = doAaiGet("network/generic-vnfs/generic-vnf/" + vnfInstanceId +"/vf-modules/vf-module/"+ vfModuleId, false);
String responseAsString = parseForTenantsByServiceSubscription("vserver",resp.readEntity(String.class));
- if (responseAsString.equals("")){
+ if (isEmpty(responseAsString)){
throw new GenericUncheckedException( String.format("A&AI has no homing data associated to vfModule '%s' of vnf '%s'", vfModuleId, vnfInstanceId));
}
else {
@@ -822,7 +839,7 @@ public class AaiClient implements AaiClientInterface {
Response resp = doAaiGet(url, false);
String responseAsString = parseForTenantsByServiceSubscription("tenant",resp.readEntity(String.class));
- if (StringUtils.isEmpty(responseAsString)){
+ if (isEmpty(responseAsString)){
throw new ParsingGetTenantsResponseFailure(String.format("A&AI has no LCP Region & Tenants associated to subscriber '%s' and service type '%s'", globalCustomerId, serviceType));
}
else {
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
index fdbe418ea..43be049a6 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
@@ -21,21 +21,19 @@
package org.onap.vid.aai;
import com.fasterxml.jackson.databind.JsonNode;
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.core.Response;
import org.onap.vid.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;
import org.onap.vid.aai.model.AaiGetPnfs.Pnf;
import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
-import org.onap.vid.aai.model.CustomQuerySimpleResult;
import org.onap.vid.aai.model.PortDetailsTranslator;
import org.onap.vid.aai.model.Properties;
import org.onap.vid.aai.model.ResourceType;
import org.onap.vid.model.SubscriberList;
import org.onap.vid.model.probes.ExternalComponentStatus;
-import javax.ws.rs.core.Response;
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
/**
* Created by Oren on 7/4/17.
*/
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java b/vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java
index b8f033c95..a94481b9e 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/WorkflowsController.java
@@ -21,10 +21,11 @@
package org.onap.vid.controller;
import java.util.List;
-import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.vid.model.LocalWorkflowParameterDefinitions;
import org.onap.vid.model.SOWorkflow;
import org.onap.vid.model.SOWorkflowParameterDefinitions;
-import org.onap.vid.services.ExtWorkflowsService;
+import org.onap.vid.services.ExternalWorkflowsService;
+import org.onap.vid.services.LocalWorkflowsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -34,24 +35,31 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(WorkflowsController.WORKFLOWS_MANAGEMENT)
-public class WorkflowsController extends RestrictedBaseController {
+public class WorkflowsController extends VidRestrictedBaseController {
static final String WORKFLOWS_MANAGEMENT = "workflows-management";
- private ExtWorkflowsService extWorkflowsService;
+ private ExternalWorkflowsService externalWorkflowsService;
+ private LocalWorkflowsService localWorkflowsService;
@Autowired
- public WorkflowsController(ExtWorkflowsService extWorkflowsService) {
- this.extWorkflowsService = extWorkflowsService;
+ public WorkflowsController(ExternalWorkflowsService externalWorkflowsService, LocalWorkflowsService localWorkflowsService) {
+ this.externalWorkflowsService = externalWorkflowsService;
+ this.localWorkflowsService = localWorkflowsService;
}
@RequestMapping(value = "workflows", method = RequestMethod.GET)
public List<SOWorkflow> getWorkflows(@RequestParam(value = "vnfName") String vnfName){
- return extWorkflowsService.getWorkflows(vnfName);
+ return externalWorkflowsService.getWorkflows(vnfName);
}
- @RequestMapping(value = "workflow-parameters/{id}", method = RequestMethod.GET)
+ @RequestMapping(value = "remote-workflow-parameters/{id}", method = RequestMethod.GET)
SOWorkflowParameterDefinitions getParameters(@PathVariable Long id) {
- return extWorkflowsService.getWorkflowParameterDefinitions(id);
+ return externalWorkflowsService.getWorkflowParameterDefinitions(id);
+ }
+
+ @RequestMapping(value = "local-workflow-parameters/{name}", method = RequestMethod.GET)
+ LocalWorkflowParameterDefinitions getParameters(@PathVariable String name) {
+ return localWorkflowsService.getWorkflowParameterDefinitions(name);
}
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameterOption.java b/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameterOption.java
index 237747933..70f7b5aa2 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameterOption.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/CategoryParameterOption.java
@@ -20,12 +20,19 @@
package org.onap.vid.model;
-import org.onap.portalsdk.core.domain.support.DomainVo;
-
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import org.onap.portalsdk.core.domain.support.DomainVo;
@Entity
@Table(name = "vid_category_parameter_option")
@@ -124,24 +131,39 @@ public class CategoryParameterOption extends DomainVo {
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
CategoryParameterOption that = (CategoryParameterOption) o;
- if (getAppId() != null ? !getAppId().equals(that.getAppId()) : that.getAppId() != null) return false;
- if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) return false;
- return getCategoryParameter() != null ? getCategoryParameter().equals(that.getCategoryParameter()) : that.getCategoryParameter() == null;
+ if (getAppId() != null ? !getAppId().equals(that.getAppId()) : that.getAppId() != null) {
+ return false;
+ }
+ if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) {
+ return false;
+ }
+ return getCategoryParameter() != null ? getCategoryParameter().equals(that.getCategoryParameter())
+ : that.getCategoryParameter() == null;
}
@Override
public int hashCode() {
int result = getAppId() != null ? getAppId().hashCode() : 0;
result = 31 * result + (getName() != null ? getName().hashCode() : 0);
- result = 31 * result + (getCategoryParameter() != null ? getCategoryParameter().hashCode() : 0);
+ result = 31 * result + hashCodeOfParentCategoryParameter();
return result;
}
+ private int hashCodeOfParentCategoryParameter() {
+ // Don't use getCategoryParameter's hashCode, as it might loop back to self's hasCode
+ return (getCategoryParameter() == null || getCategoryParameter().getId() == null)
+ ? 0 : getCategoryParameter().getId().hashCode();
+ }
+
@Override
public String toString() {
return "CategoryParameterOption{" +
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt b/vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt
index 9fbae0612..b88c3f6f6 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/model/SOWorkflows.kt
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* VID
* ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,27 +20,62 @@
package org.onap.vid.model
-data class SOWorkflow constructor(val id: Long, val name: String) {
+data class SOWorkflow constructor(
+ val id: Long,
+ val name: String) {
fun clone(): SOWorkflow {
return copy()
}
}
-data class SOWorkflows @JvmOverloads constructor(val workflows: List<SOWorkflow> = emptyList()) {
+data class SOWorkflows @JvmOverloads constructor(
+ val workflows: List<SOWorkflow> = emptyList()) {
fun clone(): SOWorkflows {
return copy(workflows.toMutableList())
}
}
-enum class SOWorkflowType(val type: String) {
+enum class SOWorkflowType(
+ val type: String) {
STRING("STRING")
}
-data class SOWorkflowParameterDefinition constructor(val id: Long, val name: String, val pattern: String,
- val type: SOWorkflowType, val required: Boolean)
+enum class LocalWorkflowType(
+ val type: String) {
+ STRING("STRING"),
+ FILE("FILE")
+}
+
+data class SOWorkflowParameterDefinition constructor(
+ val id: Long,
+ val name: String,
+ val pattern: String,
+ val type: SOWorkflowType,
+ val required: Boolean)
-data class SOWorkflowParameterDefinitions constructor(val parameterDefinitions: List<SOWorkflowParameterDefinition> = emptyList()) {
+data class SOWorkflowParameterDefinitions constructor(
+ val parameterDefinitions: List<SOWorkflowParameterDefinition> = emptyList()) {
fun clone(): SOWorkflowParameterDefinitions {
return copy(parameterDefinitions.toMutableList())
}
}
+
+data class LocalWorkflowParameterDefinition @JvmOverloads constructor(
+ val id: Long,
+ val name: String,
+ val required: Boolean,
+ val type: LocalWorkflowType,
+ val pattern: String? = null,
+ val msgOnPatternError: String? = null,
+ val msgOnContentError: String? = null,
+ val acceptableFileType: String? = null
+)
+
+data class LocalWorkflowParameterDefinitions constructor(
+ val parameterDefinitions: List<LocalWorkflowParameterDefinition> = emptyList()
+) {
+ fun clone(): LocalWorkflowParameterDefinitions {
+ return copy(parameterDefinitions.toMutableList())
+ }
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
index dfe3185b2..1c68e8292 100644
--- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
+++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
@@ -62,6 +62,7 @@ public enum Features implements Feature {
FLAG_1902_NEW_VIEW_EDIT,
FLAG_EXP_USE_DEFAULT_HOST_NAME_VERIFIER,
FLAG_1902_VNF_GROUPING,
+ FLAG_HANDLE_SO_WORKFLOWS
;
public boolean isActive() {
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsService.java b/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsService.java
index a4450ca01..da909a54d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsService.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsService.java
@@ -24,7 +24,7 @@ import java.util.List;
import org.onap.vid.model.SOWorkflow;
import org.onap.vid.model.SOWorkflowParameterDefinitions;
-public interface ExtWorkflowsService {
+public interface ExternalWorkflowsService {
List<SOWorkflow> getWorkflows(String vnfName);
SOWorkflowParameterDefinitions getWorkflowParameterDefinitions(Long workflowId);
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsServiceImpl.java
index 61ed2da67..1da03f0ac 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/ExtWorkflowsServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/ExternalWorkflowsServiceImpl.java
@@ -30,12 +30,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
-public class ExtWorkflowsServiceImpl implements ExtWorkflowsService {
+public class ExternalWorkflowsServiceImpl implements ExternalWorkflowsService {
private MockedWorkflowsRestClient mockedWorkflowsRestClient;
@Autowired
- public ExtWorkflowsServiceImpl(MockedWorkflowsRestClient mockedWorkflowsRestClient) {
+ public ExternalWorkflowsServiceImpl(MockedWorkflowsRestClient mockedWorkflowsRestClient) {
this.mockedWorkflowsRestClient = mockedWorkflowsRestClient;
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsService.java b/vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsService.java
new file mode 100644
index 000000000..b0674f0e3
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsService.java
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.services;
+
+import org.onap.vid.model.LocalWorkflowParameterDefinitions;
+
+public interface LocalWorkflowsService {
+ LocalWorkflowParameterDefinitions getWorkflowParameterDefinitions(String workflowName);
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsServiceImpl.java
new file mode 100644
index 000000000..733d275d8
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/services/LocalWorkflowsServiceImpl.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.services;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import java.util.Map;
+import org.onap.vid.model.LocalWorkflowParameterDefinition;
+import org.onap.vid.model.LocalWorkflowParameterDefinitions;
+import org.onap.vid.model.LocalWorkflowType;
+import org.springframework.stereotype.Service;
+
+@Service
+public class LocalWorkflowsServiceImpl implements LocalWorkflowsService {
+
+ Map<String, LocalWorkflowParameterDefinitions> WORKFLOWS_WITH_PARAMETERS = ImmutableMap.<String, LocalWorkflowParameterDefinitions>builder()
+ .put("VNF Scale Out", new LocalWorkflowParameterDefinitions(
+ ImmutableList.of(
+ new LocalWorkflowParameterDefinition(1, "Configuration Parameters", true, LocalWorkflowType.STRING,".*")
+ )
+ ))
+ .put("VNF In Place Software Update", new LocalWorkflowParameterDefinitions(
+ ImmutableList.of(
+ new LocalWorkflowParameterDefinition(2, "Operations timeout",true, LocalWorkflowType.STRING,"[0-9]+"),
+ new LocalWorkflowParameterDefinition(3, "Existing software version", true, LocalWorkflowType.STRING, "[-a-zA-Z0-9.]+"),
+ new LocalWorkflowParameterDefinition(4, "New software version", true, LocalWorkflowType.STRING, "[-a-zA-Z0-9.]+")
+ )
+ ))
+ .put("VNF Config Update", new LocalWorkflowParameterDefinitions(
+ ImmutableList.of(
+ new LocalWorkflowParameterDefinition(5, "Attach configuration file", true, LocalWorkflowType.FILE, ".*", "Invalid file type. Please select a file with a CSV extension.", "Invalid file structure.", ".csv")
+ )
+ ))
+ .build();
+
+ @Override
+ public LocalWorkflowParameterDefinitions getWorkflowParameterDefinitions(String workflowName) {
+ return WORKFLOWS_WITH_PARAMETERS.get(workflowName);
+ }
+
+}