diff options
author | 2020-01-30 11:23:57 -0500 | |
---|---|---|
committer | 2020-01-30 16:38:18 +0000 | |
commit | 032ce4ec7c3d7ac138555dfe980ca53ebbf39f01 (patch) | |
tree | 97ead4fa03fbc4e31900fcc39adf5c1fd4594d39 /blueprints-processor/plugin/model-provider/src/main | |
parent | 4903545aae48b6b8169b8716ba5bce7f0cd8d7ba (diff) |
Removing blueprints-processor
Blueprints-Processor is deprecated, use CCSDK/CDS instead
Change-Id: I0abc96061c3c5edc6c5d02bcd6f35e18e31882a7
Issue-ID: CCSDK-2051
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Diffstat (limited to 'blueprints-processor/plugin/model-provider/src/main')
63 files changed, 0 insertions, 6950 deletions
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelConstant.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelConstant.java deleted file mode 100644 index 02e4553b3..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelConstant.java +++ /dev/null @@ -1,145 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model;
-
-public class ConfigModelConstant {
-
- private ConfigModelConstant() {
-
- }
-
- public static final String STATUS_CODE_SUCCESS = "200";
- public static final String STATUS_CODE_FAILURE = "400";
-
- public static final String STATUS_SUCCESS = "success";
- public static final String STATUS_FAILURE = "failure";
- public static final String STATUS_SKIPPED = "skipped";
-
- public static final String CONFIG_STATUS_PENDING = "pending";
- public static final String CONFIG_STATUS_FAILED = "failed";
- public static final String CONFIG_STATUS_SUCCESS = "success";
-
- public static final String USER_SYSTEM = "System";
- public static final String PROTOCOL_NETCONF = "netconf";
-
- public static final String MODEL_CONTENT_TYPE_TOSCA_JSON = "TOSCA_JSON";
- public static final String MODEL_CONTENT_TYPE_TOSCA_YAML = "TOSCA_YAML";
- public static final String MODEL_CONTENT_TYPE_TEMPLATE = "TEMPLATE";
- public static final String MODEL_CONTENT_TYPE_YANG = "YANG";
- public static final String MODEL_CONTENT_TYPE_SCHEMA = "SCHEMA";
-
- public static final String SERVICE_TEMPLATE_KEY_ARTIFACT_AUTHOR = "author";
- public static final String SERVICE_TEMPLATE_KEY_ARTIFACT_NAME = "service-template-name";
- public static final String SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION = "service-template-version";
-
- public static final String MODEL_DEFINITION_TYPE_NODE_TYPE = "node_type";
- public static final String MODEL_DEFINITION_TYPE_CAPABILITY_TYPE = "capability_type";
- public static final String MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE = "relationship_type";
- public static final String MODEL_DEFINITION_TYPE_DATA_TYPE = "data_type";
- public static final String MODEL_DEFINITION_TYPE_ARTIFACT_TYPE = "artifact_type";
-
- public static final String MODEL_TYPE_DATA_TYPE = "tosca.datatypes.Root";
- public static final String MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic";
- public static final String MODEL_TYPE_NODE_TYPE = "tosca.nodes.Root";
-
- public static final String MODEL_TYPE_NODE_DG = "tosca.nodes.DG";
- public static final String MODEL_TYPE_NODE_COMPONENT = "tosca.nodes.Component";
- public static final String MODEL_TYPE_NODE_COMPONENT_PYTHON = "tosca.nodes.Component.Python";
- public static final String MODEL_TYPE_NODE_VNF = "tosca.nodes.Vnf";
- public static final String MODEL_TYPE_NODE_ARTIFACT = "tosca.nodes.Artifact";
-
- public static final String MODEL_TYPE_ARTIFACT_TEMPLATE = "tosca.artifact.Template";
- public static final String MODEL_TYPE_ARTIFACT_LICENCE = "tosca.artifacts.Licence";
-
- public static final String MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON = "tosca.relationships.DependsOn";
- public static final String MODEL_TYPE_RELATIONSHIPS_HOSTED_ON = "tosca.relationships.HostedOn";
- public static final String MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO = "tosca.relationships.ConnectsTo";
- public static final String MODEL_TYPE_RELATIONSHIPS_ATTACH_TO = "tosca.relationships.AttachesTo";
- public static final String MODEL_TYPE_RELATIONSHIPS_ROUTES_TO = "tosca.relationships.RoutesTo";
-
- public static final String NODE_TEMPLATE_TYPE_ARTIFACT_CONFIG_TEMPLATE = "artifact-config-template";
-
- public static final String CAPABILITY_PROPERTY_MAPPING = "mapping";
- public static final String CAPABILITY_PROPERTY_CONTENT = "content";
-
- public static final String SOURCE_INPUT = "input";
- public static final String SOURCE_DEFAULT = "default";
- public static final String SOURCE_MDSAL = "mdsal";
- public static final String SOURCE_DB = "db";
- public static final String SOURCE_COMPONENT = "component";
-
- public static final String PROPERTY_STATUS = "status";
- public static final String PROPERTY_ERROR_CODE = "error-code";
- public static final String PROPERTY_ERROR_MESSAGE = "error-message";
-
- public static final String PROPERTY_REQUEST_INPUT = "request-input";
- public static final String PROPERTY_REQUEST_HEADER = "request-header";
- public static final String PROPERTY_REQUEST_PAYLOAD = "request-payload";
-
- public static final String PROPERTY_RESPONSE_PAYLOAD = "response-payload";
- public static final String PROPERTY_RESPONSE_JSON_NODE = "response-json-node";
-
- public static final String PROPERTY_PAYLOAD = "payload";
- public static final String PROPERTY_INPUTS = "inputs";
- public static final String PROPERTY_ORGINATOR_ID = "originator-id";
- public static final String PROPERTY_API_VERSION = "api-ver";
- public static final String PROPERTY_REQUEST_ID = "request-id";
- public static final String PROPERTY_SUB_REQUEST_ID = "sub-request-id";
- public static final String PROPERTY_REQUEST = "request";
- public static final String PROPERTY_RECIPE = "action";
-
- public static final String PROPERTY_SELECTOR = "prifix";
- public static final String PROPERTY_NODE_TEMPLATES = "node_templates";
- public static final String PROPERTY_NODE_TYPES = "node_types";
- public static final String PROPERTY_DATA_TYPES = "data_types";
- public static final String PROPERTY_ACTION_NAME = "action-name";
- public static final String PROPERTY_ACTION_PREFIX = "action-prefix";
- public static final String PROPERTY_TEMPLATE_NAME = "template-name";
-
- public static final String PROPERTY_CURRENT_INTERFACE = "current-interface";
- public static final String PROPERTY_CURRENT_OPERATION = "current-operation";
- public static final String PROPERTY_CURRENT_IMPLEMENTATION = "current-implementation";
- public static final String PROPERTY_CURRENT_NODETYPE_DERIVED_FROM = "current-node-type-derived-from";
- public static final String PROPERTY_CURRENT_RESOURCE_ASSIGNMENT = "current-resource-assignment";
- public static final String PROPERTY_CURRENT_DICTIONARY_DEFINITION = "current-dictionary-definition";
- public static final String PROPERTY_RESOURCE_ASSIGNMENTS_DATA = "resource-assignments-data";
-
- public static final String PROPERTY_RECIPE_NAMES = "action-names";
- public static final String PROPERTY_DICTIONARIES = "dictionaries";
- public static final String PROPERTY_RESOURCE_ASSIGNMENTS = "resource-assignments";
- public static final String PROPERTY_RESOURCE_KEY = "resource-key";
- public static final String PROPERTY_RESOURCE_NAME = "resource-name";
- public static final String PROPERTY_RESERVATION_ID = "reservation-id";
-
- public static final String PROPERTY_NODE_TEMPLATES_DOT = "node_templates.";
- public static final String PROPERTY_NODE_TYPES_DOT = "node_types.";
- public static final String PROPERTY_DATA_TYPES_DOT = "data_types.";
- public static final String PROPERTY_INPUTS_DOT = "inputs.";
- public static final String PROPERTY_ARTIFACTS_DOT = "artifacts.";
- public static final String PROPERTY_DICTIONARY_KEY_DOT = "dictionary-key.";
- public static final String PROPERTY_TEMPLATE_KEY_DOT = "template-key.";
- public static final String PROPERTY_RECIPE_KEY_DOT = "recipe-key.";
-
- public static final String PROPERTY_DOT_STATUS = ".status";
- public static final String PROPERTY_DOT_ERROR_MESSAGE = ".error-message";
-
- public static final String EXPRESSION_GET_INPUT = "get_input";
- public static final String EXPRESSION_GET_ATTRIBUTE = "get_attribute";
- public static final String EXPRESSION_SET_VALUE = "set_value";
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelException.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelException.java deleted file mode 100644 index aa71c265a..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ConfigModelException.java +++ /dev/null @@ -1,50 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model;
-
-/**
- * ConfigGeneratorException.java Purpose: Provide Configuration Generator ConfigGeneratorException
- *
- * @version 1.0
- */
-public class ConfigModelException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * This is a ConfigGeneratorException constructor
- *
- * @param message
- */
- public ConfigModelException(String message) {
- super(message);
- }
-
- /**
- * This is a ConfigGeneratorException constructor
- *
- * @param message
- */
- public ConfigModelException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ValidTypes.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ValidTypes.java deleted file mode 100644 index 1be6089d5..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/ValidTypes.java +++ /dev/null @@ -1,105 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * ValidTypes.java Purpose: Provide Configuration Generator ValidTypes
- *
- * @version 1.0
- */
-public class ValidTypes {
-
- public static final String DATA_TYPE_STRING = "string";
- public static final String DATA_TYPE_INTEGER = "integer";
- public static final String DATA_TYPE_FLOAT = "float";
- public static final String DATA_TYPE_BOOLEAN = "boolean";
- public static final String DATA_TYPE_TIMESTAMP = "timestamp";
- public static final String DATA_TYPE_NULL = "null";
- public static final String DATA_TYPE_LIST = "list";
- public static final String DATA_TYPE_LONGTEXT = "longtext";
-
- private ValidTypes() {
-
- }
-
- public static List<String> getValidModelTypes() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(ConfigModelConstant.MODEL_DEFINITION_TYPE_DATA_TYPE);
- validTypes.add(ConfigModelConstant.MODEL_DEFINITION_TYPE_NODE_TYPE);
- validTypes.add(ConfigModelConstant.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE);
- validTypes.add(ConfigModelConstant.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE);
- return validTypes;
- }
-
- public static List<String> getValidNodeTypes() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_DG);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_COMPONENT);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_VNF);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_ARTIFACT);
- return validTypes;
- }
-
- public static List<String> getValidDerivedFrom() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(ConfigModelConstant.MODEL_TYPE_DATA_TYPE_DYNAMIC);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_DATA_TYPE);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_NODE_TYPE);
- return validTypes;
- }
-
- public static List<String> getValidDataTypeDerivedFrom() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(ConfigModelConstant.MODEL_TYPE_DATA_TYPE_DYNAMIC);
- validTypes.add(ConfigModelConstant.MODEL_TYPE_DATA_TYPE);
- return validTypes;
- }
-
- public static List<String> getValidPropertType() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(DATA_TYPE_STRING);
- validTypes.add(DATA_TYPE_INTEGER);
- validTypes.add(DATA_TYPE_FLOAT);
- validTypes.add(DATA_TYPE_BOOLEAN);
- validTypes.add(DATA_TYPE_TIMESTAMP);
- validTypes.add(DATA_TYPE_NULL);
- validTypes.add(DATA_TYPE_LIST);
- return validTypes;
- }
-
- public static List<String> getPrimitivePropertType() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(DATA_TYPE_STRING);
- validTypes.add(DATA_TYPE_INTEGER);
- validTypes.add(DATA_TYPE_FLOAT);
- validTypes.add(DATA_TYPE_BOOLEAN);
- validTypes.add(DATA_TYPE_TIMESTAMP);
- validTypes.add(DATA_TYPE_NULL);
- return validTypes;
- }
-
- public static List<String> getListPropertType() {
- List<String> validTypes = new ArrayList<>();
- validTypes.add(DATA_TYPE_LIST);
- return validTypes;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactDefinition.java deleted file mode 100644 index a26209425..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactDefinition.java +++ /dev/null @@ -1,105 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * ArtifactDefinition.java Purpose: Provide ArtifactDefinition TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class ArtifactDefinition {
- @JsonIgnore
- private String id;
- private String type;
- private String file;
- private String repository;
- private String description;
- @JsonProperty("deploy_Path")
- private String deployPath;
- // Used for Template Type
- private String content;
- private String mappingContent;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getFile() {
- return file;
- }
-
- public void setFile(String file) {
- this.file = file;
- }
-
- public String getRepository() {
- return repository;
- }
-
- public void setRepository(String repository) {
- this.repository = repository;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getDeployPath() {
- return deployPath;
- }
-
- public void setDeployPath(String deployPath) {
- this.deployPath = deployPath;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public String getMappingContent() {
- return mappingContent;
- }
-
- public void setMappingContent(String mappingContent) {
- this.mappingContent = mappingContent;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactType.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactType.java deleted file mode 100644 index 3add0a3f5..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ArtifactType.java +++ /dev/null @@ -1,102 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class ArtifactType {
- @JsonIgnore
- private String id;
- private String description;
- private String version;
- private Map<String, String> metadata;
- @JsonProperty("derived_from")
- private String derivedFrom;
- private Map<String, PropertyDefinition> properties;
- @JsonProperty("mime_type")
- private String mimeType;
- @JsonProperty("file_ext")
- private List<String> fileExt;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public String getDerivedFrom() {
- return derivedFrom;
- }
-
- public void setDerivedFrom(String derivedFrom) {
- this.derivedFrom = derivedFrom;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
- public String getMimeType() {
- return mimeType;
- }
-
- public void setMimeType(String mimeType) {
- this.mimeType = mimeType;
- }
-
- public List<String> getFileExt() {
- return fileExt;
- }
-
- public void setFileExt(List<String> fileExt) {
- this.fileExt = fileExt;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityAssignment.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityAssignment.java deleted file mode 100644 index f40388ce0..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityAssignment.java +++ /dev/null @@ -1,49 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * CapabilityAssignment.java Purpose: Provide CapabilityAssignment TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class CapabilityAssignment {
- @JsonIgnore
- private String id;
- private Map<String, Object> properties;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityDefinition.java deleted file mode 100644 index 467e9bbdc..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/CapabilityDefinition.java +++ /dev/null @@ -1,88 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * CapabilityDefinition.java Purpose: Provide CapabilityDefinition TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class CapabilityDefinition {
- @JsonIgnore
- private String id;
- private String type;
- private String description;
- private Map<String, PropertyDefinition> properties;
- @JsonProperty("valid_source_types")
- private List<String> validSourceTypes;
- private List<Object> occurrences;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
- public List<String> getValidSourceTypes() {
- return validSourceTypes;
- }
-
- public void setValidSourceTypes(List<String> validSourceTypes) {
- this.validSourceTypes = validSourceTypes;
- }
-
- public List<Object> getOccurrences() {
- return occurrences;
- }
-
- public void setOccurrences(List<Object> occurrences) {
- this.occurrences = occurrences;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ConstraintClause.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ConstraintClause.java deleted file mode 100644 index 2066e8f7a..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ConstraintClause.java +++ /dev/null @@ -1,150 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * ConstraintClause.java Purpose: 3.5.2 Constraint clause.
- *
- * @version 1.0
- */
-public class ConstraintClause {
- @JsonProperty("equal")
- private Object equal;
-
- @JsonProperty("greater_than")
- private Object greaterThan;
-
- @JsonProperty("greater_or_equal")
- private Object greaterOrEqual;
-
- @JsonProperty("less_than")
- private Object lessThan;
-
- @JsonProperty("less_or_equal")
- private Object lessOrEqual;
-
- @JsonProperty("in_range")
- private Object inRange;
-
- @JsonProperty("valid_values")
- private List<Object> validValues;
-
- @JsonProperty("length")
- private Object length;
-
- @JsonProperty("min_length")
- private Object minLength;
-
- @JsonProperty("max_length")
- private Object maxLength;
-
- @JsonProperty("pattern")
- private String pattern;
-
- public Object getEqual() {
- return equal;
- }
-
- public void setEqual(Object equal) {
- this.equal = equal;
- }
-
- public Object getGreaterThan() {
- return greaterThan;
- }
-
- public void setGreaterThan(Object greaterThan) {
- this.greaterThan = greaterThan;
- }
-
- public Object getGreaterOrEqual() {
- return greaterOrEqual;
- }
-
- public void setGreaterOrEqual(Object greaterOrEqual) {
- this.greaterOrEqual = greaterOrEqual;
- }
-
- public Object getLessThan() {
- return lessThan;
- }
-
- public void setLessThan(Object lessThan) {
- this.lessThan = lessThan;
- }
-
- public Object getLessOrEqual() {
- return lessOrEqual;
- }
-
- public void setLessOrEqual(Object lessOrEqual) {
- this.lessOrEqual = lessOrEqual;
- }
-
- public Object getInRange() {
- return inRange;
- }
-
- public void setInRange(Object inRange) {
- this.inRange = inRange;
- }
-
- public List<Object> getValidValues() {
- return validValues;
- }
-
- public void setValidValues(List<Object> validValues) {
- this.validValues = validValues;
- }
-
- public Object getLength() {
- return length;
- }
-
- public void setLength(Object length) {
- this.length = length;
- }
-
- public Object getMinLength() {
- return minLength;
- }
-
- public void setMinLength(Object minLength) {
- this.minLength = minLength;
- }
-
- public Object getMaxLength() {
- return maxLength;
- }
-
- public void setMaxLength(Object maxLength) {
- this.maxLength = maxLength;
- }
-
- public String getPattern() {
- return pattern;
- }
-
- public void setPattern(String pattern) {
- this.pattern = pattern;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/DataType.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/DataType.java deleted file mode 100644 index 6df6ba2a8..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/DataType.java +++ /dev/null @@ -1,88 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * DataType.java Purpose: Provide DataType TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class DataType {
- @JsonIgnore
- private String id;
- private String version;
- private String description;
- @JsonProperty("derived_from")
- private String derivedFrom;
- private List<Map<String, Object>> constraints;
- private Map<String, PropertyDefinition> properties;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getDerivedFrom() {
- return derivedFrom;
- }
-
- public void setDerivedFrom(String derivedFrom) {
- this.derivedFrom = derivedFrom;
- }
-
- public List<Map<String, Object>> getConstraints() {
- return constraints;
- }
-
- public void setConstraints(List<Map<String, Object>> constraints) {
- this.constraints = constraints;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/EntrySchema.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/EntrySchema.java deleted file mode 100644 index 663442161..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/EntrySchema.java +++ /dev/null @@ -1,36 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-/**
- * EntrySchema.java Purpose: Provide EntrySchema TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class EntrySchema {
- private String type;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Implementation.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Implementation.java deleted file mode 100644 index 46facdb69..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Implementation.java +++ /dev/null @@ -1,49 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * Implementation.java Purpose: Provide Operation Implementation TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class Implementation {
- @JsonIgnore
- private String primary;
- private List<String> dependencies;
-
- public String getPrimary() {
- return primary;
- }
-
- public void setPrimary(String primary) {
- this.primary = primary;
- }
-
- public List<String> getDependencies() {
- return dependencies;
- }
-
- public void setDependencies(List<String> dependencies) {
- this.dependencies = dependencies;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceAssignment.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceAssignment.java deleted file mode 100644 index 9007dd027..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceAssignment.java +++ /dev/null @@ -1,58 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * InterfaceAssignment.java Purpose: Provide InterfaceAssignment TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class InterfaceAssignment {
- @JsonIgnore
- private String id;
- private String type;
- private Map<String, OperationAssignment> operations;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map<String, OperationAssignment> getOperations() {
- return operations;
- }
-
- public void setOperations(Map<String, OperationAssignment> operations) {
- this.operations = operations;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceDefinition.java deleted file mode 100644 index bcd0ef375..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/InterfaceDefinition.java +++ /dev/null @@ -1,58 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * InterfaceAssignment.java Purpose: Provide InterfaceAssignment TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class InterfaceDefinition {
- @JsonIgnore
- private String id;
- private String type;
- private Map<String, OperationDefinition> operations;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map<String, OperationDefinition> getOperations() {
- return operations;
- }
-
- public void setOperations(Map<String, OperationDefinition> operations) {
- this.operations = operations;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeTemplate.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeTemplate.java deleted file mode 100644 index c62b719e3..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeTemplate.java +++ /dev/null @@ -1,112 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * NodeTemplate.java Purpose: Provide NodeTemplate TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class NodeTemplate {
- @JsonIgnore
- private String id;
- private String description;
- private String type;
- private Map<String, String> metadata;
- private Map<String, Object> properties;
- private Map<String, InterfaceAssignment> interfaces;
- private Map<String, ArtifactDefinition> artifacts;
- private Map<String, CapabilityAssignment> capabilities;
- private Map<String, RequirementAssignment> requirements;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
-
- public Map<String, InterfaceAssignment> getInterfaces() {
- return interfaces;
- }
-
- public void setInterfaces(Map<String, InterfaceAssignment> interfaces) {
- this.interfaces = interfaces;
- }
-
- public Map<String, ArtifactDefinition> getArtifacts() {
- return artifacts;
- }
-
- public void setArtifacts(Map<String, ArtifactDefinition> artifacts) {
- this.artifacts = artifacts;
- }
-
- public Map<String, CapabilityAssignment> getCapabilities() {
- return capabilities;
- }
-
- public void setCapabilities(Map<String, CapabilityAssignment> capabilities) {
- this.capabilities = capabilities;
- }
-
- public Map<String, RequirementAssignment> getRequirements() {
- return requirements;
- }
-
- public void setRequirements(Map<String, RequirementAssignment> requirements) {
- this.requirements = requirements;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeType.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeType.java deleted file mode 100644 index f97910995..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/NodeType.java +++ /dev/null @@ -1,114 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * NodeType.java Purpose: Provide NodeType TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class NodeType {
- @JsonIgnore
- private String id;
- private String description;
- private String version;
- private Map<String, String> metadata;
- @JsonProperty("derived_from")
- private String derivedFrom;
- private Map<String, PropertyDefinition> properties;
- private Map<String, CapabilityDefinition> capabilities;
- private Map<String, RequirementDefinition> requirements;
- private Map<String, InterfaceDefinition> interfaces;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public String getDerivedFrom() {
- return derivedFrom;
- }
-
- public void setDerivedFrom(String derivedFrom) {
- this.derivedFrom = derivedFrom;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
- public Map<String, CapabilityDefinition> getCapabilities() {
- return capabilities;
- }
-
- public void setCapabilities(Map<String, CapabilityDefinition> capabilities) {
- this.capabilities = capabilities;
- }
-
- public Map<String, RequirementDefinition> getRequirements() {
- return requirements;
- }
-
- public void setRequirements(Map<String, RequirementDefinition> requirements) {
- this.requirements = requirements;
- }
-
- public Map<String, InterfaceDefinition> getInterfaces() {
- return interfaces;
- }
-
- public void setInterfaces(Map<String, InterfaceDefinition> interfaces) {
- this.interfaces = interfaces;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationAssignment.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationAssignment.java deleted file mode 100644 index cbb14067d..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationAssignment.java +++ /dev/null @@ -1,76 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * OperationAssignment.java Purpose: Provide OperationAssignment TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class OperationAssignment {
- @JsonIgnore
- private String id;
- private String description;
- private String implementation;
- private Map<String, Object> inputs;
- private Map<String, Object> outputs;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getImplementation() {
- return implementation;
- }
-
- public void setImplementation(String implementation) {
- this.implementation = implementation;
- }
-
- public Map<String, Object> getInputs() {
- return inputs;
- }
-
- public void setInputs(Map<String, Object> inputs) {
- this.inputs = inputs;
- }
-
- public Map<String, Object> getOutputs() {
- return outputs;
- }
-
- public void setOutputs(Map<String, Object> outputs) {
- this.outputs = outputs;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationDefinition.java deleted file mode 100644 index eeb333500..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/OperationDefinition.java +++ /dev/null @@ -1,76 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * OperationDefinition.java Purpose: Provide OperationDefinition TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class OperationDefinition {
- @JsonIgnore
- private String id;
- private String description;
- private Implementation implementation;
- private Map<String, PropertyDefinition> inputs;
- private Map<String, PropertyDefinition> outputs;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Implementation getImplementation() {
- return implementation;
- }
-
- public void setImplementation(Implementation implementation) {
- this.implementation = implementation;
- }
-
- public Map<String, PropertyDefinition> getInputs() {
- return inputs;
- }
-
- public void setInputs(Map<String, PropertyDefinition> inputs) {
- this.inputs = inputs;
- }
-
- public Map<String, PropertyDefinition> getOutputs() {
- return outputs;
- }
-
- public void setOutputs(Map<String, PropertyDefinition> outputs) {
- this.outputs = outputs;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/PropertyDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/PropertyDefinition.java deleted file mode 100644 index a300d2386..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/PropertyDefinition.java +++ /dev/null @@ -1,125 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.HashMap;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * PropertyDefinition.java Purpose: Provide PropertyDefinition TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class PropertyDefinition {
- @JsonIgnore
- private String id;
- private String description;
- private Boolean required;
- private String type;
- @JsonProperty("default")
- private Object defaultValue;
- private String status;
- private List<HashMap<String, Object>> constraints;
- @JsonProperty("entry_schema")
- private EntrySchema entrySchema;
- private Object value;
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("[");
- builder.append(" type :" + getType());
- builder.append(", value :" + getValue());
- builder.append("]");
- return builder.toString();
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Boolean getRequired() {
- return required;
- }
-
- public void setRequired(Boolean required) {
- this.required = required;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Object getDefaultValue() {
- return defaultValue;
- }
-
- public void setDefaultValue(Object defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public List<HashMap<String, Object>> getConstraints() {
- return constraints;
- }
-
- public void setConstraints(List<HashMap<String, Object>> constraints) {
- this.constraints = constraints;
- }
-
- public EntrySchema getEntrySchema() {
- return entrySchema;
- }
-
- public void setEntrySchema(EntrySchema entrySchema) {
- this.entrySchema = entrySchema;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RelationshipTemplate.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RelationshipTemplate.java deleted file mode 100644 index 172d5a846..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RelationshipTemplate.java +++ /dev/null @@ -1,56 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-
-/**
- * RelationshipTemplate.java Purpose: Provide RelationshipTemplate TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class RelationshipTemplate {
- private String description;
- private String type;
- private Map<String, PropertyDefinition> properties;
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map<String, PropertyDefinition> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, PropertyDefinition> properties) {
- this.properties = properties;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementAssignment.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementAssignment.java deleted file mode 100644 index c26de45e5..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementAssignment.java +++ /dev/null @@ -1,67 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * RequirementAssignment.java Purpose: Provide RequirementAssignment TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class RequirementAssignment {
- @JsonIgnore
- private String id;
- private String capability;
- private String node;
- // Relationship Type or Relationship Template
- private String relationship;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getCapability() {
- return capability;
- }
-
- public void setCapability(String capability) {
- this.capability = capability;
- }
-
- public String getNode() {
- return node;
- }
-
- public void setNode(String node) {
- this.node = node;
- }
-
- public String getRelationship() {
- return relationship;
- }
-
- public void setRelationship(String relationship) {
- this.relationship = relationship;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementDefinition.java deleted file mode 100644 index 623a76031..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/RequirementDefinition.java +++ /dev/null @@ -1,85 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * RequirementDefinition.java Purpose: Provide RequirementDefinition TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class RequirementDefinition {
- @JsonIgnore
- private String id;
- private String description;
- private String capability;
- private String node;
- private String relationship;
- private List<Object> occurrences;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getCapability() {
- return capability;
- }
-
- public void setCapability(String capability) {
- this.capability = capability;
- }
-
- public String getNode() {
- return node;
- }
-
- public void setNode(String node) {
- this.node = node;
- }
-
- public String getRelationship() {
- return relationship;
- }
-
- public void setRelationship(String relationship) {
- this.relationship = relationship;
- }
-
- public List<Object> getOccurrences() {
- return occurrences;
- }
-
- public void setOccurrences(List<Object> occurrences) {
- this.occurrences = occurrences;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ResourceAssignment.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ResourceAssignment.java deleted file mode 100644 index 9f852c11c..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ResourceAssignment.java +++ /dev/null @@ -1,165 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Date;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * ResourceAssignment.java Purpose: Provide ResourceAssignment Custom TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class ResourceAssignment {
-
- private String name;
-
- @JsonProperty("property")
- private PropertyDefinition property;
-
- @JsonProperty("input-param")
- private Boolean inputParameter;
-
- @JsonProperty("dictionary-name")
- private String dictionaryName;
-
- @JsonProperty("dictionary-source")
- private String dictionarySource;
-
- @JsonProperty("dependencies")
- private List<String> dependencies;
-
- @JsonProperty("version")
- private int version;
-
- @JsonProperty("status")
- private String status;
-
- @JsonProperty("message")
- private String message;
-
- @JsonProperty("updated-date")
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- private Date updatedDate;
-
- @JsonProperty("updated-by")
- private String updatedBy;
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("[");
- builder.append("name = " + name);
- builder.append(", source = " + dictionarySource);
- if (dependencies != null) {
- builder.append(", dependencies = " + dependencies);
- }
- builder.append("]");
- return builder.toString();
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public PropertyDefinition getProperty() {
- return property;
- }
-
- public void setProperty(PropertyDefinition property) {
- this.property = property;
- }
-
- public Boolean getInputParameter() {
- return inputParameter;
- }
-
- public void setInputParameter(Boolean inputParameter) {
- this.inputParameter = inputParameter;
- }
-
- public String getDictionaryName() {
- return dictionaryName;
- }
-
- public void setDictionaryName(String dictionaryName) {
- this.dictionaryName = dictionaryName;
- }
-
- public String getDictionarySource() {
- return dictionarySource;
- }
-
- public void setDictionarySource(String dictionarySource) {
- this.dictionarySource = dictionarySource;
- }
-
- public List<String> getDependencies() {
- return dependencies;
- }
-
- public void setDependencies(List<String> dependencies) {
- this.dependencies = dependencies;
- }
-
- public int getVersion() {
- return version;
- }
-
- public void setVersion(int version) {
- this.version = version;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Date getUpdatedDate() {
- return updatedDate;
- }
-
- public void setUpdatedDate(Date updatedDate) {
- this.updatedDate = updatedDate;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ServiceTemplate.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ServiceTemplate.java deleted file mode 100644 index f66d73727..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/ServiceTemplate.java +++ /dev/null @@ -1,118 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * ServiceTemplate.java Purpose: Provide ServiceTemplate TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class ServiceTemplate {
- @JsonIgnore
- private String id;
- @JsonProperty("tosca_definitions_version")
- private String toscaDefinitionsVersion;
- private Map<String, String> metadata;
- private String description;
- @JsonProperty("dsl_definitions")
- private Map<String, Object> dslDefinitions;
- @JsonProperty("topology_template")
- private TopologyTemplate topologyTemplate;
- @JsonProperty("artifact_types")
- private Map<String, ArtifactType> artifactTypes;
- @JsonProperty("node_types")
- private Map<String, NodeType> nodeTypes;
- @JsonProperty("data_types")
- private Map<String, DataType> dataTypes;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getToscaDefinitionsVersion() {
- return toscaDefinitionsVersion;
- }
-
- public void setToscaDefinitionsVersion(String toscaDefinitionsVersion) {
- this.toscaDefinitionsVersion = toscaDefinitionsVersion;
- }
-
- public Map<String, String> getMetadata() {
- return metadata;
- }
-
- public void setMetadata(Map<String, String> metadata) {
- this.metadata = metadata;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, Object> getDslDefinitions() {
- return dslDefinitions;
- }
-
- public void setDslDefinitions(Map<String, Object> dslDefinitions) {
- this.dslDefinitions = dslDefinitions;
- }
-
- public TopologyTemplate getTopologyTemplate() {
- return topologyTemplate;
- }
-
- public void setTopologyTemplate(TopologyTemplate topologyTemplate) {
- this.topologyTemplate = topologyTemplate;
- }
-
- public Map<String, NodeType> getNodeTypes() {
- return nodeTypes;
- }
-
- public void setNodeTypes(Map<String, NodeType> nodeTypes) {
- this.nodeTypes = nodeTypes;
- }
-
- public Map<String, DataType> getDataTypes() {
- return dataTypes;
- }
-
- public void setDataTypes(Map<String, DataType> dataTypes) {
- this.dataTypes = dataTypes;
- }
-
- public Map<String, ArtifactType> getArtifactTypes() {
- return artifactTypes;
- }
-
- public void setArtifactTypes(Map<String, ArtifactType> artifactTypes) {
- this.artifactTypes = artifactTypes;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/TopologyTemplate.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/TopologyTemplate.java deleted file mode 100644 index 1f609386a..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/TopologyTemplate.java +++ /dev/null @@ -1,97 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * TopologyTemplate.java Purpose: Provide TopologyTemplate TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class TopologyTemplate {
- @JsonIgnore
- private String id;
- private String description;
- private Map<String, PropertyDefinition> inputs;
- @JsonProperty("node_templates")
- private Map<String, NodeTemplate> nodeTemplates;
- @JsonProperty("relationship_templates")
- private Map<String, RelationshipTemplate> relationshipTemplates;
- private Map<String, CapabilityAssignment> capabilities;
- private Map<String, Workflow> workflows;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Map<String, PropertyDefinition> getInputs() {
- return inputs;
- }
-
- public void setInputs(Map<String, PropertyDefinition> inputs) {
- this.inputs = inputs;
- }
-
- public Map<String, NodeTemplate> getNodeTemplates() {
- return nodeTemplates;
- }
-
- public void setNodeTemplates(Map<String, NodeTemplate> nodeTemplates) {
- this.nodeTemplates = nodeTemplates;
- }
-
- public Map<String, RelationshipTemplate> getRelationshipTemplates() {
- return relationshipTemplates;
- }
-
- public void setRelationshipTemplates(Map<String, RelationshipTemplate> relationshipTemplates) {
- this.relationshipTemplates = relationshipTemplates;
- }
-
- public Map<String, CapabilityAssignment> getCapabilities() {
- return capabilities;
- }
-
- public void setCapabilities(Map<String, CapabilityAssignment> capabilities) {
- this.capabilities = capabilities;
- }
-
- public Map<String, Workflow> getWorkflows() {
- return workflows;
- }
-
- public void setWorkflows(Map<String, Workflow> workflows) {
- this.workflows = workflows;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Workflow.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Workflow.java deleted file mode 100644 index 09742a3d0..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/Workflow.java +++ /dev/null @@ -1,39 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * Workflow.java Purpose: Provide Workflow TOSCO Model POJO bean.
- *
- * @version 1.0
- */
-public class Workflow {
- @JsonIgnore
- private String id;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/ActionIdentifiers.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/ActionIdentifiers.java deleted file mode 100644 index 2b54a2c8b..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/ActionIdentifiers.java +++ /dev/null @@ -1,62 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class ActionIdentifiers {
- @JsonProperty("service-template-name")
- private String serviceTemplateName;
- @JsonProperty("service-template-version")
- private String serviceTemplateVersion;
- @JsonProperty("action-name")
- private String actionName;
- private String mode;
-
- public String getServiceTemplateName() {
- return serviceTemplateName;
- }
-
- public void setServiceTemplateName(String serviceTemplateName) {
- this.serviceTemplateName = serviceTemplateName;
- }
-
- public String getServiceTemplateVersion() {
- return serviceTemplateVersion;
- }
-
- public void setServiceTemplateVersion(String serviceTemplateVersion) {
- this.serviceTemplateVersion = serviceTemplateVersion;
- }
-
- public String getActionName() {
- return actionName;
- }
-
- public void setActionName(String actionName) {
- this.actionName = actionName;
- }
-
- public String getMode() {
- return mode;
- }
-
- public void setMode(String mode) {
- this.mode = mode;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/CommonHeader.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/CommonHeader.java deleted file mode 100644 index 4a4011ef1..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/CommonHeader.java +++ /dev/null @@ -1,82 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class CommonHeader {
-
- private String timestamp;
- @JsonProperty("api-ver")
- private String apiVer;
- @JsonProperty("originator-id")
- private String originatorId;
- @JsonProperty("request-id")
- private String requestId;
- @JsonProperty("sub-request-id")
- private String subRequestId;
- private Flags flags;
-
- public String getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(String timestamp) {
- this.timestamp = timestamp;
- }
-
- public String getApiVer() {
- return apiVer;
- }
-
- public void setApiVer(String apiVer) {
- this.apiVer = apiVer;
- }
-
- public String getOriginatorId() {
- return originatorId;
- }
-
- public void setOriginatorId(String originatorId) {
- this.originatorId = originatorId;
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getSubRequestId() {
- return subRequestId;
- }
-
- public void setSubRequestId(String subRequestId) {
- this.subRequestId = subRequestId;
- }
-
- public Flags getFlags() {
- return flags;
- }
-
- public void setFlags(Flags flags) {
- this.flags = flags;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Flags.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Flags.java deleted file mode 100644 index b1f2a9399..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Flags.java +++ /dev/null @@ -1,40 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-public class Flags {
- private boolean force;
- private Integer ttl;
-
- public boolean isForce() {
- return force;
- }
-
- public void setForce(boolean force) {
- this.force = force;
- }
-
- public Integer getTtl() {
- return ttl;
- }
-
- public void setTtl(Integer ttl) {
- this.ttl = ttl;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Status.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Status.java deleted file mode 100644 index 2cdd839d6..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/Status.java +++ /dev/null @@ -1,61 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class Status {
-
- private Integer code;
- @JsonProperty("error-message")
- private String errorMessage;
- private String message;
- private String completed;
-
- public Integer getCode() {
- return code;
- }
-
- public void setCode(Integer code) {
- this.code = code;
- }
-
- public String getErrorMessage() {
- return errorMessage;
- }
-
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public String getCompleted() {
- return completed;
- }
-
- public void setCompleted(String completed) {
- this.completed = completed;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionRequest.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionRequest.java deleted file mode 100644 index 56148eeef..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionRequest.java +++ /dev/null @@ -1,45 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class TransactionRequest {
-
- @JsonProperty("transaction-request-id")
- private String transactionRequestId;
- @JsonProperty("message-type")
- private String messageType;
-
- public String getTransactionRequestId() {
- return transactionRequestId;
- }
-
- public void setTransactionRequestId(String transactionRequestId) {
- this.transactionRequestId = transactionRequestId;
- }
-
- public String getMessageType() {
- return messageType;
- }
-
- public void setMessageType(String messageType) {
- this.messageType = messageType;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionResponse.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionResponse.java deleted file mode 100644 index cc935e813..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/api/TransactionResponse.java +++ /dev/null @@ -1,46 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data.api;
-
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class TransactionResponse {
-
- @JsonProperty("transaction-request-id")
- private String transactionRequestId;
- @JsonProperty("event-message")
- private List<String> eventMessage;
-
- public String getTransactionRequestId() {
- return transactionRequestId;
- }
-
- public void setTransactionRequestId(String transactionRequestId) {
- this.transactionRequestId = transactionRequestId;
- }
-
- public List<String> getEventMessage() {
- return eventMessage;
- }
-
- public void setEventMessage(List<String> eventMessage) {
- this.eventMessage = eventMessage;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/ResourceDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/ResourceDefinition.java deleted file mode 100644 index 25605fcd2..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/ResourceDefinition.java +++ /dev/null @@ -1,83 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data.dict;
-
-import java.util.Map;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ResourceDefinition {
-
- @JsonProperty(value = "name", required = true)
- private String name;
-
- @JsonProperty(value = "tags")
- private String tags;
-
- @JsonProperty(value = "property")
- private PropertyDefinition property;
-
- @JsonProperty(value = "updated-by")
- private String updatedBy;
-
- @JsonProperty(value = "sources", required = true)
- private Map<String, SourcesDefinition> sourcesDefinition;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public PropertyDefinition getProperty() {
- return property;
- }
-
- public void setProperty(PropertyDefinition property) {
- this.property = property;
- }
-
- public String getTags() {
- return tags;
- }
-
- public void setTags(String tags) {
- this.tags = tags;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
- public Map<String, SourcesDefinition> getSources() {
- return sourcesDefinition;
- }
-
- public void setSources(Map<String, SourcesDefinition> sourcesDefinition) {
- this.sourcesDefinition = sourcesDefinition;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesDefinition.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesDefinition.java deleted file mode 100644 index 0ce7eda37..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesDefinition.java +++ /dev/null @@ -1,48 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data.dict;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class SourcesDefinition {
-
- @JsonProperty(value = "type", required = true)
- private String type;
-
- @JsonProperty(value = "properties", required = true)
- private SourcesProperties properties;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public SourcesProperties getProperties() {
- return properties;
- }
-
- public void setProperties(SourcesProperties properties) {
- this.properties = properties;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesProperties.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesProperties.java deleted file mode 100644 index 696e1516d..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/data/dict/SourcesProperties.java +++ /dev/null @@ -1,127 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.data.dict;
-
-import java.util.List;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class SourcesProperties {
-
- @JsonProperty(value = "key")
- private String key;
-
- @JsonProperty(value = "type")
- private String type;
-
- @JsonProperty(value = "query")
- private String query;
-
- @JsonProperty(value = "url-path")
- private String urlPath;
-
- @JsonProperty(value = "expression-type")
- private String expressionType;
-
- @JsonProperty(value = "path")
- private String path;
-
- @JsonProperty("input-key-mapping")
- private Map<String, String> inputKeyMapping;
-
- @JsonProperty("output-key-mapping")
- private Map<String, String> outputKeyMapping;
-
- @JsonProperty("key-dependencies")
- private List<String> dependencies;
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getQuery() {
- return query;
- }
-
- public void setQuery(String query) {
- this.query = query;
- }
-
- public String getUrlPath() {
- return urlPath;
- }
-
- public void setUrlPath(String urlPath) {
- this.urlPath = urlPath;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setExpressionType(String expressionType) {
- this.expressionType = expressionType;
- }
-
- public String getExpressionType() {
- return expressionType;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public Map<String, String> getInputKeyMapping() {
- return inputKeyMapping;
- }
-
- public void setInputKeyMapping(Map<String, String> inputKeyMapping) {
- this.inputKeyMapping = inputKeyMapping;
- }
-
- public Map<String, String> getOutputKeyMapping() {
- return outputKeyMapping;
- }
-
- public void setOutputKeyMapping(Map<String, String> outputKeyMapping) {
- this.outputKeyMapping = outputKeyMapping;
- }
-
- public List<String> getDependencies() {
- return dependencies;
- }
-
- public void setDependencies(List<String> dependencies) {
- this.dependencies = dependencies;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModel.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModel.java deleted file mode 100644 index 66de05b0e..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModel.java +++ /dev/null @@ -1,231 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.domain;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-public class ConfigModel implements Serializable {
-
- private Long id;
- private String serviceUUID;
- private String distributionId;
- private String serviceName;
- private String serviceDescription;
- private String resourceUUID;
- private String resourceInstanceName;
- private String resourceName;
- private String resourceVersion;
- private String resourceType;
- private String artifactUUId;
- private String artifactType;
- private String artifactVersion;
- private String artifactDescription;
- private Integer internalVersion;
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- private Date createdDate = new Date();
- private String artifactName;
- private String published;
- private String updatedBy;
- private String tags;
- @SuppressWarnings("squid:S1948")
- private List<ConfigModelContent> configModelContents;
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder("[");
- buffer.append("id = " + id);
- buffer.append(", artifactType = " + artifactType);
- buffer.append(", artifactVersion = " + artifactVersion);
- buffer.append(", artifactName = " + artifactName);
- buffer.append(", active = " + published);
- buffer.append("]");
- return buffer.toString();
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getServiceUUID() {
- return serviceUUID;
- }
-
- public void setServiceUUID(String serviceUUID) {
- this.serviceUUID = serviceUUID;
- }
-
- public String getDistributionId() {
- return distributionId;
- }
-
- public void setDistributionId(String distributionId) {
- this.distributionId = distributionId;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public String getServiceDescription() {
- return serviceDescription;
- }
-
- public void setServiceDescription(String serviceDescription) {
- this.serviceDescription = serviceDescription;
- }
-
- public String getResourceUUID() {
- return resourceUUID;
- }
-
- public void setResourceUUID(String resourceUUID) {
- this.resourceUUID = resourceUUID;
- }
-
- public String getResourceInstanceName() {
- return resourceInstanceName;
- }
-
- public void setResourceInstanceName(String resourceInstanceName) {
- this.resourceInstanceName = resourceInstanceName;
- }
-
- public String getResourceName() {
- return resourceName;
- }
-
- public void setResourceName(String resourceName) {
- this.resourceName = resourceName;
- }
-
- public String getResourceVersion() {
- return resourceVersion;
- }
-
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
- }
-
- public String getResourceType() {
- return resourceType;
- }
-
- public void setResourceType(String resourceType) {
- this.resourceType = resourceType;
- }
-
- public String getArtifactUUId() {
- return artifactUUId;
- }
-
- public void setArtifactUUId(String artifactUUId) {
- this.artifactUUId = artifactUUId;
- }
-
- public String getArtifactType() {
- return artifactType;
- }
-
- public void setArtifactType(String artifactType) {
- this.artifactType = artifactType;
- }
-
- public String getArtifactVersion() {
- return artifactVersion;
- }
-
- public void setArtifactVersion(String artifactVersion) {
- this.artifactVersion = artifactVersion;
- }
-
- public String getArtifactDescription() {
- return artifactDescription;
- }
-
- public void setArtifactDescription(String artifactDescription) {
- this.artifactDescription = artifactDescription;
- }
-
- public Integer getInternalVersion() {
- return internalVersion;
- }
-
- public void setInternalVersion(Integer internalVersion) {
- this.internalVersion = internalVersion;
- }
-
- public Date getCreatedDate() {
- return createdDate;
- }
-
- public void setCreatedDate(Date createdDate) {
- this.createdDate = createdDate;
- }
-
- public String getArtifactName() {
- return artifactName;
- }
-
- public void setArtifactName(String artifactName) {
- this.artifactName = artifactName;
- }
-
- public String getPublished() {
- return published;
- }
-
- public void setPublished(String published) {
- this.published = published;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
- public String getTags() {
- return tags;
- }
-
- public void setTags(String tags) {
- this.tags = tags;
- }
-
- public List<ConfigModelContent> getConfigModelContents() {
- return configModelContents;
- }
-
- public void setConfigModelContents(List<ConfigModelContent> configModelContents) {
- this.configModelContents = configModelContents;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModelContent.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModelContent.java deleted file mode 100644 index cba2570ea..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ConfigModelContent.java +++ /dev/null @@ -1,91 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.domain;
-
-import java.util.Date;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-public class ConfigModelContent {
-
- private Long id;
- private String name;
- private String contentType;
- private String description;
- private String content;
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- private Date creationDate = new Date();
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder("[");
- buffer.append("id = " + id);
- buffer.append(", name = " + name);
- buffer.append(", type = " + contentType);
- buffer.append("]");
- return buffer.toString();
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getContentType() {
- return contentType;
- }
-
- public void setContentType(String type) {
- this.contentType = type;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ResourceDictionary.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ResourceDictionary.java deleted file mode 100644 index d97d3a395..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/domain/ResourceDictionary.java +++ /dev/null @@ -1,119 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.domain;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import java.io.Serializable;
-import java.util.Date;
-
-public class ResourceDictionary implements Serializable {
- private static final long serialVersionUID = 1L;
- private Long id;
- private String name;
- private String dataType;
- private String entrySchema;
- private JsonNode definition;
- private String description;
- private String tags;
- private Date creationDate;
- private String updatedBy;
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder("[");
- buffer.append("name = " + name);
- buffer.append(", dataType = " + dataType);
- buffer.append(", entrySchema = " + entrySchema);
- buffer.append(", creationDate = " + creationDate);
- buffer.append("]");
- return buffer.toString();
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getEntrySchema() {
- return entrySchema;
- }
-
- public void setEntrySchema(String entrySchema) {
- this.entrySchema = entrySchema;
- }
-
- public JsonNode getDefinition() {
- return definition;
- }
-
- public void setDefinition(JsonNode definition) {
- this.definition = definition;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getTags() {
- return tags;
- }
-
- public void setTags(String tags) {
- this.tags = tags;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNode.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNode.java deleted file mode 100644 index 92ccee223..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNode.java +++ /dev/null @@ -1,41 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-public interface ComponentNode extends SvcLogicJavaPlugin {
-
- public Boolean preCondition(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException;
-
- public void preProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException;
-
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException;
-
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException;
-
- public void postProcess(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException;
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeDelegate.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeDelegate.java deleted file mode 100644 index 4b9743fb7..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeDelegate.java +++ /dev/null @@ -1,42 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ComponentNodeDelegate implements SvcLogicJavaPlugin {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ComponentNodeDelegate.class);
- private ComponentNodeService componentNodeService;
-
- public ComponentNodeDelegate(ComponentNodeService componentNodeService) {
- logger.info("{} Constructor Initiated", "ComponentNodeDelegate");
- this.componentNodeService = componentNodeService;
-
- }
-
- public void process(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
- this.componentNodeService.process(inParams, ctx, null);
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeService.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeService.java deleted file mode 100644 index 12efc6569..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeService.java +++ /dev/null @@ -1,32 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-public interface ComponentNodeService {
-
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException;
-
- public ComponentNode getComponentNodeInterface(String pluginName, String componentType) throws SvcLogicException;
-
- public ComponentNode getComponentNode(SvcLogicContext ctx, String selectorName) throws SvcLogicException;
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeServiceImpl.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeServiceImpl.java deleted file mode 100644 index df0dae10f..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ComponentNodeServiceImpl.java +++ /dev/null @@ -1,174 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.data.adaptor.DataAdaptorConstants;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.InterfaceAssignment;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ComponentNodeServiceImpl implements ComponentNodeService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ComponentNodeServiceImpl.class);
-
- private BundleContext bcontext;
- private ConfigResourceService configResourceService;
- private ConfigModelService configModelService;
-
- public ComponentNodeServiceImpl(BundleContext blueprintBundleContext, ConfigResourceService configResourceService,
- ConfigRestAdaptorService configRestAdaptorService) {
- logger.info("{} Constructor Initiated", "ComponentNodeServiceImpl");
- this.bcontext = blueprintBundleContext;
- this.configResourceService = configResourceService;
- this.configModelService = new ConfigModelServiceImpl(configRestAdaptorService);
- }
-
- @Override
- public void process(Map<String, String> inParams, SvcLogicContext ctx, Map<String, Object> componentContext)
- throws SvcLogicException {
- String requestId = null;
- String selector = null;
- try {
- selector = inParams.get(ConfigModelConstant.PROPERTY_SELECTOR);
- requestId = ctx.getAttribute(ConfigModelConstant.PROPERTY_REQUEST_ID);
-
- logger.info("Component execution started with input params ({})", inParams);
- configModelService.assignInParamsFromModel(ctx, inParams);
-
- String currentInterface = inParams.get(ConfigModelConstant.PROPERTY_CURRENT_INTERFACE);
- String currentNodeDerivedFrom = inParams.get(ConfigModelConstant.PROPERTY_CURRENT_NODETYPE_DERIVED_FROM);
-
- configResourceService.save(new TransactionLog(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_COMPONENT,
- String.format("Executing Component (%s) derived from (%s) with Params : (%s) ", currentInterface,
- currentNodeDerivedFrom, inParams)));
-
- ComponentNode handler = getComponentNodeInterface(currentInterface, currentNodeDerivedFrom);
-
- if (handler == null) {
- throw new SvcLogicException(
- String.format("Could not find Component for Interface %s", currentInterface));
- }
- if (componentContext == null) {
- componentContext = new HashMap<>();
- }
-
- logger.debug("Executing component ({})", currentInterface);
-
- if (handler.preCondition(inParams, ctx, componentContext)) {
- handler.preProcess(inParams, ctx, componentContext);
- handler.process(inParams, ctx, componentContext);
- handler.postProcess(inParams, ctx, componentContext);
- logger.debug("Executed component ({}) successfully.", currentInterface);
- configResourceService
- .save(new TransactionLog(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_COMPONENT,
- String.format("Component (%s) executed successfully. ", currentInterface)));
-
- ctx.setAttribute(selector + ConfigModelConstant.PROPERTY_DOT_STATUS,
- ConfigModelConstant.STATUS_SUCCESS);
- } else {
- logger.info("Skipped component execution ({})", handler.getClass());
- configResourceService
- .save(new TransactionLog(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_COMPONENT,
- String.format("Skipping component (%s) execution.", handler.getClass())));
- ctx.setAttribute(selector + ConfigModelConstant.PROPERTY_DOT_STATUS,
- ConfigModelConstant.STATUS_SKIPPED);
- }
-
- configModelService.assignOutParamsFromModel(ctx, inParams);
- ctx.setStatus(ConfigModelConstant.STATUS_SUCCESS);
- } catch (Exception e) {
- logger.error(String.format("Failed in component (%s) execution for request id (%s) with error %s", selector,
- requestId, e.getMessage()));
- configResourceService.save(new TransactionLog(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_COMPONENT,
- String.format("Failed in component (%s) execution for request id (%s) with error %s", selector,
- requestId, e.getMessage())));
-
- ctx.setAttribute(selector + ConfigModelConstant.PROPERTY_DOT_STATUS, ConfigModelConstant.STATUS_FAILURE);
- ctx.setAttribute(selector + ConfigModelConstant.PROPERTY_DOT_ERROR_MESSAGE, e.getMessage());
- ctx.setAttribute(ConfigModelConstant.PROPERTY_ERROR_MESSAGE, e.getMessage());
- ctx.setStatus(ConfigModelConstant.STATUS_FAILURE);
- throw new SvcLogicException(e.getMessage(), e);
- }
- }
-
- @Override
- public ComponentNode getComponentNodeInterface(String pluginName, String componentType) throws SvcLogicException {
-
- logger.info("Searching for component node plugin ({}) component type ({})", pluginName, componentType);
-
- if (StringUtils.isBlank(pluginName)) {
- throw new SvcLogicException(
- String.format("Could not get Interface Name from Service Template : %s ", pluginName));
- }
-
- pluginName = pluginName.replace("-", ".");
- ServiceReference sref = bcontext.getServiceReference(pluginName);
-
- if (sref == null) {
- throw new SvcLogicException(
- String.format("Could not find service reference object for plugin %s", pluginName));
- }
- return (ComponentNode) bcontext.getService(sref);
- }
-
- @Override
- public ComponentNode getComponentNode(SvcLogicContext ctx, String componentKey) throws SvcLogicException {
-
- if (StringUtils.isBlank(componentKey)) {
- logger.warn("Can't get node template content for a component key ({})", componentKey);
- return null;
- }
-
- String nodeTemplateContent = ctx.getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + componentKey);
- logger.info("Processing component template : ({})", nodeTemplateContent);
-
- if (StringUtils.isBlank(nodeTemplateContent)) {
- logger.warn("Couldn't get node template content for component key ({})", componentKey);
- return null;
- }
-
- NodeTemplate nodeTemplate = TransformationUtils.readValue(nodeTemplateContent, NodeTemplate.class);
- if (nodeTemplate == null || StringUtils.isBlank(nodeTemplate.getType())) {
- logger.warn("Failed to convert content ({}) to node template.", nodeTemplateContent);
- return null;
- }
-
- ComponentNode componentNode = null;
- for (Map.Entry<String, InterfaceAssignment> nodeTemplateInterface : nodeTemplate.getInterfaces().entrySet()) {
- if (nodeTemplateInterface != null && nodeTemplateInterface.getValue() != null) {
- String pluginName = nodeTemplateInterface.getKey();
- componentNode = getComponentNodeInterface(pluginName, ConfigModelConstant.MODEL_TYPE_NODE_COMPONENT);
- }
- }
- return componentNode;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigBlueprintService.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigBlueprintService.java deleted file mode 100644 index 701dffce9..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigBlueprintService.java +++ /dev/null @@ -1,100 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.domain.ConfigModel;
-import org.onap.ccsdk.features.model.domain.ConfigModelContent;
-import org.onap.ccsdk.features.model.utils.PrepareContextUtils;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants;
-import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigBlueprintService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigBlueprintService.class);
-
- private final ConfigRestAdaptorService configRestAdaptorService;
-
- public ConfigBlueprintService(ConfigRestAdaptorService configRestAdaptorService) {
- this.configRestAdaptorService = configRestAdaptorService;
- }
-
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateName,
- String serviceTemplateVersion) throws SvcLogicException {
- try {
- PrepareContextUtils prepareContextUtils = new PrepareContextUtils();
- String serviceTemplateContent = getServiceModel(context, serviceTemplateName, serviceTemplateVersion);
-
- if (StringUtils.isBlank(serviceTemplateContent)) {
- throw new SvcLogicException(String.format("Failed to get the Service Template (%s), version (%s)",
- serviceTemplateName, serviceTemplateVersion));
- }
-
- return prepareContextUtils.prepareContext(context, input, serviceTemplateContent);
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage(), e);
- }
- }
-
- @SuppressWarnings("squid:S3776")
- private String getServiceModel(Map<String, String> context, String serviceTemplateName,
- String serviceTemplateVersion) throws SvcLogicException, ConfigRestAdaptorException {
- String content = null;
-
- logger.info("Getting service template ({}) of version ({}) ", serviceTemplateName, serviceTemplateVersion);
-
- String path = "config-model/by-name/" + serviceTemplateName + "/version/" + serviceTemplateVersion;
-
- ConfigModel configModel = configRestAdaptorService
- .getResource(ConfigRestAdaptorConstants.SELECTOR_MODEL_SERVICE, path, ConfigModel.class);
-
- if (configModel == null || configModel.getConfigModelContents() == null
- || configModel.getConfigModelContents().isEmpty()) {
- throw new SvcLogicException("Service template model is missing for service template name ("
- + serviceTemplateName + "), service template version (" + serviceTemplateVersion + ") ");
- } else {
- if (configModel.getPublished() == null || !configModel.getPublished().equalsIgnoreCase("Y")) {
- throw new SvcLogicException(String.format(
- "Service template model is not published for service template (%s) ", serviceTemplateName));
- }
-
- List<ConfigModelContent> configModelContents = configModel.getConfigModelContents();
- for (ConfigModelContent configModelContent : configModelContents) {
- if (configModelContent != null) {
- if (ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON.equals(configModelContent.getContentType())) {
- content = configModelContent.getContent();
- } else if (ConfigModelConstant.MODEL_CONTENT_TYPE_TEMPLATE
- .equals(configModelContent.getContentType())) {
- context.put(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + configModelContent.getName()
- + ".content", configModelContent.getContent());
- }
- }
- }
- logger.trace("Service model data : {} ", content);
- }
- return content;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelNode.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelNode.java deleted file mode 100644 index cb652bd68..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelNode.java +++ /dev/null @@ -1,24 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-public class ConfigModelNode implements SvcLogicJavaPlugin {
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelService.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelService.java deleted file mode 100644 index 38ade14de..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelService.java +++ /dev/null @@ -1,55 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.List;
-import java.util.Map;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-public interface ConfigModelService {
-
- public Boolean validateServiceTemplate(ServiceTemplate serviceTemplate) throws SvcLogicException;
-
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateName,
- String serviceTemplateVersion) throws SvcLogicException;
-
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateContent)
- throws SvcLogicException;
-
- public Map<String, String> convertJson2properties(Map<String, String> context, String jsonContent,
- List<String> blockKeys) throws SvcLogicException;
-
- public Map<String, String> convertServiceTemplate2Properties(String serviceTemplateContent,
- final Map<String, String> context) throws SvcLogicException;
-
- public Map<String, String> convertServiceTemplate2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) throws SvcLogicException;
-
- public SvcLogicContext assignInParamsFromModel(final SvcLogicContext context, final Map<String, String> inParams)
- throws SvcLogicException;
-
- public SvcLogicContext assignOutParamsFromModel(final SvcLogicContext context, final Map<String, String> inParams)
- throws SvcLogicException;
-
- public String getNodeTemplateContent(final SvcLogicContext context, String templateName) throws SvcLogicException;
-
- public String getNodeTemplateMapping(final SvcLogicContext context, String templateName) throws SvcLogicException;
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelServiceImpl.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelServiceImpl.java deleted file mode 100644 index 231f76af9..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/service/ConfigModelServiceImpl.java +++ /dev/null @@ -1,244 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.service;
-
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.CapabilityAssignment;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.utils.NodePropertyUtils;
-import org.onap.ccsdk.features.model.utils.PrepareContextUtils;
-import org.onap.ccsdk.features.model.utils.ServiceTemplateUtils;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import org.onap.ccsdk.features.model.validator.ServiceTemplateValidator;
-import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigModelServiceImpl implements ConfigModelService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigModelServiceImpl.class);
- private static final String CLASS_NAME = "ConfigModelServiceImpl";
-
- private final ConfigRestAdaptorService configRestAdaptorService;
-
- public ConfigModelServiceImpl(ConfigRestAdaptorService configRestAdaptorService) {
- logger.info("{} Constuctor Initated...", CLASS_NAME);
- this.configRestAdaptorService = configRestAdaptorService;
- }
-
- @Override
- public Boolean validateServiceTemplate(ServiceTemplate serviceTemplate) throws SvcLogicException {
- try {
- ServiceTemplateValidator serviceTemplateValidator = new ServiceTemplateValidator();
- return serviceTemplateValidator.validateServiceTemplate(serviceTemplate);
- } catch (ConfigModelException e) {
- throw new SvcLogicException(e.getMessage());
- }
- }
-
- @Override
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateName,
- String serviceTemplateVersion) throws SvcLogicException {
-
- ConfigBlueprintService configBlueprintService = new ConfigBlueprintService(configRestAdaptorService);
- return configBlueprintService.prepareContext(context, input, serviceTemplateName, serviceTemplateVersion);
- }
-
- @Override
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateContent)
- throws SvcLogicException {
- try {
- PrepareContextUtils prepareContextUtils = new PrepareContextUtils();
- return prepareContextUtils.prepareContext(context, input, serviceTemplateContent);
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- }
-
- @Override
- public Map<String, String> convertJson2properties(Map<String, String> context, String jsonContent,
- List<String> blockKeys) throws SvcLogicException {
- try {
- return TransformationUtils.convertJson2Properties(context, jsonContent, blockKeys);
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- }
-
- @Override
- public Map<String, String> convertServiceTemplate2Properties(String serviceTemplateContent,
- final Map<String, String> context) throws SvcLogicException {
- try {
- ServiceTemplateUtils serviceTemplateUtils = new ServiceTemplateUtils();
- return serviceTemplateUtils.convertServiceTemplate2Properties(serviceTemplateContent, context);
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- }
-
- @Override
- public Map<String, String> convertServiceTemplate2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) throws SvcLogicException {
- try {
- ServiceTemplateUtils serviceTemplateUtils = new ServiceTemplateUtils();
- return serviceTemplateUtils.convertServiceTemplate2Properties(serviceTemplate, context);
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- }
-
- @SuppressWarnings("squid:S3776")
- @Override
- public SvcLogicContext assignInParamsFromModel(final SvcLogicContext context, final Map<String, String> inParams)
- throws SvcLogicException {
- logger.debug("Processing component input param ({})", inParams);
- try {
- if (context != null && inParams != null && inParams.containsKey(ConfigModelConstant.PROPERTY_SELECTOR)) {
- String componentKey = inParams.get(ConfigModelConstant.PROPERTY_SELECTOR);
- if (StringUtils.isNotBlank(componentKey)) {
- String nodeTemplateContent =
- context.getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + componentKey);
- logger.info("Processing node template content ({})", nodeTemplateContent);
- if (StringUtils.isNotBlank(nodeTemplateContent)) {
- NodeTemplate nodeTemplate =
- TransformationUtils.readValue(nodeTemplateContent, NodeTemplate.class);
- if (nodeTemplate != null && StringUtils.isNotBlank(nodeTemplate.getType())) {
- String nodeTypeContent = context
- .getAttribute(ConfigModelConstant.PROPERTY_NODE_TYPES_DOT + nodeTemplate.getType());
- NodeType nodetype = TransformationUtils.readValue(nodeTypeContent, NodeType.class);
- if (nodetype != null) {
- inParams.put(ConfigModelConstant.PROPERTY_CURRENT_NODETYPE_DERIVED_FROM,
- nodetype.getDerivedFrom());
- NodePropertyUtils nodePropertyUtils = new NodePropertyUtils(context, inParams);
- nodePropertyUtils.assignInParamsFromModel(nodetype, nodeTemplate);
- } else {
- throw new SvcLogicException(
- String.format("Failed to get node type (%s) for node template (%s).",
- nodeTemplate.getType(), componentKey));
- }
-
- } else {
- throw new SvcLogicException(String
- .format("Failed to convert content (%s) to node template.", nodeTemplateContent));
- }
- } else {
- throw new SvcLogicException(String
- .format("Couldn't get node template content for component key (%s).", componentKey));
- }
- } else {
- throw new SvcLogicException(
- String.format("Couldn't get component key (prefix) from inparam (%s)", inParams));
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- return context;
- }
-
- @Override
- public SvcLogicContext assignOutParamsFromModel(final SvcLogicContext context, final Map<String, String> inParams)
- throws SvcLogicException {
- try {
- if (context != null && inParams != null && inParams.containsKey(ConfigModelConstant.PROPERTY_SELECTOR)) {
- String componentKey = inParams.get(ConfigModelConstant.PROPERTY_SELECTOR);
- logger.info("Processing component output for prefix key ({})", componentKey);
- if (StringUtils.isNotBlank(componentKey)) {
- String nodeTemplateContent =
- context.getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + componentKey);
- if (StringUtils.isNotBlank(nodeTemplateContent)) {
- NodeTemplate nodeTemplate =
- TransformationUtils.readValue(nodeTemplateContent, NodeTemplate.class);
- if (nodeTemplate != null && StringUtils.isNotBlank(nodeTemplate.getType())) {
- String nodeTypeContent = context
- .getAttribute(ConfigModelConstant.PROPERTY_NODE_TYPES_DOT + nodeTemplate.getType());
- NodeType nodetype = TransformationUtils.readValue(nodeTypeContent, NodeType.class);
- NodePropertyUtils nodePropertyUtils = new NodePropertyUtils(context, inParams);
- nodePropertyUtils.assignOutParamsFromModel(nodetype, nodeTemplate);
- }
- }
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- return context;
- }
-
- @Override
- public String getNodeTemplateContent(final SvcLogicContext context, String templateName) throws SvcLogicException {
- String content = null;
- try {
- if (context != null && StringUtils.isNotBlank(templateName)) {
- logger.info("Processing Artifact Node Template for content : ({})", templateName);
- content = context
- .getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + templateName + ".content");
- }
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- return content;
- }
-
- @SuppressWarnings("squid:S3776")
- @Override
- public String getNodeTemplateMapping(final SvcLogicContext context, String templateName) throws SvcLogicException {
- String mapping = null;
- try {
- if (context != null && StringUtils.isNotBlank(templateName)) {
- logger.info("Processing artifact node template for mapping : ({})", templateName);
- if (StringUtils.isNotBlank(templateName)) {
- String nodeTemplateContent =
- context.getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + templateName);
- if (StringUtils.isNotBlank(nodeTemplateContent)) {
-
- NodeTemplate nodeTemplate =
- TransformationUtils.readValue(nodeTemplateContent, NodeTemplate.class);
-
- if (nodeTemplate != null && nodeTemplate.getCapabilities() != null && nodeTemplate
- .getCapabilities().containsKey(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING)) {
-
- CapabilityAssignment capability =
- nodeTemplate.getCapabilities().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
- if (capability.getProperties() != null) {
- List mappingList = (List) capability.getProperties()
- .get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
- if (mappingList != null) {
- mapping = TransformationUtils.getJson(mappingList);
- }
-
- }
- }
- }
- }
- }
- } catch (Exception e) {
- throw new SvcLogicException(e.getMessage());
- }
- return mapping;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ExpressionUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ExpressionUtils.java deleted file mode 100644 index cdc8fc330..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ExpressionUtils.java +++ /dev/null @@ -1,191 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class ExpressionUtils {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ExpressionUtils.class);
-
- private final SvcLogicContext context;
- private final Map<String, String> inParams;
-
- public ExpressionUtils(final SvcLogicContext context, final Map<String, String> inParams) {
- this.context = context;
- this.inParams = inParams;
- }
-
- public void populatePropertAssignmentsWithPrefix(String prefix, Map<String, PropertyDefinition> typeProperties,
- Map<String, Object> templateProperties) throws IOException {
- if (typeProperties != null && templateProperties != null) {
- ObjectMapper mapper = new ObjectMapper();
- String templatejsonContent = mapper.writeValueAsString(templateProperties);
- logger.debug("Expression inputs ({}).", templatejsonContent);
-
- JsonNode rootArray = mapper.readTree(templatejsonContent);
- processJsonExpression(rootArray);
- if (rootArray != null) {
- Map<String, String> prefixParams = new HashMap<>();
- TransformationUtils.convertJson2RootProperties(prefixParams, rootArray);
- logger.info("Resolved inputs ({}).", rootArray);
- prefixParams.forEach((key, value) -> {
- this.inParams.put(prefix + "." + key, value);
- });
- }
- }
- }
-
- public void populatePropertAssignments(Map<String, PropertyDefinition> typeProperties,
- Map<String, Object> templateProperties) throws IOException {
- if (typeProperties != null && templateProperties != null) {
- ObjectMapper mapper = new ObjectMapper();
- String templatejsonContent = mapper.writeValueAsString(templateProperties);
- logger.info("Expression inputs ({}).", templatejsonContent);
-
- JsonNode rootArray = mapper.readTree(templatejsonContent);
- processJsonExpression(rootArray);
- TransformationUtils.convertJson2RootProperties(this.inParams, rootArray);
- logger.info("Resolved inputs ({}).", rootArray);
-
- }
- }
-
- public void populateOutPropertAssignments(Map<String, PropertyDefinition> typeProperties,
- Map<String, Object> templateProperties) throws IOException {
- if (typeProperties != null && templateProperties != null) {
- ObjectMapper mapper = new ObjectMapper();
- String templatejsonContent = mapper.writeValueAsString(templateProperties);
- logger.info("Expression outputs ({}).", templatejsonContent);
-
- JsonNode rootArray = mapper.readTree(templatejsonContent);
- processJsonExpression(rootArray);
- logger.info("Resolved outputs ({}).", rootArray);
- }
- }
-
- public void processJsonExpression(JsonNode rootArray) throws IOException {
- if (rootArray != null) {
- Iterator<Map.Entry<String, JsonNode>> fields = rootArray.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- processJsonNode(rootArray, entry.getKey(), entry.getValue());
- }
- }
- }
-
- private void processJsonNode(JsonNode parentNode, String nodeName, JsonNode node) throws IOException {
- if (node == null) {
- // Do Nothing
- } else if (node.isArray()) {
- String[] a = new String[node.size()];
-
- for (int i = 0; i < a.length; i++) {
- processJsonNode(null, null, node.get(i));
- }
- } else if (node.isObject()) {
-
- Iterator<Map.Entry<String, JsonNode>> fields = node.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- processJsonNode(node, entry.getKey(), entry.getValue());
- }
- } else if (node.isTextual()) {
- boolean expression = checkExpressionContent(node.asText());
- if (expression) {
- processExpressionContent(parentNode, nodeName, node);
- }
- }
- }
-
- private boolean checkExpressionContent(String content) {
- return (StringUtils.isNotBlank(content) && (content.contains(ConfigModelConstant.EXPRESSION_GET_INPUT)
- || content.contains(ConfigModelConstant.EXPRESSION_GET_ATTRIBUTE)
- || content.contains(ConfigModelConstant.EXPRESSION_SET_VALUE)));
- }
-
- @SuppressWarnings("squid:S3776")
- private void processExpressionContent(JsonNode parentNode, String nodeName, JsonNode node) throws IOException {
-
- if (node != null && StringUtils.isNotBlank(node.asText())) {
- String content = node.asText();
- ObjectMapper mapper = new ObjectMapper();
- Map<String, String> expressionMap = mapper.readValue(content, Map.class);
- boolean isExpressionNode = false;
-
- if (expressionMap != null) {
- String expressionValue = null;
- String expressionKey = null;
-
- if (expressionMap.containsKey(ConfigModelConstant.EXPRESSION_GET_INPUT)) {
- isExpressionNode = true;
- expressionKey = expressionMap.get(ConfigModelConstant.EXPRESSION_GET_INPUT);
- expressionValue = resolveGetInputExpression(expressionKey, context);
- if (expressionValue == null) {
- expressionValue = resolveGetInputExpression("inputs." + expressionKey + ".default", context);
- }
- } else if (expressionMap.containsKey(ConfigModelConstant.EXPRESSION_GET_ATTRIBUTE)) {
- isExpressionNode = true;
- expressionValue =
- context.getAttribute(expressionMap.get(ConfigModelConstant.EXPRESSION_GET_ATTRIBUTE));
- } else if (expressionMap.containsKey(ConfigModelConstant.EXPRESSION_SET_VALUE)) {
- isExpressionNode = true;
- expressionKey = expressionMap.get(ConfigModelConstant.EXPRESSION_SET_VALUE);
- expressionValue = context.getAttribute(expressionKey);
-
- if (StringUtils.isNotBlank(expressionKey)) {
- context.setAttribute(expressionKey, expressionValue);
- }
- }
-
- if (isExpressionNode && expressionValue == null) {
- ((ObjectNode) parentNode).put(nodeName, "");
- }
- if (StringUtils.isNotBlank(expressionValue)) {
- if (expressionValue.trim().startsWith("[") || expressionValue.trim().startsWith("{")) {
- JsonNode valueNode = mapper.readTree(expressionValue);
- ((ObjectNode) parentNode).put(nodeName, valueNode);
- } else {
- ((ObjectNode) parentNode).put(nodeName, expressionValue);
- }
- }
- logger.debug("expression ({}), expression key ({}), expression Value ({})", expressionMap,
- expressionKey, expressionValue);
- }
- }
- }
-
- private String resolveGetInputExpression(String key, final SvcLogicContext context) {
- if (StringUtils.isNotBlank(key) && context != null) {
- return context.getAttribute(key);
- }
- return null;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonParserUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonParserUtils.java deleted file mode 100644 index d9cc3507f..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonParserUtils.java +++ /dev/null @@ -1,59 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import static com.jayway.jsonpath.JsonPath.using;
-import java.util.List;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.jayway.jsonpath.Configuration;
-import com.jayway.jsonpath.Option;
-import com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider;
-import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider;
-
-@SuppressWarnings("squid:S1118")
-public class JsonParserUtils {
-
- public static final Configuration JACKSON_JSON_NODE_CONFIGURATION = Configuration.builder()
- .mappingProvider(new JacksonMappingProvider()).jsonProvider(new JacksonJsonNodeJsonProvider()).build();
-
- public static final Configuration PATH_CONFIGURATION = Configuration.builder().options(Option.AS_PATH_LIST).build();
-
- public static List<String> paths(String jsonContent, String expression) {
- return using(PATH_CONFIGURATION).parse(jsonContent).read(expression);
- }
-
- public static List<String> paths(JsonNode jsonNode, String expression) {
- return paths(jsonNode.toString(), expression);
- }
-
- public static JsonNode parse(String jsonContent, String expression) {
- return using(JACKSON_JSON_NODE_CONFIGURATION).parse(jsonContent).read(expression);
- }
-
- public static JsonNode parse(JsonNode jsonNode, String expression) {
- return parse(jsonNode.toString(), expression);
- }
-
- public static JsonNode parseNSet(String jsonContent, String expression, JsonNode value) {
- return using(JACKSON_JSON_NODE_CONFIGURATION).parse(jsonContent).set(expression, value).json();
- }
-
- public static JsonNode parseNSet(JsonNode jsonNode, String expression, JsonNode valueNode) {
- return parseNSet(jsonNode.toString(), expression, valueNode);
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonUtils.java deleted file mode 100644 index 2db4b4875..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/JsonUtils.java +++ /dev/null @@ -1,109 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import org.onap.ccsdk.features.model.ValidTypes;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.NullNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * JsonUtils.java Purpose: Provide Configuration Generator JsonUtils Information
- *
- * @version 1.0
- */
-public class JsonUtils {
-
- private JsonUtils() {
-
- }
-
- public static void populatePrimitiveValues(String key, Object value, String primitiveType, ObjectNode objectNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equals(primitiveType)) {
- objectNode.put(key, (Boolean) value);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equals(primitiveType)) {
- objectNode.put(key, (Integer) value);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equals(primitiveType)) {
- objectNode.put(key, (Float) value);
- } else if (ValidTypes.DATA_TYPE_TIMESTAMP.equals(primitiveType)) {
- objectNode.put(key, (String) value);
- } else {
- objectNode.put(key, (String) value);
- }
- }
-
- public static void populatePrimitiveValues(Object value, String primitiveType, ArrayNode objectNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equals(primitiveType)) {
- objectNode.add((Boolean) value);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equals(primitiveType)) {
- objectNode.add((Integer) value);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equals(primitiveType)) {
- objectNode.add((Float) value);
- } else if (ValidTypes.DATA_TYPE_TIMESTAMP.equals(primitiveType)) {
- objectNode.add((String) value);
- } else {
- objectNode.add((String) value);
- }
- }
-
- public static void populatePrimitiveDefaultValues(String key, String primitiveType, ObjectNode objectNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equals(primitiveType)) {
- objectNode.put(key, false);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equals(primitiveType)) {
- objectNode.put(key, 0);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equals(primitiveType)) {
- objectNode.put(key, 0.0);
- } else {
- objectNode.put(key, "");
- }
- }
-
- public static void populatePrimitiveDefaultValuesForArrayNode(String primitiveType, ArrayNode arrayNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equals(primitiveType)) {
- arrayNode.add(false);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equals(primitiveType)) {
- arrayNode.add(0);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equals(primitiveType)) {
- arrayNode.add(0.0);
- } else {
- arrayNode.add("");
- }
- }
-
- public static void populateJsonNodeValues(String key, JsonNode nodeValue, String type, ObjectNode objectNode) {
- if (nodeValue == null || nodeValue instanceof NullNode) {
- objectNode.put(key, nodeValue);
- } else if (ValidTypes.getPrimitivePropertType().contains(type)) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equals(type)) {
- objectNode.put(key, nodeValue.asBoolean());
- } else if (ValidTypes.DATA_TYPE_INTEGER.equals(type)) {
- objectNode.put(key, nodeValue.asInt());
- } else if (ValidTypes.DATA_TYPE_FLOAT.equals(type)) {
- objectNode.put(key, nodeValue.floatValue());
- } else if (ValidTypes.DATA_TYPE_TIMESTAMP.equals(type)) {
- objectNode.put(key, nodeValue.asText());
- } else {
- objectNode.put(key, nodeValue.asText());
- }
- } else {
- objectNode.set(key, nodeValue);
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/NodePropertyUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/NodePropertyUtils.java deleted file mode 100644 index 0feb8b5a7..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/NodePropertyUtils.java +++ /dev/null @@ -1,187 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.CapabilityAssignment;
-import org.onap.ccsdk.features.model.data.CapabilityDefinition;
-import org.onap.ccsdk.features.model.data.InterfaceAssignment;
-import org.onap.ccsdk.features.model.data.InterfaceDefinition;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.OperationAssignment;
-import org.onap.ccsdk.features.model.data.OperationDefinition;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class NodePropertyUtils {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(NodePropertyUtils.class);
- private final SvcLogicContext context;
- private final Map<String, String> inParams;
- private ExpressionUtils jsonExpressionUtils;
-
- public NodePropertyUtils(final SvcLogicContext context, final Map<String, String> inParams) {
- this.context = context;
- this.inParams = inParams;
- jsonExpressionUtils = new ExpressionUtils(this.context, this.inParams);
- }
-
- @SuppressWarnings("squid:S3776")
- public SvcLogicContext assignInParamsFromModel(NodeType nodetype, NodeTemplate nodeTemplate) throws IOException {
- if (nodeTemplate != null) {
- Map<String, Object> inputs = null;
- // Populate the Type inputs
- Map<String, PropertyDefinition> nodeTypeinputs = new HashMap<>();
- for (Map.Entry<String, InterfaceDefinition> nodeTypeInterface : nodetype.getInterfaces().entrySet()) {
- if (nodeTypeInterface != null && nodeTypeInterface.getValue() != null) {
- for (Map.Entry<String, OperationDefinition> nodeTypeOperation : nodeTypeInterface.getValue()
- .getOperations().entrySet()) {
- nodeTypeinputs = nodeTypeOperation.getValue().getInputs();
- logger.trace("Populated node type input ({}).", nodeTypeinputs);
- }
- }
- }
-
- if (!nodeTypeinputs.isEmpty()) {
- // Populate the Template inputs
- for (Map.Entry<String, InterfaceAssignment> nodeTemplateInterface : nodeTemplate.getInterfaces()
- .entrySet()) {
- if (nodeTemplateInterface != null && nodeTemplateInterface.getValue() != null) {
- this.inParams.put(ConfigModelConstant.PROPERTY_CURRENT_INTERFACE,
- nodeTemplateInterface.getKey());
- for (Map.Entry<String, OperationAssignment> nodeTemplateOperation : nodeTemplateInterface
- .getValue().getOperations().entrySet()) {
- if (nodeTemplateOperation != null) {
- this.inParams.put(ConfigModelConstant.PROPERTY_CURRENT_OPERATION,
- nodeTemplateOperation.getKey());
- if (StringUtils.isNotBlank(nodeTemplateOperation.getValue().getImplementation())) {
- this.inParams.put(ConfigModelConstant.PROPERTY_CURRENT_IMPLEMENTATION,
- nodeTemplateOperation.getValue().getImplementation());
- }
- inputs = nodeTemplateOperation.getValue().getInputs();
- logger.trace("Populated node template input({}).", inputs);
- // Assign Default Values & Types
- jsonExpressionUtils.populatePropertAssignments(nodeTypeinputs, inputs);
- }
- }
- }
- }
- }
-
- if (nodeTemplate.getRequirements() != null && !nodeTemplate.getRequirements().isEmpty()) {
- assignInParamsFromRequirementModel(nodeTemplate, context, inParams);
- }
- }
- return context;
- }
-
- @SuppressWarnings("squid:S3776")
- public SvcLogicContext assignOutParamsFromModel(NodeType nodetype, NodeTemplate nodeTemplate) throws IOException {
-
- if (nodeTemplate != null) {
- Map<String, Object> outputs = null;
- // Populate the Type Outputs
- Map<String, PropertyDefinition> nodeTypeOutputs = new HashMap<>();
-
- for (Map.Entry<String, InterfaceDefinition> nodeTypeInterface : nodetype.getInterfaces().entrySet()) {
- if (nodeTypeInterface != null && nodeTypeInterface.getValue() != null) {
- for (Map.Entry<String, OperationDefinition> nodeTypeOperation : nodeTypeInterface.getValue()
- .getOperations().entrySet()) {
- nodeTypeOutputs = nodeTypeOperation.getValue().getOutputs();
- logger.info("Populated node type output ({}).", nodeTypeOutputs);
- }
- }
- }
-
- if (!nodeTypeOutputs.isEmpty()) {
- // Populate the Template Outputs
- for (Map.Entry<String, InterfaceAssignment> nodeTemplateInterface : nodeTemplate.getInterfaces()
- .entrySet()) {
- if (nodeTemplateInterface != null && nodeTemplateInterface.getValue() != null) {
- for (Map.Entry<String, OperationAssignment> nodeTemplateOperation : nodeTemplateInterface
- .getValue().getOperations().entrySet()) {
- outputs = nodeTemplateOperation.getValue().getOutputs();
- logger.info("Populated node template output ({}).", outputs);
- // Assign Default Values & Types
- jsonExpressionUtils.populateOutPropertAssignments(nodeTypeOutputs, outputs);
- // TO DO
- }
- }
- }
- }
- }
- return context;
- }
-
- @SuppressWarnings({"squid:S3776", "squid:S00112"})
- public SvcLogicContext assignInParamsFromRequirementModel(NodeTemplate nodeTemplate, final SvcLogicContext context,
- final Map<String, String> inParams) {
- if (nodeTemplate != null && nodeTemplate.getRequirements() != null && context != null && inParams != null) {
- nodeTemplate.getRequirements().forEach((requrementKey, requirement) -> {
- if (requirement != null && StringUtils.isNotBlank(requirement.getNode())
- && StringUtils.isNotBlank(requirement.getCapability())) {
- String requirementNodeTemplateContent = context
- .getAttribute(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + requirement.getNode());
- logger.info("Processing requirement node ({}) template content ({}) ", requirement.getNode(),
- requirementNodeTemplateContent);
- NodeTemplate requirementNodeTemplate =
- TransformationUtils.readValue(requirementNodeTemplateContent, NodeTemplate.class);
- if (requirementNodeTemplate != null && requirementNodeTemplate.getCapabilities() != null) {
- String nodeTypeContent = context.getAttribute(
- ConfigModelConstant.PROPERTY_NODE_TYPES_DOT + requirementNodeTemplate.getType());
- NodeType nodeType = TransformationUtils.readValue(nodeTypeContent, NodeType.class);
- if (nodeType != null && nodeType.getCapabilities() != null
- && nodeType.getCapabilities().containsKey(requirement.getCapability())) {
- CapabilityDefinition capabilityDefinition =
- nodeType.getCapabilities().get(requirement.getCapability());
- if (capabilityDefinition != null) {
- CapabilityAssignment capabilityAssignment =
- requirementNodeTemplate.getCapabilities().get(requirement.getCapability());
- try {
- assignInParamsFromCapabilityModel(requrementKey, capabilityDefinition,
- capabilityAssignment, context);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
- }
- }
- });
- }
- return context;
- }
-
- public SvcLogicContext assignInParamsFromCapabilityModel(String requirementName,
- CapabilityDefinition capabilityDefinition, CapabilityAssignment capabilityAssignment,
- final SvcLogicContext context) throws IOException {
- if (capabilityAssignment != null && capabilityAssignment.getProperties() != null) {
- jsonExpressionUtils.populatePropertAssignmentsWithPrefix(requirementName,
- capabilityDefinition.getProperties(), capabilityAssignment.getProperties());
- }
- return context;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/PrepareContextUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/PrepareContextUtils.java deleted file mode 100644 index 34c465cea..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/PrepareContextUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class PrepareContextUtils {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(PrepareContextUtils.class);
-
- public Map<String, String> prepareContext(Map<String, String> context, String input, String serviceTemplateContent)
- throws Exception {
- if (StringUtils.isNotBlank(serviceTemplateContent)) {
-
- if (context == null) {
- context = new HashMap<>();
- }
- if (StringUtils.isNotBlank(input)) {
- TransformationUtils.convertJson2RootProperties(context, input);
- }
-
- String recipeName = context.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- if (StringUtils.isNotBlank(recipeName)) {
- String recipeInputName =
- recipeName.replace(ConfigModelConstant.PROPERTY_RECIPE, ConfigModelConstant.PROPERTY_REQUEST);
- String recipeInput = context.get(recipeInputName);
- if (StringUtils.isNotBlank(recipeInput)) {
- // Un necessary to hold the Recipe Request, It is already in input
- context.remove(recipeInputName);
- context.remove(ConfigModelConstant.PROPERTY_PAYLOAD);
- TransformationUtils.convertJson2RootProperties(context, recipeInput);
- logger.info("Converted recipe ({}) request inputs to context.", recipeName);
- }
- }
-
- ServiceTemplateUtils serviceTemplateUtils = new ServiceTemplateUtils();
- serviceTemplateUtils.convertServiceTemplate2Properties(serviceTemplateContent, context);
- }
- return context;
-
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtils.java deleted file mode 100644 index c68c52c3f..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceAssignmentUtils.java +++ /dev/null @@ -1,302 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.NullNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.base.Preconditions;
-
-public class ResourceAssignmentUtils {
-
- private ResourceAssignmentUtils() {
-
- }
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceAssignmentUtils.class);
-
- public static String getArtifactNodeContent(String nodeTemplateName, Map<String, Object> context) {
- Preconditions.checkArgument(StringUtils.isNotBlank(nodeTemplateName),
- "getArtifactNodeContent missing template name");
- return (String) context.get(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateName + ".content");
- }
-
- public static List<ResourceAssignment> getArtifactNodeMapping(String nodeTemplateName,
- Map<String, Object> context) {
- Preconditions.checkArgument(StringUtils.isNotBlank(nodeTemplateName),
- "getArtifactNodeMapping missing template name");
- List<ResourceAssignment> resourceAssignments = null;
- String resourceMappingContent =
- (String) context.get(ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateName + ".mapping");
- if (StringUtils.isNotBlank(resourceMappingContent)) {
- resourceAssignments = TransformationUtils.getListfromJson(resourceMappingContent, ResourceAssignment.class);
-
- } else {
- logger.warn("missing mapping content for node template ({})", nodeTemplateName);
- }
- return resourceAssignments;
- }
-
- // Not used Any whre
- public static synchronized void cleanContextTemplateNDictionaryKeys(Map<String, Object> componentContext) {
- String recipeName = (String) componentContext.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- Set<String> removeSet = new HashSet<>();
- componentContext.forEach((key, value) -> {
- if (StringUtils.isNotBlank(key)
- && (key.startsWith(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + ".")
- || key.startsWith(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + "."))) {
- removeSet.add(key);
- }
- });
- componentContext.keySet().removeAll(removeSet);
- }
-
- public static synchronized Object getDictionaryKeyValue(Map<String, Object> componentContext,
- ResourceAssignment resourceMapping) {
- Object value = null;
- if (resourceMapping != null && componentContext != null) {
- String recipeName = (String) componentContext.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- String dictionaryKeyName = resourceMapping.getDictionaryName();
- value = componentContext
- .get(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryKeyName);
- }
- return value;
- }
-
- public static synchronized Object getDictionaryKeyValue(Map<String, Object> componentContext,
- ResourceDefinition resourceDictionary) {
- Object value = null;
- if (resourceDictionary != null && componentContext != null) {
- String recipeName = (String) componentContext.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- String dictionaryKeyName = resourceDictionary.getName();
- value = componentContext
- .get(ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryKeyName);
- }
- return value;
- }
-
- public static synchronized Object getTemplateKeyValue(Map<String, Object> componentContext,
- ResourceAssignment resourceMapping) {
- Object value = null;
- if (resourceMapping != null && componentContext != null) {
- String recipeName = (String) componentContext.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- String templateKeyName = resourceMapping.getName();
- value = componentContext
- .get(ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + "." + templateKeyName);
- }
- return value;
- }
-
- public static synchronized void setResourceDataValue(Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment, Object value) throws ConfigModelException {
-
- if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getName())
- && resourceAssignment.getProperty() != null) {
-
- String recipeName = (String) componentContext.get(ConfigModelConstant.PROPERTY_ACTION_NAME);
- String templateKeyName = resourceAssignment.getName();
- String dictionaryKeyName = resourceAssignment.getDictionaryName();
-
- if (StringUtils.isBlank(dictionaryKeyName)) {
- resourceAssignment.setDictionaryName(templateKeyName);
- dictionaryKeyName = templateKeyName;
- logger.warn("Missing dictionary key, setting with template key ({}) as dictionary key ({})",
- templateKeyName, dictionaryKeyName);
- }
- String type = resourceAssignment.getProperty().getType();
- try {
- if (StringUtils.isNotBlank(type)) {
- Object convertedValue = convertResourceValue(type, value);
-
- componentContext.put(
- ConfigModelConstant.PROPERTY_DICTIONARY_KEY_DOT + recipeName + "." + dictionaryKeyName,
- convertedValue);
- componentContext.put(
- ConfigModelConstant.PROPERTY_RECIPE_KEY_DOT + recipeName + "." + templateKeyName,
- convertedValue);
-
- logger.trace("Setting Resource Value ({}) for Resource Name ({}) of type ({}) ", convertedValue,
- dictionaryKeyName, type);
-
- resourceAssignment.getProperty().setValue(convertedValue);
- resourceAssignment.setUpdatedDate(new Date());
- resourceAssignment.setUpdatedBy(ConfigModelConstant.USER_SYSTEM);
- resourceAssignment.setStatus(ConfigModelConstant.STATUS_SUCCESS);
- }
- } catch (Exception e) {
- throw new ConfigModelException(String.format(
- "Failed in setting value for template key (%s) and dictionary key (%s) of type (%s) with error message (%s)",
- templateKeyName, dictionaryKeyName, type, e.getMessage()));
- }
- } else {
- throw new ConfigModelException(
- String.format("Failed in setting resource value for resource mapping (%s)", resourceAssignment));
- }
- }
-
- private static Object convertResourceValue(String type, Object value) {
- Object convertedValue = null;
-
- if (value == null || value instanceof NullNode) {
- logger.info("Returning {} value from convertResourceValue", value);
- return null;
- }
-
- if (ValidTypes.getPrimitivePropertType().contains(type)) {
- convertedValue = convertPrimitiveResourceValue(type, value);
- } else {
- // Case where Resource is non-primitive type
- if (value instanceof JsonNode || value instanceof ObjectNode || value instanceof ArrayNode) {
- convertedValue = value;
- } else if (value instanceof String) {
- convertedValue = TransformationUtils.getJsonNodeForString((String) value);
- } else {
- convertedValue = TransformationUtils.getJsonNodeForObject(value);
- }
- }
- return convertedValue;
- }
-
- @SuppressWarnings("squid:S3776")
- private static Object convertPrimitiveResourceValue(String type, Object value) {
- Object convertedValue = value;
-
- if (value instanceof ArrayNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equalsIgnoreCase(type)) {
- convertedValue = ((ArrayNode) value).asBoolean();
- } else if (ValidTypes.DATA_TYPE_INTEGER.equalsIgnoreCase(type)) {
- convertedValue = ((ArrayNode) value).asInt();
- } else if (ValidTypes.DATA_TYPE_FLOAT.equalsIgnoreCase(type)) {
- convertedValue = Float.valueOf(((ArrayNode) value).toString());
- } else {
- convertedValue = ((ArrayNode) value).toString();
- }
- } else if (value instanceof JsonNode) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equalsIgnoreCase(type)) {
- convertedValue = ((JsonNode) value).asBoolean();
- } else if (ValidTypes.DATA_TYPE_INTEGER.equalsIgnoreCase(type)) {
- convertedValue = ((JsonNode) value).asInt();
- } else if (ValidTypes.DATA_TYPE_FLOAT.equalsIgnoreCase(type)) {
- convertedValue = Float.valueOf(((JsonNode) value).asText());
- } else {
- convertedValue = ((JsonNode) value).asText();
- }
- } else if (value instanceof String) {
- if (ValidTypes.DATA_TYPE_BOOLEAN.equalsIgnoreCase(type)) {
- convertedValue = Boolean.valueOf((String) value);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equalsIgnoreCase(type)) {
- convertedValue = Integer.valueOf((String) value);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equalsIgnoreCase(type)) {
- convertedValue = Float.valueOf((String) value);
- }
- }
- logger.info("Returning value ({}) from convertPrimitiveResourceValue", convertedValue);
- return convertedValue;
- }
-
- @SuppressWarnings("squid:S1172")
- public static synchronized void setFailedResourceDataValue(Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment, String message) {
- setFailedResourceDataValue(resourceAssignment, message);
- }
-
- public static synchronized void setFailedResourceDataValue(ResourceAssignment resourceAssignment, String message) {
- if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getName())
- && resourceAssignment.getProperty() != null) {
- resourceAssignment.setUpdatedDate(new Date());
- resourceAssignment.setStatus(ConfigModelConstant.STATUS_FAILURE);
- resourceAssignment.setUpdatedBy(ConfigModelConstant.USER_SYSTEM);
- resourceAssignment.setMessage(message);
- }
- }
-
- public static synchronized void assertTemplateKeyValueNotNull(Map<String, Object> componentContext,
- ResourceAssignment resourceAssignment) throws ConfigModelException {
- if (resourceAssignment != null && resourceAssignment.getProperty() != null
- && BooleanUtils.isTrue(resourceAssignment.getProperty().getRequired())
- && getTemplateKeyValue(componentContext, resourceAssignment) == null) {
- logger.error("failed to populate mandatory resource mapping ({})", resourceAssignment);
- throw new ConfigModelException(
- String.format("failed to populate mandatory resource mapping (%s)", resourceAssignment));
- }
- }
-
- @SuppressWarnings({"squid:S3776", "squid:S1141"})
- public static synchronized String generateResourceDataForAssignments(List<ResourceAssignment> assignments)
- throws ConfigModelException {
- String result = "{}";
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonNode root = mapper.readTree(result);
- for (ResourceAssignment resourceMapping : assignments) {
- if (resourceMapping != null && resourceMapping.getName() != null
- && resourceMapping.getProperty() != null) {
-
- String type = resourceMapping.getProperty().getType();
- Object value = resourceMapping.getProperty().getValue();
- logger.info("Generating Resource name ({}), type ({}), value ({})", resourceMapping.getName(), type,
- value);
- if (value == null) {
- ((ObjectNode) root).set(resourceMapping.getName(), null);
- } else if (value instanceof JsonNode) {
- ((ObjectNode) root).put(resourceMapping.getName(), (JsonNode) value);
- } else if (ValidTypes.DATA_TYPE_STRING.equalsIgnoreCase(type)) {
- ((ObjectNode) root).put(resourceMapping.getName(), (String) value);
- } else if (ValidTypes.DATA_TYPE_BOOLEAN.equalsIgnoreCase(type)) {
- ((ObjectNode) root).put(resourceMapping.getName(), (Boolean) value);
- } else if (ValidTypes.DATA_TYPE_INTEGER.equalsIgnoreCase(type)) {
- ((ObjectNode) root).put(resourceMapping.getName(), (Integer) value);
- } else if (ValidTypes.DATA_TYPE_FLOAT.equalsIgnoreCase(type)) {
- ((ObjectNode) root).put(resourceMapping.getName(), (Float) value);
- } else if (ValidTypes.DATA_TYPE_TIMESTAMP.equalsIgnoreCase(type)) {
- ((ObjectNode) root).put(resourceMapping.getName(), (String) value);
- } else {
- JsonNode jsonNode = TransformationUtils.getJsonNodeForObject(value);
- if (jsonNode != null) {
- ((ObjectNode) root).put(resourceMapping.getName(), jsonNode);
- } else {
- ((ObjectNode) root).set(resourceMapping.getName(), null);
- }
- }
- }
- }
- result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(root);
- logger.info("Generated Resource Param Data ({})", result);
- } catch (Exception e) {
- throw new ConfigModelException(e.getMessage(), e);
- }
- return result;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceDictionaryUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceDictionaryUtils.java deleted file mode 100644 index 080171ef6..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ResourceDictionaryUtils.java +++ /dev/null @@ -1,119 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.Supplier;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;
-import org.onap.ccsdk.features.model.data.dict.SourcesDefinition;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-/**
- * ResourceDictionaryUtils.java Purpose to provide ResourceDictionaryUtils
- *
- * @version 1.0
- */
-public class ResourceDictionaryUtils {
-
- private ResourceDictionaryUtils() {
- // Do nothing
- }
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceDictionaryUtils.class);
-
- /**
- * This Method is to assign the source name to the Dictionary Definition Check to see if the source
- * definition is not present then assign, if more than one source then assign only one source.
- *
- * @param resourceAssignment
- * @param resourceDefinition
- */
- @SuppressWarnings("squid:S3776")
- public static void populateSourceMapping(ResourceAssignment resourceAssignment,
- ResourceDefinition resourceDefinition) {
-
- if (resourceAssignment != null && resourceDefinition != null
- && StringUtils.isBlank(resourceAssignment.getDictionarySource())) {
-
- setProperty(resourceAssignment, resourceDefinition);
- Map<String, SourcesDefinition> sourcesDefinition = resourceDefinition.getSources();
-
- if (sourcesDefinition != null && MapUtils.isNotEmpty(sourcesDefinition) && sourcesDefinition.size() == 1) {
- if (sourcesDefinition.get("input") != null) {
- resourceAssignment.setDictionarySource(ConfigModelConstant.SOURCE_INPUT);
- } else if (sourcesDefinition.get("default") != null) {
- resourceAssignment.setDictionarySource(ConfigModelConstant.SOURCE_DEFAULT);
- } else if (sourcesDefinition.get("db") != null) {
- resourceAssignment.setDictionarySource(ConfigModelConstant.SOURCE_DB);
- if (resolve(() -> sourcesDefinition.get("db").getProperties().getDependencies()).isPresent()
- && CollectionUtils
- .isNotEmpty(sourcesDefinition.get("db").getProperties().getDependencies())) {
- resourceAssignment
- .setDependencies(sourcesDefinition.get("db").getProperties().getDependencies());
- }
- } else if (sourcesDefinition.get("mdsal") != null) {
- resourceAssignment.setDictionarySource(ConfigModelConstant.SOURCE_MDSAL);
- if (resolve(() -> sourcesDefinition.get("mdsal").getProperties().getDependencies()).isPresent()
- && CollectionUtils
- .isNotEmpty(sourcesDefinition.get("mdsal").getProperties().getDependencies())) {
- resourceAssignment
- .setDependencies(sourcesDefinition.get("mdsal").getProperties().getDependencies());
- }
- }
- logger.info("automapped resourceAssignment : {}", resourceAssignment);
- }
- }
- }
-
- public static <T> Optional<T> resolve(Supplier<T> resolver) {
- try {
- T result = resolver.get();
- return Optional.ofNullable(result);
- } catch (NullPointerException e) {
- return Optional.empty();
- }
- }
-
- /**
- * Overriding ResourceAssignment Properties with properties defined in Dictionary
- */
- private static void setProperty(ResourceAssignment resourceAssignment, ResourceDefinition resourceDefinition) {
- if (StringUtils.isNotBlank(resourceDefinition.getProperty().getType())) {
- PropertyDefinition property = resourceAssignment.getProperty();
- if (property == null) {
- property = new PropertyDefinition();
- }
- if (resourceDefinition.getProperty() != null) {
- property.setType(resourceDefinition.getProperty().getType());
- if (resourceDefinition.getProperty().getEntrySchema() != null) {
- property.setEntrySchema(resourceDefinition.getProperty().getEntrySchema());
- }
- resourceAssignment.setProperty(property);
- }
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtils.java deleted file mode 100644 index c63719875..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/ServiceTemplateUtils.java +++ /dev/null @@ -1,277 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.util.Map;
-import org.apache.commons.collections.MapUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.data.InterfaceAssignment;
-import org.onap.ccsdk.features.model.data.InterfaceDefinition;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.OperationAssignment;
-import org.onap.ccsdk.features.model.data.OperationDefinition;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.data.TopologyTemplate;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ServiceTemplateUtils {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ServiceTemplateUtils.class);
-
- public Map<String, String> convertServiceTemplate2Properties(String serviceTemplateContent,
- final Map<String, String> context) {
- if (StringUtils.isNotBlank(serviceTemplateContent)) {
- ServiceTemplate serviceTemplate =
- TransformationUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
- convertServiceTemplate2Properties(serviceTemplate, context);
- }
- return context;
- }
-
- public Map<String, String> convertServiceTemplate2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) {
- if (serviceTemplate != null) {
- convertServiceTemplateMetadata2Properties(serviceTemplate, context);
- convertServiceTemplateInputs2Properties(serviceTemplate, context);
- convertDataTypes2Properties(serviceTemplate, context);
- convertNode2Properties(serviceTemplate, context);
- }
- return context;
- }
-
- public Map<String, String> convertServiceTemplateMetadata2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) {
-
- if (serviceTemplate != null && serviceTemplate.getMetadata() != null) {
- serviceTemplate.getMetadata().forEach((metaDataKey, metadata) -> {
- context.put(metaDataKey, metadata);
- });
- }
- return context;
- }
-
- public Map<String, String> convertServiceTemplateInputs2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) {
-
- if (serviceTemplate != null && serviceTemplate.getTopologyTemplate() != null
- && serviceTemplate.getTopologyTemplate().getInputs() != null) {
-
- serviceTemplate.getTopologyTemplate().getInputs().forEach((paramKey, parameterDefinition) -> {
- if (parameterDefinition != null) {
- context.put(ConfigModelConstant.PROPERTY_INPUTS_DOT + paramKey + ".type",
- parameterDefinition.getType());
- if (parameterDefinition.getRequired()) {
- context.put(ConfigModelConstant.PROPERTY_INPUTS_DOT + paramKey + ".required",
- String.valueOf(parameterDefinition.getRequired()));
- }
- if (parameterDefinition.getDefaultValue() != null) {
- context.put(ConfigModelConstant.PROPERTY_INPUTS_DOT + paramKey + ".default",
- String.valueOf(parameterDefinition.getDefaultValue()));
- }
- }
- });
- }
- return context;
- }
-
- public Map<String, String> convertDataTypes2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) {
- if (serviceTemplate != null && serviceTemplate.getDataTypes() != null) {
- serviceTemplate.getDataTypes().forEach((dataTypeKey, dataType) -> {
- logger.trace("Populating Data Type Key : ({})", dataTypeKey);
- String dataTypeContent = TransformationUtils.getJson(dataType);
- context.put("data_types." + dataTypeKey, dataTypeContent);
- });
- }
- return context;
- }
-
- public Map<String, String> convertNode2Properties(ServiceTemplate serviceTemplate,
- final Map<String, String> context) {
-
- if (serviceTemplate != null && serviceTemplate.getNodeTypes() != null
- && serviceTemplate.getTopologyTemplate() != null
- && serviceTemplate.getTopologyTemplate().getNodeTemplates() != null) {
-
- serviceTemplate.getTopologyTemplate().getNodeTemplates().forEach((nodeTemplateKey, nodeTemplate) -> {
- if (nodeTemplate != null && StringUtils.isNotBlank(nodeTemplate.getType())) {
- String nodeTypeKey = nodeTemplate.getType();
- logger.trace("Populating Node Type Key : ({}) for Node Template : ({})", nodeTypeKey,
- nodeTemplateKey);
- String nodeTemplateContent = TransformationUtils.getJson(nodeTemplate);
- context.put("node_templates." + nodeTemplateKey, nodeTemplateContent);
- if (serviceTemplate.getNodeTypes().containsKey(nodeTypeKey)) {
- NodeType nodeType = serviceTemplate.getNodeTypes().get(nodeTypeKey);
- String nodeTypeContent = TransformationUtils.getJson(nodeType);
- context.put("node_types." + nodeTypeKey, nodeTypeContent);
- String nodeDerivedFrom = nodeType.getDerivedFrom();
- if (ConfigModelConstant.MODEL_TYPE_NODE_DG.equalsIgnoreCase(nodeDerivedFrom)) {
- populateDGNodeProperties(nodeTemplateKey, nodeTemplate, context, nodeDerivedFrom);
- }
- }
- // Populate the Artifact Definitions
- populateNodeTemplateArtifacts(nodeTemplateKey, nodeTemplate, context);
- }
- });
- }
- return context;
- }
-
- @SuppressWarnings("squid:S1172")
- public Map<String, String> populateVnfNodeProperties(String nodeTemplateKey, NodeTemplate nodeTemplate,
- final Map<String, String> context, String nodeDerivedFrom) {
- if (nodeTemplate != null && nodeTemplate.getCapabilities() != null) {
- nodeTemplate.getCapabilities().forEach((capabilityKey, capability) -> {
- capability.getProperties().forEach((propertyKey, property) -> {
- context.put(nodeTemplateKey + "." + capabilityKey + "." + propertyKey, String.valueOf(property));
- });
- });
- }
-
- return context;
- }
-
- public Map<String, String> populateNodeTemplateArtifacts(String nodeTemplateKey, NodeTemplate nodeTemplate,
- final Map<String, String> context) {
- if (MapUtils.isNotEmpty(nodeTemplate.getArtifacts())) {
- nodeTemplate.getArtifacts().forEach((artifactName, artifact) -> {
- if (StringUtils.isNotBlank(artifactName) && artifact != null) {
- logger.trace("Populating Node Template Artifacts ({}) for Node Template ({})", artifactName,
- nodeTemplateKey);
- String fileKeyName = ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateKey + "."
- + ConfigModelConstant.PROPERTY_ARTIFACTS_DOT + artifactName + ".file";
- String deployKeyName = ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateKey + "."
- + ConfigModelConstant.PROPERTY_ARTIFACTS_DOT + artifactName + ".deploy_path";
- String contentKeyName = ConfigModelConstant.PROPERTY_NODE_TEMPLATES_DOT + nodeTemplateKey + "."
- + ConfigModelConstant.PROPERTY_ARTIFACTS_DOT + artifactName + ".content";
- context.put(fileKeyName, artifact.getFile());
- context.put(deployKeyName, artifact.getDeployPath());
- context.put(contentKeyName, artifact.getContent());
- }
- });
- }
- return context;
- }
-
- public Map<String, String> populateDGNodeProperties(String nodeTemplateKey, NodeTemplate nodeTemplate,
- final Map<String, String> context, String nodeDerivedFrom) {
- if (nodeTemplate != null && nodeTemplate.getInterfaces() != null) {
-
- if (nodeTemplate.getProperties() != null) {
- nodeTemplate.getProperties().forEach((propKey, propValue) -> {
- if (propKey != null && propValue != null) {
- context.put("dg." + nodeTemplateKey + "." + propKey, String.valueOf(propValue));
- }
- });
- }
-
- nodeTemplate.getInterfaces().forEach((interfaceKey, interfaceDefinition) -> {
-
- interfaceDefinition.getOperations().forEach((operationKey, operation) -> {
- if (ConfigModelConstant.MODEL_TYPE_NODE_DG.equalsIgnoreCase(nodeDerivedFrom)) {
- context.put("dg." + nodeTemplateKey + ".module", interfaceKey);
- context.put("dg." + nodeTemplateKey + ".flow", operationKey);
- }
- });
- });
- }
- return context;
- }
-
- public SvcLogicContext getInterfaceOpertationDefinition(ServiceTemplate serviceTemplate,
- final SvcLogicContext context) {
-
- if (serviceTemplate != null && serviceTemplate.getNodeTypes() != null
- && serviceTemplate.getTopologyTemplate() != null
- && serviceTemplate.getTopologyTemplate().getNodeTemplates() != null) {
-
- TopologyTemplate topologyTemplates = serviceTemplate.getTopologyTemplate();
- // Copy Definition to Template
- copyNodeType2Template(serviceTemplate.getNodeTypes(), topologyTemplates.getNodeTemplates());
-
- topologyTemplates.getNodeTemplates().forEach((templateKey, nodeTemplate) -> {
-
- if (StringUtils.isNotBlank(templateKey) && nodeTemplate != null
- && nodeTemplate.getInterfaces() != null) {
-
- nodeTemplate.getInterfaces().forEach((interfaceKey, interfaceDefinition) -> {
- if (StringUtils.isNotBlank(interfaceKey) && interfaceDefinition != null) {
- interfaceDefinition.getOperations().forEach((operationKey, operation) -> {
- String definitionKey = interfaceKey + "." + operationKey;
- String definitionContent = TransformationUtils.getJson(operation);
- context.setAttribute(definitionKey, definitionContent);
- // Set the Operation & Method Params
- });
- }
- });
- }
- });
- }
- return context;
- }
-
- public void copyNodeType2Template(Map<String, NodeType> nodeTypes, Map<String, NodeTemplate> nodeTemplates) {
- if (nodeTypes != null && nodeTemplates != null) {
-
- nodeTemplates.forEach((templateKey, nodeTemplate) -> {
- if (StringUtils.isNotBlank(templateKey) && nodeTemplate != null) {
- String type = nodeTemplate.getType();
- // Check the Node Template Type is Present
- if (StringUtils.isNotBlank(type) && nodeTypes.containsKey(type)) {
- NodeType nodeType = nodeTypes.get(type);
- logger.trace("Checking Node Type Content : ({})", TransformationUtils.getJson(nodeType));
- copyNodeTypeInterface2Template(nodeType.getInterfaces(), nodeTemplate.getInterfaces());
- }
- }
- });
- }
- }
-
- public void copyNodeTypeInterface2Template(Map<String, InterfaceDefinition> nodeTypeInterfaces,
- Map<String, InterfaceAssignment> nodeTemplateInterfaces) {
- if (nodeTypeInterfaces != null && nodeTemplateInterfaces != null) {
-
- nodeTemplateInterfaces.forEach((interfaceKey, nodeTemplateinterface) -> {
- InterfaceDefinition nodeTypeInterface = nodeTypeInterfaces.get(interfaceKey);
- logger.trace("Checking Interface Type Content : ({})", TransformationUtils.getJson(nodeTypeInterface));
- if (nodeTypeInterface != null && nodeTemplateinterface != null) {
- copyNodeTypeOperation2Template(nodeTypeInterface.getOperations(),
- nodeTemplateinterface.getOperations());
- }
- });
- }
- }
-
- public void copyNodeTypeOperation2Template(Map<String, OperationDefinition> nodeTypeOperations,
- Map<String, OperationAssignment> nodeTemplateOperations) {
- if (nodeTypeOperations != null && nodeTemplateOperations != null) {
-
- nodeTemplateOperations.forEach((operationKey, nodeTemplateOperation) -> {
- OperationDefinition nodeTypeInterfaceOperation = nodeTypeOperations.get(operationKey);
- if (nodeTypeInterfaceOperation != null && nodeTemplateOperation != null) {
- logger.info("Checking Operation Type Content : " + operationKey + " : "
- + TransformationUtils.getJson(nodeTypeInterfaceOperation));
- }
- });
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TopologicalSortingUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TopologicalSortingUtils.java deleted file mode 100644 index 4f16a0c5f..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TopologicalSortingUtils.java +++ /dev/null @@ -1,188 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Stack;
-
-public class TopologicalSortingUtils<V> {
-
- /**
- * The implementation here is basically an adjacency list, but instead of an array of lists, a Map
- * is used to map each vertex to its list of adjacent vertices.
- */
- private Map<V, List<V>> neighbors = new HashMap<>();
-
- /**
- * String representation of graph.
- */
- @Override
- public String toString() {
- StringBuilder s = new StringBuilder();
- neighbors.forEach((v, vs) -> s.append("\n " + v + " -> " + vs));
- return s.toString();
- }
-
- public Map<V, List<V>> getNeighbors() {
- return neighbors;
- }
-
- /**
- * Add a vertex to the graph. Nothing happens if vertex is already in graph.
- */
- public void add(V vertex) {
- if (neighbors.containsKey(vertex))
- return;
- neighbors.put(vertex, new ArrayList<V>());
- }
-
- /**
- * True iff graph contains vertex.
- */
- public boolean contains(V vertex) {
- return neighbors.containsKey(vertex);
- }
-
- /**
- * Add an edge to the graph; if either vertex does not exist, it's added. This implementation allows
- * the creation of multi-edges and self-loops.
- */
- public void add(V from, V to) {
- this.add(from);
- this.add(to);
- neighbors.get(from).add(to);
- }
-
- /**
- * Remove an edge from the graph. Nothing happens if no such edge.
- *
- * @throws IllegalArgumentException if either vertex doesn't exist.
- */
- public void remove(V from, V to) {
- if (!(this.contains(from) && this.contains(to)))
- throw new IllegalArgumentException("Nonexistent vertex");
- neighbors.get(from).remove(to);
- }
-
- /**
- * Report (as a Map) the out-degree of each vertex.
- */
- public Map<V, Integer> outDegree() {
- Map<V, Integer> result = new HashMap<>();
- neighbors.forEach((v, vs) -> result.put(v, vs.size()));
- return result;
- }
-
- /**
- * Report (as a Map) the in-degree of each vertex.
- */
- public Map<V, Integer> inDegree() {
- Map<V, Integer> result = new HashMap<>();
- for (V v : neighbors.keySet())
- result.put(v, 0); // All in-degrees are 0
-
- neighbors.forEach((from, vs) -> vs.forEach(to -> result.put(to, result.get(to) + 1) // Increment in-degree
- ));
-
- return result;
- }
-
- /**
- * Report (as a List) the topological sort of the vertices; null for no such sort.
- */
- @SuppressWarnings({"squid:S1149", "squid:S1168"})
- public List<V> topSort() {
- Map<V, Integer> degree = inDegree();
- // Determine all vertices with zero in-degree
- Stack<V> zeroVerts = new Stack<>(); // Stack as good as any here
-
- degree.forEach((v, vs) -> {
- if (vs == 0)
- zeroVerts.push(v);
- });
-
- // Determine the topological order
- List<V> result = new ArrayList<>();
- while (!zeroVerts.isEmpty()) {
- V v = zeroVerts.pop(); // Choose a vertex with zero in-degree
- result.add(v); // Vertex v is next in topol order
- // "Remove" vertex v by updating its neighbors
- for (V neighbor : neighbors.get(v)) {
- degree.put(neighbor, degree.get(neighbor) - 1);
- // Remember any vertices that now have zero in-degree
- if (degree.get(neighbor) == 0)
- zeroVerts.push(neighbor);
- }
- }
- // Check that we have used the entire graph (if not, there was a cycle)
- if (result.size() != neighbors.size())
- return null;
- return result;
- }
-
- /**
- * True iff graph is a dag (directed acyclic graph).
- */
- public boolean isDag() {
- return topSort() != null;
- }
-
- /**
- * Report (as a Map) the bfs distance to each vertex from the start vertex. The distance is an
- * Integer; the value null is used to represent infinity (implying that the corresponding node
- * cannot be reached).
- */
- public Map bfsDistance(V start) {
- Map<V, Integer> distance = new HashMap<>();
- // Initially, all distance are infinity, except start node
- for (V v : neighbors.keySet())
- distance.put(v, null);
- distance.put(start, 0);
- // Process nodes in queue order
- Queue<V> queue = new LinkedList<>();
- queue.offer(start); // Place start node in queue
- while (!queue.isEmpty()) {
- V v = queue.remove();
- int vDist = distance.get(v);
- // Update neighbors
- for (V neighbor : neighbors.get(v)) {
- if (distance.get(neighbor) != null)
- continue; // Ignore if already done
- distance.put(neighbor, vDist + 1);
- queue.offer(neighbor);
- }
- }
- return distance;
- }
-
- /**
- * Main program (for testing). public static void main (String[] args) { // Create a Graph with
- * Integer nodes TopologicalSortingUtils<String> graph = new TopologicalSortingUtils<String>();
- * graph.add("bundle-id", "bundle-mac"); graph.add("bundle-id", "bundle-ip");
- * graph.add("bundle-mac", "bundle-ip"); graph.add("bundle-ip", "bundle-mac");
- * System.out.println("The current graph: " + graph); System.out.println("In-degrees: " +
- * graph.inDegree()); System.out.println("Out-degrees: " + graph.outDegree()); System.out.println("A
- * topological sort of the vertices: " + graph.topSort()); System.out.println("The graph " +
- * (graph.isDag()?"is":"is not") + " a dag"); }
- */
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TransformationUtils.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TransformationUtils.java deleted file mode 100644 index 138745ccf..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/utils/TransformationUtils.java +++ /dev/null @@ -1,429 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.utils;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TreeMap;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.type.CollectionType;
-import com.fasterxml.jackson.module.jsonSchema.JsonSchema;
-import com.fasterxml.jackson.module.jsonSchema.JsonSchemaGenerator;
-
-/**
- * TransformationUtils.java Purpose: Provide Configuration Generator TransformationUtils Information
- *
- * @version 1.0
- */
-public class TransformationUtils {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(TransformationUtils.class);
-
- private TransformationUtils() {
-
- }
-
- /**
- * This is a getJson method
- *
- * @param configparameters
- * @return String
- */
- public static String getJson(Map<String, Object> configparameters) {
- String jsonContent = null;
- try {
- ObjectMapper mapper = new ObjectMapper();
- jsonContent = mapper.writeValueAsString(configparameters);
- } catch (JsonProcessingException e) {
- logger.warn(e.getMessage());
- }
- return jsonContent;
- }
-
- /**
- * This is a getJsonNode method
- *
- * @param configparameters
- * @return String
- */
- public static JsonNode getJsonNode(Map<String, String> configparameters) {
- JsonNode jsonContent = null;
- try {
- ObjectMapper mapper = new ObjectMapper();
- jsonContent = mapper.valueToTree(configparameters);
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- return jsonContent;
- }
-
- /**
- * This is a getJson method
- *
- * @param instance
- * @param pretty
- * @return Map<String , Object>
- */
- public static String getJson(Object instance, boolean pretty) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- if (pretty) {
- mapper.enable(SerializationFeature.INDENT_OUTPUT);
- }
- return mapper.writeValueAsString(instance);
- } catch (JsonProcessingException e) {
- logger.warn(e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getJson method
- *
- * @param instance
- * @return String
- */
- public static String getJson(Object instance) {
- return getJson(instance, false);
- }
-
- /**
- * This is a getJsonNodeForobject method
- *
- * @param instance
- * @return JsonNode
- */
- public static JsonNode getJsonNodeForObject(Object instance) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- return mapper.convertValue(instance, JsonNode.class);
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getJsonNodeForString method
- *
- * @param content
- * @return JsonNode
- */
- public static JsonNode getJsonNodeForString(String content) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- return mapper.readTree(content);
- } catch (Exception e) {
- logger.warn(e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getMapfromJson method
- *
- * @param content
- * @return Map<String , Object>
- */
- public static Map<String, Object> getMapfromJson(String content) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- return mapper.readValue(content, new TypeReference<Map<String, String>>() {});
- } catch (Exception e) {
- logger.warn("failed in getMapfromJson for the content ({}) with error message ({}).", content,
- e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getMapfromJson method
- *
- * @param content
- * @return Map<String , Object>
- */
- public static Map<String, Object> getMapfromJsonString(String content) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- return mapper.readValue(content, new TypeReference<Map<String, Object>>() {});
- } catch (Exception e) {
- logger.warn("failed in getMapfromJson for the content ({}) with error message ({}).", content,
- e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getListfromJson method
- *
- * @param content
- * @return Map<String , Object>
- */
- @SuppressWarnings("squid:S1168")
- public static <T> List<T> getListfromJson(String content, Class<T> valueType) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- CollectionType javaType = mapper.getTypeFactory().constructCollectionType(List.class, valueType);
- return mapper.readValue(content, javaType);
- } catch (Exception e) {
- logger.warn("failed in getListfromJson for the content ({}) with error message ({}).", content,
- e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a getJsonSchema method
- *
- * @param valueType
- * @return String
- */
- public static String getJsonSchema(Class clazz) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- JsonSchemaGenerator schemaGen = new JsonSchemaGenerator(mapper);
- JsonSchema schema = schemaGen.generateSchema(clazz);
- return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(schema);
-
- } catch (Exception e) {
- logger.warn("failed in getJsonSchema with error message ({}).", e.getMessage());
- }
- return null;
- }
-
- /**
- * This is a readValue method
- *
- * @param content
- * @param valueType
- * @return <T>
- */
-
- public static <T> T readValue(String content, Class<T> valueType) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- return mapper.readValue(content, valueType);
- } catch (Exception e) {
- logger.warn("failed in readValue for the content ({}) with error message ({}).", content, e.getMessage());
- }
- return null;
- }
-
- /**
- * @param node
- * @param valueType
- * @param <T>
- * @return
- */
- public static <T> T treeToValue(JsonNode node, Class<T> valueType) {
- try {
- ObjectMapper mapper = new ObjectMapper();
- return mapper.treeToValue(node, valueType);
- } catch (Exception e) {
- logger.warn("failed in readValue for the content ({}) with error message ({}).", node, e.getMessage());
- }
- return null;
- }
-
- /**
- * @param node
- * @param valueType
- * @param <T>
- * @return List<T>
- */
- public static <T> List<T> treeToListValue(JsonNode node, Class<T> valueType) {
- List<T> resultList = new ArrayList<>();
- if (node instanceof ArrayNode) {
- for (JsonNode subnode : node) {
- if (subnode != null) {
- resultList.add(treeToValue(subnode, valueType));
- }
- }
- }
- return resultList;
- }
-
- /**
- * This is a removeJsonNullNode method
- *
- * @param node
- */
- public static void removeJsonNullNode(JsonNode node) {
- Iterator<JsonNode> it = node.iterator();
- while (it.hasNext()) {
- JsonNode child = it.next();
- if (child.isNull()) {
- it.remove();
- } else {
- removeJsonNullNode(child);
- }
- }
- }
-
- public static void printProperty(Properties property) {
- if (property != null) {
- Map<String, String> sortedMap = new TreeMap(property);
- StringBuilder buffer = new StringBuilder();
- sortedMap.entrySet().forEach(message -> {
- buffer.append("\n" + message.toString());
- });
- logger.debug("Property : ({})", buffer);
- }
- }
-
- public static void printMap(Map<String, String> map) {
- if (map != null) {
- Map<String, String> sortedMap = new TreeMap(map);
- StringBuilder buffer = new StringBuilder();
- sortedMap.entrySet().forEach(message -> {
- buffer.append("\n" + message.toString());
- });
- logger.debug("Map: ({})", buffer);
- }
- }
-
- @SuppressWarnings("squid:S00112")
- public static Map<String, String> convertJson2RootProperties(Map<String, String> context, String jsonContent)
- throws Exception {
- if (context == null) {
- context = new HashMap<>();
- }
-
- ObjectMapper mapper = new ObjectMapper();
- JsonNode rootArray = mapper.readTree(jsonContent);
- return convertJson2RootProperties(context, rootArray);
- }
-
- public static Map<String, String> convertJson2RootProperties(Map<String, String> context, JsonNode rootArray) {
- Map<String, String> sortedMap = null;
-
- if (context == null) {
- context = new HashMap<>();
- }
- if (rootArray != null) {
- Iterator<Map.Entry<String, JsonNode>> fields = rootArray.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- if (entry != null && entry.getValue() != null) {
- if (entry.getValue().isTextual()) {
- context.put(entry.getKey(), entry.getValue().textValue());
- } else {
- context.put(entry.getKey(), entry.getValue().toString());
- }
- }
- }
- }
- sortedMap = new TreeMap<>(context);
- return sortedMap;
- }
-
- @SuppressWarnings("squid:S00112")
- public static Map<String, String> convertJson2Properties(Map<String, String> context, String jsonContent,
- List<String> blockKeys) throws Exception {
- Map<String, String> sortedMap = null;
-
- if (context == null) {
- context = new HashMap<>();
- }
-
- ObjectMapper mapper = new ObjectMapper();
- JsonNode rootArray = mapper.readTree(jsonContent);
-
- if (rootArray != null) {
- Iterator<Map.Entry<String, JsonNode>> fields = rootArray.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- processJsonNode(context, blockKeys, entry.getKey(), entry.getValue());
- }
- }
- sortedMap = new TreeMap<>(context);
- return sortedMap;
- }
-
- public static Map<String, String> convertJson2Properties(Map<String, String> context, JsonNode rootArray,
- List<String> blockKeys) throws IOException {
- Map<String, String> sortedMap = null;
-
- if (context == null) {
- context = new HashMap<>();
- }
-
- if (blockKeys == null) {
- blockKeys = new ArrayList<>();
- }
-
- if (rootArray != null) {
- Iterator<Map.Entry<String, JsonNode>> fields = rootArray.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- processJsonNode(context, blockKeys, entry.getKey(), entry.getValue());
- }
- }
- sortedMap = new TreeMap<>(context);
- return sortedMap;
- }
-
- private static void processJsonNode(Map<String, String> propertyMap, List<String> blockKeys, String nodeName,
- JsonNode node) throws IOException {
-
- logger.trace("Block Key ({})", nodeName);
- if (node == null) {
- return;
- }
-
- String keyName = null;
- if (blockKeys != null && blockKeys.contains(nodeName)) {
- if (node.isArray() || node.isObject()) {
- propertyMap.put(nodeName, node.toString());
- } else {
- propertyMap.put(nodeName, node.asText());
- }
- } else if (node.isArray()) {
- for (int i = 0; i < node.size(); i++) {
- keyName = nodeName + "[" + i + "]";
- processJsonNode(propertyMap, blockKeys, keyName, node.get(i));
- }
- } else if (node.isObject()) {
- Iterator<Map.Entry<String, JsonNode>> fields = node.fields();
- while (fields.hasNext()) {
- Map.Entry<String, JsonNode> entry = fields.next();
- keyName = nodeName + "." + entry.getKey();
- processJsonNode(propertyMap, blockKeys, keyName, entry.getValue());
- }
- } else {
- propertyMap.put(nodeName, node.asText());
- }
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/DataTypeValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/DataTypeValidator.java deleted file mode 100644 index 32d546eed..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/DataTypeValidator.java +++ /dev/null @@ -1,109 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.DataType;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-
-/**
- * DataTypeValidator.java Purpose: Provide Configuration Generator DataTypeValidator
- *
- * @version 1.0
- */
-public class DataTypeValidator {
-
- private StringBuilder message;
- private Map<String, DataType> stDataTypes;
- private ServiceTemplate serviceTemplate;
- private PropertyDefinitionValidator propertyDefinitionValidator;
-
- /**
- * This is a DataTypeValidator
- *
- * @param serviceTemplate
- * @throws ConfigModelException
- */
- public DataTypeValidator(ServiceTemplate serviceTemplate, StringBuilder message) throws ConfigModelException {
- this.serviceTemplate = serviceTemplate;
- this.message = message;
- propertyDefinitionValidator = new PropertyDefinitionValidator(this.message);
- stDataTypes = new HashMap<>();
- loadInitial();
-
- }
-
- private void loadInitial() {
- if (serviceTemplate != null && serviceTemplate.getDataTypes() != null) {
- message.append("\n DataTypes" + serviceTemplate.getDataTypes());
- serviceTemplate.getDataTypes().forEach((dataTypeKey, dataType) -> {
- stDataTypes.put(dataTypeKey, dataType);
- message.append("\n Data Type (" + dataTypeKey + ") loaded successfully.");
- });
- }
- }
-
- /**
- * This is a validateDataTypes
- *
- * @return boolean
- * @throws ConfigModelException
- */
- @SuppressWarnings("squid:S00112")
- public boolean validateDataTypes() {
- if (serviceTemplate != null && serviceTemplate.getDataTypes() != null) {
-
- serviceTemplate.getDataTypes().forEach((dataTypeKey, dataType) -> {
- if (dataType != null) {
- try {
- String derivedFrom = dataType.getDerivedFrom();
- checkValidDerivedType(dataTypeKey, derivedFrom);
- checkValidProperties(dataTypeKey, dataType.getProperties());
- } catch (ConfigModelException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- });
- }
- return true;
- }
-
- private boolean checkValidDerivedType(String dataTypeName, String derivedFrom) throws ConfigModelException {
-
- if (StringUtils.isBlank(derivedFrom) || !ValidTypes.getValidDataTypeDerivedFrom().contains(derivedFrom)) {
- throw new ConfigModelException(derivedFrom + " is not a valid derived type for Data type " + dataTypeName);
- }
- return true;
- }
-
- private boolean checkValidProperties(String dataTypeName, Map<String, PropertyDefinition> properties) {
- if (properties != null) {
- message.append("\n validation Data Type (" + dataTypeName + ") Property.");
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, properties);
- }
- return true;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/NodeTypeValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/NodeTypeValidator.java deleted file mode 100644 index 4cb9ae14d..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/NodeTypeValidator.java +++ /dev/null @@ -1,237 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.CapabilityDefinition;
-import org.onap.ccsdk.features.model.data.DataType;
-import org.onap.ccsdk.features.model.data.InterfaceDefinition;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.OperationDefinition;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.RequirementDefinition;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-/**
- * NodeTypeValidator.java Purpose: Provide Configuration Generator NodeTypeValidator
- *
- * @version 1.0
- */
-public class NodeTypeValidator {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(NodeTypeValidator.class);
- private StringBuilder message;
- private Map<String, DataType> stDataTypes;
- private Map<String, NodeType> stNodeTypes;
- private ServiceTemplate serviceTemplate;
- private PropertyDefinitionValidator propertyDefinitionValidator;
-
- /**
- * This is a NodeTypeValidator
- *
- * @param serviceTemplate
- * @throws ConfigModelException
- */
- public NodeTypeValidator(ServiceTemplate serviceTemplate, StringBuilder message) throws ConfigModelException {
- this.serviceTemplate = serviceTemplate;
- this.message = message;
- propertyDefinitionValidator = new PropertyDefinitionValidator(this.message);
- stDataTypes = new HashMap<>();
- stNodeTypes = new HashMap<>();
- loadInitial();
-
- }
-
- private void loadInitial() {
- if (serviceTemplate != null) {
-
- if (serviceTemplate.getDataTypes() != null) {
- serviceTemplate.getDataTypes().forEach((dataTypeKey, dataType) -> {
- stDataTypes.put(dataTypeKey, dataType);
- logger.trace("Data Type ({}) loaded successfully.", dataTypeKey);
- });
- }
-
- if (serviceTemplate.getNodeTypes() != null) {
- serviceTemplate.getNodeTypes().forEach((nodeTypeKey, nodeType) -> {
- stNodeTypes.put(nodeTypeKey, nodeType);
- logger.trace("NodeType Type ({}) loaded successfully.", nodeTypeKey);
- });
- }
-
- }
-
- }
-
- /**
- * This is a validateNodeTypes to validate the Node Type
- *
- * @return boolean
- * @throws ConfigModelException
- */
- @SuppressWarnings({"squid:S00112", "squid:S3776"})
- public boolean validateNodeTypes() {
- if (serviceTemplate != null && serviceTemplate.getNodeTypes() != null) {
- serviceTemplate.getNodeTypes().forEach((nodeTypeKey, nodeType) -> {
- if (nodeType != null) {
- message.append("\n ***** Validation Node Type (" + nodeTypeKey + "), derived from ("
- + nodeType.getDerivedFrom() + ")");
- try {
- validateNodeType(ConfigModelConstant.MODEL_DEFINITION_TYPE_NODE_TYPE,
- nodeType.getDerivedFrom());
-
- if (nodeType.getProperties() != null) {
- checkValidProperties(nodeType.getProperties());
- }
-
- if (nodeType.getCapabilities() != null) {
- validateNodeTypeCapabilities(nodeType.getCapabilities());
- }
-
- if (nodeType.getInterfaces() != null) {
- validateNodeTypeInterface(nodeType.getInterfaces());
- }
-
- if (nodeType.getRequirements() != null) {
- validateNodeTypeRequirement(nodeType.getRequirements());
- }
-
- } catch (ConfigModelException e) {
- logger.error(e.getMessage());
- throw new RuntimeException(e.getMessage());
- }
-
- }
- });
- }
- return true;
- }
-
- private boolean validateNodeType(String definitionType, String derivedFrom) throws ConfigModelException {
- boolean valid = true;
- if (!ConfigModelConstant.MODEL_DEFINITION_TYPE_DATA_TYPE.equalsIgnoreCase(definitionType)
- && !ValidTypes.getValidNodeTypes().contains(derivedFrom)) {
- throw new ConfigModelException("Not Valid Model Type (" + derivedFrom + ")");
- }
- return valid;
- }
-
- private boolean checkValidProperties(Map<String, PropertyDefinition> properties) {
- if (properties != null) {
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, properties);
- }
- return true;
- }
-
- @SuppressWarnings("squid:S00112")
- private boolean validateNodeTypeCapabilities(Map<String, CapabilityDefinition> capabilities) {
- if (capabilities != null) {
- capabilities.forEach((capabilityKey, capability) -> {
- if (capability != null) {
- Map<String, PropertyDefinition> properties = capability.getProperties();
- message.append("\n Validation Capability (" + capabilityKey + ") properties :");
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, properties);
- }
- });
- }
- return true;
- }
-
- @SuppressWarnings("squid:S00112")
- private boolean validateNodeTypeInterface(Map<String, InterfaceDefinition> interfaces) {
- if (interfaces != null) {
- interfaces.forEach((interfaceKey, interfaceDefinition) -> {
- if (interfaceDefinition != null && interfaceDefinition.getOperations() != null) {
- validateNodeTypeInterfaceOperation(interfaceDefinition.getOperations());
- }
- });
- }
- return true;
- }
-
- @SuppressWarnings("squid:S00112")
- private boolean validateNodeTypeInterfaceOperation(Map<String, OperationDefinition> operations) {
- if (operations != null) {
- operations.forEach((operationKey, operation) -> {
- if (operation != null) {
- Map<String, PropertyDefinition> inputs = operation.getInputs();
- message.append("\n Validation Operation (" + operationKey + ") Inputs :");
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, inputs);
- message.append("\n Validation Operation (" + operationKey + ") output :");
- Map<String, PropertyDefinition> outputs = operation.getOutputs();
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, outputs);
- }
- });
- }
- return true;
- }
-
- @SuppressWarnings("squid:S00112")
- private boolean validateNodeTypeRequirement(Map<String, RequirementDefinition> requirements) {
- if (requirements != null) {
- requirements.forEach((requirementKey, requirement) -> {
- if (requirement != null) {
- String nodeTypeName = requirement.getNode();
- String capabilityName = requirement.getCapability();
- try {
- checkCapabilityPresentInNodeType(nodeTypeName, capabilityName);
- } catch (ConfigModelException e) {
- throw new RuntimeException(e);
- }
- }
- });
- }
- return true;
- }
-
- private boolean checkCapabilityPresentInNodeType(String nodeTypeName, String capabilityName)
- throws ConfigModelException {
- if (StringUtils.isNotBlank(nodeTypeName) && StringUtils.isNotBlank(capabilityName)) {
-
- if (!stNodeTypes.containsKey(nodeTypeName)) {
- throw new ConfigModelException(nodeTypeName + " Node Type not Defined.");
- } else {
- message.append("\n Node Type (" + nodeTypeName + ") Defined.");
- }
-
- NodeType relationalNodeType = stNodeTypes.get(nodeTypeName);
-
- if (relationalNodeType.getCapabilities() == null) {
- throw new ConfigModelException(
- "Node Type (" + nodeTypeName + "), doesn't have Capability Definitions.");
- }
-
- if (!relationalNodeType.getCapabilities().containsKey(capabilityName)) {
- throw new ConfigModelException("Node Type (" + nodeTypeName + ") doesn't have (" + capabilityName
- + ") Capability Definitions.");
- } else {
- message.append(
- "\n Node Type (" + nodeTypeName + ") has (" + capabilityName + ") Capability Definitions.");
- }
-
- }
- return true;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/PropertyDefinitionValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/PropertyDefinitionValidator.java deleted file mode 100644 index 080fee2b6..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/PropertyDefinitionValidator.java +++ /dev/null @@ -1,89 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.ValidTypes;
-import org.onap.ccsdk.features.model.data.DataType;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-
-/**
- * PropertyDefinitionValidator.java Purpose: Provide Configuration Generator
- * PropertyDefinitionValidator
- *
- * @version 1.0
- */
-public class PropertyDefinitionValidator {
-
- StringBuilder message = new StringBuilder();
-
- public PropertyDefinitionValidator(StringBuilder message) {
- this.message = message;
-
- }
-
- /**
- * This is a validatePropertyDefinition stored in database
- *
- * @param stDataTypes
- * @param properties
- * @return boolean
- * @throws ConfigModelException
- */
- @SuppressWarnings({"squid:S00112", "squid:S3776", "squid:S1192"})
- public boolean validatePropertyDefinition(Map<String, DataType> stDataTypes,
- Map<String, PropertyDefinition> properties) {
-
- if (stDataTypes != null && properties != null) {
- properties.forEach((propertyKey, prop) -> {
- if (propertyKey != null && prop != null) {
- try {
- String propertType = prop.getType();
- message.append("\n Validating (" + propertyKey + ") " + prop);
-
- if (!ValidTypes.getValidPropertType().contains(propertType)
- && !stDataTypes.containsKey(propertType)) {
- throw new ConfigModelException("Data Type (" + propertyKey + ") -> type(" + propertType
- + ") is not a valid type.");
- } else if (ValidTypes.getListPropertType().contains(propertType)) {
- if (prop.getEntrySchema() == null || StringUtils.isBlank(prop.getEntrySchema().getType())) {
- throw new ConfigModelException("Data Type (" + propertyKey + ") -> type (" + propertType
- + ") Entity Schema is not defined.");
- }
-
- String entitySchemaType = prop.getEntrySchema().getType();
-
- if (!ValidTypes.getValidPropertType().contains(entitySchemaType)
- && !stDataTypes.containsKey(entitySchemaType)) {
- message.append("\n Present Data Type " + stDataTypes);
- throw new ConfigModelException("Data Type (" + propertyKey + ") -> type(" + propertType
- + ") -> entitySchema(" + entitySchemaType + ") is not defined.");
- }
- }
- } catch (ConfigModelException e) {
- throw new RuntimeException(e);
- }
- }
- });
- }
- return true;
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ResourceAssignmentValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ResourceAssignmentValidator.java deleted file mode 100644 index 8f2efd110..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ResourceAssignmentValidator.java +++ /dev/null @@ -1,163 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.CapabilityAssignment;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.ResourceAssignment;
-import org.onap.ccsdk.features.model.utils.TopologicalSortingUtils;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ResourceAssignmentValidator {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceAssignmentValidator.class);
- private List<ResourceAssignment> assignments;
- private Map<String, ResourceAssignment> resourceAssignmentMap = new HashMap<>();
- private StringBuilder validationMessage = new StringBuilder();
-
- public ResourceAssignmentValidator(NodeTemplate nodeTemplate) throws ConfigModelException {
-
- if (nodeTemplate != null && nodeTemplate.getCapabilities() != null) {
- CapabilityAssignment capabilityAssignment =
- nodeTemplate.getCapabilities().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
- if (capabilityAssignment != null && capabilityAssignment.getProperties() != null) {
- Object mappingObject =
- capabilityAssignment.getProperties().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
- if (mappingObject != null) {
- String mappingContent = TransformationUtils.getJson(mappingObject);
- if (StringUtils.isNotBlank(mappingContent)) {
- this.assignments =
- TransformationUtils.getListfromJson(mappingContent, ResourceAssignment.class);
- } else {
- validationMessage
- .append(String.format("Failed to transform Mapping Content (%s) ", mappingContent));
- throw new ConfigModelException(
- String.format("Failed to transform Mapping Content (%s) ", mappingContent));
- }
- }
- }
- }
- }
-
- public ResourceAssignmentValidator(List<ResourceAssignment> assignments) {
- this.assignments = assignments;
- }
-
- /**
- * This is a validateResourceAssignment to validate the Topology Template
- *
- * @return boolean
- * @throws ConfigModelException
- */
- public boolean validateResourceAssignment() throws ConfigModelException {
- if (assignments != null && !assignments.isEmpty()) {
- validateDuplicateDictionaryKeys();
- validateCyclicDependencty();
- if (validationMessage.length() > 0) {
- logger.error("Resourece Assignment Validation : {}", validationMessage);
- throw new ConfigModelException("Resourece Assignment Validation :" + validationMessage.toString());
- }
- }
- return true;
- }
-
- @SuppressWarnings("squid:S3776")
- private void validateDuplicateDictionaryKeys() {
- this.assignments.forEach(resourceMapping -> {
- if (resourceMapping != null) {
- if (!resourceAssignmentMap.containsKey(resourceMapping.getName())) {
- resourceAssignmentMap.put(resourceMapping.getName(), resourceMapping);
- } else {
- validationMessage.append(String.format("Duplicate Assignment Template Key (%s) is Present",
- resourceMapping.getName()));
- }
- }
- });
-
- if (!assignments.isEmpty()) {
- Set<String> uniqueSet = new HashSet<>();
- for (ResourceAssignment resourceAssignment : assignments) {
- if (resourceAssignment != null) {
- boolean added = uniqueSet.add(resourceAssignment.getDictionaryName());
- if (!added) {
- validationMessage.append(
- String.format("Duplicate Assignment Dictionary Key (%s) present with Template Key (%s)",
- resourceAssignment.getDictionaryName(), resourceAssignment.getName()));
- }
- }
- }
- }
- }
-
- private void validateCyclicDependencty() {
- TopologicalSortingUtils<ResourceAssignment> topologySorting = new TopologicalSortingUtils<>();
- this.resourceAssignmentMap.forEach((mappingKey, mapping) -> {
- if (mapping != null) {
- if (mapping.getDependencies() != null && !mapping.getDependencies().isEmpty()) {
- for (String dependency : mapping.getDependencies()) {
- topologySorting.add(resourceAssignmentMap.get(dependency), mapping);
- }
- } else {
- topologySorting.add(null, mapping);
- }
- }
- });
-
- if (!topologySorting.isDag()) {
- String graph = getTopologicalGraph(topologySorting);
- validationMessage.append("Cyclic Dependency :" + graph);
- }
- }
-
- public String getTopologicalGraph(TopologicalSortingUtils<ResourceAssignment> topologySorting) {
- StringBuilder s = new StringBuilder();
- if (topologySorting != null) {
- Map<ResourceAssignment, List<ResourceAssignment>> neighbors = topologySorting.getNeighbors();
-
- neighbors.forEach((v, vs) -> {
- if (v == null) {
- s.append("\n * -> [");
- List<ResourceAssignment> links = vs;
- for (ResourceAssignment resourceAssignment : links) {
- s.append("(" + resourceAssignment.getDictionaryName() + ":" + resourceAssignment.getName()
- + "),");
- }
- s.append("]");
- } else {
- s.append("\n (" + v.getDictionaryName() + ":" + v.getName() + ") -> [");
- List<ResourceAssignment> links = vs;
- for (ResourceAssignment resourceAssignment : links) {
- s.append("(" + resourceAssignment.getDictionaryName() + ":" + resourceAssignment.getName()
- + "),");
- }
- s.append("]");
- }
- });
- }
- return s.toString();
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidator.java deleted file mode 100644 index f503427c8..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/ServiceTemplateValidator.java +++ /dev/null @@ -1,129 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.utils.TransformationUtils;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-/**
- * ServiceTemplateValidator.java Purpose: Provide Configuration Generator ServiceTemplateValidator
- *
- * @version 1.0
- */
-
-public class ServiceTemplateValidator {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ServiceTemplateValidator.class);
-
- private Map<String, String> metaData = new HashMap<>();
-
- StringBuilder message = new StringBuilder();
-
- /**
- * This is a validateServiceTemplate
- *
- * @param serviceTemplateContent
- * @return boolean
- * @throws ConfigModelException
- */
- @SuppressWarnings("squid:S00112")
- public boolean validateServiceTemplate(String serviceTemplateContent) throws ConfigModelException {
- if (StringUtils.isNotBlank(serviceTemplateContent)) {
- ServiceTemplate serviceTemplate =
- TransformationUtils.readValue(serviceTemplateContent, ServiceTemplate.class);
- return validateServiceTemplate(serviceTemplate);
- } else {
- throw new ConfigModelException(
- "Service Template Content is (" + serviceTemplateContent + ") not Defined.");
- }
- }
-
- /**
- * This is a validateServiceTemplate
- *
- * @param serviceTemplate
- * @return boolean
- * @throws ConfigModelException
- */
- @SuppressWarnings("squid:S00112")
- public boolean validateServiceTemplate(ServiceTemplate serviceTemplate) throws ConfigModelException {
- if (serviceTemplate != null) {
- try {
- validateMetaData(serviceTemplate);
- (new DataTypeValidator(serviceTemplate, message)).validateDataTypes();
- (new NodeTypeValidator(serviceTemplate, message)).validateNodeTypes();
- (new TopologyTemplateValidator(serviceTemplate, message)).validateTopologyTemplate();
- logger.debug("Validation Message : {}", message);
- } catch (Exception e) {
- throw new ConfigModelException(
- "Validation Failed " + e.toString() + ",Message Trace : \n" + message.toString());
- }
-
- } else {
- throw new ConfigModelException("Service Template is not defined.");
- }
- return true;
- }
-
- /**
- * This is a getMetaData to get the key information during the
- *
- * @return Map<String , String>
- */
- public Map<String, String> getMetaData() {
- return metaData;
- }
-
- private void validateMetaData(ServiceTemplate serviceTemplate) throws ConfigModelException {
- if (serviceTemplate.getMetadata() != null) {
- this.metaData.putAll(serviceTemplate.getMetadata());
-
- String author = serviceTemplate.getMetadata().get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_AUTHOR);
- String serviceTemplateName =
- serviceTemplate.getMetadata().get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_NAME);
- String serviceTemplateVersion =
- serviceTemplate.getMetadata().get(ConfigModelConstant.SERVICE_TEMPLATE_KEY_ARTIFACT_VERSION);
-
- if (StringUtils.isBlank(author)) {
- throw new ConfigModelException("Service Template Metadata (author) Information is missing.");
- }
-
- if (StringUtils.isBlank(serviceTemplateName)) {
- throw new ConfigModelException(
- "Service Template Metadata (service-template-name) Information is missing.");
- }
-
- if (StringUtils.isBlank(serviceTemplateVersion)) {
- throw new ConfigModelException(
- "Service Template Metadata (service-template-version) Information is missing.");
- }
-
- } else {
- throw new ConfigModelException("Service Template Metadata Information is missing.");
- }
-
- }
-
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/TopologyTemplateValidator.java b/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/TopologyTemplateValidator.java deleted file mode 100644 index c735a54cd..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/java/org/onap/ccsdk/features/model/validator/TopologyTemplateValidator.java +++ /dev/null @@ -1,203 +0,0 @@ -/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.model.validator;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.model.ConfigModelConstant;
-import org.onap.ccsdk.features.model.ConfigModelException;
-import org.onap.ccsdk.features.model.data.DataType;
-import org.onap.ccsdk.features.model.data.NodeTemplate;
-import org.onap.ccsdk.features.model.data.NodeType;
-import org.onap.ccsdk.features.model.data.PropertyDefinition;
-import org.onap.ccsdk.features.model.data.RequirementAssignment;
-import org.onap.ccsdk.features.model.data.ServiceTemplate;
-import org.onap.ccsdk.features.model.data.TopologyTemplate;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-/**
- * TopologyTemplateValidator.java Purpose: Provide Configuration Generator TopologyTemplateValidator
- *
- * @version 1.0
- */
-public class TopologyTemplateValidator {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(TopologyTemplateValidator.class);
- private StringBuilder message;
- private Map<String, DataType> stDataTypes;
- private Map<String, NodeType> stNodeTypes;
- private Map<String, NodeTemplate> stNodeTemplates;
- private ServiceTemplate serviceTemplate;
- private PropertyDefinitionValidator propertyDefinitionValidator;
-
- /**
- * This is a TopologyTemplateValidator
- *
- * @param serviceTemplate
- * @throws ConfigModelException
- */
- public TopologyTemplateValidator(ServiceTemplate serviceTemplate, StringBuilder message) {
- this.serviceTemplate = serviceTemplate;
- this.message = message;
- propertyDefinitionValidator = new PropertyDefinitionValidator(this.message);
- stDataTypes = new HashMap<>();
- stNodeTypes = new HashMap<>();
- stNodeTemplates = new HashMap<>();
- loadInitial();
- }
-
- private void loadInitial() {
- if (serviceTemplate != null) {
-
- if (serviceTemplate.getDataTypes() != null) {
- serviceTemplate.getDataTypes().forEach((dataTypeKey, dataType) -> {
- stDataTypes.put(dataTypeKey, dataType);
- logger.trace("Data Type ({}) loaded successfully.", dataTypeKey);
- });
- }
-
- if (serviceTemplate.getNodeTypes() != null) {
- serviceTemplate.getNodeTypes().forEach((nodeTypeKey, nodeType) -> {
- stNodeTypes.put(nodeTypeKey, nodeType);
- logger.trace("Node Type ({}) loaded successfully.", nodeTypeKey);
- });
- }
-
- if (serviceTemplate.getTopologyTemplate() != null) {
- TopologyTemplate topologyTemplate = serviceTemplate.getTopologyTemplate();
-
- if (topologyTemplate.getNodeTemplates() != null) {
- topologyTemplate.getNodeTemplates().forEach((nodeTemplateKey, nodeTemplate) -> {
- stNodeTemplates.put(nodeTemplateKey, nodeTemplate);
- logger.trace("Node Template ({}) Type loaded successfully.", nodeTemplateKey);
- });
- }
- }
- }
-
- }
-
- /**
- * This is a validateTopologyTemplate to validate the Topology Template
- *
- * @return boolean
- * @throws ConfigModelException
- */
- public boolean validateTopologyTemplate() {
- if (serviceTemplate != null && serviceTemplate.getTopologyTemplate() != null) {
-
- checkValidInputProperties(serviceTemplate.getTopologyTemplate().getInputs());
-
- validateNodeTemplates(serviceTemplate.getTopologyTemplate().getNodeTemplates());
- }
- return true;
- }
-
- private boolean checkValidInputProperties(Map<String, PropertyDefinition> properties) {
- if (properties != null) {
- message.append("\n Validation topology template input properties :");
- propertyDefinitionValidator.validatePropertyDefinition(stDataTypes, properties);
- }
- return true;
- }
-
- @SuppressWarnings({"squid:S00112", "squid:S3776"})
- private boolean validateNodeTemplates(Map<String, NodeTemplate> nodeTemplates) {
- if (nodeTemplates != null) {
- nodeTemplates.forEach((nodeTemplateKey, nodeTemplate) -> {
- if (nodeTemplate != null) {
- message.append("\n ##### Validation Node Template (" + nodeTemplateKey + "), of type ("
- + nodeTemplate.getType() + ")");
-
- String nodeTypeName = nodeTemplate.getType();
- if (!stNodeTypes.containsKey(nodeTypeName)) {
- throw new RuntimeException("Node Type (" + nodeTypeName + ")not Defined.");
- }
-
- if (nodeTemplate.getRequirements() != null) {
- validateNodeTemplateRequirement(nodeTemplate.getRequirements());
- }
-
- // Validate Resource Assignments
- NodeType nodeType = stNodeTypes.get(nodeTypeName);
- if (nodeType != null
- && ConfigModelConstant.MODEL_TYPE_NODE_ARTIFACT.equals(nodeType.getDerivedFrom())) {
- logger.info("Validating Resource Assignment NodeTemplate ({}).", nodeTemplateKey);
- ResourceAssignmentValidator resourceAssignmentValidator;
- try {
- resourceAssignmentValidator = new ResourceAssignmentValidator(nodeTemplate);
- resourceAssignmentValidator.validateResourceAssignment();
- } catch (ConfigModelException e) {
- throw new RuntimeException(e);
- }
-
- }
- }
- });
- }
- return true;
- }
-
- @SuppressWarnings("squid:S00112")
- private boolean validateNodeTemplateRequirement(Map<String, RequirementAssignment> requirements) {
- if (requirements != null) {
- requirements.forEach((requirementKey, requirement) -> {
- if (requirement != null) {
- String requirementnodeTypeName = requirement.getNode();
- String capabilityName = requirement.getCapability();
- try {
- checkCapabilityPresentInNodeTemplate(requirementnodeTypeName, capabilityName);
- } catch (ConfigModelException e) {
- throw new RuntimeException(e);
- }
- }
- });
- }
- return true;
- }
-
- private boolean checkCapabilityPresentInNodeTemplate(String nodeTemplateName, String capabilityName)
- throws ConfigModelException {
- if (StringUtils.isNotBlank(nodeTemplateName) && StringUtils.isNotBlank(capabilityName)) {
-
- if (!stNodeTemplates.containsKey(nodeTemplateName)) {
- throw new ConfigModelException(nodeTemplateName + " Node Template not Defined.");
- } else {
- message.append("\n Node Template (" + nodeTemplateName + ") Defined.");
- }
-
- NodeTemplate relationalNodeType = stNodeTemplates.get(nodeTemplateName);
-
- if (relationalNodeType.getCapabilities() == null) {
- throw new ConfigModelException(
- "Node Template (" + nodeTemplateName + "), doesn't have Capability Definitions.");
- }
-
- if (!relationalNodeType.getCapabilities().containsKey(capabilityName)) {
- throw new ConfigModelException("Node Type (" + nodeTemplateName + ") doesn't have (" + capabilityName
- + ") Capability Definitions.");
- } else {
- message.append("\n Node Template (" + nodeTemplateName + ") has (" + capabilityName
- + ") Capability Definitions.");
- }
-
- }
- return true;
- }
-}
diff --git a/blueprints-processor/plugin/model-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/blueprints-processor/plugin/model-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml deleted file mode 100644 index 5a07f94c6..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <!-- Dependency -->
-
- <reference id="configResourceService"
- interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />
-
- <reference id="configRestAdaptorService"
- interface="org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService" />
-
- <!-- Expose the Common Component Bean -->
- <bean id="configModelNode"
- class="org.onap.ccsdk.features.model.service.ConfigModelNode">
- </bean>
-
- <service ref="configModelNode"
- interface="org.onap.ccsdk.features.model.service.ConfigModelNode" />
-
- <bean id="configModelService"
- class="org.onap.ccsdk.features.model.service.ConfigModelServiceImpl">
- <argument ref="configRestAdaptorService" />
- </bean>
-
- <service ref="configModelService"
- interface="org.onap.ccsdk.features.model.service.ConfigModelService" />
-
-
- <!-- ComponentNode -->
-
- <bean id="componentNodeService"
- class="org.onap.ccsdk.features.model.service.ComponentNodeServiceImpl">
- <argument ref="blueprintBundleContext" />
- <argument ref="configResourceService" />
- <argument ref="configRestAdaptorService" />
- </bean>
-
- <service ref="componentNodeService"
- interface="org.onap.ccsdk.features.model.service.ComponentNodeService" />
-
- <bean id="componentNodeDelegate"
- class="org.onap.ccsdk.features.model.service.ComponentNodeDelegate">
- <argument ref="componentNodeService" />
- </bean>
-
- <service ref="componentNodeDelegate"
- interface="org.onap.ccsdk.features.model.service.ComponentNodeDelegate" />
-
-</blueprint>
diff --git a/blueprints-processor/plugin/model-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/blueprints-processor/plugin/model-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml deleted file mode 100644 index 5a07f94c6..000000000 --- a/blueprints-processor/plugin/model-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <!-- Dependency -->
-
- <reference id="configResourceService"
- interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />
-
- <reference id="configRestAdaptorService"
- interface="org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService" />
-
- <!-- Expose the Common Component Bean -->
- <bean id="configModelNode"
- class="org.onap.ccsdk.features.model.service.ConfigModelNode">
- </bean>
-
- <service ref="configModelNode"
- interface="org.onap.ccsdk.features.model.service.ConfigModelNode" />
-
- <bean id="configModelService"
- class="org.onap.ccsdk.features.model.service.ConfigModelServiceImpl">
- <argument ref="configRestAdaptorService" />
- </bean>
-
- <service ref="configModelService"
- interface="org.onap.ccsdk.features.model.service.ConfigModelService" />
-
-
- <!-- ComponentNode -->
-
- <bean id="componentNodeService"
- class="org.onap.ccsdk.features.model.service.ComponentNodeServiceImpl">
- <argument ref="blueprintBundleContext" />
- <argument ref="configResourceService" />
- <argument ref="configRestAdaptorService" />
- </bean>
-
- <service ref="componentNodeService"
- interface="org.onap.ccsdk.features.model.service.ComponentNodeService" />
-
- <bean id="componentNodeDelegate"
- class="org.onap.ccsdk.features.model.service.ComponentNodeDelegate">
- <argument ref="componentNodeService" />
- </bean>
-
- <service ref="componentNodeDelegate"
- interface="org.onap.ccsdk.features.model.service.ComponentNodeDelegate" />
-
-</blueprint>
|