From 2edfe7ed72d64e37fe98e99418d28400c59a9c12 Mon Sep 17 00:00:00 2001 From: Einat Vinouze Date: Mon, 23 Sep 2019 12:06:47 +0300 Subject: Add a position field to BaseResource Issue-ID: VID-646 Signed-off-by: Einat Vinouze Change-Id: Id1f84dadd31840cf9fa3cdbc7afd7da727a22c7f --- .../org/onap/vid/job/command/ResourceCommand.kt | 1 + .../model/serviceInstantiation/BaseResource.java | 35 +++++++++++++------ .../model/serviceInstantiation/InstanceGroup.java | 20 ++++++----- .../serviceInstantiation/InstanceGroupMember.java | 12 ++++--- .../vid/model/serviceInstantiation/Network.java | 34 ++++++++++--------- .../serviceInstantiation/ServiceInstantiation.java | 3 +- .../vid/model/serviceInstantiation/VfModule.java | 39 +++++++++++----------- .../onap/vid/model/serviceInstantiation/Vnf.java | 36 ++++++++++---------- 8 files changed, 102 insertions(+), 78 deletions(-) (limited to 'vid-app-common/src/main/java') diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt index 8c769d68d..ac5c2751c 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt @@ -22,6 +22,7 @@ package org.onap.vid.job.command import com.fasterxml.jackson.module.kotlin.convertValue +import org.apache.commons.lang3.ObjectUtils.defaultIfNull import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate import org.onap.vid.changeManagement.RequestDetailsWrapper import org.onap.vid.exceptions.AbortingException diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java index 75658f2b1..642843a0c 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java @@ -58,6 +58,9 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { protected String statusMessage; + protected Integer position; + + private static final Map actionStingToEnumMap = ImmutableMap.builder() .put("Delete", Action.Delete) .put("Create", Action.Create) @@ -70,17 +73,18 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { protected BaseResource(@JsonProperty("modelInfo") ModelInfo modelInfo, - @JsonProperty("instanceName") String instanceName, - @JsonProperty("action") String action, - @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, - @JsonProperty("legacyRegion") String legacyRegion, - @JsonProperty("tenantId") String tenantId, - @JsonProperty("instanceParams") List> instanceParams, - @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, - @JsonProperty("instanceId") String instanceId, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { + @JsonProperty("instanceName") String instanceName, + @JsonProperty("action") String action, + @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, + @JsonProperty("legacyRegion") String legacyRegion, + @JsonProperty("tenantId") String tenantId, + @JsonProperty("instanceParams") List> instanceParams, + @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, + @JsonProperty("instanceId") String instanceId, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { this.modelInfo = modelInfo; this.modelInfo.setModelType(getModelType()); this.rollbackOnFailure = rollbackOnFailure; @@ -93,6 +97,7 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { this.trackById = trackById; this.isFailed = isFailed!= null ? isFailed: false; this.statusMessage = statusMessage; + this.position = position; } private Action actionStringToEnum(String actionAsString) { @@ -163,6 +168,14 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { this.statusMessage = statusMessage; } + public Integer getPosition() { + return position; + } + + public void setPosition(Integer position) { + this.position = position; + } + @JsonIgnore public abstract Collection getChildren(); diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java index b945f1327..f23c2e73e 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java @@ -34,16 +34,18 @@ public class InstanceGroup extends BaseResource implements JobAdapter.AsyncJobRe private final Map vnfGroupMembers; public InstanceGroup(@JsonProperty("modelInfo") ModelInfo modelInfo, - @JsonProperty("instanceName") String instanceName, - @JsonProperty("action") String action, - @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, - @JsonProperty("instanceId") String instanceId, - @JsonProperty("vnfs") Map vnfGroupMembers, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { + @JsonProperty("instanceName") String instanceName, + @JsonProperty("action") String action, + @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, + @JsonProperty("instanceId") String instanceId, + @JsonProperty("vnfs") Map vnfGroupMembers, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { - super(modelInfo, instanceName, action, null, null, null, null, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage); + super(modelInfo, instanceName, action, null, null, null, null, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, + position); this.vnfGroupMembers = vnfGroupMembers; } diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java index 7bfaf02b1..e9f34ccfb 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java @@ -30,11 +30,13 @@ import org.onap.vid.mso.model.ModelInfo; public class InstanceGroupMember extends BaseResource implements JobAdapter.AsyncJobRequest{ public InstanceGroupMember(@JsonProperty("instanceId") String instanceId, - @JsonProperty("action") String action, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { - super(new ModelInfo(), null, action, null, null, null, null, false, instanceId, trackById, isFailed, statusMessage); + @JsonProperty("action") String action, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { + super(new ModelInfo(), null, action, null, null, null, null, false, instanceId, trackById, isFailed, statusMessage, + position); } @Override diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java index 797e28a02..b9a0aeb85 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java @@ -39,22 +39,24 @@ public class Network extends BaseResource implements JobAdapter.AsyncJobRequest private final String lineOfBusiness; public Network(@JsonProperty("modelInfo") ModelInfo modelInfo, - @JsonProperty("productFamilyId") String productFamilyId, - @JsonProperty("instanceName") String instanceName, - @JsonProperty("action") String action, - @JsonProperty("platformName") String platformName, - @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, - @JsonProperty("legacyRegion") String legacyRegion, - @JsonProperty("tenantId") String tenantId, - @JsonProperty("instanceParams") List> instanceParams, - @JsonProperty("lineOfBusinessName") String lineOfBusiness, - @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, - @JsonProperty("instanceId") String instanceId, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { - - super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage); + @JsonProperty("productFamilyId") String productFamilyId, + @JsonProperty("instanceName") String instanceName, + @JsonProperty("action") String action, + @JsonProperty("platformName") String platformName, + @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, + @JsonProperty("legacyRegion") String legacyRegion, + @JsonProperty("tenantId") String tenantId, + @JsonProperty("instanceParams") List> instanceParams, + @JsonProperty("lineOfBusinessName") String lineOfBusiness, + @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, + @JsonProperty("instanceId") String instanceId, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { + + super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, + position); this.productFamilyId = productFamilyId; this.platformName = platformName; this.lineOfBusiness = lineOfBusiness; diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java index afc8534a1..8828faf1d 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java @@ -104,7 +104,8 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy @JsonProperty("isFailed") Boolean isFailed, @JsonProperty("statusMessage") String statusMessage, @JsonProperty("vidNotions") VidNotions vidNotions) { - super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage); + super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, + null); this.owningEntityId = owningEntityId; this.owningEntityName = owningEntityName; this.projectName = projectName; diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java index 233850d58..41da85e35 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java @@ -42,22 +42,24 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest @JsonInclude(NON_NULL) private Boolean usePreload; private Map supplementaryParams; - public VfModule( @JsonProperty("modelInfo") ModelInfo modelInfo, - @JsonProperty("instanceName") String instanceName, - @JsonProperty("volumeGroupName") String volumeGroupInstanceName, - @JsonProperty("action") String action, - @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, - @JsonProperty("legacyRegion") String legacyRegion, - @JsonProperty("tenantId") String tenantId, - @JsonProperty("instanceParams") List> instanceParams, - @JsonProperty("supplementaryFileContent") Map supplementaryParams, - @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, - @JsonProperty("sdncPreLoad") Boolean usePreload, - @JsonProperty("instanceId") String instanceId, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { - super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage); + public VfModule(@JsonProperty("modelInfo") ModelInfo modelInfo, + @JsonProperty("instanceName") String instanceName, + @JsonProperty("volumeGroupName") String volumeGroupInstanceName, + @JsonProperty("action") String action, + @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, + @JsonProperty("legacyRegion") String legacyRegion, + @JsonProperty("tenantId") String tenantId, + @JsonProperty("instanceParams") List> instanceParams, + @JsonProperty("supplementaryFileContent") Map supplementaryParams, + @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, + @JsonProperty("sdncPreLoad") Boolean usePreload, + @JsonProperty("instanceId") String instanceId, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { + super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, + position); this.volumeGroupInstanceName = volumeGroupInstanceName; this.usePreload = usePreload; this.supplementaryParams = supplementaryParams; @@ -107,8 +109,7 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest this.getInstanceId(), this.getTrackById(), this.getIsFailed(), - this.getStatusMessage() - ); - + this.getStatusMessage(), + this.getPosition()); } } \ No newline at end of file diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java index 0da3f0695..fc71f279f 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java @@ -44,23 +44,25 @@ public class Vnf extends BaseResource implements JobAdapter.AsyncJobRequest { private final Map> vfModules; public Vnf(@JsonProperty("modelInfo") ModelInfo modelInfo, - @JsonProperty("productFamilyId") String productFamilyId, - @JsonProperty("instanceName") String instanceName, - @JsonProperty("action") String action, - @JsonProperty("platformName") String platformName, - @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, - @JsonProperty("legacyRegion") String legacyRegion, - @JsonProperty("tenantId") String tenantId, - @JsonProperty("instanceParams") List> instanceParams, - @JsonProperty("lineOfBusinessName") String lineOfBusiness, - @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, - @JsonProperty("instanceId") String instanceId, - @JsonProperty("vfModules") Map> vfModules, - @JsonProperty("trackById") String trackById, - @JsonProperty("isFailed") Boolean isFailed, - @JsonProperty("statusMessage") String statusMessage) { - - super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage); + @JsonProperty("productFamilyId") String productFamilyId, + @JsonProperty("instanceName") String instanceName, + @JsonProperty("action") String action, + @JsonProperty("platformName") String platformName, + @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, + @JsonProperty("legacyRegion") String legacyRegion, + @JsonProperty("tenantId") String tenantId, + @JsonProperty("instanceParams") List> instanceParams, + @JsonProperty("lineOfBusinessName") String lineOfBusiness, + @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, + @JsonProperty("instanceId") String instanceId, + @JsonProperty("vfModules") Map> vfModules, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position) { + + super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, + position); this.productFamilyId = productFamilyId; this.platformName = platformName; this.lineOfBusiness = lineOfBusiness; -- cgit 1.2.3-korg