summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-heat-lib/src/main/java
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-03-22 15:33:06 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-24 06:59:47 +0000
commitd378c37fbd1ecec7b43394926f1ca32a695e07de (patch)
tree5c8a085f8732f980d871d966ac49361644efa698 /openecomp-be/lib/openecomp-heat-lib/src/main/java
parenta6ae7294ecd336d7e88f915710b08e2658eaee00 (diff)
Reformat openecomp-be
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3449 Change-Id: I13e02322f8e00820cc5a1d85752caaeda9bf10d1
Diffstat (limited to 'openecomp-be/lib/openecomp-heat-lib/src/main/java')
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/DefinedHeatParameterTypes.java31
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java21
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitFrequency.java7
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitSize.java7
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitTime.java8
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitTypes.java7
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java8
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestContent.java2
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestFile.java1
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java5
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ContrailResourceTypes.java8
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ContrailV2ResourceTypes.java4
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.java2
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java2
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java6
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java17
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.java1
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java2
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java2
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.java1
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.java3
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.java7
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java12
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.java8
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.java5
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java5
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java49
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/ValidationStructureList.java1
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/ErrorCodes.java9
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java14
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatResourceUtil.java52
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java34
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/manifest/ManifestUtil.java28
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java65
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java89
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManager.java17
36 files changed, 140 insertions, 400 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/DefinedHeatParameterTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/DefinedHeatParameterTypes.java
index 4205f0bee3..2131dec35e 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/DefinedHeatParameterTypes.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/DefinedHeatParameterTypes.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes;
import java.util.HashMap;
@@ -33,12 +32,7 @@ import org.onap.sdc.tosca.datatypes.model.ScalarUnitValidator;
@AllArgsConstructor
@Getter
public enum DefinedHeatParameterTypes {
- NUMBER("number"),
- STRING("string"),
- COMMA_DELIMITED_LIST("comma_delimited_list"),
- JSON("json"),
- BOOLEAN("boolean");
-
+ NUMBER("number"), STRING("string"), COMMA_DELIMITED_LIST("comma_delimited_list"), JSON("json"), BOOLEAN("boolean");
private static ScalarUnitValidator scalarUnitValidator = ScalarUnitValidator.getInstance();
private static Map<String, DefinedHeatParameterTypes> stringToDefinedType;
@@ -64,49 +58,39 @@ public enum DefinedHeatParameterTypes {
*/
public static boolean isValueIsFromGivenType(final Object value, final String parameterType) {
final DefinedHeatParameterTypes definedType = findByHeatResource(parameterType);
-
if (Objects.nonNull(definedType)) {
switch (definedType) {
case NUMBER:
- if (scalarUnitValidator.isValueScalarUnit(value, ToscaScalarUnitSize.class) ||
- scalarUnitValidator.isValueScalarUnit(value, ToscaScalarUnitTime.class) ||
- scalarUnitValidator.isValueScalarUnit(value, ToscaScalarUnitFrequency.class)) {
+ if (scalarUnitValidator.isValueScalarUnit(value, ToscaScalarUnitSize.class) || scalarUnitValidator
+ .isValueScalarUnit(value, ToscaScalarUnitTime.class) || scalarUnitValidator
+ .isValueScalarUnit(value, ToscaScalarUnitFrequency.class)) {
return isValueString(value);
}
return NumberUtils.isNumber(String.valueOf(value));
-
case BOOLEAN:
return HeatBoolean.isValueBoolean(value);
-
case COMMA_DELIMITED_LIST:
return isValueCommaDelimitedList(value);
-
case JSON:
return isValueJson(value);
-
case STRING:
return isValueString(value);
default:
}
}
-
return false;
}
public static boolean isNovaServerEnvValueIsFromRightType(final Object value) {
- return isValueIsFromGivenType(value, COMMA_DELIMITED_LIST.getType())
- || isValueIsFromGivenType(value, STRING.getType());
+ return isValueIsFromGivenType(value, COMMA_DELIMITED_LIST.getType()) || isValueIsFromGivenType(value, STRING.getType());
}
private static boolean isValueCommaDelimitedList(final Object value) {
- return value instanceof List
- || String.valueOf(value).contains(",")
- || isValueIsFromGivenType(value, DefinedHeatParameterTypes.STRING.type);
+ return value instanceof List || String.valueOf(value).contains(",") || isValueIsFromGivenType(value, DefinedHeatParameterTypes.STRING.type);
}
private static boolean isValueString(final Object value) {
- return value instanceof String
- || ClassUtils.isPrimitiveOrWrapper(value.getClass());
+ return value instanceof String || ClassUtils.isPrimitiveOrWrapper(value.getClass());
}
private static boolean isValueJson(final Object value) {
@@ -116,5 +100,4 @@ public enum DefinedHeatParameterTypes {
public static boolean isEmptyValueInEnv(final Object value) {
return Objects.isNull(value);
}
-
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java
index 19fa2d5964..8b5d91c6e0 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java
@@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.heat.datatypes;
import java.util.HashSet;
import java.util.Set;
-
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -28,17 +26,11 @@ import org.openecomp.sdc.logging.api.LoggerFactory;
public class HeatBoolean {
+ private static final Logger LOG = LoggerFactory.getLogger(HeatBoolean.class.getName());
private static Set<Object> heatFalse;
private static Set<Object> heatTrue;
- private static final Logger LOG = LoggerFactory.getLogger(HeatBoolean.class.getName());
-
- private HeatBoolean() {
- //Utility classes, which are a collection of static members, are not meant to be instantiated
- }
static {
-
-
heatFalse = new HashSet<>();
heatFalse.add("f");
heatFalse.add(false);
@@ -47,7 +39,6 @@ public class HeatBoolean {
heatFalse.add("n");
heatFalse.add("no");
heatFalse.add(0);
-
heatTrue = new HashSet<>();
heatTrue.add("t");
heatTrue.add(true);
@@ -56,7 +47,10 @@ public class HeatBoolean {
heatTrue.add("y");
heatTrue.add("yes");
heatTrue.add(1);
+ }
+ private HeatBoolean() {
+ //Utility classes, which are a collection of static members, are not meant to be instantiated
}
/**
@@ -66,7 +60,6 @@ public class HeatBoolean {
* @return the boolean
*/
public static Boolean eval(Object value) {
-
if (value instanceof String) {
value = ((String) value).toLowerCase();
}
@@ -75,11 +68,9 @@ public class HeatBoolean {
} else if (heatTrue.contains(value)) {
return true;
} else {
- throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withId(ErrorCodes.INVALID_BOOLEAN)
- .withCategory(ErrorCategory.APPLICATION)
- .withMessage("Invalid boolean value [" + value + "].").build());
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withId(ErrorCodes.INVALID_BOOLEAN).withCategory(ErrorCategory.APPLICATION)
+ .withMessage("Invalid boolean value [" + value + "].").build());
}
-
}
/**
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitFrequency.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitFrequency.java
index 8ec246555a..e61a9269f2 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitFrequency.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitFrequency.java
@@ -16,14 +16,9 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes;
/**
* This enum is responsible for defining properties that have scalar values measured in units per second.
*/
-public enum ToscaScalarUnitFrequency {
-
- HZ, KHZ, MHZ, GHZ
-
-}
+public enum ToscaScalarUnitFrequency {HZ, KHZ, MHZ, GHZ}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitSize.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitSize.java
index 12f6a176a3..6117ebdfc1 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitSize.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitSize.java
@@ -16,14 +16,9 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes;
/**
* This enum is responsible for defining properties that have scalar values measured in size units.
*/
-public enum ToscaScalarUnitSize {
-
- B, KB, KIB, MB, MIB, GB, GIB, TB, TIB
-
-}
+public enum ToscaScalarUnitSize {B, KB, KIB, MB, MIB, GB, GIB, TB, TIB}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitTime.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitTime.java
index 0a41a63ed1..081e06121e 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitTime.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitTime.java
@@ -16,15 +16,9 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes;
-
/**
* This enum is responsible for defining properties that have scalar values measured in size units.
*/
-public enum ToscaScalarUnitTime {
-
- D, H, M, S, MS, US, NS
-
-}
+public enum ToscaScalarUnitTime {D, H, M, S, MS, US, NS}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitTypes.java
index 05cc97c8dc..d92ef4fc2e 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitTypes.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/ToscaScalarUnitTypes.java
@@ -16,7 +16,6 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes;
import lombok.AllArgsConstructor;
@@ -28,10 +27,6 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ToscaScalarUnitTypes {
-
- SCALAR_UNIT_SIZE("scalar-unit.size"),
- SCALAR_UNIT_TIME("scalar-unit.time"),
- SCALAR_UNIT_FREQUENCY("scalar-unit.frequency");
-
+ SCALAR_UNIT_SIZE("scalar-unit.size"), SCALAR_UNIT_TIME("scalar-unit.time"), SCALAR_UNIT_FREQUENCY("scalar-unit.frequency");
private String type;
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java
index 27b035b2ac..0e079414d2 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.manifest;
import java.util.ArrayList;
@@ -26,7 +25,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
-
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -37,9 +35,7 @@ import org.apache.commons.collections4.CollectionUtils;
@Data
public class FileData {
- protected static final Set<Type> heatFileTypes =
- new HashSet<>(Arrays.asList(Type.HEAT, Type.HEAT_NET, Type.HEAT_VOL));
-
+ protected static final Set<Type> heatFileTypes = new HashSet<>(Arrays.asList(Type.HEAT, Type.HEAT_NET, Type.HEAT_VOL));
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
private Boolean isBase;
@@ -79,6 +75,7 @@ public class FileData {
@AllArgsConstructor
@Getter
public enum Type {
+ // @formatter:off
HEAT("HEAT"),
HEAT_ENV("HEAT_ENV"),
HEAT_NET("HEAT_NET"),
@@ -99,6 +96,7 @@ public class FileData {
OTHER("OTHER"),
PNF_SW_INFORMATION("PNF_SW_INFORMATION"),
PM_DICTIONARY("PM_DICTIONARY");
+ // @formatter:on
private String displayName;
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestContent.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestContent.java
index 107b060094..2976542bf0 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestContent.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestContent.java
@@ -17,11 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.manifest;
import java.util.List;
-
import lombok.Data;
@Data
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestFile.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestFile.java
index 6a62740bf5..0eeb2a6121 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestFile.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestFile.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.manifest;
import lombok.Data;
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java
index 13b3fac170..81840e741b 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java
@@ -17,12 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
-import java.util.ArrayList;
import java.util.List;
-
import lombok.AccessLevel;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -39,6 +36,6 @@ public class Constraint {
private String pattern;
public void setRange(Integer[] inRange) {
- this.range = new Integer[] {inRange[0], inRange[1]};
+ this.range = new Integer[]{inRange[0], inRange[1]};
}
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ContrailResourceTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ContrailResourceTypes.java
index 7538f11593..28ba22a874 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ContrailResourceTypes.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ContrailResourceTypes.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import java.util.HashMap;
@@ -25,17 +24,18 @@ import java.util.Map;
import java.util.Objects;
public enum ContrailResourceTypes {
+ // @formatter:off
ATTACH_POLICY("OS::Contrail::AttachPolicy"),
SERVICE_INSTANCE("OS::Contrail::ServiceInstance"),
SERVICE_TEMPLATE("OS::Contrail::ServiceTemplate"),
NETWORK_POLICY("OS::Contrail::NetworkPolicy"),
VIRTUAL_NETWORK("OS::Contrail::VirtualNetwork");
+ // @formatter:on
private static Map<String, ContrailResourceTypes> stringToContrailResourceTypeMap;
static {
stringToContrailResourceTypeMap = new HashMap<>();
-
for (ContrailResourceTypes type : ContrailResourceTypes.values()) {
stringToContrailResourceTypeMap.put(type.contrailResourceType, type);
}
@@ -54,9 +54,7 @@ public enum ContrailResourceTypes {
* @return the contrail resource types
*/
public static ContrailResourceTypes findByContrailV2Resource(String contrailV2Resource) {
- return contrailV2Resource == null ? null
- : stringToContrailResourceTypeMap.get(contrailV2Resource);
-
+ return contrailV2Resource == null ? null : stringToContrailResourceTypeMap.get(contrailV2Resource);
}
public static boolean isResourceTypeContrail(String resourceType) {
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ContrailV2ResourceTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ContrailV2ResourceTypes.java
index 40253ad1be..cae1c7f521 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ContrailV2ResourceTypes.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ContrailV2ResourceTypes.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import java.util.HashMap;
@@ -25,16 +24,17 @@ import java.util.Map;
import java.util.Objects;
public enum ContrailV2ResourceTypes {
+ // @formatter:off
NETWROK_IPAM("OS::ContrailV2::NetworkIpam"),
VIRTUAL_NETWORK("OS::ContrailV2::VirtualNetwork"),
NETWORK_POLICY("OS::ContrailV2::NetworkPolicy"),
VIRTUAL_MACHINE_INTERFACE("OS::ContrailV2::VirtualMachineInterface");
+ // @formatter:on
private static Map<String, ContrailV2ResourceTypes> stringToContrailV2ResourceTypeMap;
static {
stringToContrailV2ResourceTypeMap = new HashMap<>();
-
for (ContrailV2ResourceTypes type : ContrailV2ResourceTypes.values()) {
stringToContrailV2ResourceTypeMap.put(type.contrailV2ResourceType, type);
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.java
index db5121b014..1713e56381 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.java
@@ -17,11 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import java.util.Map;
-
import lombok.Data;
@Data
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java
index 3387c43840..c8dee98449 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java
@@ -17,12 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import java.util.List;
import java.util.Map;
-
import lombok.Data;
@Data
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java
index 73020bcbcf..b85ec3bb5b 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java
@@ -17,21 +17,21 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import java.util.ArrayList;
import java.util.List;
-
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum HeatPseudoParameters {
+ // @formatter:off
OS_STACK_NAME("OS::stack_name"),
OS_STACK_ID("OS::stack_id"),
OS_PROJECT_ID("OS::project_id");
+ // @formatter:on
private static final List<String> pseudoParameterNames = new ArrayList<>();
private final String pseudoParameter;
@@ -42,8 +42,8 @@ public enum HeatPseudoParameters {
}
}
+
public static List<String> getPseudoParameterNames() {
return pseudoParameterNames;
}
-
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java
index a9598eb67f..8e7456b679 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import java.util.ArrayList;
@@ -27,6 +26,7 @@ import java.util.Map;
import java.util.Objects;
public enum HeatResourcesTypes {
+ // @formatter:off
NOVA_SERVER_RESOURCE_TYPE("OS::Nova::Server"),
NOVA_SERVER_GROUP_RESOURCE_TYPE("OS::Nova::ServerGroup"),
NEUTRON_PORT_RESOURCE_TYPE("OS::Neutron::Port"),
@@ -48,13 +48,13 @@ public enum HeatResourcesTypes {
CONTRAIL_SERVICE_INSTANCE("OS::Contrail::ServiceInstance"),
CONTRAIL_V2_NETWORK_RULE_RESOURCE_TYPE("OS::ContrailV2::NetworkPolicy"),
RESOURCE_GROUP_RESOURCE_TYPE("OS::Heat::ResourceGroup");
+ // @formatter:on
private static Map<String, HeatResourcesTypes> stringToHeatResourceTypeMap;
private String heatResource;
static {
stringToHeatResourceTypeMap = new HashMap<>();
-
for (HeatResourcesTypes type : HeatResourcesTypes.values()) {
stringToHeatResourceTypeMap.put(type.heatResource, type);
}
@@ -81,10 +81,10 @@ public enum HeatResourcesTypes {
public static boolean isResourceExpectedToBeExposed(String resourceType) {
//todo - check
return (resourceType.equals(NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource())
- || resourceType.equals(CONTRAIL_VIRTUAL_NETWORK_RESOURCE_TYPE.getHeatResource())
- || resourceType.equals(NEUTRON_NET_RESOURCE_TYPE.getHeatResource())
- || resourceType.equals(CINDER_VOLUME_RESOURCE_TYPE.getHeatResource())
- || resourceType.equals(NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource())
+ || resourceType.equals(CONTRAIL_VIRTUAL_NETWORK_RESOURCE_TYPE.getHeatResource())
+ || resourceType.equals(NEUTRON_NET_RESOURCE_TYPE.getHeatResource())
+ || resourceType.equals(CINDER_VOLUME_RESOURCE_TYPE.getHeatResource())
+ || resourceType.equals(NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource())
);
}
@@ -94,14 +94,11 @@ public enum HeatResourcesTypes {
* @param types the types
* @return the list for resource type
*/
- public static Map<HeatResourcesTypes, List<String>> getListForResourceType(
- HeatResourcesTypes... types) {
+ public static Map<HeatResourcesTypes, List<String>> getListForResourceType(HeatResourcesTypes... types) {
Map<HeatResourcesTypes, List<String>> result = new HashMap<>();
-
for (HeatResourcesTypes type : types) {
result.put(type, new ArrayList<>());
}
-
return result;
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.java
index 343205d171..629f317a47 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import lombok.Data;
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java
index 81372aa68c..51df5df455 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java
@@ -17,12 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import java.util.List;
import java.util.Map;
-
import lombok.Data;
@Data
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java
index 4595466436..d675cd2200 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java
@@ -17,11 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import java.util.List;
-
import lombok.Data;
@Data
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.java
index 3f6dc9f7ce..0a1bd4fa02 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import lombok.AllArgsConstructor;
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.java
index 77a7cd4552..c8f7d96925 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.java
@@ -17,13 +17,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
-
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -32,7 +30,6 @@ import lombok.Getter;
public enum PolicyTypes {
AFFINITY("affinity"),
ANTI_AFFINITY("anti-affinity");
-
private static Map<String, PolicyTypes> stringToPolicyTypesMap;
static {
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.java
index 46673c2eaa..1f6493ae1d 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import lombok.AllArgsConstructor;
@@ -26,10 +25,6 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum PropertiesMapKeyTypes {
- IMAGE("image"),
- FLAVOR("flavor"),
- NETWORKS("networks"),
- RESOURCE_DEF("resource_def");
-
+ IMAGE("image"), FLAVOR("flavor"), NETWORKS("networks"), RESOURCE_DEF("resource_def");
private String keyMap;
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java
index 4703f43632..a756d35c03 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java
@@ -17,11 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import java.util.Map;
-
import lombok.Data;
@Data
@@ -36,13 +34,7 @@ public class Resource {
@Override
public String toString() {
- return "Resource{"
- + "type='" + type + '\''
- + ", properties=" + properties
- + ", metadata=" + metadata
- + ", depends_on=" + depends_on
- + ", update_policy='" + update_policy + '\''
- + ", deletion_policy='" + deletion_policy + '\''
- + '}';
+ return "Resource{" + "type='" + type + '\'' + ", properties=" + properties + ", metadata=" + metadata + ", depends_on=" + depends_on
+ + ", update_policy='" + update_policy + '\'' + ", deletion_policy='" + deletion_policy + '\'' + '}';
}
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.java
index 9c1feb2cc4..f86e53ba15 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import lombok.AllArgsConstructor;
@@ -26,11 +25,6 @@ import lombok.Getter;
@AllArgsConstructor
@Getter
public enum ResourceReferenceFunctions {
- GET_RESOURCE("get_resource"),
- GET_PARAM("get_param"),
- GET_ATTR("get_attr"),
- GET_FILE("get_file"),
- SCHEDULER_HINTS("scheduler_hints");
-
+ GET_RESOURCE("get_resource"), GET_PARAM("get_param"), GET_ATTR("get_attr"), GET_FILE("get_file"), SCHEDULER_HINTS("scheduler_hints");
private String function;
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.java
index c4a13588a1..574e510082 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.model;
import java.util.HashMap;
@@ -34,9 +33,9 @@ public enum ResourceTypeToMessageString {
resourcesTypesStringMap = new HashMap<>();
for (ResourceTypeToMessageString resourceTypeToMessageString : ResourceTypeToMessageString
- .values()) {
+ .values()) {
resourcesTypesStringMap
- .put(resourceTypeToMessageString.type, resourceTypeToMessageString.messageString);
+ .put(resourceTypeToMessageString.type, resourceTypeToMessageString.messageString);
}
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java
index 9d1fbe3cb3..ce8c15953d 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java
@@ -17,12 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.structure;
import java.util.ArrayList;
import java.util.List;
-
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@@ -36,11 +34,9 @@ import org.openecomp.sdc.heat.datatypes.manifest.FileData;
public class Artifact implements Comparable<Artifact> {
private String fileName;
-
@Setter(AccessLevel.NONE)
@EqualsAndHashCode.Exclude
private FileData.Type type;
-
@EqualsAndHashCode.Exclude
private List<ErrorMessage> errors;
@@ -58,7 +54,6 @@ public class Artifact implements Comparable<Artifact> {
if (this.errors == null || this.errors.isEmpty()) {
this.errors = new ArrayList<>();
}
-
this.errors.add(error);
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java
index 93eb7c649d..893f5f58d3 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java
@@ -19,7 +19,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.structure;
import java.util.ArrayList;
@@ -38,11 +37,9 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
private String fileName;
private FileData.Type type;
-
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
private Boolean isBase;
-
private HeatStructureTree env;
private List<ErrorMessage> errors;
private Set<HeatStructureTree> heat;
@@ -63,14 +60,6 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
this.fileName = fileName;
}
- public Boolean getBase() {
- return isBase;
- }
-
- public void setBase(Boolean isBase) {
- this.isBase = isBase;
- }
-
/**
* Gets heat structure tree by name.
*
@@ -78,17 +67,23 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
* @param filename the filename
* @return the heat structure tree by name
*/
- public static HeatStructureTree getHeatStructureTreeByName(Set<HeatStructureTree> filesSet,
- String filename) {
+ public static HeatStructureTree getHeatStructureTreeByName(Set<HeatStructureTree> filesSet, String filename) {
for (HeatStructureTree heatStructureTree : filesSet) {
if (heatStructureTree.getFileName().equals(filename)) {
return heatStructureTree;
}
}
-
return null;
}
+ public Boolean getBase() {
+ return isBase;
+ }
+
+ public void setBase(Boolean isBase) {
+ this.isBase = isBase;
+ }
+
/**
* Add heat structure tree to nested heat list.
*
@@ -152,7 +147,6 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
if (this.heat == null) {
this.heat = new TreeSet<>();
}
-
this.heat.add(heat);
}
@@ -165,7 +159,6 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
if (this.other == null) {
this.other = new TreeSet<>();
}
-
this.other.add(other);
}
@@ -173,7 +166,6 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
if (this.helm == null) {
this.helm = new TreeSet<>();
}
-
this.helm.add(helm);
}
@@ -200,10 +192,8 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
* @param type the type
*/
public void removeFromVolumeOrNetwork(String fileNameToRemove, FileData.Type type) {
- Set<HeatStructureTree> volumeOrNetworkSet =
- type.equals(FileData.Type.HEAT_VOL) ? this.volume : this.network;
+ Set<HeatStructureTree> volumeOrNetworkSet = type.equals(FileData.Type.HEAT_VOL) ? this.volume : this.network;
HeatStructureTree toRemove = getHeatStructureTreeByName(volumeOrNetworkSet, fileNameToRemove);
-
volumeOrNetworkSet.remove(toRemove);
}
@@ -217,7 +207,6 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
result1 = 31 * result1 + (artifacts != null ? artifacts.hashCode() : 0);
result1 = 31 * result1 + (nested != null ? nested.hashCode() : 0);
result1 = 31 * result1 + (errors != null ? errors.hashCode() : 0);
-
return result1;
}
@@ -229,11 +218,8 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
if (other == null || getClass() != other.getClass()) {
return false;
}
-
HeatStructureTree heatStructureTree = (HeatStructureTree) other;
-
- if (fileName != null ? !fileName.equals(heatStructureTree.fileName)
- : heatStructureTree.fileName != null) {
+ if (fileName != null ? !fileName.equals(heatStructureTree.fileName) : heatStructureTree.fileName != null) {
return false;
}
if (env != null ? !env.equals(heatStructureTree.env) : heatStructureTree.env != null) {
@@ -242,23 +228,18 @@ public class HeatStructureTree implements Comparable<HeatStructureTree> {
if (heat != null ? !heat.equals(heatStructureTree.heat) : heatStructureTree.heat != null) {
return false;
}
- if (volume != null ? !volume.equals(heatStructureTree.volume)
- : heatStructureTree.volume != null) {
+ if (volume != null ? !volume.equals(heatStructureTree.volume) : heatStructureTree.volume != null) {
return false;
}
- if (network != null ? !network.equals(heatStructureTree.network)
- : heatStructureTree.network != null) {
+ if (network != null ? !network.equals(heatStructureTree.network) : heatStructureTree.network != null) {
return false;
}
- if (artifacts != null ? !artifacts.equals(heatStructureTree.artifacts)
- : heatStructureTree.artifacts != null) {
+ if (artifacts != null ? !artifacts.equals(heatStructureTree.artifacts) : heatStructureTree.artifacts != null) {
return false;
}
- if (nested != null ? !nested.equals(heatStructureTree.nested)
- : heatStructureTree.nested != null) {
+ if (nested != null ? !nested.equals(heatStructureTree.nested) : heatStructureTree.nested != null) {
return false;
}
-
return errors != null ? errors.equals(heatStructureTree.errors) : heatStructureTree.errors == null;
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/ValidationStructureList.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/ValidationStructureList.java
index 27b87b9045..d23f6e5af5 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/ValidationStructureList.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/ValidationStructureList.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.datatypes.structure;
import lombok.AllArgsConstructor;
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/ErrorCodes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/ErrorCodes.java
index e239d225e8..8e7d398170 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/ErrorCodes.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/ErrorCodes.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,10 +17,9 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.services;
-
public class ErrorCodes {
- public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN";
+
+ public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN";
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java
index 1e917ea4cd..7d4033e552 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java
@@ -13,14 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.heat.services;
-
public class HeatConstants {
+
public static final String GET_ATTR_FROM_RESOURCE_GROUP_PREFIX = "resource.";
public static final String RESOURCE_GROUP_INDEX_VAR_DEFAULT_VALUE = "%index%";
-
public static final String INDEX_PROPERTY_NAME = "index_var";
public static final String SERVICE_SCALING_PROPERTY_NAME = "service_scaling";
public static final String INSTANCE_UUID_PROPERTY_NAME = "instance_uuid";
@@ -32,13 +30,11 @@ public class HeatConstants {
public static final String VIRTUAL_NETWORK_PROPERTY_NAME = "virtual_network";
public static final String BLOCK_DEVICE_MAPPING = "block_device_mapping";
public static final String BLOCK_DEVICE_MAPPING_V2 = "block_device_mapping_v2";
- public static final String VMI_SUB_INTERFACE_VLAN_TAG_PROPERTY_NAME
- = "virtual_machine_interface_properties_sub_interface_vlan_tag";
+ public static final String VMI_SUB_INTERFACE_VLAN_TAG_PROPERTY_NAME = "virtual_machine_interface_properties_sub_interface_vlan_tag";
public static final String VMI_PROPERTIES_PROPERTY_NAME = "virtual_machine_interface_properties";
public static final String VMI_REFS_PROPERTY_NAME = "virtual_machine_interface_refs";
public static final String VMI_MAC_ADDRESSES = "virtual_machine_interface_mac_addresses";
- public static final String VMI_MAC_ADDRESSES_MAC_ADDRESSES =
- "virtual_machine_interface_mac_addresses#virtual_machine_interface_mac_addresses_mac_address";
+ public static final String VMI_MAC_ADDRESSES_MAC_ADDRESSES = "virtual_machine_interface_mac_addresses#virtual_machine_interface_mac_addresses_mac_address";
public static final String VIRTUAL_NETWORK_REFS_PROPERTY_NAME = "virtual_network_refs";
public static final String READ_ONLY_PROPERTY_NAME = "read_only";
public static final String VOL_ID_PROPERTY_NAME = "volume_id";
@@ -48,8 +44,7 @@ public class HeatConstants {
public static final String ORDERED_INTERFACES_PROPERTY_NAME = "ordered_interfaces";
public static final String SHARED_IP_LIST_PROPERTY_NAME = "shared_ip_list";
public static final String STATIC_ROUTES_LIST_PROPERTY_NAME = "static_routes_list";
- public static final String SERVICE_INTERFCAE_TYPE_LIST_PROPERTY_NAME =
- "service_interface_type_list";
+ public static final String SERVICE_INTERFCAE_TYPE_LIST_PROPERTY_NAME = "service_interface_type_list";
public static final String PORT_SECURITY_ENABLED_PROPERTY_NAME = "port_security_enabled";
public static final String SHARED_PROPERTY_NAME = "shared";
public static final String ADMIN_STATE_UP_PROPERTY_NAME = "admin_state_up";
@@ -70,5 +65,4 @@ public class HeatConstants {
private HeatConstants() {
//Hide the implicit constructor
}
-
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatResourceUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatResourceUtil.java
index 4563e686e5..fa8845e382 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatResourceUtil.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatResourceUtil.java
@@ -13,14 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.heat.services;
import java.util.Objects;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes;
@@ -30,36 +28,26 @@ public class HeatResourceUtil {
private static final String UNDERSCORE = "_";
private static final String WORDS_REGEX = "(\\w+)";
private static final String PORT_RESOURCE_ID_REGEX_SUFFIX = "(_\\d+)*";
- private static final String PORT_RESOURCE_ID_REGEX_PREFIX =
- WORDS_REGEX + PORT_RESOURCE_ID_REGEX_SUFFIX;
- private static final String PORT_INT_RESOURCE_ID_REGEX_PREFIX = PORT_RESOURCE_ID_REGEX_PREFIX
- + UNDERSCORE + "int_" + WORDS_REGEX + UNDERSCORE;
+ private static final String PORT_RESOURCE_ID_REGEX_PREFIX = WORDS_REGEX + PORT_RESOURCE_ID_REGEX_SUFFIX;
+ private static final String PORT_INT_RESOURCE_ID_REGEX_PREFIX = PORT_RESOURCE_ID_REGEX_PREFIX + UNDERSCORE + "int_" + WORDS_REGEX + UNDERSCORE;
private static final String SUB_INTERFACE_INT_RESOURCE_ID_REGEX_PREFIX =
- PORT_RESOURCE_ID_REGEX_PREFIX + UNDERSCORE + "subint_" + WORDS_REGEX + UNDERSCORE;
+ PORT_RESOURCE_ID_REGEX_PREFIX + UNDERSCORE + "subint_" + WORDS_REGEX + UNDERSCORE;
- public static Optional<String> evaluateNetworkRoleFromResourceId(String resourceId,
- String resourceType) {
+ public static Optional<String> evaluateNetworkRoleFromResourceId(String resourceId, String resourceType) {
Optional<PortType> portType = getPortType(resourceType);
if (portType.isPresent()) {
- String portResourceIdRegex =
- PORT_RESOURCE_ID_REGEX_PREFIX + UNDERSCORE + WORDS_REGEX + UNDERSCORE
- + portType.get().getPortTypeName() + PORT_RESOURCE_ID_REGEX_SUFFIX;
- String portIntResourceIdRegex =
- PORT_INT_RESOURCE_ID_REGEX_PREFIX + portType.get().getPortTypeName()
- + PORT_RESOURCE_ID_REGEX_SUFFIX;
-
+ String portResourceIdRegex = PORT_RESOURCE_ID_REGEX_PREFIX + UNDERSCORE + WORDS_REGEX + UNDERSCORE + portType.get().getPortTypeName()
+ + PORT_RESOURCE_ID_REGEX_SUFFIX;
+ String portIntResourceIdRegex = PORT_INT_RESOURCE_ID_REGEX_PREFIX + portType.get().getPortTypeName() + PORT_RESOURCE_ID_REGEX_SUFFIX;
String portNetworkRole = getNetworkRole(resourceId, portResourceIdRegex);
String portIntNetworkRole = getNetworkRole(resourceId, portIntResourceIdRegex);
-
- return Optional.ofNullable(Objects.nonNull(portNetworkRole)
- ? portNetworkRole : portIntNetworkRole);
+ return Optional.ofNullable(Objects.nonNull(portNetworkRole) ? portNetworkRole : portIntNetworkRole);
}
return Optional.empty();
}
private static Optional<PortType> getPortType(String resourceType) {
- if (HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource()
- .equals(resourceType)) {
+ if (HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource().equals(resourceType)) {
return Optional.of(PortType.VMI);
} else if (HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource().equals(resourceType)) {
return Optional.of(PortType.PORT);
@@ -74,28 +62,16 @@ public class HeatResourceUtil {
* @param resourceType the resource type
* @return the optional
*/
- public static Optional<String> extractNetworkRoleFromSubInterfaceId(String resourceId,
- String resourceType) {
+ public static Optional<String> extractNetworkRoleFromSubInterfaceId(String resourceId, String resourceType) {
Optional<PortType> portType = getPortType(resourceType);
if (portType.isPresent()) {
String subInterfaceResourceIdRegex =
- SUB_INTERFACE_INT_RESOURCE_ID_REGEX_PREFIX + portType.get().getPortTypeName()
- + PORT_RESOURCE_ID_REGEX_SUFFIX;
-
+ SUB_INTERFACE_INT_RESOURCE_ID_REGEX_PREFIX + portType.get().getPortTypeName() + PORT_RESOURCE_ID_REGEX_SUFFIX;
return Optional.ofNullable(getNetworkRole(resourceId, subInterfaceResourceIdRegex));
}
return Optional.empty();
}
- @AllArgsConstructor
- @Getter
- private enum PortType {
- PORT("port"),
- VMI("vmi");
-
- private String portTypeName;
- }
-
private static String getNetworkRole(String portResourceId, String portIdRegex) {
Pattern pattern = Pattern.compile(portIdRegex);
Matcher matcher = pattern.matcher(portResourceId);
@@ -109,4 +85,10 @@ public class HeatResourceUtil {
return null;
}
+ @AllArgsConstructor
+ @Getter
+ private enum PortType {
+ PORT("port"), VMI("vmi");
+ private String portTypeName;
+ }
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java
index b73c7e8b8b..cc239751a8 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.services;
import java.util.HashSet;
@@ -25,7 +24,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
import org.openecomp.core.validation.types.GlobalValidationContext;
@@ -51,63 +49,50 @@ public class HeatStructureUtil {
* @param globalContext the global context
* @return the referenced values by function name
*/
- public static Set<String> getReferencedValuesByFunctionName(String filename, String functionName,
- Object propertyValue,
+ public static Set<String> getReferencedValuesByFunctionName(String filename, String functionName, Object propertyValue,
GlobalValidationContext globalContext) {
Set<String> valuesNames = new HashSet<>();
if (propertyValue instanceof Map) {
Map<String, Object> currPropertyMap = (Map<String, Object>) propertyValue;
if (currPropertyMap.containsKey(functionName)) {
Object getFunctionValue = currPropertyMap.get(functionName);
- if (!(getFunctionValue instanceof String) && functionName.equals(
- ResourceReferenceFunctions.GET_RESOURCE.getFunction())) {
+ if (!(getFunctionValue instanceof String) && functionName.equals(ResourceReferenceFunctions.GET_RESOURCE.getFunction())) {
globalContext.addMessage(filename, ErrorLevel.ERROR, ErrorMessagesFormatBuilder
- .getErrorWithParameters(globalContext.getMessageCode(),
- Messages.INVALID_GET_RESOURCE_SYNTAX.getErrorMessage(),
- getFunctionValue == null ? "null" : getFunctionValue.toString()));
+ .getErrorWithParameters(globalContext.getMessageCode(), Messages.INVALID_GET_RESOURCE_SYNTAX.getErrorMessage(),
+ getFunctionValue == null ? "null" : getFunctionValue.toString()));
return valuesNames;
}
if (getFunctionValue instanceof String) {
-
if (functionName.equals(ResourceReferenceFunctions.GET_FILE.getFunction())) {
getFunctionValue = ((String) getFunctionValue).replace("file:///", "");
}
-
valuesNames.add((String) getFunctionValue);
} else if (getFunctionValue instanceof List) {
if (CollectionUtils.isNotEmpty((List) getFunctionValue)) {
if (((List) getFunctionValue).get(0) instanceof String) {
valuesNames.add(((String) ((List) getFunctionValue).get(0)).replace("file:///", ""));
} else {
- valuesNames.addAll(getReferencedValuesByFunctionName(filename, functionName,
- ((List) getFunctionValue).get(0), globalContext));
+ valuesNames
+ .addAll(getReferencedValuesByFunctionName(filename, functionName, ((List) getFunctionValue).get(0), globalContext));
}
-
}
} else {
- valuesNames.addAll(
- getReferencedValuesByFunctionName(filename, functionName, getFunctionValue,
- globalContext));
+ valuesNames.addAll(getReferencedValuesByFunctionName(filename, functionName, getFunctionValue, globalContext));
}
} else {
for (Map.Entry<String, Object> nestedPropertyMap : currPropertyMap.entrySet()) {
- valuesNames.addAll(getReferencedValuesByFunctionName(filename, functionName,
- nestedPropertyMap.getValue(), globalContext));
+ valuesNames.addAll(getReferencedValuesByFunctionName(filename, functionName, nestedPropertyMap.getValue(), globalContext));
}
}
} else if (propertyValue instanceof List) {
List propertyValueArray = (List) propertyValue;
for (Object propValue : propertyValueArray) {
- valuesNames.addAll(
- getReferencedValuesByFunctionName(filename, functionName, propValue,
- globalContext));
+ valuesNames.addAll(getReferencedValuesByFunctionName(filename, functionName, propValue, globalContext));
}
}
-
return valuesNames;
}
-
/**
* Is nested resource.
*
@@ -120,5 +105,4 @@ public class HeatStructureUtil {
}
return resourceType.endsWith(".yaml") || resourceType.endsWith(".yml");
}
-
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/manifest/ManifestUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/manifest/ManifestUtil.java
index 8c6daac71e..65afb4bab2 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/manifest/ManifestUtil.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/manifest/ManifestUtil.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.openecomp.sdc.heat.services.manifest;
import java.util.HashMap;
@@ -25,14 +24,12 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.sdc.heat.datatypes.manifest.FileData;
import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
public class ManifestUtil {
-
/**
* Gets file and its env.
*
@@ -45,7 +42,6 @@ public class ManifestUtil {
return fileEnvMap;
}
-
/**
* Scan file env map.
*
@@ -53,13 +49,10 @@ public class ManifestUtil {
* @param fileDataList the file data list
* @param fileEnvMap the file env map
*/
- private static void scanFileEnvMap(FileData fileData, List<FileData> fileDataList,
- Map<String, FileData> fileEnvMap) {
-
+ private static void scanFileEnvMap(FileData fileData, List<FileData> fileDataList, Map<String, FileData> fileEnvMap) {
if (CollectionUtils.isEmpty(fileDataList)) {
return;
}
-
for (FileData childFileData : fileDataList) {
FileData.Type childType = childFileData.getType();
if (fileData != null) {
@@ -71,7 +64,6 @@ public class ManifestUtil {
}
}
-
/**
* Gets file type map.
*
@@ -84,15 +76,13 @@ public class ManifestUtil {
return fileTypeMap;
}
- private static FileData.Type scanFileTypeMap(FileData fileData, List<FileData> data,
- Map<String, FileData.Type> fileTypeMap) {
+ private static FileData.Type scanFileTypeMap(FileData fileData, List<FileData> data, Map<String, FileData.Type> fileTypeMap) {
if (fileData != null) {
fileTypeMap.put(fileData.getFile(), fileData.getType());
}
if (data == null) {
return null;
}
-
for (FileData chileFileData : data) {
FileData.Type type = scanFileTypeMap(chileFileData, chileFileData.getData(), fileTypeMap);
if (type != null) {
@@ -102,7 +92,6 @@ public class ManifestUtil {
return null;
}
-
/**
* Gets artifacts.
*
@@ -112,7 +101,6 @@ public class ManifestUtil {
public static Set<String> getArtifacts(ManifestContent manifestContent) {
Set<String> artifacts = new HashSet<>();
scanArtifacts(null, manifestContent.getData(), artifacts);
-
return artifacts;
}
@@ -122,22 +110,18 @@ public class ManifestUtil {
artifacts.add(fileData.getFile());
}
}
-
if (data == null) {
return;
}
-
for (FileData chileFileData : data) {
scanArtifacts(chileFileData, chileFileData.getData(), artifacts);
}
}
private static boolean isArtifact(FileData fileData) {
- return FileData.Type.valueOf(fileData.getType().name()) != null
- && !fileData.getType().equals(FileData.Type.HEAT)
- && !fileData.getType().equals(FileData.Type.HEAT_ENV)
- && !fileData.getType().equals(FileData.Type.HEAT_NET)
- && !fileData.getType().equals(FileData.Type.HEAT_VOL);
+ return FileData.Type.valueOf(fileData.getType().name()) != null && !fileData.getType().equals(FileData.Type.HEAT) && !fileData.getType()
+ .equals(FileData.Type.HEAT_ENV) && !fileData.getType().equals(FileData.Type.HEAT_NET) && !fileData.getType()
+ .equals(FileData.Type.HEAT_VOL);
}
/**
@@ -158,11 +142,9 @@ public class ManifestUtil {
baseFiles.add(fileData.getFile());
}
}
-
if (data == null) {
return;
}
-
for (FileData chileFileData : data) {
scanBase(chileFileData, chileFileData.getData(), baseFiles);
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
index b441fc8660..2907b73ccb 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.openecomp.sdc.heat.services.tree;
import java.io.InputStream;
@@ -23,7 +22,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-
import org.onap.sdc.tosca.services.YamlUtil;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.file.FileUtils;
@@ -39,12 +37,9 @@ import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
-
public class HeatTreeManager {
private static final Logger LOGGER = LoggerFactory.getLogger(HeatTreeManager.class);
-
-
private FileContentHandler heatContentMap = new FileContentHandler();
private byte[] manifest;
private HeatStructureTree tree = new HeatStructureTree();
@@ -65,7 +60,6 @@ public class HeatTreeManager {
public void addFile(String fileName, InputStream content) {
if (fileName.equals(SdcCommon.MANIFEST_NAME)) {
manifest = FileUtils.toByteArray(content);
-
} else {
heatContentMap.addFile(fileName, content);
}
@@ -79,25 +73,19 @@ public class HeatTreeManager {
LOGGER.error("Missing manifest file in the zip.");
return;
}
- ManifestContent manifestData =
- JsonUtil.json2Object(new String(manifest), ManifestContent.class);
+ ManifestContent manifestData = JsonUtil.json2Object(new String(manifest), ManifestContent.class);
scanTree(null, manifestData.getData());
addNonNestedVolumeNetworkToTree(volumeFileToParent, nestedFiles.keySet(), true);
addNonNestedVolumeNetworkToTree(networkFileToParent, nestedFiles.keySet(), false);
handleOrphans();
-
tree = fileTreeRef.get(SdcCommon.PARENT);
}
private void handleOrphans() {
tree = fileTreeRef.get(SdcCommon.PARENT);
candidateOrphanArtifacts.forEach((key, value) -> tree.addArtifactToArtifactList(value));
- nestedFiles
- .values().stream().filter(tree.getHeat()::contains)
- .forEach(tree.getHeat()::remove);
-
- heatContentMap.getFileList().stream().filter(this::isNotInManifestFiles)
- .forEach(this::addTreeOther);
+ nestedFiles.values().stream().filter(tree.getHeat()::contains).forEach(tree.getHeat()::remove);
+ heatContentMap.getFileList().stream().filter(this::isNotInManifestFiles).forEach(this::addTreeOther);
}
private boolean isNotInManifestFiles(String fileName) {
@@ -113,18 +101,12 @@ public class HeatTreeManager {
tree.getOther().add(other);
}
-
- private void handleHeatContentReference(HeatStructureTree fileHeatStructureTree,
- GlobalValidationContext globalContext) {
-
+ private void handleHeatContentReference(HeatStructureTree fileHeatStructureTree, GlobalValidationContext globalContext) {
String fileName = fileHeatStructureTree.getFileName();
try (InputStream fileContent = this.heatContentMap.getFileContentAsStream(fileName)) {
- HeatOrchestrationTemplate hot =
- new YamlUtil().yamlToObject(fileContent, HeatOrchestrationTemplate.class);
-
+ HeatOrchestrationTemplate hot = new YamlUtil().yamlToObject(fileContent, HeatOrchestrationTemplate.class);
Set<String> nestedSet = HeatTreeManagerUtil.getNestedFiles(hot);
addHeatNestedFiles(fileHeatStructureTree, nestedSet);
-
Set<String> artifactSet = HeatTreeManagerUtil.getArtifactFiles(fileName, hot, globalContext);
addHeatArtifactFiles(fileHeatStructureTree, artifactSet);
} catch (Exception exp) {
@@ -132,14 +114,10 @@ public class HeatTreeManager {
}
}
-
- private void addHeatArtifactFiles(HeatStructureTree fileHeatStructureTree,
- Set<String> artifactSet) {
+ private void addHeatArtifactFiles(HeatStructureTree fileHeatStructureTree, Set<String> artifactSet) {
Artifact artifact;
for (String artifactName : artifactSet) {
- FileData.Type type =
- candidateOrphanArtifacts.get(artifactName) != null ? candidateOrphanArtifacts
- .get(artifactName).getType() : null;
+ FileData.Type type = candidateOrphanArtifacts.get(artifactName) != null ? candidateOrphanArtifacts.get(artifactName).getType() : null;
artifact = new Artifact(artifactName, type);
artifactRef.put(artifactName, artifact);
candidateOrphanArtifacts.remove(artifactName);
@@ -147,7 +125,6 @@ public class HeatTreeManager {
}
}
-
private void addHeatNestedFiles(HeatStructureTree fileHeatStructureTree, Set<String> nestedSet) {
HeatStructureTree childHeatStructureTree;
for (String nestedName : nestedSet) {
@@ -162,22 +139,16 @@ public class HeatTreeManager {
}
}
-
/**
* Add errors.
*
* @param validationErrors the validation errors
*/
public void addErrors(Map<String, List<ErrorMessage>> validationErrors) {
-
- validationErrors.entrySet().stream()
- .filter(entry -> fileTreeRef.get(entry.getKey()) != null)
- .forEach(entry -> entry.getValue().forEach(fileTreeRef.get(entry.getKey())::addErrorToErrorsList));
-
- validationErrors.entrySet().stream()
- .filter(entry -> artifactRef.get(entry.getKey()) != null)
- .forEach(entry -> artifactRef.get(entry.getKey()).setErrors(entry.getValue()));
-
+ validationErrors.entrySet().stream().filter(entry -> fileTreeRef.get(entry.getKey()) != null)
+ .forEach(entry -> entry.getValue().forEach(fileTreeRef.get(entry.getKey())::addErrorToErrorsList));
+ validationErrors.entrySet().stream().filter(entry -> artifactRef.get(entry.getKey()) != null)
+ .forEach(entry -> artifactRef.get(entry.getKey()).setErrors(entry.getValue()));
}
/**
@@ -200,12 +171,10 @@ public class HeatTreeManager {
} else {
parentHeatStructureTree = fileTreeRef.get(parent);
}
-
for (FileData fileData : data) {
fileName = fileData.getFile();
manifestFiles.add(fileName);
type = fileData.getType();
-
if (Objects.nonNull(type) && FileData.Type.HEAT.equals(type)) {
fileHeatStructureTree = fileTreeRef.get(fileName);
if (fileHeatStructureTree == null) {
@@ -226,7 +195,6 @@ public class HeatTreeManager {
childHeatStructureTree.setBase(fileData.getBase());
childHeatStructureTree.setType(type);
fileTreeRef.put(childHeatStructureTree.getFileName(), childHeatStructureTree);
-
if (type == null) {
parentHeatStructureTree.addOtherToOtherList(childHeatStructureTree);
} else if (FileData.Type.HEAT_NET.equals(type)) {
@@ -235,7 +203,6 @@ public class HeatTreeManager {
scanTree(fileName, fileData.getData());
}
handleHeatContentReference(childHeatStructureTree, null);
-
} else if (FileData.Type.HEAT_VOL.equals(type)) {
volumeFileToParent.put(childHeatStructureTree, parentHeatStructureTree);
if (fileData.getData() != null) {
@@ -253,8 +220,7 @@ public class HeatTreeManager {
}
} else if (FileData.Type.HELM.equals(type)) {
parentHeatStructureTree.addToHelmList(childHeatStructureTree);
- }
- else {
+ } else {
artifact = new Artifact(fileName, type);
if (!artifactRef.keySet().contains(fileName)) {
artifactRef.put(fileName, artifact);
@@ -265,10 +231,8 @@ public class HeatTreeManager {
}
}
-
- private void addNonNestedVolumeNetworkToTree(
- Map<HeatStructureTree, HeatStructureTree> netVolToParent, Set<String> nestedFileNames,
- boolean isVolume) {
+ private void addNonNestedVolumeNetworkToTree(Map<HeatStructureTree, HeatStructureTree> netVolToParent, Set<String> nestedFileNames,
+ boolean isVolume) {
for (Map.Entry<HeatStructureTree, HeatStructureTree> entry : netVolToParent.entrySet()) {
HeatStructureTree netOrVolNode = entry.getKey();
HeatStructureTree parent = entry.getValue();
@@ -282,7 +246,6 @@ public class HeatTreeManager {
}
}
-
public HeatStructureTree getTree() {
return tree;
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java
index 9970a4d74c..43bc3f80a9 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java
@@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.openecomp.sdc.heat.services.tree;
import java.util.Collection;
@@ -23,7 +21,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.core.utilities.file.FileContentHandler;
@@ -42,7 +39,6 @@ public class HeatTreeManagerUtil {
private static final String TYPE = "type";
private HeatTreeManagerUtil() {
-
}
/**
@@ -52,11 +48,8 @@ public class HeatTreeManagerUtil {
* @return the heat tree manager
*/
public static HeatTreeManager initHeatTreeManager(FileContentHandler fileContentMap) {
-
HeatTreeManager heatTreeManager = new HeatTreeManager();
- fileContentMap.getFileList().forEach(
- fileName -> heatTreeManager.addFile(fileName, fileContentMap.getFileContentAsStream(fileName)));
-
+ fileContentMap.getFileList().forEach(fileName -> heatTreeManager.addFile(fileName, fileContentMap.getFileContentAsStream(fileName)));
return heatTreeManager;
}
@@ -68,10 +61,8 @@ public class HeatTreeManagerUtil {
*/
public static Set<String> getNestedFiles(HeatOrchestrationTemplate hot) {
Set<String> nestedFileList = new HashSet<>();
- hot.getResources().values().stream().filter(
- resource -> resource.getType().endsWith(".yaml") || resource.getType().endsWith(".yml"))
- .forEach(resource -> nestedFileList.add(resource.getType()));
-
+ hot.getResources().values().stream().filter(resource -> resource.getType().endsWith(".yaml") || resource.getType().endsWith(".yml"))
+ .forEach(resource -> nestedFileList.add(resource.getType()));
Set<String> resourceDefNestedFiles = getResourceDefNestedFiles(hot);
nestedFileList.addAll(resourceDefNestedFiles);
return nestedFileList;
@@ -85,52 +76,36 @@ public class HeatTreeManagerUtil {
* @param globalContext the global context
* @return the artifact files name
*/
- public static Set<String> getArtifactFiles(String filename, HeatOrchestrationTemplate hot,
- GlobalValidationContext globalContext) {
+ public static Set<String> getArtifactFiles(String filename, HeatOrchestrationTemplate hot, GlobalValidationContext globalContext) {
Set<String> artifactSet = new HashSet<>();
- Collection<Resource> resourcesValue =
- hot.getResources() == null ? null : hot.getResources().values();
+ Collection<Resource> resourcesValue = hot.getResources() == null ? null : hot.getResources().values();
if (CollectionUtils.isNotEmpty(resourcesValue)) {
for (Resource resource : resourcesValue) {
- Collection<Object> properties =
- resource.getProperties() == null ? null : resource.getProperties().values();
-
- artifactSet.addAll(getArtifactsFromPropertiesAndAddInArtifactSet(properties,
- filename, globalContext));
+ Collection<Object> properties = resource.getProperties() == null ? null : resource.getProperties().values();
+ artifactSet.addAll(getArtifactsFromPropertiesAndAddInArtifactSet(properties, filename, globalContext));
}
}
return artifactSet;
}
- private static Set<String> getArtifactsFromPropertiesAndAddInArtifactSet(Collection<Object> properties,
- String filename,
+ private static Set<String> getArtifactsFromPropertiesAndAddInArtifactSet(Collection<Object> properties, String filename,
GlobalValidationContext globalContext) {
Set<String> artifactSet = new HashSet<>();
if (CollectionUtils.isNotEmpty(properties)) {
-
for (Object property : properties) {
- Set<String> artifactNames =
- HeatStructureUtil.getReferencedValuesByFunctionName(filename, "get_file", property,
- globalContext);
+ Set<String> artifactNames = HeatStructureUtil.getReferencedValuesByFunctionName(filename, "get_file", property, globalContext);
artifactSet.addAll(artifactNames);
}
}
-
return artifactSet;
}
private static Set<String> getResourceDefNestedFiles(HeatOrchestrationTemplate hot) {
Set<String> resourceDefNestedFiles = new HashSet<>();
- hot.getResources()
- .entrySet().stream().filter(entry -> entry.getValue().getType()
- .equals(HeatResourcesTypes.RESOURCE_GROUP_RESOURCE_TYPE.getHeatResource()))
- .filter(entry ->
- getResourceDef(entry.getValue()) != null
- && HeatStructureUtil.isNestedResource(
- getResourceDef(entry.getValue())
- .getType()))
- .forEach(entry -> resourceDefNestedFiles.add(
- getResourceDef(entry.getValue()).getType()));
+ hot.getResources().entrySet().stream()
+ .filter(entry -> entry.getValue().getType().equals(HeatResourcesTypes.RESOURCE_GROUP_RESOURCE_TYPE.getHeatResource())).filter(
+ entry -> getResourceDef(entry.getValue()) != null && HeatStructureUtil.isNestedResource(getResourceDef(entry.getValue()).getType()))
+ .forEach(entry -> resourceDefNestedFiles.add(getResourceDef(entry.getValue()).getType()));
return resourceDefNestedFiles;
}
@@ -144,8 +119,7 @@ public class HeatTreeManagerUtil {
public static Resource getResourceDef(Resource resource) {
Resource resourceDef = null;
Map<String, Object> resourceDefValueMap = resource.getProperties() == null ? new HashMap<>()
- : (Map<String, Object>) resource.getProperties().get(
- PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap());
+ : (Map<String, Object>) resource.getProperties().get(PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap());
if (MapUtils.isNotEmpty(resourceDefValueMap)) {
Object resourceDefType = resourceDefValueMap.get(TYPE);
if (resourceDefType instanceof String && isResourceGroupTypeNested((String) resourceDefType)) {
@@ -154,43 +128,33 @@ public class HeatTreeManagerUtil {
//noinspection unchecked
resourceDef.setProperties((Map<String, Object>) resourceDefValueMap.get("properties"));
}
-
}
return resourceDef;
}
@SuppressWarnings("unchecked")
- public static void checkResourceGroupTypeValid(String filename, String resourceName,
- Resource resource,
- GlobalValidationContext globalContext) {
+ public static void checkResourceGroupTypeValid(String filename, String resourceName, Resource resource, GlobalValidationContext globalContext) {
Map<String, Object> resourceDefValueMap = resource.getProperties() == null ? new HashMap<>()
- : (Map<String, Object>) resource.getProperties().get(
- PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap());
+ : (Map<String, Object>) resource.getProperties().get(PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap());
if (MapUtils.isNotEmpty(resourceDefValueMap)) {
Object resourceDefType = resourceDefValueMap.get(TYPE);
if (Objects.nonNull(resourceDefType) && !(resourceDefType instanceof String)) {
globalContext.addMessage(filename, ErrorLevel.WARNING, ErrorMessagesFormatBuilder
- .getErrorWithParameters(
- globalContext.getMessageCode(),
- Messages.INVALID_RESOURCE_GROUP_TYPE.getErrorMessage(),
- resourceName, resourceDefType.toString()));
+ .getErrorWithParameters(globalContext.getMessageCode(), Messages.INVALID_RESOURCE_GROUP_TYPE.getErrorMessage(), resourceName,
+ resourceDefType.toString()));
}
}
}
@SuppressWarnings("unchecked")
- public static void checkResourceTypeValid(String filename, String resourceName,
- Resource resource,
- GlobalValidationContext globalContext) {
+ public static void checkResourceTypeValid(String filename, String resourceName, Resource resource, GlobalValidationContext globalContext) {
Map<String, Object> resourceDefValueMap = resource.getProperties() == null ? new HashMap<>()
- : (Map<String, Object>) resource.getProperties().get(PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap());
+ : (Map<String, Object>) resource.getProperties().get(PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap());
if (MapUtils.isNotEmpty(resourceDefValueMap)) {
Object resourceDefType = resourceDefValueMap.get(TYPE);
if (Objects.isNull(resourceDefType)) {
globalContext.addMessage(filename, ErrorLevel.WARNING, ErrorMessagesFormatBuilder
- .getErrorWithParameters(
- globalContext.getMessageCode(), Messages.INVALID_RESOURCE_TYPE.getErrorMessage(),
- "null", resourceName));
+ .getErrorWithParameters(globalContext.getMessageCode(), Messages.INVALID_RESOURCE_TYPE.getErrorMessage(), "null", resourceName));
}
}
}
@@ -199,20 +163,17 @@ public class HeatTreeManagerUtil {
return HeatStructureUtil.isNestedResource(resourceDefType);
}
- public static boolean checkIfResourceGroupTypeIsNested(String filename, String resourceName,
- Resource resource,
+ public static boolean checkIfResourceGroupTypeIsNested(String filename, String resourceName, Resource resource,
GlobalValidationContext globalContext) {
//noinspection unchecked
Map<String, Object> resourceDefValueMap = resource.getProperties() == null ? new HashMap<>()
- : (Map<String, Object>) resource.getProperties().get(PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap());
+ : (Map<String, Object>) resource.getProperties().get(PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap());
if (MapUtils.isNotEmpty(resourceDefValueMap)) {
Object resourceDefType = resourceDefValueMap.get(TYPE);
if (resourceDefType instanceof String && isResourceGroupTypeNested((String) resourceDefType)) {
globalContext.addMessage(filename, ErrorLevel.WARNING, ErrorMessagesFormatBuilder
- .getErrorWithParameters(
- globalContext.getMessageCode(),
- Messages.INVALID_RESOURCE_GROUP_TYPE.getErrorMessage(),
- resourceName, resourceDefType.toString()));
+ .getErrorWithParameters(globalContext.getMessageCode(), Messages.INVALID_RESOURCE_GROUP_TYPE.getErrorMessage(), resourceName,
+ resourceDefType.toString()));
return true;
}
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManager.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManager.java
index 944ab62f9f..6957cb4fd6 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManager.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManager.java
@@ -12,8 +12,7 @@
* 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.
-**/
-
+ **/
package org.openecomp.sdc.heat.services.tree;
import java.io.File;
@@ -22,7 +21,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Pattern;
-
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
@@ -37,7 +35,6 @@ public class ToscaTreeManager {
private HeatStructureTree tree = new HeatStructureTree();
private Map<String, HeatStructureTree> fileTreeRef = new HashMap<>();
-
/**
* Add file.
*
@@ -60,14 +57,12 @@ public class ToscaTreeManager {
}
}
- private void addFileToTree(String[] splitFilename, int startIndex, String fullFileName,
- HeatStructureTree parent) {
+ private void addFileToTree(String[] splitFilename, int startIndex, String fullFileName, HeatStructureTree parent) {
fileTreeRef.putIfAbsent(fullFileName, new HeatStructureTree());
HeatStructureTree heatStructureTree = fileTreeRef.get(fullFileName);
heatStructureTree.setFileName(splitFilename[startIndex]);
if (startIndex < splitFilename.length - 1) {
- addFileToTree(splitFilename, startIndex + 1,
- getFullFileName(fullFileName, splitFilename[startIndex + 1]), heatStructureTree);
+ addFileToTree(splitFilename, startIndex + 1, getFullFileName(fullFileName, splitFilename[startIndex + 1]), heatStructureTree);
}
parent.addHeatStructureTreeToNestedHeatList(heatStructureTree);
}
@@ -78,9 +73,8 @@ public class ToscaTreeManager {
* @param validationErrors the validation errors
*/
public void addErrors(Map<String, List<ErrorMessage>> validationErrors) {
- validationErrors.entrySet().stream().filter(entry ->
- Objects.nonNull(fileTreeRef.get(entry.getKey()))).forEach(entry -> entry.getValue()
- .forEach(error -> fileTreeRef.get(entry.getKey()).addErrorToErrorsList(error)));
+ validationErrors.entrySet().stream().filter(entry -> Objects.nonNull(fileTreeRef.get(entry.getKey())))
+ .forEach(entry -> entry.getValue().forEach(error -> fileTreeRef.get(entry.getKey()).addErrorToErrorsList(error)));
}
private String getFullFileName(String parentFullName, String fileName) {
@@ -91,7 +85,6 @@ public class ToscaTreeManager {
if (filename.contains("/")) {
return filename.split("/");
}
-
return filename.split(Pattern.quote(File.separator));
}