diff options
Diffstat (limited to 'catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data')
74 files changed, 3437 insertions, 4310 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AdditionalInfoParameterData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AdditionalInfoParameterData.java index 41bdad9e5b..6b32cde98e 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AdditionalInfoParameterData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AdditionalInfoParameterData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,138 +17,117 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.Map; - public class AdditionalInfoParameterData extends GraphNode { - AdditionalInfoParameterDataDefinition additionalInfoParameterDataDefinition; - - private Map<String, String> parameters; - - private Map<String, String> idToKey; - - public AdditionalInfoParameterData() { - super(NodeTypeEnum.AdditionalInfoParameters); - additionalInfoParameterDataDefinition = new AdditionalInfoParameterDataDefinition(); - } - - public AdditionalInfoParameterData(AdditionalInfoParameterDataDefinition additionalInfoParameterDataDefinition, - Map<String, String> parameters, Map<String, String> idToKey) { - super(NodeTypeEnum.AdditionalInfoParameters); - this.additionalInfoParameterDataDefinition = additionalInfoParameterDataDefinition; - this.parameters = parameters; - this.idToKey = idToKey; - } - - public AdditionalInfoParameterData(Map<String, Object> properties) { - - this(); - - additionalInfoParameterDataDefinition - .setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - additionalInfoParameterDataDefinition - .setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - additionalInfoParameterDataDefinition - .setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - additionalInfoParameterDataDefinition.setLastCreatedCounter( - (Integer) properties.get(GraphPropertiesDictionary.PROPERTY_COUNTER.getProperty())); - Type mapType = new TypeToken<HashMap<String, String>>() { - }.getType(); - HashMap<String, String> prametersfromJson = getGson().fromJson( - (String) properties.get(GraphPropertiesDictionary.ADDITIONAL_INFO_PARAMS.getProperty()), mapType); - - this.setParameters(prametersfromJson); - - // this.setParameters((HashMap<String, String>) properties - // .get(GraphPropertiesDictionary.ADDITIONAL_INFO_PARAMS - // .getProperty())); - - HashMap<String, String> idToKeyfromJson = getGson().fromJson( - (String) properties.get(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY.getProperty()), mapType); - - this.setIdToKey(idToKeyfromJson); - // this.setIdToKey((HashMap<String, String>) properties - // .get(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY - // .getProperty())); - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, additionalInfoParameterDataDefinition.getUniqueId()); - - // String parametersToJson = getGson().toJson(getParameters()); - - // addIfExists(map, GraphPropertiesDictionary.ADDITIONAL_INFO_PARAMS, - // parametersToJson); - addIfExists(map, GraphPropertiesDictionary.ADDITIONAL_INFO_PARAMS, getParameters()); - - // String idToKeyToJson = getGson().toJson(getIdToKey()); - // addIfExists(map, GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY, - // idToKeyToJson); - addIfExists(map, GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY, getIdToKey()); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, - additionalInfoParameterDataDefinition.getCreationTime()); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, - additionalInfoParameterDataDefinition.getModificationTime()); - - addIfExists(map, GraphPropertiesDictionary.PROPERTY_COUNTER, - additionalInfoParameterDataDefinition.getLastCreatedCounter()); - - return map; - } - - @Override - public String getUniqueId() { - return additionalInfoParameterDataDefinition.getUniqueId(); - } - - public AdditionalInfoParameterDataDefinition getAdditionalInfoParameterDataDefinition() { - return additionalInfoParameterDataDefinition; - } - - public void setAdditionalInfoParameterDataDefinition( - AdditionalInfoParameterDataDefinition additionalInfoParameterDataDefinition) { - this.additionalInfoParameterDataDefinition = additionalInfoParameterDataDefinition; - } - - public Map<String, String> getParameters() { - return parameters; - } - - public void setParameters(Map<String, String> parameters) { - this.parameters = parameters; - } - - public Map<String, String> getIdToKey() { - return idToKey; - } - - public void setIdToKey(Map<String, String> idToKey) { - this.idToKey = idToKey; - } - - @Override - public String toString() { - return "PropertyData [parameters= " + parameters + " idToKey= " + idToKey - + ", additionalInfoParameterDataDefinition=" + additionalInfoParameterDataDefinition + "]"; - } + AdditionalInfoParameterDataDefinition additionalInfoParameterDataDefinition; + private Map<String, String> parameters; + private Map<String, String> idToKey; + + public AdditionalInfoParameterData() { + super(NodeTypeEnum.AdditionalInfoParameters); + additionalInfoParameterDataDefinition = new AdditionalInfoParameterDataDefinition(); + } + + public AdditionalInfoParameterData(AdditionalInfoParameterDataDefinition additionalInfoParameterDataDefinition, Map<String, String> parameters, + Map<String, String> idToKey) { + super(NodeTypeEnum.AdditionalInfoParameters); + this.additionalInfoParameterDataDefinition = additionalInfoParameterDataDefinition; + this.parameters = parameters; + this.idToKey = idToKey; + } + + public AdditionalInfoParameterData(Map<String, Object> properties) { + this(); + additionalInfoParameterDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + additionalInfoParameterDataDefinition.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + additionalInfoParameterDataDefinition.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + additionalInfoParameterDataDefinition + .setLastCreatedCounter((Integer) properties.get(GraphPropertiesDictionary.PROPERTY_COUNTER.getProperty())); + Type mapType = new TypeToken<HashMap<String, String>>() { + }.getType(); + HashMap<String, String> prametersfromJson = getGson() + .fromJson((String) properties.get(GraphPropertiesDictionary.ADDITIONAL_INFO_PARAMS.getProperty()), mapType); + this.setParameters(prametersfromJson); + // this.setParameters((HashMap<String, String>) properties + + // .get(GraphPropertiesDictionary.ADDITIONAL_INFO_PARAMS + + // .getProperty())); + HashMap<String, String> idToKeyfromJson = getGson() + .fromJson((String) properties.get(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY.getProperty()), mapType); + this.setIdToKey(idToKeyfromJson); + // this.setIdToKey((HashMap<String, String>) properties + + // .get(GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY + + // .getProperty())); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, additionalInfoParameterDataDefinition.getUniqueId()); + // String parametersToJson = getGson().toJson(getParameters()); + + // addIfExists(map, GraphPropertiesDictionary.ADDITIONAL_INFO_PARAMS, + + // parametersToJson); + addIfExists(map, GraphPropertiesDictionary.ADDITIONAL_INFO_PARAMS, getParameters()); + // String idToKeyToJson = getGson().toJson(getIdToKey()); + + // addIfExists(map, GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY, + + // idToKeyToJson); + addIfExists(map, GraphPropertiesDictionary.ADDITIONAL_INFO_ID_TO_KEY, getIdToKey()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, additionalInfoParameterDataDefinition.getCreationTime()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, additionalInfoParameterDataDefinition.getModificationTime()); + addIfExists(map, GraphPropertiesDictionary.PROPERTY_COUNTER, additionalInfoParameterDataDefinition.getLastCreatedCounter()); + return map; + } + + @Override + public String getUniqueId() { + return additionalInfoParameterDataDefinition.getUniqueId(); + } + + public AdditionalInfoParameterDataDefinition getAdditionalInfoParameterDataDefinition() { + return additionalInfoParameterDataDefinition; + } + + public void setAdditionalInfoParameterDataDefinition(AdditionalInfoParameterDataDefinition additionalInfoParameterDataDefinition) { + this.additionalInfoParameterDataDefinition = additionalInfoParameterDataDefinition; + } + + public Map<String, String> getParameters() { + return parameters; + } + + public void setParameters(Map<String, String> parameters) { + this.parameters = parameters; + } + + public Map<String, String> getIdToKey() { + return idToKey; + } + + public void setIdToKey(Map<String, String> idToKey) { + this.idToKey = idToKey; + } + + @Override + public String toString() { + return "PropertyData [parameters= " + parameters + " idToKey= " + idToKey + ", additionalInfoParameterDataDefinition=" + + additionalInfoParameterDataDefinition + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AnnotationTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AnnotationTypeData.java index 995bece49d..25ac2a9c3d 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AnnotationTypeData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AnnotationTypeData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,17 +17,15 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.AnnotationTypeDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class AnnotationTypeData extends GraphNode { private AnnotationTypeDataDefinition annotationTypeDataDefinition; @@ -44,18 +42,13 @@ public class AnnotationTypeData extends GraphNode { public AnnotationTypeData(Map<String, Object> properties) { this(); - annotationTypeDataDefinition - .setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + annotationTypeDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); annotationTypeDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - annotationTypeDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - annotationTypeDataDefinition.setHighestVersion( - (boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty())); + annotationTypeDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + annotationTypeDataDefinition.setHighestVersion((boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty())); annotationTypeDataDefinition.setVersion((String) properties.get(GraphPropertiesDictionary.VERSION.getProperty())); - annotationTypeDataDefinition - .setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - annotationTypeDataDefinition - .setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + annotationTypeDataDefinition.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + annotationTypeDataDefinition.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); } @Override @@ -100,5 +93,4 @@ public class AnnotationTypeData extends GraphNode { public String toString() { return "AnnotationTypeData [annotationTypeDataDefinition=" + annotationTypeDataDefinition + "]"; } - } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactData.java index 9781f572eb..040cc496d8 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ArtifactData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,142 +17,131 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class ArtifactData extends GraphNode { - private ArtifactDataDefinition artifactDataDefinition; - - public ArtifactData() { - super(NodeTypeEnum.ArtifactRef); - artifactDataDefinition = new ArtifactDataDefinition(); - } - - public ArtifactData(ArtifactDataDefinition artifactDataDefinition) { - super(NodeTypeEnum.ArtifactRef); - this.artifactDataDefinition = artifactDataDefinition; - - } - - public ArtifactData(Map<String, Object> properties) { - this(); - artifactDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - artifactDataDefinition.setArtifactType((String) properties.get(GraphPropertiesDictionary.ARTIFACT_TYPE.getProperty())); - artifactDataDefinition.setArtifactRef((String) properties.get(GraphPropertiesDictionary.ARTIFACT_REF.getProperty())); - artifactDataDefinition.setArtifactName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - artifactDataDefinition.setArtifactRepository((String) properties.get(GraphPropertiesDictionary.ARTIFACT_REPOSITORY.getProperty())); - artifactDataDefinition.setArtifactChecksum((String) properties.get(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty())); - artifactDataDefinition.setArtifactCreator((String) properties.get(GraphPropertiesDictionary.CREATOR.getProperty())); - artifactDataDefinition.setUserIdCreator((String) properties.get(GraphPropertiesDictionary.CREATOR_ID.getProperty())); - artifactDataDefinition.setUserIdLastUpdater((String) properties.get(GraphPropertiesDictionary.LAST_UPDATER.getProperty())); - artifactDataDefinition.setCreatorFullName((String) properties.get(GraphPropertiesDictionary.CREATOR_FULL_NAME.getProperty())); - artifactDataDefinition.setUpdaterFullName((String) properties.get(GraphPropertiesDictionary.UPDATER_FULL_NAME.getProperty())); - artifactDataDefinition.setCreationDate((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - artifactDataDefinition.setLastUpdateDate((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - artifactDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - artifactDataDefinition.setEsId((String) properties.get(GraphPropertiesDictionary.ES_ID.getProperty())); - artifactDataDefinition.setArtifactLabel((String) properties.get(GraphPropertiesDictionary.ARTIFACT_LABEL.getProperty())); - artifactDataDefinition.setMandatory((Boolean) properties.get(GraphPropertiesDictionary.IS_ABSTRACT.getProperty())); - artifactDataDefinition.setArtifactChecksum((String) properties.get(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty())); - artifactDataDefinition.setArtifactDisplayName((String) properties.get(GraphPropertiesDictionary.ARTIFACT_DISPLAY_NAME.getProperty())); - artifactDataDefinition.setApiUrl((String) properties.get(GraphPropertiesDictionary.API_URL.getProperty())); - artifactDataDefinition.setServiceApi((Boolean) properties.get(GraphPropertiesDictionary.SERVICE_API.getProperty())); - artifactDataDefinition.setArtifactVersion((String) properties.get(GraphPropertiesDictionary.ARTIFACT_VERSION.getProperty())); - artifactDataDefinition.setArtifactUUID((String) properties.get(GraphPropertiesDictionary.ARTIFACT_UUID.getProperty())); - artifactDataDefinition.setPayloadUpdateDate((Long) properties.get(GraphPropertiesDictionary.PAYLOAD_UPDATE_DATE.getProperty())); - artifactDataDefinition.setHeatParamsUpdateDate((Long) properties.get(GraphPropertiesDictionary.HEAT_PARAMS_UPDATE_DATE.getProperty())); - artifactDataDefinition.setGenerated((Boolean) properties.get(GraphPropertiesDictionary.GENERATED.getProperty())); - Type listType = new TypeToken<List<String>>() { - }.getType(); - List<String> requiredArtifactsfromJson = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.REQUIRED_ARTIFACTS.getProperty()), listType); - artifactDataDefinition.setRequiredArtifacts(requiredArtifactsfromJson); - - String groupType = (String) properties.get(GraphPropertiesDictionary.ARTIFACT_GROUP_TYPE.getProperty()); - if (groupType != null && !groupType.isEmpty()) { - - artifactDataDefinition.setArtifactGroupType(ArtifactGroupTypeEnum.findType(groupType)); - } - - Integer timeout = (Integer) properties.get(GraphPropertiesDictionary.ARTIFACT_TIMEOUT.getProperty()); - if (timeout != null) { - - artifactDataDefinition.setTimeout(timeout); - } - - } - - public ArtifactDataDefinition getArtifactDataDefinition() { - return artifactDataDefinition; - } - - public void setArtifactDataDefinition(ArtifactDataDefinition artifactDataDefinition) { - this.artifactDataDefinition = artifactDataDefinition; - } - - @Override - public String getUniqueId() { - return artifactDataDefinition.getUniqueId(); - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, artifactDataDefinition.getUniqueId()); - addIfExists(map, GraphPropertiesDictionary.ARTIFACT_TYPE, artifactDataDefinition.getArtifactType()); - addIfExists(map, GraphPropertiesDictionary.ARTIFACT_REF, artifactDataDefinition.getArtifactRef()); - addIfExists(map, GraphPropertiesDictionary.NAME, artifactDataDefinition.getArtifactName()); - addIfExists(map, GraphPropertiesDictionary.ARTIFACT_REPOSITORY, artifactDataDefinition.getArtifactRepository()); - addIfExists(map, GraphPropertiesDictionary.ARTIFACT_CHECKSUM, artifactDataDefinition.getArtifactChecksum()); - addIfExists(map, GraphPropertiesDictionary.CREATOR, artifactDataDefinition.getArtifactCreator()); - addIfExists(map, GraphPropertiesDictionary.CREATOR_ID, artifactDataDefinition.getUserIdCreator()); - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATER, artifactDataDefinition.getUserIdLastUpdater()); - addIfExists(map, GraphPropertiesDictionary.CREATOR_FULL_NAME, artifactDataDefinition.getCreatorFullName()); - addIfExists(map, GraphPropertiesDictionary.UPDATER_FULL_NAME, artifactDataDefinition.getUpdaterFullName()); - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, artifactDataDefinition.getCreationDate()); - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, artifactDataDefinition.getLastUpdateDate()); - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, artifactDataDefinition.getDescription()); - addIfExists(map, GraphPropertiesDictionary.ES_ID, artifactDataDefinition.getEsId()); - addIfExists(map, GraphPropertiesDictionary.ARTIFACT_LABEL, artifactDataDefinition.getArtifactLabel()); - addIfExists(map, GraphPropertiesDictionary.IS_ABSTRACT, artifactDataDefinition.getMandatory()); - addIfExists(map, GraphPropertiesDictionary.ARTIFACT_CHECKSUM, artifactDataDefinition.getArtifactChecksum()); - addIfExists(map, GraphPropertiesDictionary.ARTIFACT_DISPLAY_NAME, artifactDataDefinition.getArtifactDisplayName()); - addIfExists(map, GraphPropertiesDictionary.API_URL, artifactDataDefinition.getApiUrl()); - addIfExists(map, GraphPropertiesDictionary.SERVICE_API, artifactDataDefinition.getServiceApi()); - addIfExists(map, GraphPropertiesDictionary.ARTIFACT_TIMEOUT, artifactDataDefinition.getTimeout()); - addIfExists(map, GraphPropertiesDictionary.ARTIFACT_VERSION, artifactDataDefinition.getArtifactVersion()); - addIfExists(map, GraphPropertiesDictionary.ARTIFACT_UUID, artifactDataDefinition.getArtifactUUID()); - addIfExists(map, GraphPropertiesDictionary.PAYLOAD_UPDATE_DATE, artifactDataDefinition.getPayloadUpdateDate()); - addIfExists(map, GraphPropertiesDictionary.HEAT_PARAMS_UPDATE_DATE, artifactDataDefinition.getHeatParamsUpdateDate()); - addIfExists(map, GraphPropertiesDictionary.REQUIRED_ARTIFACTS, artifactDataDefinition.getRequiredArtifacts()); - addIfExists(map, GraphPropertiesDictionary.GENERATED, artifactDataDefinition.getGenerated()); - - String groupType = null; - ArtifactGroupTypeEnum groupTypeEnum = artifactDataDefinition.getArtifactGroupType(); - if (groupTypeEnum != null) { - groupType = groupTypeEnum.getType(); - } - addIfExists(map, GraphPropertiesDictionary.ARTIFACT_GROUP_TYPE, groupType); - - return map; - } - - @Override - public String toString() { - return "ArtifactData [artifactDataDefinition=" + artifactDataDefinition + "]"; - } - + private ArtifactDataDefinition artifactDataDefinition; + + public ArtifactData() { + super(NodeTypeEnum.ArtifactRef); + artifactDataDefinition = new ArtifactDataDefinition(); + } + + public ArtifactData(ArtifactDataDefinition artifactDataDefinition) { + super(NodeTypeEnum.ArtifactRef); + this.artifactDataDefinition = artifactDataDefinition; + } + + public ArtifactData(Map<String, Object> properties) { + this(); + artifactDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + artifactDataDefinition.setArtifactType((String) properties.get(GraphPropertiesDictionary.ARTIFACT_TYPE.getProperty())); + artifactDataDefinition.setArtifactRef((String) properties.get(GraphPropertiesDictionary.ARTIFACT_REF.getProperty())); + artifactDataDefinition.setArtifactName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + artifactDataDefinition.setArtifactRepository((String) properties.get(GraphPropertiesDictionary.ARTIFACT_REPOSITORY.getProperty())); + artifactDataDefinition.setArtifactChecksum((String) properties.get(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty())); + artifactDataDefinition.setArtifactCreator((String) properties.get(GraphPropertiesDictionary.CREATOR.getProperty())); + artifactDataDefinition.setUserIdCreator((String) properties.get(GraphPropertiesDictionary.CREATOR_ID.getProperty())); + artifactDataDefinition.setUserIdLastUpdater((String) properties.get(GraphPropertiesDictionary.LAST_UPDATER.getProperty())); + artifactDataDefinition.setCreatorFullName((String) properties.get(GraphPropertiesDictionary.CREATOR_FULL_NAME.getProperty())); + artifactDataDefinition.setUpdaterFullName((String) properties.get(GraphPropertiesDictionary.UPDATER_FULL_NAME.getProperty())); + artifactDataDefinition.setCreationDate((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + artifactDataDefinition.setLastUpdateDate((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + artifactDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + artifactDataDefinition.setEsId((String) properties.get(GraphPropertiesDictionary.ES_ID.getProperty())); + artifactDataDefinition.setArtifactLabel((String) properties.get(GraphPropertiesDictionary.ARTIFACT_LABEL.getProperty())); + artifactDataDefinition.setMandatory((Boolean) properties.get(GraphPropertiesDictionary.IS_ABSTRACT.getProperty())); + artifactDataDefinition.setArtifactChecksum((String) properties.get(GraphPropertiesDictionary.ARTIFACT_CHECKSUM.getProperty())); + artifactDataDefinition.setArtifactDisplayName((String) properties.get(GraphPropertiesDictionary.ARTIFACT_DISPLAY_NAME.getProperty())); + artifactDataDefinition.setApiUrl((String) properties.get(GraphPropertiesDictionary.API_URL.getProperty())); + artifactDataDefinition.setServiceApi((Boolean) properties.get(GraphPropertiesDictionary.SERVICE_API.getProperty())); + artifactDataDefinition.setArtifactVersion((String) properties.get(GraphPropertiesDictionary.ARTIFACT_VERSION.getProperty())); + artifactDataDefinition.setArtifactUUID((String) properties.get(GraphPropertiesDictionary.ARTIFACT_UUID.getProperty())); + artifactDataDefinition.setPayloadUpdateDate((Long) properties.get(GraphPropertiesDictionary.PAYLOAD_UPDATE_DATE.getProperty())); + artifactDataDefinition.setHeatParamsUpdateDate((Long) properties.get(GraphPropertiesDictionary.HEAT_PARAMS_UPDATE_DATE.getProperty())); + artifactDataDefinition.setGenerated((Boolean) properties.get(GraphPropertiesDictionary.GENERATED.getProperty())); + Type listType = new TypeToken<List<String>>() { + }.getType(); + List<String> requiredArtifactsfromJson = getGson() + .fromJson((String) properties.get(GraphPropertiesDictionary.REQUIRED_ARTIFACTS.getProperty()), listType); + artifactDataDefinition.setRequiredArtifacts(requiredArtifactsfromJson); + String groupType = (String) properties.get(GraphPropertiesDictionary.ARTIFACT_GROUP_TYPE.getProperty()); + if (groupType != null && !groupType.isEmpty()) { + artifactDataDefinition.setArtifactGroupType(ArtifactGroupTypeEnum.findType(groupType)); + } + Integer timeout = (Integer) properties.get(GraphPropertiesDictionary.ARTIFACT_TIMEOUT.getProperty()); + if (timeout != null) { + artifactDataDefinition.setTimeout(timeout); + } + } + + public ArtifactDataDefinition getArtifactDataDefinition() { + return artifactDataDefinition; + } + + public void setArtifactDataDefinition(ArtifactDataDefinition artifactDataDefinition) { + this.artifactDataDefinition = artifactDataDefinition; + } + + @Override + public String getUniqueId() { + return artifactDataDefinition.getUniqueId(); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, artifactDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.ARTIFACT_TYPE, artifactDataDefinition.getArtifactType()); + addIfExists(map, GraphPropertiesDictionary.ARTIFACT_REF, artifactDataDefinition.getArtifactRef()); + addIfExists(map, GraphPropertiesDictionary.NAME, artifactDataDefinition.getArtifactName()); + addIfExists(map, GraphPropertiesDictionary.ARTIFACT_REPOSITORY, artifactDataDefinition.getArtifactRepository()); + addIfExists(map, GraphPropertiesDictionary.ARTIFACT_CHECKSUM, artifactDataDefinition.getArtifactChecksum()); + addIfExists(map, GraphPropertiesDictionary.CREATOR, artifactDataDefinition.getArtifactCreator()); + addIfExists(map, GraphPropertiesDictionary.CREATOR_ID, artifactDataDefinition.getUserIdCreator()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATER, artifactDataDefinition.getUserIdLastUpdater()); + addIfExists(map, GraphPropertiesDictionary.CREATOR_FULL_NAME, artifactDataDefinition.getCreatorFullName()); + addIfExists(map, GraphPropertiesDictionary.UPDATER_FULL_NAME, artifactDataDefinition.getUpdaterFullName()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, artifactDataDefinition.getCreationDate()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, artifactDataDefinition.getLastUpdateDate()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, artifactDataDefinition.getDescription()); + addIfExists(map, GraphPropertiesDictionary.ES_ID, artifactDataDefinition.getEsId()); + addIfExists(map, GraphPropertiesDictionary.ARTIFACT_LABEL, artifactDataDefinition.getArtifactLabel()); + addIfExists(map, GraphPropertiesDictionary.IS_ABSTRACT, artifactDataDefinition.getMandatory()); + addIfExists(map, GraphPropertiesDictionary.ARTIFACT_CHECKSUM, artifactDataDefinition.getArtifactChecksum()); + addIfExists(map, GraphPropertiesDictionary.ARTIFACT_DISPLAY_NAME, artifactDataDefinition.getArtifactDisplayName()); + addIfExists(map, GraphPropertiesDictionary.API_URL, artifactDataDefinition.getApiUrl()); + addIfExists(map, GraphPropertiesDictionary.SERVICE_API, artifactDataDefinition.getServiceApi()); + addIfExists(map, GraphPropertiesDictionary.ARTIFACT_TIMEOUT, artifactDataDefinition.getTimeout()); + addIfExists(map, GraphPropertiesDictionary.ARTIFACT_VERSION, artifactDataDefinition.getArtifactVersion()); + addIfExists(map, GraphPropertiesDictionary.ARTIFACT_UUID, artifactDataDefinition.getArtifactUUID()); + addIfExists(map, GraphPropertiesDictionary.PAYLOAD_UPDATE_DATE, artifactDataDefinition.getPayloadUpdateDate()); + addIfExists(map, GraphPropertiesDictionary.HEAT_PARAMS_UPDATE_DATE, artifactDataDefinition.getHeatParamsUpdateDate()); + addIfExists(map, GraphPropertiesDictionary.REQUIRED_ARTIFACTS, artifactDataDefinition.getRequiredArtifacts()); + addIfExists(map, GraphPropertiesDictionary.GENERATED, artifactDataDefinition.getGenerated()); + String groupType = null; + ArtifactGroupTypeEnum groupTypeEnum = artifactDataDefinition.getArtifactGroupType(); + if (groupTypeEnum != null) { + groupType = groupTypeEnum.getType(); + } + addIfExists(map, GraphPropertiesDictionary.ARTIFACT_GROUP_TYPE, groupType); + return map; + } + + @Override + public String toString() { + return "ArtifactData [artifactDataDefinition=" + artifactDataDefinition + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeData.java index bb23f7434c..b9cac83079 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,10 +17,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.utils.Constants; @@ -28,103 +30,77 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.Map; - public class AttributeData extends GraphNode { - PropertyDataDefinition attributeDataDefinition; - - public AttributeData() { - super(NodeTypeEnum.Attribute); - attributeDataDefinition = new PropertyDataDefinition(); - } - - public AttributeData(PropertyDataDefinition attributeDataDefinition) { - super(NodeTypeEnum.Attribute); - this.attributeDataDefinition = attributeDataDefinition; - } - - @Override - public String toString() { - return "AttributeData [attributeDataDefinition=" + attributeDataDefinition + "]"; - } - - @Override - public String getUniqueId() { - return attributeDataDefinition.getUniqueId(); - } - - public PropertyDataDefinition getAttributeDataDefinition() { - return attributeDataDefinition; - } - - public void setAttributeDataDefinition(PropertyDataDefinition attributeDataDefinition) { - this.attributeDataDefinition = attributeDataDefinition; - } - - public AttributeData(Map<String, Object> properties) { - - this(); - - attributeDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - attributeDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - - attributeDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - - String defaultValue = (String) properties.get(GraphPropertiesDictionary.DEFAULT_VALUE.getProperty()); - if (Constants.GRAPH_EMPTY_VALUE.equals(defaultValue)) { - attributeDataDefinition.setDefaultValue(null); - } else { - attributeDataDefinition.setDefaultValue(defaultValue); - } - - attributeDataDefinition.setStatus((String) properties.get(GraphPropertiesDictionary.STATUS.getProperty())); - - attributeDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - - attributeDataDefinition.setValue((String) properties.get(GraphPropertiesDictionary.VALUE.getProperty())); - - Type schemaType = new TypeToken<SchemaDefinition>() { - }.getType(); - SchemaDefinition schema = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.ENTRY_SCHEMA.getProperty()), schemaType); - attributeDataDefinition.setSchema(schema); - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, attributeDataDefinition.getUniqueId()); - - addIfExists(map, GraphPropertiesDictionary.TYPE, attributeDataDefinition.getType()); - - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, attributeDataDefinition.getDescription()); - - String defaultValue = attributeDataDefinition.getDefaultValue(); - if (defaultValue == null) { - defaultValue = Constants.GRAPH_EMPTY_VALUE; - } - - addIfExists(map, GraphPropertiesDictionary.DEFAULT_VALUE, defaultValue); - - addIfExists(map, GraphPropertiesDictionary.STATUS, attributeDataDefinition.getStatus()); - - addIfExists(map, GraphPropertiesDictionary.NAME, attributeDataDefinition.getName()); - - addIfExists(map, GraphPropertiesDictionary.VALUE, attributeDataDefinition.getValue()); - - SchemaDefinition entrySchema = attributeDataDefinition.getSchema(); - if (entrySchema != null) { - String entrySchemaStr = getGson().toJson(entrySchema); - addIfExists(map, GraphPropertiesDictionary.ENTRY_SCHEMA, entrySchemaStr); - } - - return map; - } + PropertyDataDefinition attributeDataDefinition; + + public AttributeData() { + super(NodeTypeEnum.Attribute); + attributeDataDefinition = new PropertyDataDefinition(); + } + + public AttributeData(PropertyDataDefinition attributeDataDefinition) { + super(NodeTypeEnum.Attribute); + this.attributeDataDefinition = attributeDataDefinition; + } + + public AttributeData(Map<String, Object> properties) { + this(); + attributeDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + attributeDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + attributeDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + String defaultValue = (String) properties.get(GraphPropertiesDictionary.DEFAULT_VALUE.getProperty()); + if (Constants.GRAPH_EMPTY_VALUE.equals(defaultValue)) { + attributeDataDefinition.setDefaultValue(null); + } else { + attributeDataDefinition.setDefaultValue(defaultValue); + } + attributeDataDefinition.setStatus((String) properties.get(GraphPropertiesDictionary.STATUS.getProperty())); + attributeDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + attributeDataDefinition.setValue((String) properties.get(GraphPropertiesDictionary.VALUE.getProperty())); + Type schemaType = new TypeToken<SchemaDefinition>() { + }.getType(); + SchemaDefinition schema = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.ENTRY_SCHEMA.getProperty()), schemaType); + attributeDataDefinition.setSchema(schema); + } + + @Override + public String toString() { + return "AttributeData [attributeDataDefinition=" + attributeDataDefinition + "]"; + } + + @Override + public String getUniqueId() { + return attributeDataDefinition.getUniqueId(); + } + + public PropertyDataDefinition getAttributeDataDefinition() { + return attributeDataDefinition; + } + + public void setAttributeDataDefinition(PropertyDataDefinition attributeDataDefinition) { + this.attributeDataDefinition = attributeDataDefinition; + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, attributeDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.TYPE, attributeDataDefinition.getType()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, attributeDataDefinition.getDescription()); + String defaultValue = attributeDataDefinition.getDefaultValue(); + if (defaultValue == null) { + defaultValue = Constants.GRAPH_EMPTY_VALUE; + } + addIfExists(map, GraphPropertiesDictionary.DEFAULT_VALUE, defaultValue); + addIfExists(map, GraphPropertiesDictionary.STATUS, attributeDataDefinition.getStatus()); + addIfExists(map, GraphPropertiesDictionary.NAME, attributeDataDefinition.getName()); + addIfExists(map, GraphPropertiesDictionary.VALUE, attributeDataDefinition.getValue()); + SchemaDefinition entrySchema = attributeDataDefinition.getSchema(); + if (entrySchema != null) { + String entrySchemaStr = getGson().toJson(entrySchema); + addIfExists(map, GraphPropertiesDictionary.ENTRY_SCHEMA, entrySchemaStr); + } + return map; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeValueData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeValueData.java index 7826862cba..8b05a99922 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeValueData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/AttributeValueData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,129 +17,108 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.utils.Constants; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - public class AttributeValueData extends GraphNode { - private String uniqueId; - - private String value; - - private String type; - - private Boolean hidden; - - private Long creationTime; - - private Long modificationTime; - - public AttributeValueData() { - super(NodeTypeEnum.AttributeValue); - } - - public AttributeValueData(Map<String, Object> properties) { - this(); - - this.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - - String updatedValue = (String) properties.get(GraphPropertiesDictionary.VALUE.getProperty()); - if (Constants.GRAPH_EMPTY_VALUE.equals(updatedValue)) { - this.setValue(null); - } else { - this.setValue(updatedValue); - } - - this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - this.setHidden((Boolean) properties.get(GraphPropertiesDictionary.HIDDEN.getProperty())); - - this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public Long getCreationTime() { - return creationTime; - } - - public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; - } - - public Long getModificationTime() { - return modificationTime; - } - - public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); - - addIfExists(map, GraphPropertiesDictionary.TYPE, type); - - addIfExists(map, GraphPropertiesDictionary.HIDDEN, hidden); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); - - String updatedValue = Objects.isNull(value) ? Constants.GRAPH_EMPTY_VALUE : value; - addIfExists(map, GraphPropertiesDictionary.VALUE, updatedValue); - return map; - } - - @Override - public String toString() { - return "AttributeValueData [uniqueId=" + uniqueId + ", hidden=" + hidden + ", type=" + type + ", creationTime=" - + creationTime + ", value=" + value + ", modificationTime=" + modificationTime + "]"; - } - - public Boolean isHidden() { - return hidden; - } - - public void setHidden(Boolean hidden) { - this.hidden = hidden; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } + private String uniqueId; + private String value; + private String type; + private Boolean hidden; + private Long creationTime; + private Long modificationTime; + + public AttributeValueData() { + super(NodeTypeEnum.AttributeValue); + } + + public AttributeValueData(Map<String, Object> properties) { + this(); + this.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + String updatedValue = (String) properties.get(GraphPropertiesDictionary.VALUE.getProperty()); + if (Constants.GRAPH_EMPTY_VALUE.equals(updatedValue)) { + this.setValue(null); + } else { + this.setValue(updatedValue); + } + this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + this.setHidden((Boolean) properties.get(GraphPropertiesDictionary.HIDDEN.getProperty())); + this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + } + + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public Long getCreationTime() { + return creationTime; + } + + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } + + public Long getModificationTime() { + return modificationTime; + } + + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); + addIfExists(map, GraphPropertiesDictionary.TYPE, type); + addIfExists(map, GraphPropertiesDictionary.HIDDEN, hidden); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); + String updatedValue = Objects.isNull(value) ? Constants.GRAPH_EMPTY_VALUE : value; + addIfExists(map, GraphPropertiesDictionary.VALUE, updatedValue); + return map; + } + + @Override + public String toString() { + return "AttributeValueData [uniqueId=" + uniqueId + ", hidden=" + hidden + ", type=" + type + ", creationTime=" + creationTime + ", value=" + + value + ", modificationTime=" + modificationTime + "]"; + } + + public Boolean isHidden() { + return hidden; + } + + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityData.java index 16357f557e..32a7dccb16 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,166 +17,148 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; - import java.lang.reflect.Type; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; +import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; public class CapabilityData extends GraphNode { - private CapabilityDataDefinition capabilityDataDefiniton; - - public CapabilityData() { - this(new CapabilityDataDefinition()); - } - - public CapabilityData(CapabilityDataDefinition capabilityDataDefiniton) { - super(NodeTypeEnum.Capability); - this.capabilityDataDefiniton = capabilityDataDefiniton; - } - - public CapabilityData(Map<String, Object> properties) { - this(); - - capabilityDataDefiniton.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - capabilityDataDefiniton.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - - Type listType = new TypeToken<List<String>>() { - }.getType(); - List<String> validSourceTypesfromJson = getGson().fromJson( - (String) properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES.getProperty()), listType); - - capabilityDataDefiniton.setValidSourceTypes(validSourceTypesfromJson); - - this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - capabilityDataDefiniton.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - capabilityDataDefiniton.setMinOccurrences((String) properties.get(GraphPropertiesDictionary.MIN_OCCURRENCES.getProperty())); - capabilityDataDefiniton.setMaxOccurrences((String) properties.get(GraphPropertiesDictionary.MAX_OCCURRENCES.getProperty())); - } - - private Long creationTime; - - private Long modificationTime; - - @Override - public String getUniqueId() { - return capabilityDataDefiniton.getUniqueId(); - } - - - public CapabilityDataDefinition getCapabilityDataDefinition() { - return capabilityDataDefiniton; - } - - public void setUniqueId(String uniqueId) { - capabilityDataDefiniton.setUniqueId(uniqueId); - } - public String getDescription() { - return capabilityDataDefiniton.getDescription(); - } + private CapabilityDataDefinition capabilityDataDefiniton; + private Long creationTime; + private Long modificationTime; - public void setDescription(String description) { - capabilityDataDefiniton.setDescription(description); - } + public CapabilityData() { + this(new CapabilityDataDefinition()); + } - /** - * Get the type of the capability - * @return - */ - public String getType() { - return capabilityDataDefiniton.getType(); - } + public CapabilityData(CapabilityDataDefinition capabilityDataDefiniton) { + super(NodeTypeEnum.Capability); + this.capabilityDataDefiniton = capabilityDataDefiniton; + } + public CapabilityData(Map<String, Object> properties) { + this(); + capabilityDataDefiniton.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + capabilityDataDefiniton.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + Type listType = new TypeToken<List<String>>() { + }.getType(); + List<String> validSourceTypesfromJson = getGson() + .fromJson((String) properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES.getProperty()), listType); + capabilityDataDefiniton.setValidSourceTypes(validSourceTypesfromJson); + this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + capabilityDataDefiniton.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + capabilityDataDefiniton.setMinOccurrences((String) properties.get(GraphPropertiesDictionary.MIN_OCCURRENCES.getProperty())); + capabilityDataDefiniton.setMaxOccurrences((String) properties.get(GraphPropertiesDictionary.MAX_OCCURRENCES.getProperty())); + } + + @Override + public String getUniqueId() { + return capabilityDataDefiniton.getUniqueId(); + } + + public void setUniqueId(String uniqueId) { + capabilityDataDefiniton.setUniqueId(uniqueId); + } + + public CapabilityDataDefinition getCapabilityDataDefinition() { + return capabilityDataDefiniton; + } + + public String getDescription() { + return capabilityDataDefiniton.getDescription(); + } + + public void setDescription(String description) { + capabilityDataDefiniton.setDescription(description); + } + + /** + * Get the type of the capability + * + * @return + */ + public String getType() { + return capabilityDataDefiniton.getType(); + } - /** + /** * Set the type of the capability + * * @return */ - public void setType(String type) { - capabilityDataDefiniton.setType(type); - } - - public List<String> getValidSourceTypes() { - return capabilityDataDefiniton.getValidSourceTypes(); - } - - public void setValidSourceTypes(List<String> validSourceTypes) { - capabilityDataDefiniton.setValidSourceTypes(validSourceTypes); - } - - public Long getCreationTime() { - return creationTime; - } - - public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; - } - - public Long getModificationTime() { - return modificationTime; - } - - public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; - } - - public String getMinOccurrences() { - return capabilityDataDefiniton.getMinOccurrences(); - } - - public void setMinOccurrences(String minOccurrences) { - if (minOccurrences != null) { - capabilityDataDefiniton.setMinOccurrences(minOccurrences); - } - } - - public String getMaxOccurrences() { - return capabilityDataDefiniton.getMaxOccurrences(); - } - - public void setMaxOccurrences(String maxOccurrences) { - if (maxOccurrences != null) { - capabilityDataDefiniton.setMaxOccurrences(maxOccurrences); - } - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, capabilityDataDefiniton.getUniqueId()); - - addIfExists(map, GraphPropertiesDictionary.VALID_SOURCE_TYPES, capabilityDataDefiniton.getValidSourceTypes()); - - addIfExists(map, GraphPropertiesDictionary.TYPE, capabilityDataDefiniton.getType()); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); - - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, capabilityDataDefiniton.getDescription()); - addIfExists(map, GraphPropertiesDictionary.MIN_OCCURRENCES, capabilityDataDefiniton.getMinOccurrences()); - addIfExists(map, GraphPropertiesDictionary.MAX_OCCURRENCES, capabilityDataDefiniton.getMaxOccurrences()); - - return map; - } - - @Override - public String toString() { - return "CapabilityData [capabilityDataDefiniton=" + capabilityDataDefiniton - + ", creationTime=" + creationTime + ", modificationTime=" + modificationTime + "]"; - } - + public void setType(String type) { + capabilityDataDefiniton.setType(type); + } + + public List<String> getValidSourceTypes() { + return capabilityDataDefiniton.getValidSourceTypes(); + } + + public void setValidSourceTypes(List<String> validSourceTypes) { + capabilityDataDefiniton.setValidSourceTypes(validSourceTypes); + } + + public Long getCreationTime() { + return creationTime; + } + + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } + + public Long getModificationTime() { + return modificationTime; + } + + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } + + public String getMinOccurrences() { + return capabilityDataDefiniton.getMinOccurrences(); + } + + public void setMinOccurrences(String minOccurrences) { + if (minOccurrences != null) { + capabilityDataDefiniton.setMinOccurrences(minOccurrences); + } + } + + public String getMaxOccurrences() { + return capabilityDataDefiniton.getMaxOccurrences(); + } + + public void setMaxOccurrences(String maxOccurrences) { + if (maxOccurrences != null) { + capabilityDataDefiniton.setMaxOccurrences(maxOccurrences); + } + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, capabilityDataDefiniton.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.VALID_SOURCE_TYPES, capabilityDataDefiniton.getValidSourceTypes()); + addIfExists(map, GraphPropertiesDictionary.TYPE, capabilityDataDefiniton.getType()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, capabilityDataDefiniton.getDescription()); + addIfExists(map, GraphPropertiesDictionary.MIN_OCCURRENCES, capabilityDataDefiniton.getMinOccurrences()); + addIfExists(map, GraphPropertiesDictionary.MAX_OCCURRENCES, capabilityDataDefiniton.getMaxOccurrences()); + return map; + } + + @Override + public String toString() { + return "CapabilityData [capabilityDataDefiniton=" + capabilityDataDefiniton + ", creationTime=" + creationTime + ", modificationTime=" + + modificationTime + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityInstData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityInstData.java index e85a670aa0..2781950fe4 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityInstData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityInstData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,111 +17,91 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; - import java.lang.reflect.Type; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; public class CapabilityInstData extends GraphNode { - public CapabilityInstData() { - super(NodeTypeEnum.CapabilityInst); - } - - public CapabilityInstData(Map<String, Object> properties) { - this(); - - this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - Type listType = new TypeToken<List<String>>() { - }.getType(); - List<String> propertiesfromJson = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.PROPERTIES.getProperty()), listType); - - this.setProperties(propertiesfromJson); - - // this.setProperties((ArrayList<String>) properties - // .get(GraphPropertiesDictionary.PROPERTIES.getProperty())); - - this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - } - - private String uniqueId; - - private List<String> properties; - - private Long creationTime; - - private Long modificationTime; - - @Override - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public Long getCreationTime() { - return creationTime; - } - - public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; - } - - public Long getModificationTime() { - return modificationTime; - } - - public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; - } - - public List<String> getProperties() { - return properties; - } - - public void setProperties(List<String> properties) { - this.properties = properties; - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); - - // String propertiesToJson = getGson().toJson(properties); - - // addIfExists(map, GraphPropertiesDictionary.PROPERTIES, - // propertiesToJson); - - addIfExists(map, GraphPropertiesDictionary.PROPERTIES, properties); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); - - return map; - } - - @Override - public String toString() { - return "CapabilityInstData [uniqueId=" + uniqueId + ", properties=" + properties + ", creationTime=" - + creationTime + ", modificationTime=" + modificationTime + "]"; - } - + private String uniqueId; + private List<String> properties; + private Long creationTime; + private Long modificationTime; + public CapabilityInstData() { + super(NodeTypeEnum.CapabilityInst); + } + public CapabilityInstData(Map<String, Object> properties) { + this(); + this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + Type listType = new TypeToken<List<String>>() { + }.getType(); + List<String> propertiesfromJson = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.PROPERTIES.getProperty()), listType); + this.setProperties(propertiesfromJson); + // this.setProperties((ArrayList<String>) properties + + // .get(GraphPropertiesDictionary.PROPERTIES.getProperty())); + this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + } + + @Override + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public Long getCreationTime() { + return creationTime; + } + + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } + + public Long getModificationTime() { + return modificationTime; + } + + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } + + public List<String> getProperties() { + return properties; + } + + public void setProperties(List<String> properties) { + this.properties = properties; + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); + // String propertiesToJson = getGson().toJson(properties); + + // addIfExists(map, GraphPropertiesDictionary.PROPERTIES, + + // propertiesToJson); + addIfExists(map, GraphPropertiesDictionary.PROPERTIES, properties); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); + return map; + } + + @Override + public String toString() { + return "CapabilityInstData [uniqueId=" + uniqueId + ", properties=" + properties + ", creationTime=" + creationTime + ", modificationTime=" + + modificationTime + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityTypeData.java index 67929953bc..8e72e67617 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityTypeData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CapabilityTypeData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,119 +17,90 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.datatypes.elements.CapabilityTypeDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; - import java.lang.reflect.Type; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; +import org.openecomp.sdc.be.datatypes.elements.CapabilityTypeDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; public class CapabilityTypeData extends GraphNode { - CapabilityTypeDataDefinition capabilityTypeDataDefinition; - - // private List<String> constraints; - - public CapabilityTypeData() { - super(NodeTypeEnum.CapabilityType); - capabilityTypeDataDefinition = new CapabilityTypeDataDefinition(); - } - - public CapabilityTypeData(CapabilityTypeDataDefinition capabilityTypeDataDefinition) { - super(NodeTypeEnum.CapabilityType); - this.capabilityTypeDataDefinition = capabilityTypeDataDefinition; - // this.constraints = constraints; - } - - public CapabilityTypeData(Map<String, Object> properties) { - - this(); - - capabilityTypeDataDefinition - .setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - capabilityTypeDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - - capabilityTypeDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - - capabilityTypeDataDefinition - .setVersion((String) properties.get(GraphPropertiesDictionary.VERSION.getProperty())); - - Type listType = new TypeToken<List<String>>() { - }.getType(); - List<String> validSourceTypesfromJson = getGson().fromJson( - (String) properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES.getProperty()), listType); - - capabilityTypeDataDefinition.setValidSourceTypes(validSourceTypesfromJson); - - // capabilityTypeDataDefinition.setValidSourceTypes((List<String>) - // properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES - // .getProperty())); - - capabilityTypeDataDefinition - .setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - capabilityTypeDataDefinition - .setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - // capabilityTypeDataDefinition.setVersion(version); - - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, capabilityTypeDataDefinition.getUniqueId()); - - addIfExists(map, GraphPropertiesDictionary.TYPE, capabilityTypeDataDefinition.getType()); - - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, capabilityTypeDataDefinition.getDescription()); - - addIfExists(map, GraphPropertiesDictionary.VERSION, capabilityTypeDataDefinition.getVersion()); - - // String validSourceTypesToJson = - // getGson().toJson(capabilityTypeDataDefinition.getValidSourceTypes()); - - // addIfExists(map, GraphPropertiesDictionary.VALID_SOURCE_TYPES, - // validSourceTypesToJson); - - addIfExists(map, GraphPropertiesDictionary.VALID_SOURCE_TYPES, - capabilityTypeDataDefinition.getValidSourceTypes()); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, capabilityTypeDataDefinition.getCreationTime()); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, - capabilityTypeDataDefinition.getModificationTime()); - - return map; - } - - public CapabilityTypeDataDefinition getCapabilityTypeDataDefinition() { - return capabilityTypeDataDefinition; - } - - public void setCapabilityTypeDataDefinition(CapabilityTypeDataDefinition capabilityTypeDataDefinition) { - this.capabilityTypeDataDefinition = capabilityTypeDataDefinition; - } - - @Override - public String toString() { - return "CapabilityTypeData [capabilityTypeDataDefinition=" + capabilityTypeDataDefinition + "]"; - } - - @Override - public String getUniqueId() { - return this.capabilityTypeDataDefinition.getUniqueId(); - } - + CapabilityTypeDataDefinition capabilityTypeDataDefinition; + + // private List<String> constraints; + public CapabilityTypeData() { + super(NodeTypeEnum.CapabilityType); + capabilityTypeDataDefinition = new CapabilityTypeDataDefinition(); + } + + public CapabilityTypeData(CapabilityTypeDataDefinition capabilityTypeDataDefinition) { + super(NodeTypeEnum.CapabilityType); + this.capabilityTypeDataDefinition = capabilityTypeDataDefinition; + // this.constraints = constraints; + } + + public CapabilityTypeData(Map<String, Object> properties) { + this(); + capabilityTypeDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + capabilityTypeDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + capabilityTypeDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + capabilityTypeDataDefinition.setVersion((String) properties.get(GraphPropertiesDictionary.VERSION.getProperty())); + Type listType = new TypeToken<List<String>>() { + }.getType(); + List<String> validSourceTypesfromJson = getGson() + .fromJson((String) properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES.getProperty()), listType); + capabilityTypeDataDefinition.setValidSourceTypes(validSourceTypesfromJson); + // capabilityTypeDataDefinition.setValidSourceTypes((List<String>) + + // properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES + + // .getProperty())); + capabilityTypeDataDefinition.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + capabilityTypeDataDefinition.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + // capabilityTypeDataDefinition.setVersion(version); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, capabilityTypeDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.TYPE, capabilityTypeDataDefinition.getType()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, capabilityTypeDataDefinition.getDescription()); + addIfExists(map, GraphPropertiesDictionary.VERSION, capabilityTypeDataDefinition.getVersion()); + // String validSourceTypesToJson = + + // getGson().toJson(capabilityTypeDataDefinition.getValidSourceTypes()); + + // addIfExists(map, GraphPropertiesDictionary.VALID_SOURCE_TYPES, + + // validSourceTypesToJson); + addIfExists(map, GraphPropertiesDictionary.VALID_SOURCE_TYPES, capabilityTypeDataDefinition.getValidSourceTypes()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, capabilityTypeDataDefinition.getCreationTime()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, capabilityTypeDataDefinition.getModificationTime()); + return map; + } + + public CapabilityTypeDataDefinition getCapabilityTypeDataDefinition() { + return capabilityTypeDataDefinition; + } + + public void setCapabilityTypeDataDefinition(CapabilityTypeDataDefinition capabilityTypeDataDefinition) { + this.capabilityTypeDataDefinition = capabilityTypeDataDefinition; + } + + @Override + public String toString() { + return "CapabilityTypeData [capabilityTypeDataDefinition=" + capabilityTypeDataDefinition + "]"; + } + + @Override + public String getUniqueId() { + return this.capabilityTypeDataDefinition.getUniqueId(); + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java index f5ec18ac61..229d774222 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/CategoryData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,83 +17,80 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public abstract class CategoryData extends GraphNode { - private String name; - private String normalizedName; - private String uniqueId; - - protected abstract void createUniqueId(); - - protected CategoryData(NodeTypeEnum label) { - super(label); - } - - protected CategoryData(String name, String normalizedName, NodeTypeEnum label) { - super(label); - this.name = name; - this.normalizedName = normalizedName; - } - - protected CategoryData(Map<String, Object> properties, NodeTypeEnum label) { - super(label); - setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - addIfExists(map, GraphPropertiesDictionary.NAME, name); - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); - addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, normalizedName); - return map; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNormalizedName() { - return normalizedName; - } - - public void setNormalizedName(String normalizedName) { - this.normalizedName = normalizedName; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - @Override - public String toString() { - return "CategoryData [name=" + name + ", normalizedName=" + normalizedName + "uniqueId=" + uniqueId + "]"; - } - - @Override - public String getUniqueIdKey() { - return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); - } - - @Override - public String getUniqueId() { - return uniqueId; - } - + private String name; + private String normalizedName; + private String uniqueId; + + protected CategoryData(NodeTypeEnum label) { + super(label); + } + + protected CategoryData(String name, String normalizedName, NodeTypeEnum label) { + super(label); + this.name = name; + this.normalizedName = normalizedName; + } + + protected CategoryData(Map<String, Object> properties, NodeTypeEnum label) { + super(label); + setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); + } + + protected abstract void createUniqueId(); + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.NAME, name); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); + addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, normalizedName); + return map; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getNormalizedName() { + return normalizedName; + } + + public void setNormalizedName(String normalizedName) { + this.normalizedName = normalizedName; + } + + @Override + public String toString() { + return "CategoryData [name=" + name + ", normalizedName=" + normalizedName + "uniqueId=" + uniqueId + "]"; + } + + @Override + public String getUniqueIdKey() { + return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); + } + + @Override + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentCacheData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentCacheData.java index 7c960ae06e..6f7084b555 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentCacheData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentCacheData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,137 +17,124 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; - import java.nio.ByteBuffer; import java.util.Date; @Table(keyspace = "sdccomponent", name = "componentcache") public class ComponentCacheData { - public static final String RESOURCE_ID_FIELD = "resourceId"; - - public static final String SERVICE_NAME_FIELD = "serviceName"; - public static final String SERVICE_VERSION_FIELD = "serviceVersion"; - public static final String ARTIFACT_NAME_FIELD = "artifactName"; - - public static final String delim = ":"; - - @PartitionKey - @Column(name = "id") - private String id; - - @Column - private ByteBuffer data; - - @Column(name = "modification_time") - private Date modificationTime; - - @Column - private String type; - - @Column(name = "is_dirty") - private boolean isDirty; - - @Column(name = "is_zipped") - private boolean isZipped; - - public ComponentCacheData() { - - } - - public ComponentCacheData(String id, byte[] data, Date modificationTime, String type, boolean isDirty, - boolean isZipped) { - super(); - this.id = id; - if (data != null) { - this.data = ByteBuffer.wrap(data.clone()); - } - this.modificationTime = modificationTime; - this.type = type; - this.isDirty = isDirty; - this.isZipped = isZipped; - } - - public ComponentCacheData(String id) { - - this.id = id; - } - - public ComponentCacheData(String artifactId, byte[] data) { - super(); - this.id = artifactId; - if (data != null) { - this.data = ByteBuffer.wrap(data.clone()); - // this.data = data.clone(); - } - } - - public byte[] getDataAsArray() { - if (data != null) { - return data.array(); - } - return null; - } - - public void setDataAsArray(byte[] data) { - if (data != null) { - this.data = ByteBuffer.wrap(data.clone()); - } - } - - public ByteBuffer getData() { - return data; - } - - public void setData(ByteBuffer data) { - if (data != null) { - this.data = data.duplicate(); - } - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Date getModificationTime() { - return modificationTime; - } - - public void setModificationTime(Date modificationTime) { - this.modificationTime = modificationTime; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public boolean getIsDirty() { - return isDirty; - } - - public void setIsDirty(boolean isDirty) { - this.isDirty = isDirty; - } - - public boolean getIsZipped() { - return isZipped; - } - - public void setIsZipped(boolean isZipped) { - this.isZipped = isZipped; - } + public static final String RESOURCE_ID_FIELD = "resourceId"; + public static final String SERVICE_NAME_FIELD = "serviceName"; + public static final String SERVICE_VERSION_FIELD = "serviceVersion"; + public static final String ARTIFACT_NAME_FIELD = "artifactName"; + public static final String delim = ":"; + @PartitionKey + @Column(name = "id") + private String id; + @Column + private ByteBuffer data; + @Column(name = "modification_time") + private Date modificationTime; + @Column + private String type; + @Column(name = "is_dirty") + private boolean isDirty; + @Column(name = "is_zipped") + private boolean isZipped; + + public ComponentCacheData() { + } + + public ComponentCacheData(String id, byte[] data, Date modificationTime, String type, boolean isDirty, boolean isZipped) { + super(); + this.id = id; + if (data != null) { + this.data = ByteBuffer.wrap(data.clone()); + } + this.modificationTime = modificationTime; + this.type = type; + this.isDirty = isDirty; + this.isZipped = isZipped; + } + + public ComponentCacheData(String id) { + this.id = id; + } + + public ComponentCacheData(String artifactId, byte[] data) { + super(); + this.id = artifactId; + if (data != null) { + this.data = ByteBuffer.wrap(data.clone()); + // this.data = data.clone(); + } + } + + public byte[] getDataAsArray() { + if (data != null) { + return data.array(); + } + return null; + } + + public void setDataAsArray(byte[] data) { + if (data != null) { + this.data = ByteBuffer.wrap(data.clone()); + } + } + + public ByteBuffer getData() { + return data; + } + + public void setData(ByteBuffer data) { + if (data != null) { + this.data = data.duplicate(); + } + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Date getModificationTime() { + return modificationTime; + } + + public void setModificationTime(Date modificationTime) { + this.modificationTime = modificationTime; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public boolean getIsDirty() { + return isDirty; + } + + public void setIsDirty(boolean isDirty) { + this.isDirty = isDirty; + } + + public boolean getIsZipped() { + return isZipped; + } + + public void setIsZipped(boolean isZipped) { + this.isZipped = isZipped; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentInstanceData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentInstanceData.java index 315bf83e2a..da4a65e762 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentInstanceData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentInstanceData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,123 +17,116 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class ComponentInstanceData extends GraphNode { - ComponentInstanceDataDefinition componentInstDataDefinition; - protected Integer groupInstanceCounter; - - public ComponentInstanceData() { - super(NodeTypeEnum.ResourceInstance); - this.componentInstDataDefinition = new ComponentInstanceDataDefinition(); - this.groupInstanceCounter = 0; - } - - public ComponentInstanceData(ComponentInstanceDataDefinition componentInstDataDefinition) { - super(NodeTypeEnum.ResourceInstance); - this.componentInstDataDefinition = componentInstDataDefinition; - this.groupInstanceCounter = 0; - } - - public ComponentInstanceData(ComponentInstanceDataDefinition componentInstDataDefinition, Integer groupInstanceCounter) { - super(NodeTypeEnum.ResourceInstance); - this.componentInstDataDefinition = componentInstDataDefinition; - this.groupInstanceCounter = groupInstanceCounter; - } - - public ComponentInstanceData(Map<String, Object> properties) { - - this(); - - componentInstDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - componentInstDataDefinition.setComponentUid((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - componentInstDataDefinition.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - componentInstDataDefinition.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - componentInstDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - componentInstDataDefinition.setPosX((String) properties.get(GraphPropertiesDictionary.POSITION_X.getProperty())); - componentInstDataDefinition.setPosY((String) properties.get(GraphPropertiesDictionary.POSITION_Y.getProperty())); - componentInstDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - componentInstDataDefinition.setPropertyValueCounter((Integer) properties.get(GraphPropertiesDictionary.PROPERTY_COUNTER.getProperty())); - componentInstDataDefinition.setAttributeValueCounter((Integer) properties.get(GraphPropertiesDictionary.ATTRIBUTE_COUNTER.getProperty())); - componentInstDataDefinition.setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); - componentInstDataDefinition.setOriginType(OriginTypeEnum.findByValue((String) properties.get(GraphPropertiesDictionary.ORIGIN_TYPE.getProperty()))); - componentInstDataDefinition.setCustomizationUUID((String) properties.get(GraphPropertiesDictionary.CUSTOMIZATION_UUID.getProperty())); - groupInstanceCounter = (Integer) properties.get(GraphPropertiesDictionary.INSTANCE_COUNTER.getProperty()); - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.TYPE, componentInstDataDefinition.getComponentUid()); - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, componentInstDataDefinition.getCreationTime()); - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, componentInstDataDefinition.getModificationTime()); - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, componentInstDataDefinition.getDescription()); - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, componentInstDataDefinition.getUniqueId()); - addIfExists(map, GraphPropertiesDictionary.POSITION_X, componentInstDataDefinition.getPosX()); - addIfExists(map, GraphPropertiesDictionary.POSITION_Y, componentInstDataDefinition.getPosY()); - addIfExists(map, GraphPropertiesDictionary.NAME, componentInstDataDefinition.getName()); - addIfExists(map, GraphPropertiesDictionary.PROPERTY_COUNTER, componentInstDataDefinition.getPropertyValueCounter()); - addIfExists(map, GraphPropertiesDictionary.ATTRIBUTE_COUNTER, componentInstDataDefinition.getAttributeValueCounter()); - addIfExists(map, GraphPropertiesDictionary.INSTANCE_COUNTER, groupInstanceCounter); - addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, componentInstDataDefinition.getNormalizedName()); - if (componentInstDataDefinition.getOriginType() != null) { - addIfExists(map, GraphPropertiesDictionary.ORIGIN_TYPE, componentInstDataDefinition.getOriginType().getValue()); - } - addIfExists(map, GraphPropertiesDictionary.CUSTOMIZATION_UUID, componentInstDataDefinition.getCustomizationUUID()); - - return map; - } - - @Override - public String getUniqueId() { - return componentInstDataDefinition.getUniqueId(); - } - - public String getName() { - return componentInstDataDefinition.getName(); - } - - @Override - public String getUniqueIdKey() { - return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); - } - - public ComponentInstanceDataDefinition getComponentInstDataDefinition() { - return componentInstDataDefinition; - } - - public void setComponentInstDataDefinition(ComponentInstanceDataDefinition componentInstDataDefinition) { - this.componentInstDataDefinition = componentInstDataDefinition; - } - - @Override - public String toString() { - return "ComponentInstanceData [componentInstDataDefinition=" + componentInstDataDefinition + "]"; - } - - public Integer getGroupInstanceCounter() { - return groupInstanceCounter; - } - - public void setGroupInstanceCounter(Integer componentInstanceCounter) { - this.groupInstanceCounter = componentInstanceCounter; - } - - public Integer increaseAndGetGroupInstanceCounter() { - return ++groupInstanceCounter; - } - + protected Integer groupInstanceCounter; + ComponentInstanceDataDefinition componentInstDataDefinition; + + public ComponentInstanceData() { + super(NodeTypeEnum.ResourceInstance); + this.componentInstDataDefinition = new ComponentInstanceDataDefinition(); + this.groupInstanceCounter = 0; + } + + public ComponentInstanceData(ComponentInstanceDataDefinition componentInstDataDefinition) { + super(NodeTypeEnum.ResourceInstance); + this.componentInstDataDefinition = componentInstDataDefinition; + this.groupInstanceCounter = 0; + } + + public ComponentInstanceData(ComponentInstanceDataDefinition componentInstDataDefinition, Integer groupInstanceCounter) { + super(NodeTypeEnum.ResourceInstance); + this.componentInstDataDefinition = componentInstDataDefinition; + this.groupInstanceCounter = groupInstanceCounter; + } + + public ComponentInstanceData(Map<String, Object> properties) { + this(); + componentInstDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + componentInstDataDefinition.setComponentUid((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + componentInstDataDefinition.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + componentInstDataDefinition.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + componentInstDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + componentInstDataDefinition.setPosX((String) properties.get(GraphPropertiesDictionary.POSITION_X.getProperty())); + componentInstDataDefinition.setPosY((String) properties.get(GraphPropertiesDictionary.POSITION_Y.getProperty())); + componentInstDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + componentInstDataDefinition.setPropertyValueCounter((Integer) properties.get(GraphPropertiesDictionary.PROPERTY_COUNTER.getProperty())); + componentInstDataDefinition.setAttributeValueCounter((Integer) properties.get(GraphPropertiesDictionary.ATTRIBUTE_COUNTER.getProperty())); + componentInstDataDefinition.setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); + componentInstDataDefinition + .setOriginType(OriginTypeEnum.findByValue((String) properties.get(GraphPropertiesDictionary.ORIGIN_TYPE.getProperty()))); + componentInstDataDefinition.setCustomizationUUID((String) properties.get(GraphPropertiesDictionary.CUSTOMIZATION_UUID.getProperty())); + groupInstanceCounter = (Integer) properties.get(GraphPropertiesDictionary.INSTANCE_COUNTER.getProperty()); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.TYPE, componentInstDataDefinition.getComponentUid()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, componentInstDataDefinition.getCreationTime()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, componentInstDataDefinition.getModificationTime()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, componentInstDataDefinition.getDescription()); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, componentInstDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.POSITION_X, componentInstDataDefinition.getPosX()); + addIfExists(map, GraphPropertiesDictionary.POSITION_Y, componentInstDataDefinition.getPosY()); + addIfExists(map, GraphPropertiesDictionary.NAME, componentInstDataDefinition.getName()); + addIfExists(map, GraphPropertiesDictionary.PROPERTY_COUNTER, componentInstDataDefinition.getPropertyValueCounter()); + addIfExists(map, GraphPropertiesDictionary.ATTRIBUTE_COUNTER, componentInstDataDefinition.getAttributeValueCounter()); + addIfExists(map, GraphPropertiesDictionary.INSTANCE_COUNTER, groupInstanceCounter); + addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, componentInstDataDefinition.getNormalizedName()); + if (componentInstDataDefinition.getOriginType() != null) { + addIfExists(map, GraphPropertiesDictionary.ORIGIN_TYPE, componentInstDataDefinition.getOriginType().getValue()); + } + addIfExists(map, GraphPropertiesDictionary.CUSTOMIZATION_UUID, componentInstDataDefinition.getCustomizationUUID()); + return map; + } + + @Override + public String getUniqueId() { + return componentInstDataDefinition.getUniqueId(); + } + + public String getName() { + return componentInstDataDefinition.getName(); + } + + @Override + public String getUniqueIdKey() { + return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); + } + + public ComponentInstanceDataDefinition getComponentInstDataDefinition() { + return componentInstDataDefinition; + } + + public void setComponentInstDataDefinition(ComponentInstanceDataDefinition componentInstDataDefinition) { + this.componentInstDataDefinition = componentInstDataDefinition; + } + + @Override + public String toString() { + return "ComponentInstanceData [componentInstDataDefinition=" + componentInstDataDefinition + "]"; + } + + public Integer getGroupInstanceCounter() { + return groupInstanceCounter; + } + + public void setGroupInstanceCounter(Integer componentInstanceCounter) { + this.groupInstanceCounter = componentInstanceCounter; + } + + public Integer increaseAndGetGroupInstanceCounter() { + return ++groupInstanceCounter; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java index d2612b9db7..0341be73f6 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ComponentMetadataData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,112 +17,110 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionaryExtractor; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public abstract class ComponentMetadataData extends GraphNode { - protected ComponentMetadataDataDefinition metadataDataDefinition; - protected Integer componentInstanceCounter; - - public ComponentMetadataData(NodeTypeEnum label, ComponentMetadataDataDefinition metadataDataDefinition) { - super(label); - this.metadataDataDefinition = metadataDataDefinition; - this.componentInstanceCounter = 0; - } - - public ComponentMetadataData(NodeTypeEnum label, ComponentMetadataDataDefinition metadataDataDefinition, GraphPropertiesDictionaryExtractor extractor) { - this(label, metadataDataDefinition); - metadataDataDefinition.setUniqueId(extractor.getUniqueId()); - metadataDataDefinition.setCreationDate(extractor.getCreationDate()); - metadataDataDefinition.setDescription(extractor.getDescription()); - metadataDataDefinition.setConformanceLevel(extractor.getConformanceLevel()); - metadataDataDefinition.setIcon(extractor.getIcon()); - metadataDataDefinition.setHighestVersion(extractor.isHighestVersion()); - metadataDataDefinition.setLastUpdateDate(extractor.getLastUpdateDate()); - metadataDataDefinition.setName(extractor.getName()); - metadataDataDefinition.setState(extractor.getState()); - metadataDataDefinition.setTags(extractor.getTags()); - metadataDataDefinition.setVersion(extractor.getVersion()); - metadataDataDefinition.setContactId(extractor.getContactId()); - metadataDataDefinition.setUUID(extractor.getUUID()); - metadataDataDefinition.setNormalizedName(extractor.getNormalizedName()); - metadataDataDefinition.setSystemName(extractor.getSystemName()); - metadataDataDefinition.setIsDeleted(extractor.isDeleted()); - metadataDataDefinition.setProjectCode(extractor.getProjectCode()); - metadataDataDefinition.setCsarUUID(extractor.getCsarUuid()); - metadataDataDefinition.setCsarVersion(extractor.getCsarVersion()); - metadataDataDefinition.setImportedToscaChecksum(extractor.getImportedToscaChecksum()); - metadataDataDefinition.setInvariantUUID(extractor.getInvariantUuid()); - componentInstanceCounter = extractor.getInstanceCounter(); - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, metadataDataDefinition.getUniqueId()); - addIfExists(map, GraphPropertiesDictionary.VERSION, metadataDataDefinition.getVersion()); - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, metadataDataDefinition.getCreationDate()); - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, metadataDataDefinition.getDescription()); - addIfExists(map, GraphPropertiesDictionary.CONFORMANCE_LEVEL, metadataDataDefinition.getConformanceLevel()); - addIfExists(map, GraphPropertiesDictionary.ICON, metadataDataDefinition.getIcon()); - addIfExists(map, GraphPropertiesDictionary.IS_HIGHEST_VERSION, metadataDataDefinition.isHighestVersion()); - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, metadataDataDefinition.getLastUpdateDate()); - addIfExists(map, GraphPropertiesDictionary.STATE, metadataDataDefinition.getState()); - addIfExists(map, GraphPropertiesDictionary.TAGS, metadataDataDefinition.getTags()); - addIfExists(map, GraphPropertiesDictionary.CONTACT_ID, metadataDataDefinition.getContactId()); - addIfExists(map, GraphPropertiesDictionary.NAME, metadataDataDefinition.getName()); - addIfExists(map, GraphPropertiesDictionary.UUID, metadataDataDefinition.getUUID()); - addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, metadataDataDefinition.getNormalizedName()); - addIfExists(map, GraphPropertiesDictionary.SYSTEM_NAME, metadataDataDefinition.getSystemName()); - addIfExists(map, GraphPropertiesDictionary.IS_DELETED, metadataDataDefinition.isDeleted()); - addIfExists(map, GraphPropertiesDictionary.INSTANCE_COUNTER, componentInstanceCounter); - addIfExists(map, GraphPropertiesDictionary.PROJECT_CODE, metadataDataDefinition.getProjectCode()); - addIfExists(map, GraphPropertiesDictionary.CSAR_UUID, metadataDataDefinition.getCsarUUID()); - addIfExists(map, GraphPropertiesDictionary.CSAR_VERSION, metadataDataDefinition.getCsarVersion()); - addIfExists(map, GraphPropertiesDictionary.IMPORTED_TOSCA_CHECKSUM, metadataDataDefinition.getImportedToscaChecksum()); - addIfExists(map, GraphPropertiesDictionary.INVARIANT_UUID, metadataDataDefinition.getInvariantUUID()); - return map; - } - - @Override - public String getUniqueId() { - return metadataDataDefinition.getUniqueId(); - } - - public ComponentMetadataDataDefinition getMetadataDataDefinition() { - return metadataDataDefinition; - } - - public void setMetadataDataDefinition(ComponentMetadataDataDefinition metadataDataDefinition) { - this.metadataDataDefinition = metadataDataDefinition; - } - - public Integer getComponentInstanceCounter() { - return componentInstanceCounter; - } - - public void setComponentInstanceCounter(Integer componentInstanceCounter) { - this.componentInstanceCounter = componentInstanceCounter; - } - - public Integer increaseAndGetComponentInstanceCounter() { - return ++componentInstanceCounter; - } - - @Override - public String toString() { - return "ComponentMetadataData [metadataDataDefinition=" + metadataDataDefinition + ", componentInstanceCounter=" + componentInstanceCounter + "]"; - } - + protected ComponentMetadataDataDefinition metadataDataDefinition; + protected Integer componentInstanceCounter; + + public ComponentMetadataData(NodeTypeEnum label, ComponentMetadataDataDefinition metadataDataDefinition) { + super(label); + this.metadataDataDefinition = metadataDataDefinition; + this.componentInstanceCounter = 0; + } + + public ComponentMetadataData(NodeTypeEnum label, ComponentMetadataDataDefinition metadataDataDefinition, + GraphPropertiesDictionaryExtractor extractor) { + this(label, metadataDataDefinition); + metadataDataDefinition.setUniqueId(extractor.getUniqueId()); + metadataDataDefinition.setCreationDate(extractor.getCreationDate()); + metadataDataDefinition.setDescription(extractor.getDescription()); + metadataDataDefinition.setConformanceLevel(extractor.getConformanceLevel()); + metadataDataDefinition.setIcon(extractor.getIcon()); + metadataDataDefinition.setHighestVersion(extractor.isHighestVersion()); + metadataDataDefinition.setLastUpdateDate(extractor.getLastUpdateDate()); + metadataDataDefinition.setName(extractor.getName()); + metadataDataDefinition.setState(extractor.getState()); + metadataDataDefinition.setTags(extractor.getTags()); + metadataDataDefinition.setVersion(extractor.getVersion()); + metadataDataDefinition.setContactId(extractor.getContactId()); + metadataDataDefinition.setUUID(extractor.getUUID()); + metadataDataDefinition.setNormalizedName(extractor.getNormalizedName()); + metadataDataDefinition.setSystemName(extractor.getSystemName()); + metadataDataDefinition.setIsDeleted(extractor.isDeleted()); + metadataDataDefinition.setProjectCode(extractor.getProjectCode()); + metadataDataDefinition.setCsarUUID(extractor.getCsarUuid()); + metadataDataDefinition.setCsarVersion(extractor.getCsarVersion()); + metadataDataDefinition.setImportedToscaChecksum(extractor.getImportedToscaChecksum()); + metadataDataDefinition.setInvariantUUID(extractor.getInvariantUuid()); + componentInstanceCounter = extractor.getInstanceCounter(); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, metadataDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.VERSION, metadataDataDefinition.getVersion()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, metadataDataDefinition.getCreationDate()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, metadataDataDefinition.getDescription()); + addIfExists(map, GraphPropertiesDictionary.CONFORMANCE_LEVEL, metadataDataDefinition.getConformanceLevel()); + addIfExists(map, GraphPropertiesDictionary.ICON, metadataDataDefinition.getIcon()); + addIfExists(map, GraphPropertiesDictionary.IS_HIGHEST_VERSION, metadataDataDefinition.isHighestVersion()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, metadataDataDefinition.getLastUpdateDate()); + addIfExists(map, GraphPropertiesDictionary.STATE, metadataDataDefinition.getState()); + addIfExists(map, GraphPropertiesDictionary.TAGS, metadataDataDefinition.getTags()); + addIfExists(map, GraphPropertiesDictionary.CONTACT_ID, metadataDataDefinition.getContactId()); + addIfExists(map, GraphPropertiesDictionary.NAME, metadataDataDefinition.getName()); + addIfExists(map, GraphPropertiesDictionary.UUID, metadataDataDefinition.getUUID()); + addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, metadataDataDefinition.getNormalizedName()); + addIfExists(map, GraphPropertiesDictionary.SYSTEM_NAME, metadataDataDefinition.getSystemName()); + addIfExists(map, GraphPropertiesDictionary.IS_DELETED, metadataDataDefinition.isDeleted()); + addIfExists(map, GraphPropertiesDictionary.INSTANCE_COUNTER, componentInstanceCounter); + addIfExists(map, GraphPropertiesDictionary.PROJECT_CODE, metadataDataDefinition.getProjectCode()); + addIfExists(map, GraphPropertiesDictionary.CSAR_UUID, metadataDataDefinition.getCsarUUID()); + addIfExists(map, GraphPropertiesDictionary.CSAR_VERSION, metadataDataDefinition.getCsarVersion()); + addIfExists(map, GraphPropertiesDictionary.IMPORTED_TOSCA_CHECKSUM, metadataDataDefinition.getImportedToscaChecksum()); + addIfExists(map, GraphPropertiesDictionary.INVARIANT_UUID, metadataDataDefinition.getInvariantUUID()); + return map; + } + + @Override + public String getUniqueId() { + return metadataDataDefinition.getUniqueId(); + } + + public ComponentMetadataDataDefinition getMetadataDataDefinition() { + return metadataDataDefinition; + } + + public void setMetadataDataDefinition(ComponentMetadataDataDefinition metadataDataDefinition) { + this.metadataDataDefinition = metadataDataDefinition; + } + + public Integer getComponentInstanceCounter() { + return componentInstanceCounter; + } + + public void setComponentInstanceCounter(Integer componentInstanceCounter) { + this.componentInstanceCounter = componentInstanceCounter; + } + + public Integer increaseAndGetComponentInstanceCounter() { + return ++componentInstanceCounter; + } + + @Override + public String toString() { + return "ComponentMetadataData [metadataDataDefinition=" + metadataDataDefinition + ", componentInstanceCounter=" + componentInstanceCounter + + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ConsumerData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ConsumerData.java index e23b134f44..fb514b8948 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ConsumerData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ConsumerData.java @@ -1,5 +1,4 @@ -package org.openecomp.sdc.be.resources.data; -/*- +package org.openecomp.sdc.be.resources.data; /*- * ============LICENSE_START======================================================= * SDC * ================================================================================ @@ -19,15 +18,14 @@ package org.openecomp.sdc.be.resources.data; * ============LICENSE_END========================================================= */ +import java.util.HashMap; +import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class ConsumerData extends GraphNode { private ConsumerDataDefinition consumerDataDefinition; @@ -40,25 +38,19 @@ public class ConsumerData extends GraphNode { public ConsumerData(ConsumerDataDefinition consumerDataDefinition) { super(NodeTypeEnum.ConsumerCredentials); this.consumerDataDefinition = consumerDataDefinition; - } public ConsumerData(Map<String, Object> properties) { super(NodeTypeEnum.ConsumerCredentials); consumerDataDefinition = new ConsumerDataDefinition(); - consumerDataDefinition.setConsumerDetailsLastupdatedtime( - (Long) properties.get(GraphPropertiesDictionary.CONSUMER_DETAILS_LAST_UPDATED_TIME.getProperty())); - consumerDataDefinition.setConsumerLastAuthenticationTime( - (Long) properties.get(GraphPropertiesDictionary.CONSUMER_LAST_AUTHENTICATION_TIME.getProperty())); consumerDataDefinition - .setConsumerName((String) properties.get(GraphPropertiesDictionary.CONSUMER_NAME.getProperty())); - consumerDataDefinition.setConsumerPassword( - (String) properties.get(GraphPropertiesDictionary.CONSUMER_PASSWORD.getProperty())); + .setConsumerDetailsLastupdatedtime((Long) properties.get(GraphPropertiesDictionary.CONSUMER_DETAILS_LAST_UPDATED_TIME.getProperty())); consumerDataDefinition - .setConsumerSalt((String) properties.get(GraphPropertiesDictionary.CONSUMER_SALT.getProperty())); - consumerDataDefinition.setLastModfierAtuid( - (String) properties.get(GraphPropertiesDictionary.LAST_MODIFIER_USER_ID.getProperty())); - + .setConsumerLastAuthenticationTime((Long) properties.get(GraphPropertiesDictionary.CONSUMER_LAST_AUTHENTICATION_TIME.getProperty())); + consumerDataDefinition.setConsumerName((String) properties.get(GraphPropertiesDictionary.CONSUMER_NAME.getProperty())); + consumerDataDefinition.setConsumerPassword((String) properties.get(GraphPropertiesDictionary.CONSUMER_PASSWORD.getProperty())); + consumerDataDefinition.setConsumerSalt((String) properties.get(GraphPropertiesDictionary.CONSUMER_SALT.getProperty())); + consumerDataDefinition.setLastModfierAtuid((String) properties.get(GraphPropertiesDictionary.LAST_MODIFIER_USER_ID.getProperty())); } @Override @@ -79,16 +71,13 @@ public class ConsumerData extends GraphNode { public Map<String, Object> toGraphMap() { Map<String, Object> map = new HashMap<>(); addIfExists(map, GraphPropertiesDictionary.CONSUMER_NAME, this.consumerDataDefinition.getConsumerName()); - addIfExists(map, GraphPropertiesDictionary.CONSUMER_PASSWORD, - this.consumerDataDefinition.getConsumerPassword()); + addIfExists(map, GraphPropertiesDictionary.CONSUMER_PASSWORD, this.consumerDataDefinition.getConsumerPassword()); addIfExists(map, GraphPropertiesDictionary.CONSUMER_SALT, this.consumerDataDefinition.getConsumerSalt()); addIfExists(map, GraphPropertiesDictionary.CONSUMER_LAST_AUTHENTICATION_TIME, - this.consumerDataDefinition.getConsumerLastAuthenticationTime()); + this.consumerDataDefinition.getConsumerLastAuthenticationTime()); addIfExists(map, GraphPropertiesDictionary.CONSUMER_DETAILS_LAST_UPDATED_TIME, - this.consumerDataDefinition.getConsumerDetailsLastupdatedtime()); - addIfExists(map, GraphPropertiesDictionary.LAST_MODIFIER_USER_ID, - this.consumerDataDefinition.getLastModfierAtuid()); - + this.consumerDataDefinition.getConsumerDetailsLastupdatedtime()); + addIfExists(map, GraphPropertiesDictionary.LAST_MODIFIER_USER_ID, this.consumerDataDefinition.getLastModfierAtuid()); return map; } @@ -103,5 +92,3 @@ public class ConsumerData extends GraphNode { return "ConsumerData [consumerDataDefinition=" + consumerDataDefinition + "]"; } } - - diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DAOArtifactData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DAOArtifactData.java index 2b79c2d79f..87bae33a1c 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DAOArtifactData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DAOArtifactData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,79 +17,70 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; import com.datastax.driver.mapping.annotations.Transient; +import java.nio.ByteBuffer; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import java.nio.ByteBuffer; - @Getter @NoArgsConstructor @Table(keyspace = "sdcartifact", name = "resources") public class DAOArtifactData { - public static final String RRESOURCE_ID_FIELD = "resourceId"; - - public static final String SERVICE_NAME_FIELD = "serviceName"; - public static final String SERVICE_VERSION_FIELD = "serviceVersion"; - public static final String ARTIFACT_NAME_FIELD = "artifactName"; - - public static final String delim = ":"; - - @PartitionKey - @Column(name = "id") - @Setter - private String id; - - /* - * Base64 encoded Artifact file data - */ - - @Column - private ByteBuffer data; - - - public DAOArtifactData(String id) { - - this.id = id; - } - - public DAOArtifactData(String artifactId, byte[] data) { - super(); - this.id = artifactId; - if (data != null) { - this.data = ByteBuffer.wrap(data.clone()); - // this.data = data.clone(); - } - - } - - @Transient - public byte[] getDataAsArray() { - // return data; - if (data != null) { - return data.array(); - } - return null; - } - - public void setDataAsArray(byte[] data) { - if (data != null) { - // this.data = data.clone(); - this.data = ByteBuffer.wrap(data.clone()); - } - } - public void setData(ByteBuffer data) { - if (data != null) { - // this.data = data.clone(); - this.data = data.duplicate(); - } - } + public static final String RRESOURCE_ID_FIELD = "resourceId"; + public static final String SERVICE_NAME_FIELD = "serviceName"; + public static final String SERVICE_VERSION_FIELD = "serviceVersion"; + public static final String ARTIFACT_NAME_FIELD = "artifactName"; + public static final String delim = ":"; + @PartitionKey + @Column(name = "id") + @Setter + private String id; + /* + * Base64 encoded Artifact file data + */ + @Column + private ByteBuffer data; + + public DAOArtifactData(String id) { + this.id = id; + } + + public DAOArtifactData(String artifactId, byte[] data) { + super(); + this.id = artifactId; + if (data != null) { + this.data = ByteBuffer.wrap(data.clone()); + // this.data = data.clone(); + } + } + + @Transient + public byte[] getDataAsArray() { + // return data; + if (data != null) { + return data.array(); + } + return null; + } + + public void setDataAsArray(byte[] data) { + if (data != null) { + // this.data = data.clone(); + this.data = ByteBuffer.wrap(data.clone()); + } + } + + public void setData(ByteBuffer data) { + if (data != null) { + // this.data = data.clone(); + this.data = data.duplicate(); + } + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DataTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DataTypeData.java index 897c24ff5b..95b22a8ac3 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DataTypeData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DataTypeData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,90 +17,67 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class DataTypeData extends GraphNode { - DataTypeDataDefinition dataTypeDataDefinition; - - public DataTypeData() { - super(NodeTypeEnum.DataType); - dataTypeDataDefinition = new DataTypeDataDefinition(); - } - - public DataTypeData(DataTypeDataDefinition dataTypeDataDefinition) { - super(NodeTypeEnum.DataType); - this.dataTypeDataDefinition = dataTypeDataDefinition; - // this.constraints = constraints; - } - - public DataTypeData(Map<String, Object> properties) { - - this(); - - dataTypeDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - dataTypeDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - - dataTypeDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - - dataTypeDataDefinition - .setDerivedFromName((String) properties.get(GraphPropertiesDictionary.DERIVED_FROM.getProperty())); - - dataTypeDataDefinition - .setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - dataTypeDataDefinition - .setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, dataTypeDataDefinition.getUniqueId()); - - addIfExists(map, GraphPropertiesDictionary.NAME, dataTypeDataDefinition.getName()); - - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, dataTypeDataDefinition.getDescription()); - - addIfExists(map, GraphPropertiesDictionary.DERIVED_FROM, dataTypeDataDefinition.getDerivedFromName()); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, dataTypeDataDefinition.getCreationTime()); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, dataTypeDataDefinition.getModificationTime()); - - return map; - } - - public DataTypeDataDefinition getDataTypeDataDefinition() { - return dataTypeDataDefinition; - } - - public void setDataTypeDataDefinition(DataTypeDataDefinition dataTypeDataDefinition) { - this.dataTypeDataDefinition = dataTypeDataDefinition; - } - - @Override - public String toString() { - return "DataTypeData [dataTypeDataDefinition=" + dataTypeDataDefinition + "]"; - } - - @Override - public String getUniqueId() { - return this.dataTypeDataDefinition.getUniqueId(); - } - + DataTypeDataDefinition dataTypeDataDefinition; + + public DataTypeData() { + super(NodeTypeEnum.DataType); + dataTypeDataDefinition = new DataTypeDataDefinition(); + } + + public DataTypeData(DataTypeDataDefinition dataTypeDataDefinition) { + super(NodeTypeEnum.DataType); + this.dataTypeDataDefinition = dataTypeDataDefinition; + // this.constraints = constraints; + } + + public DataTypeData(Map<String, Object> properties) { + this(); + dataTypeDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + dataTypeDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + dataTypeDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + dataTypeDataDefinition.setDerivedFromName((String) properties.get(GraphPropertiesDictionary.DERIVED_FROM.getProperty())); + dataTypeDataDefinition.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + dataTypeDataDefinition.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, dataTypeDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.NAME, dataTypeDataDefinition.getName()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, dataTypeDataDefinition.getDescription()); + addIfExists(map, GraphPropertiesDictionary.DERIVED_FROM, dataTypeDataDefinition.getDerivedFromName()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, dataTypeDataDefinition.getCreationTime()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, dataTypeDataDefinition.getModificationTime()); + return map; + } + + public DataTypeDataDefinition getDataTypeDataDefinition() { + return dataTypeDataDefinition; + } + + public void setDataTypeDataDefinition(DataTypeDataDefinition dataTypeDataDefinition) { + this.dataTypeDataDefinition = dataTypeDataDefinition; + } + + @Override + public String toString() { + return "DataTypeData [dataTypeDataDefinition=" + dataTypeDataDefinition + "]"; + } + + @Override + public String getUniqueId() { + return this.dataTypeDataDefinition.getUniqueId(); + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/EntryData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/EntryData.java index a3229bf88a..7df9545b67 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/EntryData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/EntryData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,36 +17,34 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import java.util.Map; public class EntryData<K, V> implements Map.Entry<K, V> { - private final K key; - private V value; - - public EntryData(K key, V value) { - this.key = key; - this.value = value; - } - - @Override - public K getKey() { - return key; - } - - @Override - public V getValue() { - return value; - } - - @Override - public V setValue(V value) { - V old = this.value; - this.value = value; - return old; - } - + private final K key; + private V value; + + public EntryData(K key, V value) { + this.key = key; + this.value = value; + } + + @Override + public K getKey() { + return key; + } + + @Override + public V getValue() { + return value; + } + + @Override + public V setValue(V value) { + V old = this.value; + this.value = value; + return old; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GraphNodeLock.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GraphNodeLock.java index a7981edcde..ba84d67471 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GraphNodeLock.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GraphNodeLock.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,63 +17,57 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class GraphNodeLock extends GraphNode { - private String uniqueId; - private Long time; - - public GraphNodeLock() { - super(NodeTypeEnum.LockNode); - time = System.currentTimeMillis(); - } - - public GraphNodeLock(String uniqueId) { - this(); - this.uniqueId = uniqueId; - } - - public GraphNodeLock(Map<String, Object> properties) { - super(NodeTypeEnum.LockNode); - - setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - setTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - } - - @Override - public String getUniqueId() { - return uniqueId; - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, time); - return map; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public Long getTime() { - return time; - } - - public void setTime(Long time) { - this.time = time; - } - + private String uniqueId; + private Long time; + + public GraphNodeLock() { + super(NodeTypeEnum.LockNode); + time = System.currentTimeMillis(); + } + + public GraphNodeLock(String uniqueId) { + this(); + this.uniqueId = uniqueId; + } + + public GraphNodeLock(Map<String, Object> properties) { + super(NodeTypeEnum.LockNode); + setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + setTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + } + + @Override + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, time); + return map; + } + + public Long getTime() { + return time; + } + + public void setTime(Long time) { + this.time = time; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupData.java index 54d55d2645..63f6651e19 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,81 +17,71 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class GroupData extends GraphNode { - GroupDataDefinition groupDataDefinition; - - public GroupData() { - super(NodeTypeEnum.Group); - groupDataDefinition = new GroupDataDefinition(); - } - - public GroupData(GroupDataDefinition groupDataDefinition) { - super(NodeTypeEnum.Group); - this.groupDataDefinition = groupDataDefinition; - } - - public GroupData(Map<String, Object> properties) { - - super(NodeTypeEnum.Group); - - groupDataDefinition = new GroupDataDefinition(); - - groupDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - groupDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - groupDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - groupDataDefinition.setVersion((String) properties.get(GraphPropertiesDictionary.VERSION.getProperty())); - groupDataDefinition - .setInvariantUUID((String) properties.get(GraphPropertiesDictionary.INVARIANT_UUID.getProperty())); - groupDataDefinition.setGroupUUID((String) properties.get(GraphPropertiesDictionary.GROUP_UUID.getProperty())); - groupDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - groupDataDefinition.setPropertyValueCounter( - (Integer) properties.get(GraphPropertiesDictionary.PROPERTY_COUNTER.getProperty())); - - } - - @Override - public String getUniqueId() { - return groupDataDefinition.getUniqueId(); - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - addIfExists(map, GraphPropertiesDictionary.NAME, groupDataDefinition.getName()); - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, groupDataDefinition.getUniqueId()); - addIfExists(map, GraphPropertiesDictionary.TYPE, groupDataDefinition.getType()); - addIfExists(map, GraphPropertiesDictionary.VERSION, groupDataDefinition.getVersion()); - addIfExists(map, GraphPropertiesDictionary.INVARIANT_UUID, groupDataDefinition.getInvariantUUID()); - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, groupDataDefinition.getDescription()); - addIfExists(map, GraphPropertiesDictionary.PROPERTY_COUNTER, groupDataDefinition.getPropertyValueCounter()); - addIfExists(map, GraphPropertiesDictionary.GROUP_UUID, groupDataDefinition.getGroupUUID()); - - return map; - } - - public GroupDataDefinition getGroupDataDefinition() { - return groupDataDefinition; - } - - public void setGroupDataDefinition(GroupDataDefinition groupDataDefinition) { - this.groupDataDefinition = groupDataDefinition; - } - - @Override - public String toString() { - return "GroupData [ " + groupDataDefinition.toString() + "]"; - } + GroupDataDefinition groupDataDefinition; + + public GroupData() { + super(NodeTypeEnum.Group); + groupDataDefinition = new GroupDataDefinition(); + } + + public GroupData(GroupDataDefinition groupDataDefinition) { + super(NodeTypeEnum.Group); + this.groupDataDefinition = groupDataDefinition; + } + + public GroupData(Map<String, Object> properties) { + super(NodeTypeEnum.Group); + groupDataDefinition = new GroupDataDefinition(); + groupDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + groupDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + groupDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + groupDataDefinition.setVersion((String) properties.get(GraphPropertiesDictionary.VERSION.getProperty())); + groupDataDefinition.setInvariantUUID((String) properties.get(GraphPropertiesDictionary.INVARIANT_UUID.getProperty())); + groupDataDefinition.setGroupUUID((String) properties.get(GraphPropertiesDictionary.GROUP_UUID.getProperty())); + groupDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + groupDataDefinition.setPropertyValueCounter((Integer) properties.get(GraphPropertiesDictionary.PROPERTY_COUNTER.getProperty())); + } + + @Override + public String getUniqueId() { + return groupDataDefinition.getUniqueId(); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.NAME, groupDataDefinition.getName()); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, groupDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.TYPE, groupDataDefinition.getType()); + addIfExists(map, GraphPropertiesDictionary.VERSION, groupDataDefinition.getVersion()); + addIfExists(map, GraphPropertiesDictionary.INVARIANT_UUID, groupDataDefinition.getInvariantUUID()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, groupDataDefinition.getDescription()); + addIfExists(map, GraphPropertiesDictionary.PROPERTY_COUNTER, groupDataDefinition.getPropertyValueCounter()); + addIfExists(map, GraphPropertiesDictionary.GROUP_UUID, groupDataDefinition.getGroupUUID()); + return map; + } + + public GroupDataDefinition getGroupDataDefinition() { + return groupDataDefinition; + } + + public void setGroupDataDefinition(GroupDataDefinition groupDataDefinition) { + this.groupDataDefinition = groupDataDefinition; + } + + @Override + public String toString() { + return "GroupData [ " + groupDataDefinition.toString() + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupInstanceData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupInstanceData.java index 88ff20e730..489bfec4c4 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupInstanceData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupInstanceData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,109 +17,83 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - - public class GroupInstanceData extends GraphNode { - - GroupInstanceDataDefinition groupDataDefinition; - - public GroupInstanceData() { - super(NodeTypeEnum.GroupInstance); - this.groupDataDefinition = new GroupInstanceDataDefinition(); - } - - public GroupInstanceData(GroupInstanceDataDefinition groupDataDefinition) { - super(NodeTypeEnum.GroupInstance); - this.groupDataDefinition = groupDataDefinition; - } - - public GroupInstanceData(Map<String, Object> properties) { - - this(); - - groupDataDefinition - .setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - groupDataDefinition - .setGroupUid((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - groupDataDefinition - .setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - groupDataDefinition - .setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - groupDataDefinition - .setPosX((String) properties.get(GraphPropertiesDictionary.POSITION_X.getProperty())); - groupDataDefinition - .setPosY((String) properties.get(GraphPropertiesDictionary.POSITION_Y.getProperty())); - groupDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - groupDataDefinition.setPropertyValueCounter( - (Integer) properties.get(GraphPropertiesDictionary.PROPERTY_COUNTER.getProperty())); - - groupDataDefinition - .setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); - - groupDataDefinition - .setCustomizationUUID((String) properties.get(GraphPropertiesDictionary.CUSTOMIZATION_UUID.getProperty())); - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.TYPE, groupDataDefinition.getGroupUid()); - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, groupDataDefinition.getCreationTime()); - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, groupDataDefinition.getModificationTime()); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, groupDataDefinition.getUniqueId()); - addIfExists(map, GraphPropertiesDictionary.POSITION_X, groupDataDefinition.getPosX()); - addIfExists(map, GraphPropertiesDictionary.POSITION_Y, groupDataDefinition.getPosY()); - addIfExists(map, GraphPropertiesDictionary.NAME, groupDataDefinition.getName()); - addIfExists(map, GraphPropertiesDictionary.PROPERTY_COUNTER, - groupDataDefinition.getPropertyValueCounter()); - - addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, groupDataDefinition.getNormalizedName()); - - addIfExists(map, GraphPropertiesDictionary.CUSTOMIZATION_UUID, groupDataDefinition.getCustomizationUUID()); - - return map; - } - - @Override - public String getUniqueId() { - return groupDataDefinition.getUniqueId(); - } - - public String getName() { - return groupDataDefinition.getName(); - } - - @Override - public String getUniqueIdKey() { - return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); - } - - public GroupInstanceDataDefinition getGroupDataDefinition() { - return groupDataDefinition; - } - - public void setComponentInstDataDefinition(GroupInstanceDataDefinition groupDataDefinition) { - this.groupDataDefinition = groupDataDefinition; - } - - @Override - public String toString() { - return "GroupInstanceData [groupInstDataDefinition=" + groupDataDefinition + "]"; - } - + GroupInstanceDataDefinition groupDataDefinition; + + public GroupInstanceData() { + super(NodeTypeEnum.GroupInstance); + this.groupDataDefinition = new GroupInstanceDataDefinition(); + } + + public GroupInstanceData(GroupInstanceDataDefinition groupDataDefinition) { + super(NodeTypeEnum.GroupInstance); + this.groupDataDefinition = groupDataDefinition; + } + + public GroupInstanceData(Map<String, Object> properties) { + this(); + groupDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + groupDataDefinition.setGroupUid((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + groupDataDefinition.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + groupDataDefinition.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + groupDataDefinition.setPosX((String) properties.get(GraphPropertiesDictionary.POSITION_X.getProperty())); + groupDataDefinition.setPosY((String) properties.get(GraphPropertiesDictionary.POSITION_Y.getProperty())); + groupDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + groupDataDefinition.setPropertyValueCounter((Integer) properties.get(GraphPropertiesDictionary.PROPERTY_COUNTER.getProperty())); + groupDataDefinition.setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); + groupDataDefinition.setCustomizationUUID((String) properties.get(GraphPropertiesDictionary.CUSTOMIZATION_UUID.getProperty())); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.TYPE, groupDataDefinition.getGroupUid()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, groupDataDefinition.getCreationTime()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, groupDataDefinition.getModificationTime()); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, groupDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.POSITION_X, groupDataDefinition.getPosX()); + addIfExists(map, GraphPropertiesDictionary.POSITION_Y, groupDataDefinition.getPosY()); + addIfExists(map, GraphPropertiesDictionary.NAME, groupDataDefinition.getName()); + addIfExists(map, GraphPropertiesDictionary.PROPERTY_COUNTER, groupDataDefinition.getPropertyValueCounter()); + addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, groupDataDefinition.getNormalizedName()); + addIfExists(map, GraphPropertiesDictionary.CUSTOMIZATION_UUID, groupDataDefinition.getCustomizationUUID()); + return map; + } + + @Override + public String getUniqueId() { + return groupDataDefinition.getUniqueId(); + } + + public String getName() { + return groupDataDefinition.getName(); + } + + @Override + public String getUniqueIdKey() { + return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); + } + + public GroupInstanceDataDefinition getGroupDataDefinition() { + return groupDataDefinition; + } + + public void setComponentInstDataDefinition(GroupInstanceDataDefinition groupDataDefinition) { + this.groupDataDefinition = groupDataDefinition; + } + + @Override + public String toString() { + return "GroupInstanceData [groupInstDataDefinition=" + groupDataDefinition + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupTypeData.java index 860358ce22..9fde326a43 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupTypeData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/GroupTypeData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,120 +17,87 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.datatypes.elements.GroupTypeDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; - import java.lang.reflect.Type; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; +import org.openecomp.sdc.be.datatypes.elements.GroupTypeDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; public class GroupTypeData extends GraphNode { - private static Type listType = new TypeToken<List<String>>() { - }.getType(); - private static Type mapType = new TypeToken<HashMap<String, String>>() { - }.getType(); - - private GroupTypeDataDefinition groupTypeDataDefinition; - - private GroupTypeData() { - super(NodeTypeEnum.GroupType); - groupTypeDataDefinition = new GroupTypeDataDefinition(); - } - - public GroupTypeData(GroupTypeDataDefinition groupTypeDataDefinition) { - super(NodeTypeEnum.GroupType); - this.groupTypeDataDefinition = groupTypeDataDefinition; - } - - public GroupTypeData(Map<String, Object> properties) { - - this(); - groupTypeDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - groupTypeDataDefinition.setIcon((String) properties.get(GraphPropertiesDictionary.ICON.getProperty())); - groupTypeDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - groupTypeDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - - groupTypeDataDefinition.setVersion((String) properties.get(GraphPropertiesDictionary.VERSION.getProperty())); - - if (properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty()) != null) { - groupTypeDataDefinition.setHighestVersion( - (boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty())); - } - - groupTypeDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - - List<String> members = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.MEMBERS.getProperty()), listType); - groupTypeDataDefinition.setMembers(members); - - HashMap<String, String> metatdata = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.METADATA.getProperty()), mapType); - groupTypeDataDefinition.setMetadata(metatdata); - - groupTypeDataDefinition - .setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - groupTypeDataDefinition - .setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, groupTypeDataDefinition.getUniqueId()); - - addIfExists(map, GraphPropertiesDictionary.TYPE, groupTypeDataDefinition.getType()); - - addIfExists(map, GraphPropertiesDictionary.NAME, groupTypeDataDefinition.getName()); - - addIfExists(map, GraphPropertiesDictionary.ICON, groupTypeDataDefinition.getIcon()); - - addIfExists(map, GraphPropertiesDictionary.VERSION, groupTypeDataDefinition.getVersion()); - - addIfExists(map, GraphPropertiesDictionary.IS_HIGHEST_VERSION, groupTypeDataDefinition.isHighestVersion()); - - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, groupTypeDataDefinition.getDescription()); - - addIfExists(map, GraphPropertiesDictionary.METADATA, groupTypeDataDefinition.getMetadata()); - - addIfExists(map, GraphPropertiesDictionary.MEMBERS, groupTypeDataDefinition.getMembers()); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, groupTypeDataDefinition.getCreationTime()); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, groupTypeDataDefinition.getModificationTime()); - - return map; - } - - public GroupTypeDataDefinition getGroupTypeDataDefinition() { - return groupTypeDataDefinition; - } - - public void setGroupTypeDataDefinition(GroupTypeDataDefinition groupTypeDataDefinition) { - this.groupTypeDataDefinition = groupTypeDataDefinition; - } - - @Override - public String toString() { - return "GroupTypeData [groupTypeDataDefinition=" + groupTypeDataDefinition + "]"; - } - - @Override - public String getUniqueId() { - return this.groupTypeDataDefinition.getUniqueId(); - } - + private static Type listType = new TypeToken<List<String>>() { + }.getType(); + private static Type mapType = new TypeToken<HashMap<String, String>>() { + }.getType(); + private GroupTypeDataDefinition groupTypeDataDefinition; + + private GroupTypeData() { + super(NodeTypeEnum.GroupType); + groupTypeDataDefinition = new GroupTypeDataDefinition(); + } + + public GroupTypeData(GroupTypeDataDefinition groupTypeDataDefinition) { + super(NodeTypeEnum.GroupType); + this.groupTypeDataDefinition = groupTypeDataDefinition; + } + + public GroupTypeData(Map<String, Object> properties) { + this(); + groupTypeDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + groupTypeDataDefinition.setIcon((String) properties.get(GraphPropertiesDictionary.ICON.getProperty())); + groupTypeDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + groupTypeDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + groupTypeDataDefinition.setVersion((String) properties.get(GraphPropertiesDictionary.VERSION.getProperty())); + if (properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty()) != null) { + groupTypeDataDefinition.setHighestVersion((boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty())); + } + groupTypeDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + List<String> members = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.MEMBERS.getProperty()), listType); + groupTypeDataDefinition.setMembers(members); + HashMap<String, String> metatdata = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.METADATA.getProperty()), mapType); + groupTypeDataDefinition.setMetadata(metatdata); + groupTypeDataDefinition.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + groupTypeDataDefinition.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, groupTypeDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.TYPE, groupTypeDataDefinition.getType()); + addIfExists(map, GraphPropertiesDictionary.NAME, groupTypeDataDefinition.getName()); + addIfExists(map, GraphPropertiesDictionary.ICON, groupTypeDataDefinition.getIcon()); + addIfExists(map, GraphPropertiesDictionary.VERSION, groupTypeDataDefinition.getVersion()); + addIfExists(map, GraphPropertiesDictionary.IS_HIGHEST_VERSION, groupTypeDataDefinition.isHighestVersion()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, groupTypeDataDefinition.getDescription()); + addIfExists(map, GraphPropertiesDictionary.METADATA, groupTypeDataDefinition.getMetadata()); + addIfExists(map, GraphPropertiesDictionary.MEMBERS, groupTypeDataDefinition.getMembers()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, groupTypeDataDefinition.getCreationTime()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, groupTypeDataDefinition.getModificationTime()); + return map; + } + + public GroupTypeDataDefinition getGroupTypeDataDefinition() { + return groupTypeDataDefinition; + } + + public void setGroupTypeDataDefinition(GroupTypeDataDefinition groupTypeDataDefinition) { + this.groupTypeDataDefinition = groupTypeDataDefinition; + } + + @Override + public String toString() { + return "GroupTypeData [groupTypeDataDefinition=" + groupTypeDataDefinition + "]"; + } + + @Override + public String getUniqueId() { + return this.groupTypeDataDefinition.getUniqueId(); + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/HeatParameterData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/HeatParameterData.java index fc27393c80..cec56a8363 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/HeatParameterData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/HeatParameterData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,156 +17,141 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.utils.Constants; import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.math.BigDecimal; -import java.util.HashMap; -import java.util.Map; - public class HeatParameterData extends GraphNode { - private HeatParameterDataDefinition heatDataDefinition; - - public HeatParameterData() { - super(NodeTypeEnum.HeatParameter); - heatDataDefinition = new HeatParameterDataDefinition(); - } - - public HeatParameterData(HeatParameterDataDefinition heatDataDef) { - super(NodeTypeEnum.HeatParameter); - this.heatDataDefinition = heatDataDef; - } - - public HeatParameterData(Map<String, Object> properties) { - this(); - - heatDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - heatDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - String type = (String) properties.get(GraphPropertiesDictionary.TYPE.getProperty()); - heatDataDefinition.setType(type); - - String description = (String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty()); - if (Constants.GRAPH_EMPTY_VALUE.equals(description)) { - heatDataDefinition.setDescription(null); - } else { - heatDataDefinition.setDescription(description); - } - - String defaultValue = (String) properties.get(GraphPropertiesDictionary.DEFAULT_VALUE.getProperty()); - if (Constants.GRAPH_EMPTY_VALUE.equals(defaultValue)) { - heatDataDefinition.setDefaultValue(null); - } else { - heatDataDefinition.setDefaultValue(getValue(type, defaultValue)); - } - - String value = (String) properties.get(GraphPropertiesDictionary.VALUE.getProperty()); - if (Constants.GRAPH_EMPTY_VALUE.equals(value)) { - heatDataDefinition.setCurrentValue(null); - } else { - heatDataDefinition.setCurrentValue(getValue(type, value)); - } - - } - - private String getValue(String type, String value) { - if (Constants.GRAPH_EMPTY_VALUE.equals(value)) { - return value; - } - if ("number".equals(type)) { - return new BigDecimal(value).toPlainString(); - } - return value; - } - - public HeatParameterDataDefinition getHeatDataDefinition() { - return heatDataDefinition; - } - - public void setHeatDataDefinition(HeatParameterDataDefinition heatDataDefinition) { - this.heatDataDefinition = heatDataDefinition; - } - - public String getName() { - return heatDataDefinition.getName(); - } - - public void setName(String name) { - heatDataDefinition.setName(name); - } - - public String getType() { - return heatDataDefinition.getType(); - } - - public void setType(String type) { - heatDataDefinition.setType(type); - } - - public String getDescription() { - return heatDataDefinition.getDescription(); - } - - public void setDescription(String description) { - heatDataDefinition.setDescription(description); - } - - public String getCurrentValue() { - return heatDataDefinition.getCurrentValue(); - } - - public void setCurrentValue(String currentValue) { - heatDataDefinition.setCurrentValue(currentValue); - } - - public String getDefaultValue() { - return heatDataDefinition.getDefaultValue(); - } - - public void setDefaultValue(String defaultValue) { - heatDataDefinition.setDefaultValue(defaultValue); - } - - @Override - public String getUniqueId() { - return heatDataDefinition.getUniqueId(); - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, getUniqueId()); - - addIfExists(map, GraphPropertiesDictionary.NAME, getName()); - - addIfExists(map, GraphPropertiesDictionary.TYPE, getType()); - - String description = getDescription(); - if (description == null) { - description = Constants.GRAPH_EMPTY_VALUE; - } - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, description); - - String defaultVal = getDefaultValue(); - if (defaultVal == null) { - defaultVal = Constants.GRAPH_EMPTY_VALUE; - } - addIfExists(map, GraphPropertiesDictionary.DEFAULT_VALUE, getValue(getType(), defaultVal)); - - String currentVal = getCurrentValue(); - if (currentVal == null) { - currentVal = Constants.GRAPH_EMPTY_VALUE; - } - - addIfExists(map, GraphPropertiesDictionary.VALUE, getValue(getType(), currentVal)); - return map; - } - + private HeatParameterDataDefinition heatDataDefinition; + + public HeatParameterData() { + super(NodeTypeEnum.HeatParameter); + heatDataDefinition = new HeatParameterDataDefinition(); + } + + public HeatParameterData(HeatParameterDataDefinition heatDataDef) { + super(NodeTypeEnum.HeatParameter); + this.heatDataDefinition = heatDataDef; + } + + public HeatParameterData(Map<String, Object> properties) { + this(); + heatDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + heatDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + String type = (String) properties.get(GraphPropertiesDictionary.TYPE.getProperty()); + heatDataDefinition.setType(type); + String description = (String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty()); + if (Constants.GRAPH_EMPTY_VALUE.equals(description)) { + heatDataDefinition.setDescription(null); + } else { + heatDataDefinition.setDescription(description); + } + String defaultValue = (String) properties.get(GraphPropertiesDictionary.DEFAULT_VALUE.getProperty()); + if (Constants.GRAPH_EMPTY_VALUE.equals(defaultValue)) { + heatDataDefinition.setDefaultValue(null); + } else { + heatDataDefinition.setDefaultValue(getValue(type, defaultValue)); + } + String value = (String) properties.get(GraphPropertiesDictionary.VALUE.getProperty()); + if (Constants.GRAPH_EMPTY_VALUE.equals(value)) { + heatDataDefinition.setCurrentValue(null); + } else { + heatDataDefinition.setCurrentValue(getValue(type, value)); + } + } + + private String getValue(String type, String value) { + if (Constants.GRAPH_EMPTY_VALUE.equals(value)) { + return value; + } + if ("number".equals(type)) { + return new BigDecimal(value).toPlainString(); + } + return value; + } + + public HeatParameterDataDefinition getHeatDataDefinition() { + return heatDataDefinition; + } + + public void setHeatDataDefinition(HeatParameterDataDefinition heatDataDefinition) { + this.heatDataDefinition = heatDataDefinition; + } + + public String getName() { + return heatDataDefinition.getName(); + } + + public void setName(String name) { + heatDataDefinition.setName(name); + } + + public String getType() { + return heatDataDefinition.getType(); + } + + public void setType(String type) { + heatDataDefinition.setType(type); + } + + public String getDescription() { + return heatDataDefinition.getDescription(); + } + + public void setDescription(String description) { + heatDataDefinition.setDescription(description); + } + + public String getCurrentValue() { + return heatDataDefinition.getCurrentValue(); + } + + public void setCurrentValue(String currentValue) { + heatDataDefinition.setCurrentValue(currentValue); + } + + public String getDefaultValue() { + return heatDataDefinition.getDefaultValue(); + } + + public void setDefaultValue(String defaultValue) { + heatDataDefinition.setDefaultValue(defaultValue); + } + + @Override + public String getUniqueId() { + return heatDataDefinition.getUniqueId(); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.NAME, getName()); + addIfExists(map, GraphPropertiesDictionary.TYPE, getType()); + String description = getDescription(); + if (description == null) { + description = Constants.GRAPH_EMPTY_VALUE; + } + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, description); + String defaultVal = getDefaultValue(); + if (defaultVal == null) { + defaultVal = Constants.GRAPH_EMPTY_VALUE; + } + addIfExists(map, GraphPropertiesDictionary.DEFAULT_VALUE, getValue(getType(), defaultVal)); + String currentVal = getCurrentValue(); + if (currentVal == null) { + currentVal = Constants.GRAPH_EMPTY_VALUE; + } + addIfExists(map, GraphPropertiesDictionary.VALUE, getValue(getType(), currentVal)); + return map; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/HeatParameterValueData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/HeatParameterValueData.java index 71f8f46050..db24df0be6 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/HeatParameterValueData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/HeatParameterValueData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,75 +17,65 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.utils.Constants; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class HeatParameterValueData extends GraphNode { - public HeatParameterValueData() { - super(NodeTypeEnum.HeatParameterValue); - } - - public HeatParameterValueData(Map<String, Object> properties) { - this(); - - this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - String value = (String) properties.get(GraphPropertiesDictionary.VALUE.getProperty()); - if (Constants.GRAPH_EMPTY_VALUE.equals(value)) { - this.setValue(null); - } else { - this.setValue(value); - } - - } - - private String uniqueId; - - private String value; - - @Override - public String getUniqueId() { - return uniqueId; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); - - String updatedValue = value; - if (updatedValue == null) { - updatedValue = Constants.GRAPH_EMPTY_VALUE; - } - addIfExists(map, GraphPropertiesDictionary.VALUE, updatedValue); - - return map; - } - - @Override - public String toString() { - return "HeatParameterValueData [uniqueId=" + uniqueId + ", value=" + value + "]"; - } - + private String uniqueId; + private String value; + + public HeatParameterValueData() { + super(NodeTypeEnum.HeatParameterValue); + } + public HeatParameterValueData(Map<String, Object> properties) { + this(); + this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + String value = (String) properties.get(GraphPropertiesDictionary.VALUE.getProperty()); + if (Constants.GRAPH_EMPTY_VALUE.equals(value)) { + this.setValue(null); + } else { + this.setValue(value); + } + } + + @Override + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); + String updatedValue = value; + if (updatedValue == null) { + updatedValue = Constants.GRAPH_EMPTY_VALUE; + } + addIfExists(map, GraphPropertiesDictionary.VALUE, updatedValue); + return map; + } + + @Override + public String toString() { + return "HeatParameterValueData [uniqueId=" + uniqueId + ", value=" + value + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InputValueData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InputValueData.java index 3888c78d59..523aa0140d 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InputValueData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InputValueData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,130 +17,109 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.utils.Constants; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - public class InputValueData extends GraphNode { - private String uniqueId; - - private String value; - - private String type; - - private Boolean hidden; - - private Long creationTime; - - private Long modificationTime; - - public InputValueData() { - super(NodeTypeEnum.InputValue); - } - - public InputValueData(Map<String, Object> properties) { - this(); - - this.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - - String updatedValue = (String) properties.get(GraphPropertiesDictionary.VALUE.getProperty()); - if (Constants.GRAPH_EMPTY_VALUE.equals(updatedValue)) { - this.setValue(null); - } else { - this.setValue(updatedValue); - } - - this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - this.setHidden((Boolean) properties.get(GraphPropertiesDictionary.HIDDEN.getProperty())); - - this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - } - - @Override - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public Long getCreationTime() { - return creationTime; - } - - public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; - } - - public Long getModificationTime() { - return modificationTime; - } - - public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); - - addIfExists(map, GraphPropertiesDictionary.TYPE, type); - - addIfExists(map, GraphPropertiesDictionary.HIDDEN, hidden); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); - - String updatedValue = Objects.isNull(value) ? Constants.GRAPH_EMPTY_VALUE : value; - addIfExists(map, GraphPropertiesDictionary.VALUE, updatedValue); - return map; - } - - @Override - public String toString() { - return "InputValueData [uniqueId=" + uniqueId + ", hidden=" + hidden + ", type=" + type + ", creationTime=" - + creationTime + ", value=" + value + ", modificationTime=" + modificationTime + "]"; - } - - public Boolean isHidden() { - return hidden; - } - - public void setHidden(Boolean hidden) { - this.hidden = hidden; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } + private String uniqueId; + private String value; + private String type; + private Boolean hidden; + private Long creationTime; + private Long modificationTime; + + public InputValueData() { + super(NodeTypeEnum.InputValue); + } + + public InputValueData(Map<String, Object> properties) { + this(); + this.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + String updatedValue = (String) properties.get(GraphPropertiesDictionary.VALUE.getProperty()); + if (Constants.GRAPH_EMPTY_VALUE.equals(updatedValue)) { + this.setValue(null); + } else { + this.setValue(updatedValue); + } + this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + this.setHidden((Boolean) properties.get(GraphPropertiesDictionary.HIDDEN.getProperty())); + this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + } + + @Override + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public Long getCreationTime() { + return creationTime; + } + + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } + + public Long getModificationTime() { + return modificationTime; + } + + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); + addIfExists(map, GraphPropertiesDictionary.TYPE, type); + addIfExists(map, GraphPropertiesDictionary.HIDDEN, hidden); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); + String updatedValue = Objects.isNull(value) ? Constants.GRAPH_EMPTY_VALUE : value; + addIfExists(map, GraphPropertiesDictionary.VALUE, updatedValue); + return map; + } + + @Override + public String toString() { + return "InputValueData [uniqueId=" + uniqueId + ", hidden=" + hidden + ", type=" + type + ", creationTime=" + creationTime + ", value=" + + value + ", modificationTime=" + modificationTime + "]"; + } + + public Boolean isHidden() { + return hidden; + } + + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InputsData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InputsData.java index 77e0c02fc4..19c6648037 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InputsData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InputsData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,10 +17,13 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.utils.Constants; @@ -28,121 +31,96 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class InputsData extends GraphNode { - PropertyDataDefinition propertyDataDefinition; - - private List<String> constraints; - - public InputsData() { - super(NodeTypeEnum.Input); - propertyDataDefinition = new PropertyDataDefinition(); - } - - public InputsData(PropertyDataDefinition propertyDataDefinition, List<String> constraints) { - super(NodeTypeEnum.Input); - this.propertyDataDefinition = propertyDataDefinition; - this.constraints = constraints; - } - - public InputsData(Map<String, Object> properties) { - - this(); - - propertyDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - propertyDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - - propertyDataDefinition.setRequired((Boolean) properties.get(GraphPropertiesDictionary.REQUIRED.getProperty())); - - String defaultValue = (String) properties.get(GraphPropertiesDictionary.DEFAULT_VALUE.getProperty()); - if (Constants.GRAPH_EMPTY_VALUE.equals(defaultValue)) { - propertyDataDefinition.setDefaultValue(null); - } else { - propertyDataDefinition.setDefaultValue(defaultValue); - } - - propertyDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - - Type listType = new TypeToken<List<String>>() { - }.getType(); - List<String> constraintsfromJson = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.CONSTRAINTS.getProperty()), listType); - setConstraints(constraintsfromJson); - // setConstraints((List<String>) - // properties.get(GraphPropertiesDictionary.CONSTRAINTS.getProperty())); - - Type schemaType = new TypeToken<SchemaDefinition>() { - }.getType(); - SchemaDefinition schema = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.ENTRY_SCHEMA.getProperty()), schemaType); - propertyDataDefinition.setSchema(schema); - - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, propertyDataDefinition.getUniqueId()); - - addIfExists(map, GraphPropertiesDictionary.TYPE, propertyDataDefinition.getType()); - - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, propertyDataDefinition.getDescription()); - - String defaultValue = propertyDataDefinition.getDefaultValue(); - if (defaultValue == null) { - defaultValue = Constants.GRAPH_EMPTY_VALUE; - } - addIfExists(map, GraphPropertiesDictionary.DEFAULT_VALUE, defaultValue); - - addIfExists(map, GraphPropertiesDictionary.REQUIRED, propertyDataDefinition.isRequired()); - - addIfExists(map, GraphPropertiesDictionary.CONSTRAINTS, getConstraints()); - - SchemaDefinition entrySchema = propertyDataDefinition.getSchema(); - if (entrySchema != null) { - String entrySchemaStr = getGson().toJson(entrySchema); - addIfExists(map, GraphPropertiesDictionary.ENTRY_SCHEMA, entrySchemaStr); - } - // String constraintsAsJson = getGson().toJson(getConstraints()); - // addIfExists(map, GraphPropertiesDictionary.CONSTRAINTS, - // constraintsAsJson); - - return map; - } - - public List<String> getConstraints() { - return constraints; - } - - public void setConstraints(List<String> constraints) { - this.constraints = constraints; - } - - @Override - public String getUniqueId() { - return propertyDataDefinition.getUniqueId(); - } - - public PropertyDataDefinition getPropertyDataDefinition() { - return propertyDataDefinition; - } - - public void setPropertyDataDefinition(PropertyDataDefinition propertyDataDefinition) { - this.propertyDataDefinition = propertyDataDefinition; - } - - @Override - public String toString() { - return "PropertyData [propertyDataDefinition=" + propertyDataDefinition + ", constraints=" + constraints + "]"; - } - + PropertyDataDefinition propertyDataDefinition; + private List<String> constraints; + + public InputsData() { + super(NodeTypeEnum.Input); + propertyDataDefinition = new PropertyDataDefinition(); + } + + public InputsData(PropertyDataDefinition propertyDataDefinition, List<String> constraints) { + super(NodeTypeEnum.Input); + this.propertyDataDefinition = propertyDataDefinition; + this.constraints = constraints; + } + + public InputsData(Map<String, Object> properties) { + this(); + propertyDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + propertyDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + propertyDataDefinition.setRequired((Boolean) properties.get(GraphPropertiesDictionary.REQUIRED.getProperty())); + String defaultValue = (String) properties.get(GraphPropertiesDictionary.DEFAULT_VALUE.getProperty()); + if (Constants.GRAPH_EMPTY_VALUE.equals(defaultValue)) { + propertyDataDefinition.setDefaultValue(null); + } else { + propertyDataDefinition.setDefaultValue(defaultValue); + } + propertyDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + Type listType = new TypeToken<List<String>>() { + }.getType(); + List<String> constraintsfromJson = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.CONSTRAINTS.getProperty()), listType); + setConstraints(constraintsfromJson); + // setConstraints((List<String>) + + // properties.get(GraphPropertiesDictionary.CONSTRAINTS.getProperty())); + Type schemaType = new TypeToken<SchemaDefinition>() { + }.getType(); + SchemaDefinition schema = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.ENTRY_SCHEMA.getProperty()), schemaType); + propertyDataDefinition.setSchema(schema); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, propertyDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.TYPE, propertyDataDefinition.getType()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, propertyDataDefinition.getDescription()); + String defaultValue = propertyDataDefinition.getDefaultValue(); + if (defaultValue == null) { + defaultValue = Constants.GRAPH_EMPTY_VALUE; + } + addIfExists(map, GraphPropertiesDictionary.DEFAULT_VALUE, defaultValue); + addIfExists(map, GraphPropertiesDictionary.REQUIRED, propertyDataDefinition.isRequired()); + addIfExists(map, GraphPropertiesDictionary.CONSTRAINTS, getConstraints()); + SchemaDefinition entrySchema = propertyDataDefinition.getSchema(); + if (entrySchema != null) { + String entrySchemaStr = getGson().toJson(entrySchema); + addIfExists(map, GraphPropertiesDictionary.ENTRY_SCHEMA, entrySchemaStr); + } + // String constraintsAsJson = getGson().toJson(getConstraints()); + + // addIfExists(map, GraphPropertiesDictionary.CONSTRAINTS, + + // constraintsAsJson); + return map; + } + + public List<String> getConstraints() { + return constraints; + } + + public void setConstraints(List<String> constraints) { + this.constraints = constraints; + } + + @Override + public String getUniqueId() { + return propertyDataDefinition.getUniqueId(); + } + + public PropertyDataDefinition getPropertyDataDefinition() { + return propertyDataDefinition; + } + + public void setPropertyDataDefinition(PropertyDataDefinition propertyDataDefinition) { + this.propertyDataDefinition = propertyDataDefinition; + } + + @Override + public String toString() { + return "PropertyData [propertyDataDefinition=" + propertyDataDefinition + ", constraints=" + constraints + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InterfaceData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InterfaceData.java index c5ba3cba14..4f3c4c0e63 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InterfaceData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/InterfaceData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,75 +17,64 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class InterfaceData extends GraphNode { - private InterfaceDataDefinition interfaceDataDefinition; - - public InterfaceData() { - super(NodeTypeEnum.Interface); - interfaceDataDefinition = new InterfaceDataDefinition(); - - } - - public InterfaceData(InterfaceData p) { - super(NodeTypeEnum.Interface); - interfaceDataDefinition = p.getInterfaceDataDefinition(); - - } - - public InterfaceData(InterfaceDataDefinition interfaceDataDefinition) { - super(NodeTypeEnum.Interface); - this.interfaceDataDefinition = interfaceDataDefinition; - - } - - public InterfaceData(Map<String, Object> properties) { - this(); - interfaceDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - interfaceDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - interfaceDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - interfaceDataDefinition - .setCreationDate((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - interfaceDataDefinition - .setLastUpdateDate((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - } - - public InterfaceDataDefinition getInterfaceDataDefinition() { - return interfaceDataDefinition; - } - - public void setInterfaceDataDefinition(InterfaceDataDefinition interfaceDataDefinition) { - this.interfaceDataDefinition = interfaceDataDefinition; - } - - @Override - public String getUniqueId() { - return interfaceDataDefinition.getUniqueId(); - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, interfaceDataDefinition.getUniqueId()); - addIfExists(map, GraphPropertiesDictionary.TYPE, interfaceDataDefinition.getType()); - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, interfaceDataDefinition.getCreationDate()); - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, interfaceDataDefinition.getLastUpdateDate()); - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, interfaceDataDefinition.getDescription()); - - return map; - } - + private InterfaceDataDefinition interfaceDataDefinition; + + public InterfaceData() { + super(NodeTypeEnum.Interface); + interfaceDataDefinition = new InterfaceDataDefinition(); + } + + public InterfaceData(InterfaceData p) { + super(NodeTypeEnum.Interface); + interfaceDataDefinition = p.getInterfaceDataDefinition(); + } + + public InterfaceData(InterfaceDataDefinition interfaceDataDefinition) { + super(NodeTypeEnum.Interface); + this.interfaceDataDefinition = interfaceDataDefinition; + } + + public InterfaceData(Map<String, Object> properties) { + this(); + interfaceDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + interfaceDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + interfaceDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + interfaceDataDefinition.setCreationDate((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + interfaceDataDefinition.setLastUpdateDate((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + } + + public InterfaceDataDefinition getInterfaceDataDefinition() { + return interfaceDataDefinition; + } + + public void setInterfaceDataDefinition(InterfaceDataDefinition interfaceDataDefinition) { + this.interfaceDataDefinition = interfaceDataDefinition; + } + + @Override + public String getUniqueId() { + return interfaceDataDefinition.getUniqueId(); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, interfaceDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.TYPE, interfaceDataDefinition.getType()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, interfaceDataDefinition.getCreationDate()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, interfaceDataDefinition.getLastUpdateDate()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, interfaceDataDefinition.getDescription()); + return map; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java index a358897bc0..7655a41002 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/MigrationTaskEntry.java @@ -17,18 +17,16 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.util.Date; import lombok.Getter; import lombok.Setter; -import java.util.Date; - @Getter @Setter @Table(keyspace = "sdcrepository", name = "migrationTasks") @@ -37,26 +35,19 @@ public class MigrationTaskEntry { @PartitionKey(0) @Column(name = "major_version") private Long majorVersion; - @ClusteringColumn @Column(name = "minor_version") private Long minorVersion; - @Column(name = "timestamp") private Date timestamp; - @Column(name = "task_name") private String taskName; - @Column(name = "execution_time") private double executionTime; - @Column(name = "task_status") private String taskStatus; - @Column(name = "msg") private String message; - @Column(name = "description") private String description; } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/OperationData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/OperationData.java index 8246c2f9ff..2fd4b2c694 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/OperationData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/OperationData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,72 +17,62 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class OperationData extends GraphNode { - OperationDataDefinition operationDataDefinition; - - protected OperationData() { - super(NodeTypeEnum.InterfaceOperation); - operationDataDefinition = new OperationDataDefinition(); - } - - public OperationData(OperationDataDefinition operationDataDefinition) { - super(NodeTypeEnum.InterfaceOperation); - this.operationDataDefinition = operationDataDefinition; - - } - - public OperationData(OperationData operationData) { - super(NodeTypeEnum.InterfaceOperation); - this.operationDataDefinition = operationData.getOperationDataDefinition(); - - } - - public OperationData(Map<String, Object> properties) { - this(); - operationDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - operationDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - operationDataDefinition - .setCreationDate((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - operationDataDefinition - .setLastUpdateDate((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - } - - public OperationDataDefinition getOperationDataDefinition() { - return operationDataDefinition; - } - - public void setOperationDataDefinition(OperationDataDefinition operationDataDefinition) { - this.operationDataDefinition = operationDataDefinition; - } - - @Override - public String getUniqueId() { - return operationDataDefinition.getUniqueId(); - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, operationDataDefinition.getUniqueId()); - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, operationDataDefinition.getCreationDate()); - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, operationDataDefinition.getLastUpdateDate()); - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, operationDataDefinition.getDescription()); - - return map; - } - + OperationDataDefinition operationDataDefinition; + + protected OperationData() { + super(NodeTypeEnum.InterfaceOperation); + operationDataDefinition = new OperationDataDefinition(); + } + + public OperationData(OperationDataDefinition operationDataDefinition) { + super(NodeTypeEnum.InterfaceOperation); + this.operationDataDefinition = operationDataDefinition; + } + + public OperationData(OperationData operationData) { + super(NodeTypeEnum.InterfaceOperation); + this.operationDataDefinition = operationData.getOperationDataDefinition(); + } + + public OperationData(Map<String, Object> properties) { + this(); + operationDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + operationDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + operationDataDefinition.setCreationDate((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + operationDataDefinition.setLastUpdateDate((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + } + + public OperationDataDefinition getOperationDataDefinition() { + return operationDataDefinition; + } + + public void setOperationDataDefinition(OperationDataDefinition operationDataDefinition) { + this.operationDataDefinition = operationDataDefinition; + } + + @Override + public String getUniqueId() { + return operationDataDefinition.getUniqueId(); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, operationDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, operationDataDefinition.getCreationDate()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, operationDataDefinition.getLastUpdateDate()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, operationDataDefinition.getDescription()); + return map; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/OperationalEnvironmentEntry.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/OperationalEnvironmentEntry.java index 8b7032d06b..51c1561c1e 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/OperationalEnvironmentEntry.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/OperationalEnvironmentEntry.java @@ -17,19 +17,17 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; -import lombok.Getter; -import lombok.Setter; -import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum; - import java.util.Date; import java.util.HashSet; import java.util.Set; +import lombok.Getter; +import lombok.Setter; +import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum; @Getter @Setter @@ -39,32 +37,23 @@ public class OperationalEnvironmentEntry { @PartitionKey(0) @Column(name = "environment_id") private String environmentId; - @Column(name = "tenant") private String tenant; - @Column(name = "is_production") private Boolean isProduction; - @Column(name = "ecomp_workload_context") private String ecompWorkloadContext; - @Column(name = "dmaap_ueb_address") private Set<String> dmaapUebAddress; - @Column(name = "ueb_api_key") private String uebApikey; - @Column(name = "ueb_secret_key") private String uebSecretKey; - @Column(name = "status") private String status; - @Column(name = "last_modified") private Date lastModified; - public void setStatus(EnvironmentStatusEnum status) { this.status = status.getName(); } @@ -75,18 +64,16 @@ public class OperationalEnvironmentEntry { } public void addDmaapUebAddress(String address) { - if ( this.dmaapUebAddress == null ) + if (this.dmaapUebAddress == null) { this.dmaapUebAddress = new HashSet<>(); + } dmaapUebAddress.add(address); } @Override public String toString() { - return "OperationalEnvironmentEntry [environmentId=" + environmentId + ", tenant=" + tenant + ", isProduction=" - + isProduction + ", ecompWorkloadContext=" + ecompWorkloadContext + ", dmaapUebAddress=" - + dmaapUebAddress + ", uebApikey=" + uebApikey + ", status=" + status - + ", lastModified=" + lastModified + "]"; + return "OperationalEnvironmentEntry [environmentId=" + environmentId + ", tenant=" + tenant + ", isProduction=" + isProduction + + ", ecompWorkloadContext=" + ecompWorkloadContext + ", dmaapUebAddress=" + dmaapUebAddress + ", uebApikey=" + uebApikey + ", status=" + + status + ", lastModified=" + lastModified + "]"; } - - } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PolicyTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PolicyTypeData.java index c09622d17a..1143044d52 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PolicyTypeData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PolicyTypeData.java @@ -17,27 +17,25 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.datatypes.elements.PolicyTypeDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; - import java.lang.reflect.Type; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; +import org.openecomp.sdc.be.datatypes.elements.PolicyTypeDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; public class PolicyTypeData extends GraphNode { - private PolicyTypeDataDefinition policyTypeDataDefinition; private static final Type mapType = new TypeToken<HashMap<String, String>>() { }.getType(); private static final Type listType = new TypeToken<List<String>>() { }.getType(); + private PolicyTypeDataDefinition policyTypeDataDefinition; public PolicyTypeData() { super(NodeTypeEnum.PolicyType); @@ -50,67 +48,38 @@ public class PolicyTypeData extends GraphNode { } public PolicyTypeData(Map<String, Object> properties) { - this(); - - policyTypeDataDefinition - .setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - HashMap<String, String> metatdata = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.METADATA.getProperty()), mapType); + policyTypeDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + HashMap<String, String> metatdata = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.METADATA.getProperty()), mapType); policyTypeDataDefinition.setMetadata(metatdata); - - List<String> members = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.TARGETS.getProperty()), listType); + List<String> members = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.TARGETS.getProperty()), listType); policyTypeDataDefinition.setTargets(members); policyTypeDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); policyTypeDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); policyTypeDataDefinition.setIcon((String) properties.get(GraphPropertiesDictionary.ICON.getProperty())); - policyTypeDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - + policyTypeDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); if (properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty()) != null) { - policyTypeDataDefinition.setHighestVersion( - (boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty())); - } - + policyTypeDataDefinition.setHighestVersion((boolean) properties.get(GraphPropertiesDictionary.IS_HIGHEST_VERSION.getProperty())); + } policyTypeDataDefinition.setVersion((String) properties.get(GraphPropertiesDictionary.VERSION.getProperty())); - - policyTypeDataDefinition - .setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - policyTypeDataDefinition - .setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - + policyTypeDataDefinition.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + policyTypeDataDefinition.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); } @Override public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, policyTypeDataDefinition.getUniqueId()); - addIfExists(map, GraphPropertiesDictionary.TYPE, policyTypeDataDefinition.getType()); - addIfExists(map, GraphPropertiesDictionary.NAME, policyTypeDataDefinition.getName()); - addIfExists(map, GraphPropertiesDictionary.ICON, policyTypeDataDefinition.getIcon()); - addIfExists(map, GraphPropertiesDictionary.VERSION, policyTypeDataDefinition.getVersion()); - addIfExists(map, GraphPropertiesDictionary.IS_HIGHEST_VERSION, policyTypeDataDefinition.isHighestVersion()); - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, policyTypeDataDefinition.getDescription()); - addIfExists(map, GraphPropertiesDictionary.METADATA, policyTypeDataDefinition.getMetadata()); - addIfExists(map, GraphPropertiesDictionary.TARGETS, policyTypeDataDefinition.getTargets()); - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, policyTypeDataDefinition.getCreationTime()); - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, policyTypeDataDefinition.getModificationTime()); - return map; } @@ -127,6 +96,4 @@ public class PolicyTypeData extends GraphNode { public PolicyTypeDataDefinition getPolicyTypeDataDefinition() { return policyTypeDataDefinition; } - - } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ProductMetadataData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ProductMetadataData.java index fac80b439d..a2534ba77e 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ProductMetadataData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ProductMetadataData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,55 +17,47 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; -import com.google.gson.reflect.TypeToken; +import java.util.Map; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionaryExtractor; import org.openecomp.sdc.be.datatypes.elements.ProductMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.lang.reflect.Type; -import java.util.List; -import java.util.Map; - public class ProductMetadataData extends ComponentMetadataData { - public ProductMetadataData() { - super(NodeTypeEnum.Product, new ProductMetadataDataDefinition()); - } - - public ProductMetadataData(ProductMetadataDataDefinition metadataDataDefinition) { - super(NodeTypeEnum.Product, metadataDataDefinition); - } - - public ProductMetadataData(GraphPropertiesDictionaryExtractor extractor) { - super(NodeTypeEnum.Product, new ProductMetadataDataDefinition(), extractor); - ((ProductMetadataDataDefinition) metadataDataDefinition).setFullName(extractor.getFullName()); - ((ProductMetadataDataDefinition) metadataDataDefinition).setContacts(extractor.getContacts()); - ((ProductMetadataDataDefinition) metadataDataDefinition).setIsActive(extractor.isActive()); - } - - @Override - public String getUniqueIdKey() { - return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> graphMap = super.toGraphMap(); - addIfExists(graphMap, GraphPropertiesDictionary.FULL_NAME, - ((ProductMetadataDataDefinition) metadataDataDefinition).getFullName()); - addIfExists(graphMap, GraphPropertiesDictionary.CONTACTS, - ((ProductMetadataDataDefinition) metadataDataDefinition).getContacts()); - addIfExists(graphMap, GraphPropertiesDictionary.IS_ACTIVE, - ((ProductMetadataDataDefinition) metadataDataDefinition).getIsActive()); - return graphMap; - } - - @Override - public String toString() { - return "ProductMetadataData [metadataDataDefinition=" + metadataDataDefinition + "]"; - } + public ProductMetadataData() { + super(NodeTypeEnum.Product, new ProductMetadataDataDefinition()); + } + + public ProductMetadataData(ProductMetadataDataDefinition metadataDataDefinition) { + super(NodeTypeEnum.Product, metadataDataDefinition); + } + + public ProductMetadataData(GraphPropertiesDictionaryExtractor extractor) { + super(NodeTypeEnum.Product, new ProductMetadataDataDefinition(), extractor); + ((ProductMetadataDataDefinition) metadataDataDefinition).setFullName(extractor.getFullName()); + ((ProductMetadataDataDefinition) metadataDataDefinition).setContacts(extractor.getContacts()); + ((ProductMetadataDataDefinition) metadataDataDefinition).setIsActive(extractor.isActive()); + } + + @Override + public String getUniqueIdKey() { + return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> graphMap = super.toGraphMap(); + addIfExists(graphMap, GraphPropertiesDictionary.FULL_NAME, ((ProductMetadataDataDefinition) metadataDataDefinition).getFullName()); + addIfExists(graphMap, GraphPropertiesDictionary.CONTACTS, ((ProductMetadataDataDefinition) metadataDataDefinition).getContacts()); + addIfExists(graphMap, GraphPropertiesDictionary.IS_ACTIVE, ((ProductMetadataDataDefinition) metadataDataDefinition).getIsActive()); + return graphMap; + } + + @Override + public String toString() { + return "ProductMetadataData [metadataDataDefinition=" + metadataDataDefinition + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PropertyData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PropertyData.java index 1047d2bb40..29d4dde848 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PropertyData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PropertyData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,10 +17,13 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.utils.Constants; @@ -28,121 +31,96 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class PropertyData extends GraphNode { - PropertyDataDefinition propertyDataDefinition; - - private List<String> constraints; - - public PropertyData() { - super(NodeTypeEnum.Property); - propertyDataDefinition = new PropertyDataDefinition(); - } - - public PropertyData(PropertyDataDefinition propertyDataDefinition, List<String> constraints) { - super(NodeTypeEnum.Property); - this.propertyDataDefinition = propertyDataDefinition; - this.constraints = constraints; - } - - public PropertyData(Map<String, Object> properties) { - - this(); - - propertyDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - propertyDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - - propertyDataDefinition.setRequired((Boolean) properties.get(GraphPropertiesDictionary.REQUIRED.getProperty())); - - String defaultValue = (String) properties.get(GraphPropertiesDictionary.DEFAULT_VALUE.getProperty()); - if (Constants.GRAPH_EMPTY_VALUE.equals(defaultValue)) { - propertyDataDefinition.setDefaultValue(null); - } else { - propertyDataDefinition.setDefaultValue(defaultValue); - } - - propertyDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - - Type listType = new TypeToken<List<String>>() { - }.getType(); - List<String> constraintsfromJson = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.CONSTRAINTS.getProperty()), listType); - setConstraints(constraintsfromJson); - // setConstraints((List<String>) - // properties.get(GraphPropertiesDictionary.CONSTRAINTS.getProperty())); - - Type schemaType = new TypeToken<SchemaDefinition>() { - }.getType(); - SchemaDefinition schema = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.ENTRY_SCHEMA.getProperty()), schemaType); - propertyDataDefinition.setSchema(schema); - - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, propertyDataDefinition.getUniqueId()); - - addIfExists(map, GraphPropertiesDictionary.TYPE, propertyDataDefinition.getType()); - - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, propertyDataDefinition.getDescription()); - - String defaultValue = propertyDataDefinition.getDefaultValue(); - if (defaultValue == null) { - defaultValue = Constants.GRAPH_EMPTY_VALUE; - } - addIfExists(map, GraphPropertiesDictionary.DEFAULT_VALUE, defaultValue); - - addIfExists(map, GraphPropertiesDictionary.REQUIRED, propertyDataDefinition.isRequired()); - - addIfExists(map, GraphPropertiesDictionary.CONSTRAINTS, getConstraints()); - - SchemaDefinition entrySchema = propertyDataDefinition.getSchema(); - if (entrySchema != null) { - String entrySchemaStr = getGson().toJson(entrySchema); - addIfExists(map, GraphPropertiesDictionary.ENTRY_SCHEMA, entrySchemaStr); - } - // String constraintsAsJson = getGson().toJson(getConstraints()); - // addIfExists(map, GraphPropertiesDictionary.CONSTRAINTS, - // constraintsAsJson); - - return map; - } - - public List<String> getConstraints() { - return constraints; - } - - public void setConstraints(List<String> constraints) { - this.constraints = constraints; - } - - @Override - public String getUniqueId() { - return propertyDataDefinition.getUniqueId(); - } - - public PropertyDataDefinition getPropertyDataDefinition() { - return propertyDataDefinition; - } - - public void setPropertyDataDefinition(PropertyDataDefinition propertyDataDefinition) { - this.propertyDataDefinition = propertyDataDefinition; - } - - @Override - public String toString() { - return "PropertyData [propertyDataDefinition=" + propertyDataDefinition + ", constraints=" + constraints + "]"; - } - + PropertyDataDefinition propertyDataDefinition; + private List<String> constraints; + + public PropertyData() { + super(NodeTypeEnum.Property); + propertyDataDefinition = new PropertyDataDefinition(); + } + + public PropertyData(PropertyDataDefinition propertyDataDefinition, List<String> constraints) { + super(NodeTypeEnum.Property); + this.propertyDataDefinition = propertyDataDefinition; + this.constraints = constraints; + } + + public PropertyData(Map<String, Object> properties) { + this(); + propertyDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + propertyDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + propertyDataDefinition.setRequired((Boolean) properties.get(GraphPropertiesDictionary.REQUIRED.getProperty())); + String defaultValue = (String) properties.get(GraphPropertiesDictionary.DEFAULT_VALUE.getProperty()); + if (Constants.GRAPH_EMPTY_VALUE.equals(defaultValue)) { + propertyDataDefinition.setDefaultValue(null); + } else { + propertyDataDefinition.setDefaultValue(defaultValue); + } + propertyDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + Type listType = new TypeToken<List<String>>() { + }.getType(); + List<String> constraintsfromJson = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.CONSTRAINTS.getProperty()), listType); + setConstraints(constraintsfromJson); + // setConstraints((List<String>) + + // properties.get(GraphPropertiesDictionary.CONSTRAINTS.getProperty())); + Type schemaType = new TypeToken<SchemaDefinition>() { + }.getType(); + SchemaDefinition schema = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.ENTRY_SCHEMA.getProperty()), schemaType); + propertyDataDefinition.setSchema(schema); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, propertyDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.TYPE, propertyDataDefinition.getType()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, propertyDataDefinition.getDescription()); + String defaultValue = propertyDataDefinition.getDefaultValue(); + if (defaultValue == null) { + defaultValue = Constants.GRAPH_EMPTY_VALUE; + } + addIfExists(map, GraphPropertiesDictionary.DEFAULT_VALUE, defaultValue); + addIfExists(map, GraphPropertiesDictionary.REQUIRED, propertyDataDefinition.isRequired()); + addIfExists(map, GraphPropertiesDictionary.CONSTRAINTS, getConstraints()); + SchemaDefinition entrySchema = propertyDataDefinition.getSchema(); + if (entrySchema != null) { + String entrySchemaStr = getGson().toJson(entrySchema); + addIfExists(map, GraphPropertiesDictionary.ENTRY_SCHEMA, entrySchemaStr); + } + // String constraintsAsJson = getGson().toJson(getConstraints()); + + // addIfExists(map, GraphPropertiesDictionary.CONSTRAINTS, + + // constraintsAsJson); + return map; + } + + public List<String> getConstraints() { + return constraints; + } + + public void setConstraints(List<String> constraints) { + this.constraints = constraints; + } + + @Override + public String getUniqueId() { + return propertyDataDefinition.getUniqueId(); + } + + public PropertyDataDefinition getPropertyDataDefinition() { + return propertyDataDefinition; + } + + public void setPropertyDataDefinition(PropertyDataDefinition propertyDataDefinition) { + this.propertyDataDefinition = propertyDataDefinition; + } + + @Override + public String toString() { + return "PropertyData [propertyDataDefinition=" + propertyDataDefinition + ", constraints=" + constraints + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PropertyValueData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PropertyValueData.java index 1ec949dace..1fac5ea0a1 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PropertyValueData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/PropertyValueData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,142 +17,117 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.utils.Constants; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class PropertyValueData extends GraphNode { - public PropertyValueData() { - super(NodeTypeEnum.PropertyValue); - } - - public PropertyValueData(Map<String, Object> properties) { - this(); - - this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - String updatedValue = (String) properties.get(GraphPropertiesDictionary.VALUE.getProperty()); - if (Constants.GRAPH_EMPTY_VALUE.equals(updatedValue)) { - this.setValue(null); - } else { - this.setValue(updatedValue); - } - - this.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - - this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - Type mapType = new TypeToken<List<PropertyRule>>() { - }.getType(); - List<PropertyRule> propertyRules = getGson().fromJson( - (String) properties.get(GraphPropertiesDictionary.PROPERTY_VALUE_RULES.getProperty()), mapType); - this.setRules(propertyRules); - - } - - private String uniqueId; - - private String value; - - private String type; - - private Long creationTime; - - private Long modificationTime; - - private List<PropertyRule> rules; - - @Override - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Long getCreationTime() { - return creationTime; - } - - public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; - } - - public Long getModificationTime() { - return modificationTime; - } - - public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public List<PropertyRule> getRules() { - return rules; - } - - public void setRules(List<PropertyRule> rules) { - this.rules = rules; - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); - - String updatedValue = value; - if (updatedValue == null) { - updatedValue = Constants.GRAPH_EMPTY_VALUE; - } - addIfExists(map, GraphPropertiesDictionary.VALUE, updatedValue); - - addIfExists(map, GraphPropertiesDictionary.TYPE, type); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); - - addIfExists(map, GraphPropertiesDictionary.PROPERTY_VALUE_RULES, rules); - - return map; - } - - @Override - public String toString() { - return "PropertyValueData [uniqueId=" + uniqueId + ", value=" + value + ", type=" + type + ", creationTime=" - + creationTime + ", modificationTime=" + modificationTime + ", rules=" + rules + "]"; - } - + private String uniqueId; + private String value; + private String type; + private Long creationTime; + private Long modificationTime; + private List<PropertyRule> rules; + public PropertyValueData() { + super(NodeTypeEnum.PropertyValue); + } + public PropertyValueData(Map<String, Object> properties) { + this(); + this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + String updatedValue = (String) properties.get(GraphPropertiesDictionary.VALUE.getProperty()); + if (Constants.GRAPH_EMPTY_VALUE.equals(updatedValue)) { + this.setValue(null); + } else { + this.setValue(updatedValue); + } + this.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + Type mapType = new TypeToken<List<PropertyRule>>() { + }.getType(); + List<PropertyRule> propertyRules = getGson() + .fromJson((String) properties.get(GraphPropertiesDictionary.PROPERTY_VALUE_RULES.getProperty()), mapType); + this.setRules(propertyRules); + } + + @Override + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Long getCreationTime() { + return creationTime; + } + + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } + + public Long getModificationTime() { + return modificationTime; + } + + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public List<PropertyRule> getRules() { + return rules; + } + + public void setRules(List<PropertyRule> rules) { + this.rules = rules; + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); + String updatedValue = value; + if (updatedValue == null) { + updatedValue = Constants.GRAPH_EMPTY_VALUE; + } + addIfExists(map, GraphPropertiesDictionary.VALUE, updatedValue); + addIfExists(map, GraphPropertiesDictionary.TYPE, type); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); + addIfExists(map, GraphPropertiesDictionary.PROPERTY_VALUE_RULES, rules); + return map; + } + + @Override + public String toString() { + return "PropertyValueData [uniqueId=" + uniqueId + ", value=" + value + ", type=" + type + ", creationTime=" + creationTime + + ", modificationTime=" + modificationTime + ", rules=" + rules + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipInstData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipInstData.java index 0deba18c02..0ff9edfbca 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipInstData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipInstData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,148 +17,124 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class RelationshipInstData extends GraphNode { - private String type; - - private String uniqueId; - - private Long creationTime; - - private Long modificationTime; - - private String capabilityOwnerId; - private String requirementOwnerId; - private String capabiltyId; - private String requirementId; - - public RelationshipInstData() { - super(NodeTypeEnum.RelationshipInst); - } - - public RelationshipInstData(Map<String, Object> properties) { - - this(); - - this.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - - this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - this.setCapabilityOwnerId((String) properties.get(GraphPropertiesDictionary.CAPABILITY_OWNER_ID.getProperty())); - this.setRequirementOwnerId( - (String) properties.get(GraphPropertiesDictionary.REQUIREMENT_OWNER_ID.getProperty())); - this.setRequirementId((String) properties.get(GraphPropertiesDictionary.REQUIREMENT_ID.getProperty())); - this.setCapabiltyId((String) properties.get(GraphPropertiesDictionary.CAPABILITY_ID.getProperty())); - - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); - - addIfExists(map, GraphPropertiesDictionary.TYPE, type); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); - addIfExists(map, GraphPropertiesDictionary.CAPABILITY_OWNER_ID, capabilityOwnerId); - addIfExists(map, GraphPropertiesDictionary.REQUIREMENT_OWNER_ID, requirementOwnerId); - - addIfExists(map, GraphPropertiesDictionary.REQUIREMENT_ID, requirementId); - - addIfExists(map, GraphPropertiesDictionary.CAPABILITY_ID, capabiltyId); - - return map; - } - - public Long getCreationTime() { - return creationTime; - } - - public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; - } - - public Long getModificationTime() { - return modificationTime; - } - - public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - @Override - public String getUniqueId() { - return uniqueId; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getCapabilityOwnerId() { - return capabilityOwnerId; - } - - public void setCapabilityOwnerId(String capabilityOwnerId) { - this.capabilityOwnerId = capabilityOwnerId; - } - - public String getRequirementOwnerId() { - return requirementOwnerId; - } - - public void setRequirementOwnerId(String requirementOwnerId) { - this.requirementOwnerId = requirementOwnerId; - } - - public String getCapabiltyId() { - return capabiltyId; - } - - public void setCapabiltyId(String capabiltyId) { - this.capabiltyId = capabiltyId; - } - - public String getRequirementId() { - return requirementId; - } - - public void setRequirementId(String requirementId) { - this.requirementId = requirementId; - } - - @Override - public String toString() { - return "RelationshipInstData [type=" + type + ", uniqueId=" + uniqueId + ", creationTime=" + creationTime - + ", modificationTime=" + modificationTime + ", capabilityOwnerId=" + capabilityOwnerId - + ", requirementOwnerId=" + requirementOwnerId + ", capabiltyId=" + capabiltyId + ", requirementId=" - + requirementId + "]"; - } - + private String type; + private String uniqueId; + private Long creationTime; + private Long modificationTime; + private String capabilityOwnerId; + private String requirementOwnerId; + private String capabiltyId; + private String requirementId; + + public RelationshipInstData() { + super(NodeTypeEnum.RelationshipInst); + } + + public RelationshipInstData(Map<String, Object> properties) { + this(); + this.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + this.setCapabilityOwnerId((String) properties.get(GraphPropertiesDictionary.CAPABILITY_OWNER_ID.getProperty())); + this.setRequirementOwnerId((String) properties.get(GraphPropertiesDictionary.REQUIREMENT_OWNER_ID.getProperty())); + this.setRequirementId((String) properties.get(GraphPropertiesDictionary.REQUIREMENT_ID.getProperty())); + this.setCapabiltyId((String) properties.get(GraphPropertiesDictionary.CAPABILITY_ID.getProperty())); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); + addIfExists(map, GraphPropertiesDictionary.TYPE, type); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); + addIfExists(map, GraphPropertiesDictionary.CAPABILITY_OWNER_ID, capabilityOwnerId); + addIfExists(map, GraphPropertiesDictionary.REQUIREMENT_OWNER_ID, requirementOwnerId); + addIfExists(map, GraphPropertiesDictionary.REQUIREMENT_ID, requirementId); + addIfExists(map, GraphPropertiesDictionary.CAPABILITY_ID, capabiltyId); + return map; + } + + public Long getCreationTime() { + return creationTime; + } + + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } + + public Long getModificationTime() { + return modificationTime; + } + + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } + + @Override + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getCapabilityOwnerId() { + return capabilityOwnerId; + } + + public void setCapabilityOwnerId(String capabilityOwnerId) { + this.capabilityOwnerId = capabilityOwnerId; + } + + public String getRequirementOwnerId() { + return requirementOwnerId; + } + + public void setRequirementOwnerId(String requirementOwnerId) { + this.requirementOwnerId = requirementOwnerId; + } + + public String getCapabiltyId() { + return capabiltyId; + } + + public void setCapabiltyId(String capabiltyId) { + this.capabiltyId = capabiltyId; + } + + public String getRequirementId() { + return requirementId; + } + + public void setRequirementId(String requirementId) { + this.requirementId = requirementId; + } + + @Override + public String toString() { + return "RelationshipInstData [type=" + type + ", uniqueId=" + uniqueId + ", creationTime=" + creationTime + ", modificationTime=" + + modificationTime + ", capabilityOwnerId=" + capabilityOwnerId + ", requirementOwnerId=" + requirementOwnerId + ", capabiltyId=" + + capabiltyId + ", requirementId=" + requirementId + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java index 440cddad55..39adfd94e3 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RelationshipTypeData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,121 +17,92 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.google.gson.reflect.TypeToken; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; -import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; -import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; - import java.lang.reflect.Type; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; +import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; public class RelationshipTypeData extends GraphNode { - RelationshipInstDataDefinition relationshipTypeDataDefinition; - - public RelationshipTypeData() { - super(NodeTypeEnum.RelationshipType); - relationshipTypeDataDefinition = new RelationshipInstDataDefinition(); - } + RelationshipInstDataDefinition relationshipTypeDataDefinition; - public RelationshipTypeData(RelationshipInstDataDefinition relationshipTypeDataDefinition) { - super(NodeTypeEnum.RelationshipType); - this.relationshipTypeDataDefinition = relationshipTypeDataDefinition; - } + public RelationshipTypeData() { + super(NodeTypeEnum.RelationshipType); + relationshipTypeDataDefinition = new RelationshipInstDataDefinition(); + } - public RelationshipTypeData(Map<String, Object> properties) { - - this(); - - relationshipTypeDataDefinition - .setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - relationshipTypeDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); - - relationshipTypeDataDefinition - .setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); - - Type listSourceType = new TypeToken<List<String>>() { - }.getType(); - List<String> validSourceTypesfromJson = getGson().fromJson( - (String) properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES.getProperty()), listSourceType); - - relationshipTypeDataDefinition.setValidSourceTypes(validSourceTypesfromJson); + public RelationshipTypeData(RelationshipInstDataDefinition relationshipTypeDataDefinition) { + super(NodeTypeEnum.RelationshipType); + this.relationshipTypeDataDefinition = relationshipTypeDataDefinition; + } + public RelationshipTypeData(Map<String, Object> properties) { + this(); + relationshipTypeDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + relationshipTypeDataDefinition.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty())); + relationshipTypeDataDefinition.setDescription((String) properties.get(GraphPropertiesDictionary.DESCRIPTION.getProperty())); + Type listSourceType = new TypeToken<List<String>>() { + }.getType(); + List<String> validSourceTypesfromJson = getGson() + .fromJson((String) properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES.getProperty()), listSourceType); + relationshipTypeDataDefinition.setValidSourceTypes(validSourceTypesfromJson); Type listTargetType = new TypeToken<List<String>>() { }.getType(); - List<String> validTargetTypesfromJson = getGson().fromJson( - (String) properties.get(GraphPropertiesDictionary.VALID_TARGET_TYPES.getProperty()), listTargetType); - + List<String> validTargetTypesfromJson = getGson() + .fromJson((String) properties.get(GraphPropertiesDictionary.VALID_TARGET_TYPES.getProperty()), listTargetType); relationshipTypeDataDefinition.setValidTargetTypes(validTargetTypesfromJson); - - // relationshipTypeDataDefinition.setValidSourceTypes((List<String>) - // properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES - // .getProperty())); - - relationshipTypeDataDefinition - .setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - relationshipTypeDataDefinition - .setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - // capabilityTypeDataDefinition.setVersion(version); - - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, relationshipTypeDataDefinition.getUniqueId()); - - addIfExists(map, GraphPropertiesDictionary.TYPE, relationshipTypeDataDefinition.getType()); - - addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, relationshipTypeDataDefinition.getDescription()); - - // String validSourceTypesToJson = - // getGson().toJson(relationshipTypeDataDefinition.getValidSourceTypes()); - - // addIfExists(map, GraphPropertiesDictionary.VALID_SOURCE_TYPES, - // validSourceTypesToJson); - - addIfExists(map, GraphPropertiesDictionary.VALID_SOURCE_TYPES, - relationshipTypeDataDefinition.getValidSourceTypes()); - - addIfExists(map, GraphPropertiesDictionary.VALID_TARGET_TYPES, - relationshipTypeDataDefinition.getValidTargetTypes()); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, relationshipTypeDataDefinition.getCreationTime()); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, - relationshipTypeDataDefinition.getModificationTime()); - - return map; - } - - public RelationshipInstDataDefinition getRelationshipTypeDataDefinition() { - return relationshipTypeDataDefinition; - } - - public void setRelationshipTypeDataDefinition(RelationshipInstDataDefinition relationshipTypeDataDefinition) { - this.relationshipTypeDataDefinition = relationshipTypeDataDefinition; - } - - @Override - public String getUniqueId() { - return this.relationshipTypeDataDefinition.getUniqueId(); - } - - @Override - public String toString() { - return "RelationshipTypeData [relationshipTypeDataDefinition=" + relationshipTypeDataDefinition + "]"; - } - + // relationshipTypeDataDefinition.setValidSourceTypes((List<String>) + + // properties.get(GraphPropertiesDictionary.VALID_SOURCE_TYPES + + // .getProperty())); + relationshipTypeDataDefinition.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + relationshipTypeDataDefinition.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + // capabilityTypeDataDefinition.setVersion(version); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, relationshipTypeDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.TYPE, relationshipTypeDataDefinition.getType()); + addIfExists(map, GraphPropertiesDictionary.DESCRIPTION, relationshipTypeDataDefinition.getDescription()); + // String validSourceTypesToJson = + + // getGson().toJson(relationshipTypeDataDefinition.getValidSourceTypes()); + + // addIfExists(map, GraphPropertiesDictionary.VALID_SOURCE_TYPES, + + // validSourceTypesToJson); + addIfExists(map, GraphPropertiesDictionary.VALID_SOURCE_TYPES, relationshipTypeDataDefinition.getValidSourceTypes()); + addIfExists(map, GraphPropertiesDictionary.VALID_TARGET_TYPES, relationshipTypeDataDefinition.getValidTargetTypes()); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, relationshipTypeDataDefinition.getCreationTime()); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, relationshipTypeDataDefinition.getModificationTime()); + return map; + } + + public RelationshipInstDataDefinition getRelationshipTypeDataDefinition() { + return relationshipTypeDataDefinition; + } + + public void setRelationshipTypeDataDefinition(RelationshipInstDataDefinition relationshipTypeDataDefinition) { + this.relationshipTypeDataDefinition = relationshipTypeDataDefinition; + } + + @Override + public String getUniqueId() { + return this.relationshipTypeDataDefinition.getUniqueId(); + } + + @Override + public String toString() { + return "RelationshipTypeData [relationshipTypeDataDefinition=" + relationshipTypeDataDefinition + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementData.java index de1b9c62aa..df696b384e 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,140 +17,118 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class RequirementData extends GraphNode { - private String uniqueId; - - private String node; - - private Long creationTime; - - private Long modificationTime; - - private String relationshipType; - private String minOccurrences = RequirementDataDefinition.MIN_OCCURRENCES; - private String maxOccurrences = RequirementDataDefinition.MAX_DEFAULT_OCCURRENCES; - - public RequirementData() { - super(NodeTypeEnum.Requirement); - - } - - public RequirementData(Map<String, Object> properties) { - - this(); - - this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - this.setNode((String) properties.get(GraphPropertiesDictionary.NODE.getProperty())); - - this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - this.setRelationshipType((String) properties.get(GraphPropertiesDictionary.RELATIONSHIP_TYPE.getProperty())); - this.setMinOccurrences((String) properties.get(GraphPropertiesDictionary.MIN_OCCURRENCES.getProperty())); - this.setMaxOccurrences((String) properties.get(GraphPropertiesDictionary.MAX_OCCURRENCES.getProperty())); - - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); - - addIfExists(map, GraphPropertiesDictionary.NODE, node); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); - - addIfExists(map, GraphPropertiesDictionary.RELATIONSHIP_TYPE, relationshipType); - addIfExists(map, GraphPropertiesDictionary.MIN_OCCURRENCES, minOccurrences); - addIfExists(map, GraphPropertiesDictionary.MAX_OCCURRENCES, maxOccurrences); - - return map; - } - - public String getNode() { - return node; - } - - public void setNode(String node) { - this.node = node; - } - - public Long getCreationTime() { - return creationTime; - } - - public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; - } - - public Long getModificationTime() { - return modificationTime; - } - - public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public String getRelationshipType() { - return relationshipType; - } - - public void setRelationshipType(String relationshipType) { - this.relationshipType = relationshipType; - } - - public String getMinOccurrences() { - return minOccurrences; - } - - public void setMinOccurrences(String minOccurrences) { - if (minOccurrences != null) { - this.minOccurrences = minOccurrences; - } - } - - public String getMaxOccurrences() { - return maxOccurrences; - } - - public void setMaxOccurrences(String maxOccurrences) { - if (maxOccurrences != null) { - this.maxOccurrences = maxOccurrences; - } - } - - @Override - public String getUniqueId() { - return uniqueId; - } - - @Override - public String toString() { - return "RequirementData [uniqueId=" + uniqueId + ", node=" + node + ", creationTime=" + creationTime - + ", modificationTime=" + modificationTime + ", relationshipType=" + relationshipType - + ", minOccurrences=" + minOccurrences + ", maxOccurrences=" + maxOccurrences + "]"; - } - + private String uniqueId; + private String node; + private Long creationTime; + private Long modificationTime; + private String relationshipType; + private String minOccurrences = RequirementDataDefinition.MIN_OCCURRENCES; + private String maxOccurrences = RequirementDataDefinition.MAX_DEFAULT_OCCURRENCES; + + public RequirementData() { + super(NodeTypeEnum.Requirement); + } + + public RequirementData(Map<String, Object> properties) { + this(); + this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + this.setNode((String) properties.get(GraphPropertiesDictionary.NODE.getProperty())); + this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + this.setRelationshipType((String) properties.get(GraphPropertiesDictionary.RELATIONSHIP_TYPE.getProperty())); + this.setMinOccurrences((String) properties.get(GraphPropertiesDictionary.MIN_OCCURRENCES.getProperty())); + this.setMaxOccurrences((String) properties.get(GraphPropertiesDictionary.MAX_OCCURRENCES.getProperty())); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); + addIfExists(map, GraphPropertiesDictionary.NODE, node); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); + addIfExists(map, GraphPropertiesDictionary.RELATIONSHIP_TYPE, relationshipType); + addIfExists(map, GraphPropertiesDictionary.MIN_OCCURRENCES, minOccurrences); + addIfExists(map, GraphPropertiesDictionary.MAX_OCCURRENCES, maxOccurrences); + return map; + } + + public String getNode() { + return node; + } + + public void setNode(String node) { + this.node = node; + } + + public Long getCreationTime() { + return creationTime; + } + + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } + + public Long getModificationTime() { + return modificationTime; + } + + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } + + public String getRelationshipType() { + return relationshipType; + } + + public void setRelationshipType(String relationshipType) { + this.relationshipType = relationshipType; + } + + public String getMinOccurrences() { + return minOccurrences; + } + + public void setMinOccurrences(String minOccurrences) { + if (minOccurrences != null) { + this.minOccurrences = minOccurrences; + } + } + + public String getMaxOccurrences() { + return maxOccurrences; + } + + public void setMaxOccurrences(String maxOccurrences) { + if (maxOccurrences != null) { + this.maxOccurrences = maxOccurrences; + } + } + + @Override + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + @Override + public String toString() { + return "RequirementData [uniqueId=" + uniqueId + ", node=" + node + ", creationTime=" + creationTime + ", modificationTime=" + + modificationTime + ", relationshipType=" + relationshipType + ", minOccurrences=" + minOccurrences + ", maxOccurrences=" + + maxOccurrences + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementImplData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementImplData.java index 36d6d8d718..c2296d5373 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementImplData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/RequirementImplData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,125 +17,101 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class RequirementImplData extends GraphNode { - private String name; - - private String uniqueId; - - private Long creationTime; - - private Long modificationTime; - - private String posX; - - private String posY; - - public RequirementImplData() { - super(NodeTypeEnum.RequirementImpl); - } - - public RequirementImplData(Map<String, Object> properties) { - - this(); - - this.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - - this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - - this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); - - this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); - - setPosX((String) properties.get(GraphPropertiesDictionary.POSITION_X.getProperty())); - - setPosY((String) properties.get(GraphPropertiesDictionary.POSITION_Y.getProperty())); - - } - - @Override - public Map<String, Object> toGraphMap() { - - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); - - addIfExists(map, GraphPropertiesDictionary.NAME, name); - - addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); - - addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); - - addIfExists(map, GraphPropertiesDictionary.POSITION_X, posX); - - addIfExists(map, GraphPropertiesDictionary.POSITION_Y, posY); - - return map; - } - - public Long getCreationTime() { - return creationTime; - } - - public void setCreationTime(Long creationTime) { - this.creationTime = creationTime; - } - - public Long getModificationTime() { - return modificationTime; - } - - public void setModificationTime(Long modificationTime) { - this.modificationTime = modificationTime; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - @Override - public String getUniqueId() { - return uniqueId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPosX() { - return posX; - } - - public void setPosX(String posX) { - this.posX = posX; - } - - public String getPosY() { - return posY; - } - - public void setPosY(String posY) { - this.posY = posY; - } - - @Override - public String toString() { - return "RequirementImplData [name=" + name + ", uniqueId=" + uniqueId + ", creationTime=" + creationTime - + ", modificationTime=" + modificationTime + ", posX=" + posX + ", posY=" + posY + "]"; - } - + private String name; + private String uniqueId; + private Long creationTime; + private Long modificationTime; + private String posX; + private String posY; + + public RequirementImplData() { + super(NodeTypeEnum.RequirementImpl); + } + + public RequirementImplData(Map<String, Object> properties) { + this(); + this.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty())); + this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty())); + setPosX((String) properties.get(GraphPropertiesDictionary.POSITION_X.getProperty())); + setPosY((String) properties.get(GraphPropertiesDictionary.POSITION_Y.getProperty())); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); + addIfExists(map, GraphPropertiesDictionary.NAME, name); + addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime); + addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime); + addIfExists(map, GraphPropertiesDictionary.POSITION_X, posX); + addIfExists(map, GraphPropertiesDictionary.POSITION_Y, posY); + return map; + } + + public Long getCreationTime() { + return creationTime; + } + + public void setCreationTime(Long creationTime) { + this.creationTime = creationTime; + } + + public Long getModificationTime() { + return modificationTime; + } + + public void setModificationTime(Long modificationTime) { + this.modificationTime = modificationTime; + } + + @Override + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPosX() { + return posX; + } + + public void setPosX(String posX) { + this.posX = posX; + } + + public String getPosY() { + return posY; + } + + public void setPosY(String posY) { + this.posY = posY; + } + + @Override + public String toString() { + return "RequirementImplData [name=" + name + ", uniqueId=" + uniqueId + ", creationTime=" + creationTime + ", modificationTime=" + + modificationTime + ", posX=" + posX + ", posY=" + posY + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceCategoryData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceCategoryData.java index 95d8b0b6be..c1c5aa664f 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceCategoryData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceCategoryData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,56 +17,53 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.Map; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.Map; - public class ResourceCategoryData extends CategoryData { - private String categoryName; - - public ResourceCategoryData() { - super(NodeTypeEnum.ResourceCategory); - } + private String categoryName; - public ResourceCategoryData(String categoryName, String name) { - super(name, "", NodeTypeEnum.ResourceCategory); - this.categoryName = categoryName; - createUniqueId(); - } + public ResourceCategoryData() { + super(NodeTypeEnum.ResourceCategory); + } - public ResourceCategoryData(Map<String, Object> properties) { - super(properties, NodeTypeEnum.ResourceCategory); - setCategoryName((String) properties.get(GraphPropertiesDictionary.CATEGORY_NAME.getProperty())); - } + public ResourceCategoryData(String categoryName, String name) { + super(name, "", NodeTypeEnum.ResourceCategory); + this.categoryName = categoryName; + createUniqueId(); + } - public String getCategoryName() { - return categoryName; - } + public ResourceCategoryData(Map<String, Object> properties) { + super(properties, NodeTypeEnum.ResourceCategory); + setCategoryName((String) properties.get(GraphPropertiesDictionary.CATEGORY_NAME.getProperty())); + } - public void setCategoryName(String categoryName) { - this.categoryName = categoryName; - } + public String getCategoryName() { + return categoryName; + } - @Override - protected void createUniqueId() { - setUniqueId(getLabel() + "." + this.categoryName + "." + getName()); - } + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } - @Override - public String toString() { - return "ResourceCategoryData [categoryName=" + categoryName + "]" + super.toString(); - } + @Override + protected void createUniqueId() { + setUniqueId(getLabel() + "." + this.categoryName + "." + getName()); + } - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> graphMap = super.toGraphMap(); - addIfExists(graphMap, GraphPropertiesDictionary.CATEGORY_NAME, categoryName); - return graphMap; - } + @Override + public String toString() { + return "ResourceCategoryData [categoryName=" + categoryName + "]" + super.toString(); + } + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> graphMap = super.toGraphMap(); + addIfExists(graphMap, GraphPropertiesDictionary.CATEGORY_NAME, categoryName); + return graphMap; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java index ddb3b9883d..5163b00df4 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ResourceMetadataData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,50 +17,48 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.Map; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionaryExtractor; import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; - -import java.util.Map; public class ResourceMetadataData extends ComponentMetadataData { - public ResourceMetadataData() { - super(NodeTypeEnum.Resource, new ResourceMetadataDataDefinition()); - } - - public ResourceMetadataData(ComponentMetadataDataDefinition metadataDataDefinition) { - super(NodeTypeEnum.Resource, metadataDataDefinition); - } + public ResourceMetadataData() { + super(NodeTypeEnum.Resource, new ResourceMetadataDataDefinition()); + } - public ResourceMetadataData(GraphPropertiesDictionaryExtractor extractor) { - super(NodeTypeEnum.Resource, new ResourceMetadataDataDefinition(), extractor); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorName(extractor.getVendorName()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorRelease(extractor.getVendorRelease()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setResourceType(extractor.getResourceType()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setAbstract(extractor.isAbstract()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setCost(extractor.getCost()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setLicenseType(extractor.getLicenseType()); - ((ResourceMetadataDataDefinition) metadataDataDefinition).setToscaResourceName(extractor.getToscaResourceName()); - } + public ResourceMetadataData(ComponentMetadataDataDefinition metadataDataDefinition) { + super(NodeTypeEnum.Resource, metadataDataDefinition); + } - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> graphMap = super.toGraphMap(); - addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_NAME, ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorName()); - addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_RELEASE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorRelease()); - addIfExists(graphMap, GraphPropertiesDictionary.RESOURCE_TYPE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getResourceType().name()); - addIfExists(graphMap, GraphPropertiesDictionary.IS_ABSTRACT, ((ResourceMetadataDataDefinition) metadataDataDefinition).isAbstract()); - addIfExists(graphMap, GraphPropertiesDictionary.COST, ((ResourceMetadataDataDefinition) metadataDataDefinition).getCost()); - addIfExists(graphMap, GraphPropertiesDictionary.LICENSE_TYPE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getLicenseType()); - addIfExists(graphMap, GraphPropertiesDictionary.TOSCA_RESOURCE_NAME, ((ResourceMetadataDataDefinition) metadataDataDefinition).getToscaResourceName()); - return graphMap; - } + public ResourceMetadataData(GraphPropertiesDictionaryExtractor extractor) { + super(NodeTypeEnum.Resource, new ResourceMetadataDataDefinition(), extractor); + ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorName(extractor.getVendorName()); + ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorRelease(extractor.getVendorRelease()); + ((ResourceMetadataDataDefinition) metadataDataDefinition).setResourceType(extractor.getResourceType()); + ((ResourceMetadataDataDefinition) metadataDataDefinition).setAbstract(extractor.isAbstract()); + ((ResourceMetadataDataDefinition) metadataDataDefinition).setCost(extractor.getCost()); + ((ResourceMetadataDataDefinition) metadataDataDefinition).setLicenseType(extractor.getLicenseType()); + ((ResourceMetadataDataDefinition) metadataDataDefinition).setToscaResourceName(extractor.getToscaResourceName()); + } + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> graphMap = super.toGraphMap(); + addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_NAME, ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorName()); + addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_RELEASE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorRelease()); + addIfExists(graphMap, GraphPropertiesDictionary.RESOURCE_TYPE, + ((ResourceMetadataDataDefinition) metadataDataDefinition).getResourceType().name()); + addIfExists(graphMap, GraphPropertiesDictionary.IS_ABSTRACT, ((ResourceMetadataDataDefinition) metadataDataDefinition).isAbstract()); + addIfExists(graphMap, GraphPropertiesDictionary.COST, ((ResourceMetadataDataDefinition) metadataDataDefinition).getCost()); + addIfExists(graphMap, GraphPropertiesDictionary.LICENSE_TYPE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getLicenseType()); + addIfExists(graphMap, GraphPropertiesDictionary.TOSCA_RESOURCE_NAME, + ((ResourceMetadataDataDefinition) metadataDataDefinition).getToscaResourceName()); + return graphMap; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java index 401d9099e6..6d16afc0a2 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; import com.datastax.driver.mapping.annotations.ClusteringColumn; @@ -25,72 +24,67 @@ import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; import com.datastax.driver.mapping.annotations.Transient; +import java.nio.ByteBuffer; +import java.util.Date; import lombok.AccessLevel; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import java.nio.ByteBuffer; -import java.util.Date; - @Getter @Setter @NoArgsConstructor @Table(keyspace = "sdcartifact", name = "sdcschemafiles") public class SdcSchemaFilesData { - @PartitionKey(0) - @Column(name = "sdcreleasenum") - private String sdcReleaseNum; - - @ClusteringColumn - @Column(name = "timestamp") - private Date timestamp; - - @PartitionKey(1) - @Column(name = "conformanceLevel") - private String conformanceLevel; - - @Column(name = "fileName") - private String fileName; - - @Column(name = "payload") - @Setter(AccessLevel.NONE)private ByteBuffer payload; - - @Column(name = "checksum") - private String checksum; - public SdcSchemaFilesData(String sdcReleaseNum, Date timestamp, String conformanceLevel, String fileName, byte[] payload, String checksum){ - this.sdcReleaseNum = sdcReleaseNum; - this.timestamp = timestamp; - this.conformanceLevel = conformanceLevel; - this.fileName = fileName; - if(payload != null) { - this.payload = ByteBuffer.wrap(payload.clone()); - } - this.checksum = checksum; - } + @PartitionKey(0) + @Column(name = "sdcreleasenum") + private String sdcReleaseNum; + @ClusteringColumn + @Column(name = "timestamp") + private Date timestamp; + @PartitionKey(1) + @Column(name = "conformanceLevel") + private String conformanceLevel; + @Column(name = "fileName") + private String fileName; + @Column(name = "payload") + @Setter(AccessLevel.NONE) + private ByteBuffer payload; + @Column(name = "checksum") + private String checksum; + public SdcSchemaFilesData(String sdcReleaseNum, Date timestamp, String conformanceLevel, String fileName, byte[] payload, String checksum) { + this.sdcReleaseNum = sdcReleaseNum; + this.timestamp = timestamp; + this.conformanceLevel = conformanceLevel; + this.fileName = fileName; + if (payload != null) { + this.payload = ByteBuffer.wrap(payload.clone()); + } + this.checksum = checksum; + } - public void setPayload(ByteBuffer payload) { - if(payload != null) { - this.payload = payload.duplicate(); - } - } + public void setPayload(ByteBuffer payload) { + if (payload != null) { + this.payload = payload.duplicate(); + } + } - public void setPayloadAsArray(byte[] payload) { - if(payload != null) { - this.payload = ByteBuffer.wrap(payload.clone()); - } - } + @Transient + public byte[] getPayloadAsArray() { + return payload != null ? payload.array() : null; + } - @Transient - public byte[] getPayloadAsArray() { - return payload != null ? payload.array() : null; - } + public void setPayloadAsArray(byte[] payload) { + if (payload != null) { + this.payload = ByteBuffer.wrap(payload.clone()); + } + } - @Override - public String toString() { - return "SdcSchemaFilesData [sdcReleaseNum=" + sdcReleaseNum + ", timestamp=" + timestamp + ", conformanceLevel=" - + conformanceLevel + ", fileName=" + fileName + ", checksum=" + checksum + "]"; - } + @Override + public String toString() { + return "SdcSchemaFilesData [sdcReleaseNum=" + sdcReleaseNum + ", timestamp=" + timestamp + ", conformanceLevel=" + conformanceLevel + + ", fileName=" + fileName + ", checksum=" + checksum + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ServiceCategoryData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ServiceCategoryData.java index 3228cbfc23..2efb4e305e 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ServiceCategoryData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ServiceCategoryData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,31 +17,28 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; - import java.util.Map; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; public class ServiceCategoryData extends CategoryData { - public ServiceCategoryData() { - super(NodeTypeEnum.ServiceCategory); - } - - public ServiceCategoryData(String categoryName) { - super(categoryName, "", NodeTypeEnum.ServiceCategory); - createUniqueId(); - } + public ServiceCategoryData() { + super(NodeTypeEnum.ServiceCategory); + } - public ServiceCategoryData(Map<String, Object> properties) { - super(properties, NodeTypeEnum.ServiceCategory); - } + public ServiceCategoryData(String categoryName) { + super(categoryName, "", NodeTypeEnum.ServiceCategory); + createUniqueId(); + } - @Override - protected void createUniqueId() { - setUniqueId(getLabel() + "." + getName()); - } + public ServiceCategoryData(Map<String, Object> properties) { + super(properties, NodeTypeEnum.ServiceCategory); + } + @Override + protected void createUniqueId() { + setUniqueId(getLabel() + "." + getName()); + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ServiceMetadataData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ServiceMetadataData.java index 01e4ca4eb4..2de2d79717 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ServiceMetadataData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/ServiceMetadataData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,45 +17,41 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.Map; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionaryExtractor; import org.openecomp.sdc.be.datatypes.components.ServiceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.Map; - public class ServiceMetadataData extends ComponentMetadataData { - public ServiceMetadataData() { - super(NodeTypeEnum.Service, new ServiceMetadataDataDefinition()); - } - - public ServiceMetadataData(ServiceMetadataDataDefinition serviceMetadataDataDefinition) { - super(NodeTypeEnum.Service, serviceMetadataDataDefinition); - } - - public ServiceMetadataData(GraphPropertiesDictionaryExtractor extractor) { - super(NodeTypeEnum.Service, new ServiceMetadataDataDefinition(), extractor); - metadataDataDefinition.setProjectCode(extractor.getProjectCode()); - ((ServiceMetadataDataDefinition) metadataDataDefinition).setDistributionStatus(extractor.getDistributionStatus()); - } - - @Override - public String getUniqueIdKey() { - return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> graphMap = super.toGraphMap(); - addIfExists(graphMap, GraphPropertiesDictionary.PROJECT_CODE, - ((ServiceMetadataDataDefinition) metadataDataDefinition).getProjectCode()); - addIfExists(graphMap, GraphPropertiesDictionary.DISTRIBUTION_STATUS, - ((ServiceMetadataDataDefinition) metadataDataDefinition).getDistributionStatus()); - return graphMap; - } - + public ServiceMetadataData() { + super(NodeTypeEnum.Service, new ServiceMetadataDataDefinition()); + } + + public ServiceMetadataData(ServiceMetadataDataDefinition serviceMetadataDataDefinition) { + super(NodeTypeEnum.Service, serviceMetadataDataDefinition); + } + + public ServiceMetadataData(GraphPropertiesDictionaryExtractor extractor) { + super(NodeTypeEnum.Service, new ServiceMetadataDataDefinition(), extractor); + metadataDataDefinition.setProjectCode(extractor.getProjectCode()); + ((ServiceMetadataDataDefinition) metadataDataDefinition).setDistributionStatus(extractor.getDistributionStatus()); + } + + @Override + public String getUniqueIdKey() { + return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> graphMap = super.toGraphMap(); + addIfExists(graphMap, GraphPropertiesDictionary.PROJECT_CODE, ((ServiceMetadataDataDefinition) metadataDataDefinition).getProjectCode()); + addIfExists(graphMap, GraphPropertiesDictionary.DISTRIBUTION_STATUS, + ((ServiceMetadataDataDefinition) metadataDataDefinition).getDistributionStatus()); + return graphMap; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/TagData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/TagData.java index 949aa83c14..f308105dac 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/TagData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/TagData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,9 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @@ -28,50 +29,46 @@ import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - @Getter @Setter @EqualsAndHashCode @ToString public class TagData extends GraphNode { - private String name; - - protected TagData(NodeTypeEnum label) { - super(label); - } + private String name; - public TagData(String name) { - super(NodeTypeEnum.Tag); - this.name = name; - } + protected TagData(NodeTypeEnum label) { + super(label); + } - public TagData() { - super(NodeTypeEnum.Tag); - } + public TagData(String name) { + super(NodeTypeEnum.Tag); + this.name = name; + } - public TagData(Map<String, Object> properties) { - super(NodeTypeEnum.Tag); - setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - } + public TagData() { + super(NodeTypeEnum.Tag); + } - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - addIfExists(map, GraphPropertiesDictionary.NAME, name); - return map; - } + public TagData(Map<String, Object> properties) { + super(NodeTypeEnum.Tag); + setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + } - @Override - public String getUniqueIdKey() { - return GraphPropertiesDictionary.NAME.getProperty(); - } + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.NAME, name); + return map; + } - @Override - public String getUniqueId() { - return name; - } + @Override + public String getUniqueIdKey() { + return GraphPropertiesDictionary.NAME.getProperty(); + } + @Override + public String getUniqueId() { + return name; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UniqueIdData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UniqueIdData.java index fd3b8659a1..cddfeb33d9 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UniqueIdData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UniqueIdData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,31 +17,28 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.Map; - public class UniqueIdData extends GraphNode { - private String uniqueId; - - public UniqueIdData(NodeTypeEnum label, String uniqueId) { - super(label); - this.uniqueId = uniqueId; - } + private String uniqueId; - @Override - public String getUniqueId() { - return uniqueId; - } + public UniqueIdData(NodeTypeEnum label, String uniqueId) { + super(label); + this.uniqueId = uniqueId; + } - @Override - public Map<String, Object> toGraphMap() { - return null; - } + @Override + public String getUniqueId() { + return uniqueId; + } + @Override + public Map<String, Object> toGraphMap() { + return null; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserData.java index 420bb7ee79..164502fb15 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,212 +17,218 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.utils.DaoUtils; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - public class UserData extends GraphNode { - private String firstName; - - private String lastName; - - private String userId; - - private String email; - - private String role; - - private String status; - - private Long lastLoginTime; - - public UserData(String firstName, String lastName, String userId, String email, String role, String status, - Long lastLoginTime) { - super(NodeTypeEnum.User); - this.firstName = firstName; - this.lastName = lastName; - this.userId = userId; - this.email = email; - this.role = role; - this.status = status; - this.lastLoginTime = lastLoginTime; - } - - public UserData() { - super(NodeTypeEnum.User); - } - - public UserData(Map<String, Object> properties) { - super(NodeTypeEnum.User); - - setFirstName((String) properties.get("firstName")); - setLastName((String) properties.get("lastName")); - setUserId((String) properties.get("userId")); - setEmail((String) properties.get("email")); - setRole((String) properties.get("role")); - setStatus((String) properties.get("status")); - setLastLoginTime((Long) properties.get("lastLoginTime")); - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getRole() { - return role; - } - - public void setRole(String role) { - this.role = role; - } - - // right name? - public void setLastLoginTime() { - Date d = new Date(); - this.lastLoginTime = new Long(d.getTime()); // this is in milli-seconds - // divide by 1000 to get - // secs? - } - - public void setLastLoginTime(Long time) { - this.lastLoginTime = time; - } - - public Long getLastLoginTime() { - return this.lastLoginTime; - } - - @Override - public String toString() { - return "UserData [firstName=" + firstName + ", lastName=" + lastName + ", userId=" + userId + ", email=" + email - + ", role=" + role + ", last Login time=" + lastLoginTime + ", parent: " + super.toString() + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((userId == null) ? 0 : userId.hashCode()); - result = prime * result + ((email == null) ? 0 : email.hashCode()); - result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); - result = prime * result + ((lastName == null) ? 0 : lastName.hashCode()); - result = prime * result + ((role == null) ? 0 : role.hashCode()); - result = prime * result + ((lastLoginTime == null) ? 0 : lastLoginTime.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - UserData other = (UserData) obj; - if (userId == null) { - if (other.userId != null) - return false; - } else if (!userId.equals(other.userId)) - return false; - if (email == null) { - if (other.email != null) - return false; - } else if (!email.equals(other.email)) - return false; - if (firstName == null) { - if (other.firstName != null) - return false; - } else if (!firstName.equals(other.firstName)) - return false; - if (lastName == null) { - if (other.lastName != null) - return false; - } else if (!lastName.equals(other.lastName)) - return false; - if (role == null) { - if (other.role != null) - return false; - } else if (!role.equals(other.role)) - return false; - if (lastLoginTime == null) { - if (other.lastLoginTime != null) - return false; - } else if (!lastLoginTime.equals(other.lastLoginTime)) - return false; - return true; - } - - public String toJson() { - return DaoUtils.convertToJson(toGraphMap()); - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - addIfExists(map, GraphPropertiesDictionary.USERID, userId); - addIfExists(map, GraphPropertiesDictionary.EMAIL, email); - addIfExists(map, GraphPropertiesDictionary.FIRST_NAME, firstName); - addIfExists(map, GraphPropertiesDictionary.LAST_NAME, lastName); - addIfExists(map, GraphPropertiesDictionary.ROLE, role); - addIfExists(map, GraphPropertiesDictionary.USER_STATUS, status); - addIfExists(map, GraphPropertiesDictionary.LAST_LOGIN_TIME, lastLoginTime); - return map; - } - - @Override - public String getUniqueIdKey() { - return GraphPropertiesDictionary.USERID.getProperty(); - } - - @Override - public String getUniqueId() { - return userId; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - + private String firstName; + private String lastName; + private String userId; + private String email; + private String role; + private String status; + private Long lastLoginTime; + + public UserData(String firstName, String lastName, String userId, String email, String role, String status, Long lastLoginTime) { + super(NodeTypeEnum.User); + this.firstName = firstName; + this.lastName = lastName; + this.userId = userId; + this.email = email; + this.role = role; + this.status = status; + this.lastLoginTime = lastLoginTime; + } + + public UserData() { + super(NodeTypeEnum.User); + } + + public UserData(Map<String, Object> properties) { + super(NodeTypeEnum.User); + setFirstName((String) properties.get("firstName")); + setLastName((String) properties.get("lastName")); + setUserId((String) properties.get("userId")); + setEmail((String) properties.get("email")); + setRole((String) properties.get("role")); + setStatus((String) properties.get("status")); + setLastLoginTime((Long) properties.get("lastLoginTime")); + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + // right name? + public void setLastLoginTime() { + Date d = new Date(); + this.lastLoginTime = new Long(d.getTime()); // this is in milli-seconds + + // divide by 1000 to get + + // secs? + } + + public Long getLastLoginTime() { + return this.lastLoginTime; + } + + public void setLastLoginTime(Long time) { + this.lastLoginTime = time; + } + + @Override + public String toString() { + return "UserData [firstName=" + firstName + ", lastName=" + lastName + ", userId=" + userId + ", email=" + email + ", role=" + role + + ", last Login time=" + lastLoginTime + ", parent: " + super.toString() + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((userId == null) ? 0 : userId.hashCode()); + result = prime * result + ((email == null) ? 0 : email.hashCode()); + result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); + result = prime * result + ((lastName == null) ? 0 : lastName.hashCode()); + result = prime * result + ((role == null) ? 0 : role.hashCode()); + result = prime * result + ((lastLoginTime == null) ? 0 : lastLoginTime.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + UserData other = (UserData) obj; + if (userId == null) { + if (other.userId != null) { + return false; + } + } else if (!userId.equals(other.userId)) { + return false; + } + if (email == null) { + if (other.email != null) { + return false; + } + } else if (!email.equals(other.email)) { + return false; + } + if (firstName == null) { + if (other.firstName != null) { + return false; + } + } else if (!firstName.equals(other.firstName)) { + return false; + } + if (lastName == null) { + if (other.lastName != null) { + return false; + } + } else if (!lastName.equals(other.lastName)) { + return false; + } + if (role == null) { + if (other.role != null) { + return false; + } + } else if (!role.equals(other.role)) { + return false; + } + if (lastLoginTime == null) { + if (other.lastLoginTime != null) { + return false; + } + } else if (!lastLoginTime.equals(other.lastLoginTime)) { + return false; + } + return true; + } + + public String toJson() { + return DaoUtils.convertToJson(toGraphMap()); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.USERID, userId); + addIfExists(map, GraphPropertiesDictionary.EMAIL, email); + addIfExists(map, GraphPropertiesDictionary.FIRST_NAME, firstName); + addIfExists(map, GraphPropertiesDictionary.LAST_NAME, lastName); + addIfExists(map, GraphPropertiesDictionary.ROLE, role); + addIfExists(map, GraphPropertiesDictionary.USER_STATUS, status); + addIfExists(map, GraphPropertiesDictionary.LAST_LOGIN_TIME, lastLoginTime); + return map; + } + + @Override + public String getUniqueIdKey() { + return GraphPropertiesDictionary.USERID.getProperty(); + } + + @Override + public String getUniqueId() { + return userId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserFunctionalMenuData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserFunctionalMenuData.java index 18ff96bbf0..bc4e29cbf8 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserFunctionalMenuData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/UserFunctionalMenuData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,79 +17,72 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.dao.utils.DaoUtils; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class UserFunctionalMenuData extends GraphNode { - private String uniqueId; - - private String functionalMenu; - - public UserFunctionalMenuData(String functionalMenu, String uniqueId) { - super(NodeTypeEnum.UserFunctionalMenu); - this.functionalMenu = functionalMenu; - this.uniqueId = uniqueId; - } - - public UserFunctionalMenuData() { - super(NodeTypeEnum.UserFunctionalMenu); - } - - public UserFunctionalMenuData(Map<String, Object> properties) { - super(NodeTypeEnum.UserFunctionalMenu); - - setFunctionalMenu((String) properties.get(GraphPropertiesDictionary.FUNCTIONAL_MENU.getProperty())); - setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - } - - public String getFunctionalMenu() { - return functionalMenu; - } - - public void setFunctionalMenu(String functionalMenu) { - this.functionalMenu = functionalMenu; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - @Override - public String toString() { - return "UserFunctionalMenuData [uniqueId=" + uniqueId + ", functionalMenu=" + functionalMenu + "]"; - } - - public String toJson() { - return DaoUtils.convertToJson(toGraphMap()); - } - - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); - - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); - addIfExists(map, GraphPropertiesDictionary.FUNCTIONAL_MENU, functionalMenu); - - return map; - } - - @Override - public String getUniqueIdKey() { - return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); - } - - @Override - public String getUniqueId() { - return uniqueId; - } - + private String uniqueId; + private String functionalMenu; + + public UserFunctionalMenuData(String functionalMenu, String uniqueId) { + super(NodeTypeEnum.UserFunctionalMenu); + this.functionalMenu = functionalMenu; + this.uniqueId = uniqueId; + } + + public UserFunctionalMenuData() { + super(NodeTypeEnum.UserFunctionalMenu); + } + + public UserFunctionalMenuData(Map<String, Object> properties) { + super(NodeTypeEnum.UserFunctionalMenu); + setFunctionalMenu((String) properties.get(GraphPropertiesDictionary.FUNCTIONAL_MENU.getProperty())); + setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + } + + public String getFunctionalMenu() { + return functionalMenu; + } + + public void setFunctionalMenu(String functionalMenu) { + this.functionalMenu = functionalMenu; + } + + @Override + public String toString() { + return "UserFunctionalMenuData [uniqueId=" + uniqueId + ", functionalMenu=" + functionalMenu + "]"; + } + + public String toJson() { + return DaoUtils.convertToJson(toGraphMap()); + } + + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId); + addIfExists(map, GraphPropertiesDictionary.FUNCTIONAL_MENU, functionalMenu); + return map; + } + + @Override + public String getUniqueIdKey() { + return GraphPropertiesDictionary.UNIQUE_ID.getProperty(); + } + + @Override + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java index 9f176d0c7c..7c9caf91ef 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingActionEnum.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,14 +17,13 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import org.openecomp.sdc.common.log.wrappers.Logger; //TODO rename to AuditAction public enum AuditingActionEnum { - + // @formatter:off // User administration ADD_USER("AddUser", AuditingTypesConstants.USER_ADMIN_EVENT_TYPE), UPDATE_USER("UpdateUser", AuditingTypesConstants.USER_ADMIN_EVENT_TYPE), @@ -52,7 +51,7 @@ public enum AuditingActionEnum { ARTIFACT_UPLOAD_BY_API("ArtifactUploadByAPI", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE), ARTIFACT_UPDATE_BY_API("ArtifactUpdateByAPI", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE), ARTIFACT_DELETE_BY_API("ArtifactDeleteByAPI", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE), - DOWNLOAD_ARTIFACT("DownloadArtifact",AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE), + DOWNLOAD_ARTIFACT("DownloadArtifact", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE), CREATE_RESOURCE_BY_API("CreateResourceByAPI", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE), CREATE_SERVICE_BY_API("CreateServiceByAPI", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE), CHANGE_LIFECYCLE_BY_API("ChangeLifecycleByAPI", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE), @@ -63,7 +62,7 @@ public enum AuditingActionEnum { ARTIFACT_DELETE("ArtifactDelete", AuditingTypesConstants.RESOURCE_ADMIN_EVENT_TYPE), ARTIFACT_DOWNLOAD("ArtifactDownload", AuditingTypesConstants.RESOURCE_ADMIN_EVENT_TYPE), - //Automated upgrade + //Automated upgrade UPDATE_SERVICE_REFERENCE("UpdateServiceReference", AuditingTypesConstants.RESOURCE_ADMIN_EVENT_TYPE), VF_UPGRADE_SERVICES("VfUpgradeServices", AuditingTypesConstants.RESOURCE_ADMIN_EVENT_TYPE), @@ -83,7 +82,7 @@ public enum AuditingActionEnum { DISTRIBUTION_UN_REGISTER("DUnRegister", AuditingTypesConstants.DISTRIBUTION_ENGINE_EVENT_TYPE), DISTRIBUTION_NOTIFY("DNotify", AuditingTypesConstants.DISTRIBUTION_NOTIFICATION_EVENT_TYPE), DISTRIBUTION_STATUS("DStatus", AuditingTypesConstants.DISTRIBUTION_STATUS_EVENT_TYPE), - DISTRIBUTION_DEPLOY("DResult",AuditingTypesConstants.DISTRIBUTION_DEPLOY_EVENT_TYPE), + DISTRIBUTION_DEPLOY("DResult", AuditingTypesConstants.DISTRIBUTION_DEPLOY_EVENT_TYPE), GET_UEB_CLUSTER("GetUebCluster", AuditingTypesConstants.DISTRIBUTION_GET_UEB_CLUSTER_EVENT_TYPE), GET_VALID_ARTIFACT_TYPES("GetValidArtifactTypes", AuditingTypesConstants.DISTRIBUTION_GET_VALID_ARTIFACT_TYPES_EVENT_TYPE), @@ -118,26 +117,17 @@ public enum AuditingActionEnum { Import_Replace_Service("ImportReplaceService", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE), Replace_VNF("ReplaceVNF", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE), Import_Replace_Resource("ReplaceVNF", AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE); - - private final String name; - private final String auditingEsType; - + // @formatter:on private static Logger log = Logger.getLogger(AuditingActionEnum.class.getName()); + private final String name; + private final String auditingEsType; AuditingActionEnum(String name, String auditingEsType) { this.name = name; this.auditingEsType = auditingEsType; } - public String getName() { - return name; - } - - public String getAuditingEsType() { - return auditingEsType; - } - public static AuditingActionEnum fromName(String name) { AuditingActionEnum res = null; AuditingActionEnum[] values = values(); @@ -152,4 +142,12 @@ public enum AuditingActionEnum { } return res; } + + public String getName() { + return name; + } + + public String getAuditingEsType() { + return auditingEsType; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java index f37f9b9d01..2c9ebe74f6 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGenericEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,23 +17,21 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; - -import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; import com.datastax.driver.mapping.annotations.Transient; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.TimeZone; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; public class AuditingGenericEvent { + + protected static String dateFormatPattern = "yyyy-MM-dd HH:mm:ss.SSS z"; @Transient protected SimpleDateFormat simpleDateFormat; - protected static String dateFormatPattern = "yyyy-MM-dd HH:mm:ss.SSS z"; - @Transient protected String requestId; @Transient @@ -49,14 +47,12 @@ public class AuditingGenericEvent { @Transient protected Map<String, Object> fields = new HashMap<>(); - public AuditingGenericEvent() { super(); simpleDateFormat = new SimpleDateFormat(dateFormatPattern); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); this.timestamp = simpleDateFormat.format(new Date()); fields.put(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName(), this.timestamp); - } public String getRequestId() { @@ -65,7 +61,6 @@ public class AuditingGenericEvent { public void setRequestId(String requestId) { this.requestId = requestId; - } public String getServiceInstanceId() { @@ -101,14 +96,12 @@ public class AuditingGenericEvent { } public void fillFields() { - } protected Date parseDateFromString(final String timestamp) { try { return simpleDateFormat.parse(timestamp); - } - catch (Exception e) { + } catch (Exception e) { return new Date(); } } @@ -128,6 +121,4 @@ public class AuditingGenericEvent { public void setFields(Map<String, Object> fields) { this.fields = fields; } - - } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGetUebClusterEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGetUebClusterEvent.java index 17a794691d..31d6fbcfda 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGetUebClusterEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingGetUebClusterEvent.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,17 +24,16 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @Table(keyspace = AuditingTypesConstants.AUDIT_KEYSPACE, name = AuditingTypesConstants.DISTRIBUTION_GET_UEB_CLUSTER_EVENT_TYPE) @@ -43,23 +41,19 @@ public class AuditingGetUebClusterEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn - @Setter(AccessLevel.NONE)protected Date timestamp1; - + @Setter(AccessLevel.NONE) + protected Date timestamp1; @Column(name = "request_id") protected String requestId; - @Column(name = "service_instance_id") protected String serviceInstanceId; @Column protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - @Column(name = "consumer_id") private String consumerId; @@ -82,6 +76,7 @@ public class AuditingGetUebClusterEvent extends AuditingGenericEvent { public void setTimestamp1(String timestamp) { this.timestamp1 = parseDateFromString(timestamp); } + public void setTimestamp1(Date timestamp) { this.timestamp1 = timestamp; } @@ -89,7 +84,6 @@ public class AuditingGetUebClusterEvent extends AuditingGenericEvent { @Override public void fillFields() { fields.put(AuditingFieldsKey.AUDIT_REQUEST_ID.getDisplayName(), getRequestId()); - fields.put(AuditingFieldsKey.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId()); fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); @@ -98,14 +92,12 @@ public class AuditingGetUebClusterEvent extends AuditingGenericEvent { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); fields.put(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName(), simpleDateFormat.format(timestamp1)); - } @Override public String toString() { - return "AuditingGetUebClusterEvent [timebaseduuid=" + timebaseduuid + ", timestamp1=" + timestamp1 - + ", requestId=" + requestId + ", serviceInstanceId=" + serviceInstanceId + ", action=" + action - + ", status=" + status + ", desc=" + desc + ", consumerId=" + consumerId + "]"; + return "AuditingGetUebClusterEvent [timebaseduuid=" + timebaseduuid + ", timestamp1=" + timestamp1 + ", requestId=" + requestId + + ", serviceInstanceId=" + serviceInstanceId + ", action=" + action + ", status=" + status + ", desc=" + desc + ", consumerId=" + + consumerId + "]"; } - } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java index 2716621cae..0d0cfe9111 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuditingTypesConstants.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; public interface AuditingTypesConstants { @@ -27,12 +26,10 @@ public interface AuditingTypesConstants { String AUDIT_KEYSPACE = "sdcaudit"; String COMPONENT_KEYSPACE = "sdccomponent"; String janusGraph_KEYSPACE = "janusgraph"; - String USER_ADMIN_EVENT_TYPE = "useradminevent"; String USER_ACCESS_EVENT_TYPE = "useraccessevent"; String RESOURCE_ADMIN_EVENT_TYPE = "resourceadminevent"; String DISTRIBUTION_DOWNLOAD_EVENT_TYPE = "distributiondownloadevent"; - String DISTRIBUTION_ENGINE_EVENT_TYPE = "distributionengineevent"; String DISTRIBUTION_NOTIFICATION_EVENT_TYPE = "distributionnotificationevent"; String DISTRIBUTION_STATUS_EVENT_TYPE = "distributionstatusevent"; @@ -40,7 +37,6 @@ public interface AuditingTypesConstants { String DISTRIBUTION_GET_UEB_CLUSTER_EVENT_TYPE = "auditinggetuebclusterevent"; //TODO remove if not in use String DISTRIBUTION_GET_VALID_ARTIFACT_TYPES_EVENT_TYPE = "auditinggetvalidartifacttypesevent"; - String ECOMP_OPERATIONAL_ENV_EVENT_TYPE = "ecompopenvironmentevent"; String AUTH_EVENT_TYPE = "authevent"; String CONSUMER_EVENT_TYPE = "consumerevent"; @@ -50,5 +46,4 @@ public interface AuditingTypesConstants { String EXTERNAL_API_EVENT_TYPE = "externalapievent"; String ENVIRONMENT_ENGINE_EVENT_TYPE = "environmentengineevent"; String FEATURE_TOGGLE_STATE = "featuretogglestate"; - } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuthEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuthEvent.java index 0133a73e3d..1f57710c25 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuthEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/AuthEvent.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,15 +24,14 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; -import lombok.Getter; -import lombok.Setter; -import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; - import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; @Getter @Setter @@ -42,30 +40,24 @@ public class AuthEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn protected Date timestamp1; - - @Column - private String url; - @Column - private String user; - - @Column(name = "auth_status") - private String authStatus; - - @Column - private String realm; @Column protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - @Column(name = "request_id") protected String requestId; + @Column + private String url; + @Column + private String user; + @Column(name = "auth_status") + private String authStatus; + @Column + private String realm; public AuthEvent(String action, CommonAuditData commonAuditData, String user, String authUrl, String realm, String authStatus) { this(); @@ -96,7 +88,6 @@ public class AuthEvent extends AuditingGenericEvent { @Override public void fillFields() { fields.put(AuditingFieldsKey.AUDIT_AUTH_URL.getDisplayName(), getUrl()); - fields.put(AuditingFieldsKey.AUDIT_AUTH_USER.getDisplayName(), getUser()); fields.put(AuditingFieldsKey.AUDIT_AUTH_STATUS.getDisplayName(), getAuthStatus()); fields.put(AuditingFieldsKey.AUDIT_AUTH_REALM.getDisplayName(), getRealm()); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/CategoryEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/CategoryEvent.java index bb3603de88..d1d31ca547 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/CategoryEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/CategoryEvent.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,15 +24,14 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; -import lombok.Getter; -import lombok.Setter; -import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; -import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; - import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; +import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; @Getter @Setter @@ -42,35 +40,26 @@ public class CategoryEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn protected Date timestamp1; - @Column String action; @Column String status; @Column(name = "description") String desc; - @Column(name = "category_name") String categoryName; - @Column(name = "sub_category_name") String subCategoryName; - @Column(name = "grouping_name") String groupingName; - @Column String modifier; - @Column(name = "service_instance_id") String serviceInstanceId; - @Column(name = "resource_type") String resourceType; - @Column(name = "request_id") String requestId; @@ -105,7 +94,6 @@ public class CategoryEvent extends AuditingGenericEvent { @Override public void fillFields() { - fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); fields.put(AuditingFieldsKey.AUDIT_DESC.getDisplayName(), getDesc()); @@ -119,6 +107,5 @@ public class CategoryEvent extends AuditingGenericEvent { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); fields.put(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName(), simpleDateFormat.format(timestamp1)); - } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ConsumerEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ConsumerEvent.java index 77bac06d51..02a2bd99d2 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ConsumerEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ConsumerEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,18 +24,16 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.Getter; import lombok.Setter; import lombok.ToString; -import org.apache.tinkerpop.shaded.jackson.annotation.JsonSetter; import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @ToString @@ -45,23 +42,18 @@ public class ConsumerEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn protected Date timestamp1; - @Column(name = "request_id") protected String requestId; @Column protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - @Column private String modifier; - @Column(name = "ecomp_user") private String ecompUser; @@ -92,7 +84,6 @@ public class ConsumerEvent extends AuditingGenericEvent { @Override public void fillFields() { fields.put(AuditingFieldsKey.AUDIT_REQUEST_ID.getDisplayName(), getRequestId()); - fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); fields.put(AuditingFieldsKey.AUDIT_DESC.getDisplayName(), getDesc()); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDeployEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDeployEvent.java index afa3f6b4e0..aca939517f 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDeployEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDeployEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,6 +24,10 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -32,11 +35,6 @@ import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; import org.openecomp.sdc.be.resources.data.auditing.model.ResourceCommonInfo; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @ToString @@ -45,35 +43,26 @@ public class DistributionDeployEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn protected Date timestamp1; - @Column(name = "request_id") protected String requestId; - @Column(name = "service_instance_id") protected String serviceInstanceId; @Column protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - @Column(name = "resource_name") private String resourceName; - @Column(name = "resource_type") private String resourceType; - @Column(name = "curr_version") private String currVersion; - @Column private String modifier; - @Column private String did; @@ -112,7 +101,6 @@ public class DistributionDeployEvent extends AuditingGenericEvent { fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); fields.put(AuditingFieldsKey.AUDIT_DESC.getDisplayName(), getDesc()); - fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_ID.getDisplayName(), getDid()); fields.put(AuditingFieldsKey.AUDIT_MODIFIER_UID.getDisplayName(), getModifier()); fields.put(AuditingFieldsKey.AUDIT_RESOURCE_CURR_VERSION.getDisplayName(), getCurrVersion()); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDownloadEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDownloadEvent.java index 84554493d9..5d683ac71d 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDownloadEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionDownloadEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,6 +24,10 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -32,11 +35,6 @@ import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @ToString @@ -45,27 +43,20 @@ public class DistributionDownloadEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn protected Date timestamp1; - @Column(name = "request_id") protected String requestId; - @Column(name = "service_instance_id") protected String serviceInstanceId; - @Column protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - @Column(name = "consumer_id") private String consumerId; - @Column(name = "resource_url") private String resourceUrl; @@ -101,7 +92,6 @@ public class DistributionDownloadEvent extends AuditingGenericEvent { fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); fields.put(AuditingFieldsKey.AUDIT_DESC.getDisplayName(), getDesc()); - fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_CONSUMER_ID.getDisplayName(), getConsumerId()); fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_RESOURCE_URL.getDisplayName(), getResourceUrl()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionEngineEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionEngineEvent.java index 3bc3582aaf..c61a1a9370 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionEngineEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionEngineEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,6 +24,10 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -32,11 +35,6 @@ import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; import org.openecomp.sdc.be.resources.data.auditing.model.DistributionTopicData; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @ToString @@ -45,39 +43,28 @@ public class DistributionEngineEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn protected Date timestamp1; - @Column(name = "request_id") protected String requestId; - @Column(name = "service_instance_id") protected String serviceInstanceId; - @Column protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - @Column(name = "consumer_id") private String consumerId; - @Column(name = "DSTATUS_TOPIC") private String dstatusTopic; - @Column(name = "DNOTIF_TOPIC") private String dnotifTopic; - @Column(name = "d_env") private String environmentName; - @Column private String role; - @Column(name = "api_key") private String apiKey; @@ -88,7 +75,7 @@ public class DistributionEngineEvent extends AuditingGenericEvent { } public DistributionEngineEvent(String action, CommonAuditData commonAuditData, String consumerId, DistributionTopicData distributionTopicData, - String apiKey, String envName, String role) { + String apiKey, String envName, String role) { this(); this.action = action; this.requestId = commonAuditData.getRequestId(); @@ -115,19 +102,16 @@ public class DistributionEngineEvent extends AuditingGenericEvent { @Override public void fillFields() { fields.put(AuditingFieldsKey.AUDIT_REQUEST_ID.getDisplayName(), getRequestId()); - fields.put(AuditingFieldsKey.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId()); fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); fields.put(AuditingFieldsKey.AUDIT_DESC.getDisplayName(), getDesc()); - fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_CONSUMER_ID.getDisplayName(), getConsumerId()); fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_API_KEY.getDisplayName(), getApiKey()); fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_ENVRIONMENT_NAME.getDisplayName(), getEnvironmentName()); fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_ROLE.getDisplayName(), getRole()); fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_STATUS_TOPIC_NAME.getDisplayName(), getDstatusTopic()); - fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_NOTIFICATION_TOPIC_NAME.getDisplayName(), - getDnotifTopic()); + fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_NOTIFICATION_TOPIC_NAME.getDisplayName(), getDnotifTopic()); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); fields.put(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName(), simpleDateFormat.format(timestamp1)); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionNotificationEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionNotificationEvent.java index 174dea663d..a487efb885 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionNotificationEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionNotificationEvent.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,6 +24,10 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; @@ -34,11 +37,6 @@ import org.openecomp.sdc.be.resources.data.auditing.model.ResourceCommonInfo; import org.openecomp.sdc.be.resources.data.auditing.model.ResourceVersionInfo; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @Table(keyspace = AuditingTypesConstants.AUDIT_KEYSPACE, name = AuditingTypesConstants.DISTRIBUTION_NOTIFICATION_EVENT_TYPE) @@ -46,50 +44,37 @@ public class DistributionNotificationEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn - @Setter(AccessLevel.NONE)protected Date timestamp1; - + @Setter(AccessLevel.NONE) + protected Date timestamp1; @Column(name = "request_id") protected String requestId; - @Column(name = "service_instance_id") protected String serviceInstanceId; @Column protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - @Column(name = "resource_name") private String resourceName; - @Column(name = "resource_type") private String resourceType; - @Column(name = "curr_version") private String currVersion; - @Column private String modifier; - @Column(name = "curr_state") private String currState; - @Column(name = "topic_name") private String topicName; - @Column private String did; - @Column(name = "env_id") private String envId; - @Column(name = "vnf_workload_context") private String vnfWorkloadContext; - @Column(name = "tenant") private String tenant; @@ -99,8 +84,7 @@ public class DistributionNotificationEvent extends AuditingGenericEvent { } public DistributionNotificationEvent(String action, CommonAuditData commonAuditData, ResourceCommonInfo resourceCommonInfo, - ResourceVersionInfo resourceVersionInfo, - String did, String modifier, String topicName, + ResourceVersionInfo resourceVersionInfo, String did, String modifier, String topicName, OperationalEnvAuditData opEnvFields) { this(); this.action = action; @@ -118,7 +102,6 @@ public class DistributionNotificationEvent extends AuditingGenericEvent { this.envId = opEnvFields.getEnvId(); this.vnfWorkloadContext = opEnvFields.getVnfWorkloadContext(); this.tenant = opEnvFields.getTenant(); - } public void setTimestamp1(String timestamp) { @@ -132,7 +115,6 @@ public class DistributionNotificationEvent extends AuditingGenericEvent { @Override public void fillFields() { fields.put(AuditingFieldsKey.AUDIT_REQUEST_ID.getDisplayName(), getRequestId()); - fields.put(AuditingFieldsKey.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId()); fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); @@ -140,7 +122,6 @@ public class DistributionNotificationEvent extends AuditingGenericEvent { fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_ENVIRONMENT_ID.getDisplayName(), getEnvId()); fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_VNF_WORKLOAD_CONTEXT.getDisplayName(), getVnfWorkloadContext()); fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_TENANT.getDisplayName(), getTenant()); - fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_ID.getDisplayName(), getDid()); fields.put(AuditingFieldsKey.AUDIT_MODIFIER_UID.getDisplayName(), getModifier()); fields.put(AuditingFieldsKey.AUDIT_RESOURCE_CURR_STATE.getDisplayName(), getCurrState()); @@ -155,12 +136,10 @@ public class DistributionNotificationEvent extends AuditingGenericEvent { @Override public String toString() { - return "DistributionNotificationEvent [timebaseduuid=" + timebaseduuid + ", timestamp1=" + timestamp1 - + ", requestId=" + requestId + ", serviceInstanceId=" + serviceInstanceId + ", action=" + action - + ", status=" + status + ", desc=" + desc + ", resourceName=" + resourceName + ", resourceType=" - + resourceType + ", currVersion=" + currVersion + ", modifier=" + modifier + ", currState=" + currState - + ", topicName=" + topicName + ", did=" + did - + ", envId=" + envId + ", vnfWorkloadContext=" + vnfWorkloadContext + ", tenant=" + tenant + "]"; + return "DistributionNotificationEvent [timebaseduuid=" + timebaseduuid + ", timestamp1=" + timestamp1 + ", requestId=" + requestId + + ", serviceInstanceId=" + serviceInstanceId + ", action=" + action + ", status=" + status + ", desc=" + desc + ", resourceName=" + + resourceName + ", resourceType=" + resourceType + ", currVersion=" + currVersion + ", modifier=" + modifier + ", currState=" + currState + + ", topicName=" + topicName + ", did=" + did + ", envId=" + envId + ", vnfWorkloadContext=" + vnfWorkloadContext + ", tenant=" + tenant + + "]"; } - } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionStatusEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionStatusEvent.java index 3c82a33f33..50ba39bf52 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionStatusEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/DistributionStatusEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,6 +24,10 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -32,11 +35,6 @@ import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; import org.openecomp.sdc.be.resources.data.auditing.model.DistributionData; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @ToString @@ -45,36 +43,26 @@ public class DistributionStatusEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn protected Date timestamp1; - @Column(name = "request_id") protected String requestId; - @Column(name = "service_instance_id") protected String serviceInstanceId; - @Column protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - @Column private String did; - @Column(name = "consumer_id") private String consumerId; - @Column(name = "topic_name") private String topicName; - @Column(name = "resoure_url") private String resoureURL; - @Column(name = "status_time") private String statusTime; @@ -82,11 +70,10 @@ public class DistributionStatusEvent extends AuditingGenericEvent { public DistributionStatusEvent() { timestamp1 = new Date(); timebaseduuid = UUIDs.timeBased(); - } - public DistributionStatusEvent(String action, CommonAuditData commonAuditData, DistributionData distributionData, - String did, String topicName, String statusTime) { + public DistributionStatusEvent(String action, CommonAuditData commonAuditData, DistributionData distributionData, String did, String topicName, + String statusTime) { this(); this.action = action; this.requestId = commonAuditData.getRequestId(); @@ -111,13 +98,11 @@ public class DistributionStatusEvent extends AuditingGenericEvent { @Override public void fillFields() { fields.put(AuditingFieldsKey.AUDIT_REQUEST_ID.getDisplayName(), getRequestId()); - fields.put(AuditingFieldsKey.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId()); fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); fields.put(AuditingFieldsKey.AUDIT_DESC.getDisplayName(), getDesc()); fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_CONSUMER_ID.getDisplayName(), getConsumerId()); - fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_ID.getDisplayName(), getDid()); fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_STATUS_TIME.getDisplayName(), getStatusTime()); fields.put(AuditingFieldsKey.AUDIT_DISTRIBUTION_TOPIC_NAME.getDisplayName(), getTopicName()); @@ -125,6 +110,5 @@ public class DistributionStatusEvent extends AuditingGenericEvent { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); fields.put(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName(), simpleDateFormat.format(timestamp1)); - } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/EcompOperationalEnvironmentEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/EcompOperationalEnvironmentEvent.java index c5cff1adb4..20396f6533 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/EcompOperationalEnvironmentEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/EcompOperationalEnvironmentEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,52 +17,42 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; import lombok.Getter; import lombok.Setter; import lombok.ToString; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; - - @Getter @Setter @ToString @Table(keyspace = AuditingTypesConstants.AUDIT_KEYSPACE, name = AuditingTypesConstants.ECOMP_OPERATIONAL_ENV_EVENT_TYPE) -public class EcompOperationalEnvironmentEvent extends AuditingGenericEvent { +public class EcompOperationalEnvironmentEvent extends AuditingGenericEvent { @PartitionKey @Column(name = "operational_environment_id") protected String operationalEnvironmentId; - @ClusteringColumn protected Date timestamp1; - @Column protected String action; - @Column(name = "operational_environment_action") protected String operationalEnvironmentAction; - @Column(name = "operational_environment_name") protected String operationalEnvironmentName; - @Column(name = "operational_environment_type") protected String operationalEnvironmentType; - @Column(name = "tenant_context") protected String tenantContext; - //Required to be public as it is used by Cassandra driver on get operation public EcompOperationalEnvironmentEvent() { timestamp1 = new Date(); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java index 3d10792cba..dbd644b7cc 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ExternalApiEvent.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,6 +24,10 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.Getter; import lombok.Setter; import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; @@ -33,72 +36,50 @@ import org.openecomp.sdc.be.resources.data.auditing.model.ResourceCommonInfo; import org.openecomp.sdc.be.resources.data.auditing.model.ResourceVersionInfo; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - /** * This class Represents the Audit for External API - * */ @Getter @Setter @Table(keyspace = AuditingTypesConstants.AUDIT_KEYSPACE, name = AuditingTypesConstants.EXTERNAL_API_EVENT_TYPE) public class ExternalApiEvent extends AuditingGenericEvent { + @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn() protected Date timestamp1; - @Column protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - + @Column(name = "service_instance_id") + protected String serviceInstanceId; + @Column(name = "invariant_uuid") + protected String invariantUuid; + @Column(name = "prev_version") + protected String prevVersion; + @Column(name = "prev_state") + protected String prevState; + @Column(name = "curr_state") + protected String currState; @Column(name = "consumer_id") private String consumerId; - @Column(name = "resource_url") private String resourceURL; - @Column(name = "resource_name") private String resourceName; - @Column(name = "resource_type") private String resourceType; - - @Column(name = "service_instance_id") - protected String serviceInstanceId; - - @Column(name = "invariant_uuid") - protected String invariantUuid; - @Column(name = "modifier") private String modifier; - - @Column(name = "prev_version") - protected String prevVersion; - @Column(name = "curr_version") private String currVersion; - - @Column(name = "prev_state") - protected String prevState; - - @Column(name = "curr_state") - protected String currState; - @Column(name = "prev_artifact_uuid") private String prevArtifactUuid; - @Column(name = "curr_artifact_uuid") private String currArtifactUuid; - @Column(name = "artifact_data") private String artifactData; @@ -108,9 +89,9 @@ public class ExternalApiEvent extends AuditingGenericEvent { timebaseduuid = UUIDs.timeBased(); } - public ExternalApiEvent(String action, CommonAuditData commonAuditData, ResourceCommonInfo resourceCommonInfo, - DistributionData distributionData, ResourceVersionInfo prevParams, ResourceVersionInfo currParams, - String modifier, String invariantUuid, String artifactData) { + public ExternalApiEvent(String action, CommonAuditData commonAuditData, ResourceCommonInfo resourceCommonInfo, DistributionData distributionData, + ResourceVersionInfo prevParams, ResourceVersionInfo currParams, String modifier, String invariantUuid, + String artifactData) { this(); this.action = action; this.status = commonAuditData.getStatus(); @@ -147,12 +128,10 @@ public class ExternalApiEvent extends AuditingGenericEvent { fields.put(AuditingFieldsKey.AUDIT_RESOURCE_NAME.getDisplayName(), getResourceName()); fields.put(AuditingFieldsKey.AUDIT_RESOURCE_TYPE.getDisplayName(), getResourceType()); fields.put(AuditingFieldsKey.AUDIT_MODIFIER_UID.getDisplayName(), getModifier()); - fields.put(AuditingFieldsKey.AUDIT_RESOURCE_PREV_VERSION.getDisplayName(), getPrevVersion()); fields.put(AuditingFieldsKey.AUDIT_RESOURCE_CURR_VERSION.getDisplayName(), getCurrVersion()); fields.put(AuditingFieldsKey.AUDIT_RESOURCE_PREV_STATE.getDisplayName(), getPrevState()); fields.put(AuditingFieldsKey.AUDIT_RESOURCE_CURR_STATE.getDisplayName(), getCurrState()); - fields.put(AuditingFieldsKey.AUDIT_PREV_ARTIFACT_UUID.getDisplayName(), getPrevArtifactUuid()); fields.put(AuditingFieldsKey.AUDIT_CURR_ARTIFACT_UUID.getDisplayName(), getCurrArtifactUuid()); fields.put(AuditingFieldsKey.AUDIT_ARTIFACT_DATA.getDisplayName(), getArtifactData()); @@ -160,13 +139,10 @@ public class ExternalApiEvent extends AuditingGenericEvent { @Override public String toString() { - return "ExternalApiEvent [timebaseduuid=" + timebaseduuid + ", timestamp1=" + timestamp1 + ", action=" + action - + ", status=" + status + ", desc=" + desc + ", consumerId=" + consumerId + ", resourceURL=" - + resourceURL + ", resourceName=" + resourceName + ", resourceType=" + resourceType - + ", serviceInstanceId=" + serviceInstanceId + ", invariantUuid=" + invariantUuid + ", modifier=" + modifier - + ", prevVersion=" + prevVersion+ ", currVersion=" + currVersion - + ", prevState=" + prevState + ", currState=" + currState - + ", prevArtifactUuid=" - + prevArtifactUuid + ", currArtifactUuid=" + currArtifactUuid + ", artifactData=" + artifactData + "]"; + return "ExternalApiEvent [timebaseduuid=" + timebaseduuid + ", timestamp1=" + timestamp1 + ", action=" + action + ", status=" + status + + ", desc=" + desc + ", consumerId=" + consumerId + ", resourceURL=" + resourceURL + ", resourceName=" + resourceName + ", resourceType=" + + resourceType + ", serviceInstanceId=" + serviceInstanceId + ", invariantUuid=" + invariantUuid + ", modifier=" + modifier + + ", prevVersion=" + prevVersion + ", currVersion=" + currVersion + ", prevState=" + prevState + ", currState=" + currState + + ", prevArtifactUuid=" + prevArtifactUuid + ", currArtifactUuid=" + currArtifactUuid + ", artifactData=" + artifactData + "]"; } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/GetCategoryHierarchyEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/GetCategoryHierarchyEvent.java index 95dc1f1729..513cdc5b81 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/GetCategoryHierarchyEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/GetCategoryHierarchyEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,42 +24,37 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.Getter; import lombok.Setter; import lombok.ToString; import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @ToString @Table(keyspace = AuditingTypesConstants.AUDIT_KEYSPACE, name = AuditingTypesConstants.GET_CATEGORY_HIERARCHY_EVENT_TYPE) public class GetCategoryHierarchyEvent extends AuditingGenericEvent { + @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn() // @Column(name="timestamp") protected Date timestamp1; - @Column(name = "request_id") protected String requestId; @Column protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - @Column private String modifier; - @Column private String details; @@ -88,10 +82,9 @@ public class GetCategoryHierarchyEvent extends AuditingGenericEvent { this.timestamp1 = timestamp1; } - @Override + @Override public void fillFields() { fields.put(AuditingFieldsKey.AUDIT_REQUEST_ID.getDisplayName(), getRequestId()); - fields.put(AuditingFieldsKey.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId()); fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/GetUsersListEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/GetUsersListEvent.java index 0ced76bd1c..6d0b8ce806 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/GetUsersListEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/GetUsersListEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,41 +24,36 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.Getter; import lombok.Setter; import lombok.ToString; import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @ToString @Table(keyspace = AuditingTypesConstants.AUDIT_KEYSPACE, name = AuditingTypesConstants.GET_USERS_LIST_EVENT_TYPE) public class GetUsersListEvent extends AuditingGenericEvent { + @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn protected Date timestamp1; - @Column(name = "request_id") protected String requestId; @Column protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - @Column private String modifier; - @Column private String details; @@ -90,7 +84,6 @@ public class GetUsersListEvent extends AuditingGenericEvent { @Override public void fillFields() { fields.put(AuditingFieldsKey.AUDIT_REQUEST_ID.getDisplayName(), getRequestId()); - fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); fields.put(AuditingFieldsKey.AUDIT_DESC.getDisplayName(), getDesc()); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ResourceAdminEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ResourceAdminEvent.java index da3563e7f5..c30cdb2d56 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ResourceAdminEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/ResourceAdminEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,6 +24,10 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -33,11 +36,6 @@ import org.openecomp.sdc.be.resources.data.auditing.model.ResourceCommonInfo; import org.openecomp.sdc.be.resources.data.auditing.model.ResourceVersionInfo; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @ToString @@ -46,80 +44,59 @@ public class ResourceAdminEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn protected Date timestamp1; - @Column protected String action; - @Column(name = "resource_type") protected String resourceType; - @Column(name = "prev_version") protected String prevVersion; - @Column(name = "prev_state") protected String prevState; - @Column(name = "curr_state") protected String currState; - - @Column(name = "resource_name") - private String resourceName; - - @Column(name = "curr_version") - private String currVersion; - @Column(name = "request_id") protected String requestId; - @Column(name = "service_instance_id") protected String serviceInstanceId; - @Column protected String status; - @Column(name = "description") protected String desc; - @Column protected String modifier; - @Column(name = "prev_artifact_UUID") protected String prevArtifactUUID; - @Column(name = "curr_artifact_UUID") protected String currArtifactUUID; - @Column(name = "artifact_data") protected String artifactData; - @Column protected String did; - @Column(name = "dprev_status") protected String dprevStatus; - @Column(name = "dcurr_status") protected String dcurrStatus; - @Column(name = "tosca_node_type") protected String toscaNodeType; - @Column protected String comment; - @Column(name = "invariant_UUID") protected String invariantUUID; + @Column(name = "resource_name") + private String resourceName; + @Column(name = "curr_version") + private String currVersion; public ResourceAdminEvent() { timestamp1 = new Date(); timebaseduuid = UUIDs.timeBased(); } - public ResourceAdminEvent(String action, CommonAuditData commonAuditData, ResourceCommonInfo resourceCommonInfo, ResourceVersionInfo prevParams, ResourceVersionInfo currParams, - String invariantUuid, String modifier, String artifactData, String comment, String did, String toscaNodeType) { + public ResourceAdminEvent(String action, CommonAuditData commonAuditData, ResourceCommonInfo resourceCommonInfo, ResourceVersionInfo prevParams, + ResourceVersionInfo currParams, String invariantUuid, String modifier, String artifactData, String comment, String did, + String toscaNodeType) { this(); this.action = action; this.requestId = commonAuditData.getRequestId(); @@ -155,7 +132,6 @@ public class ResourceAdminEvent extends AuditingGenericEvent { @Override public void fillFields() { fields.put(AuditingFieldsKey.AUDIT_REQUEST_ID.getDisplayName(), getRequestId()); - fields.put(AuditingFieldsKey.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId()); fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); @@ -176,7 +152,6 @@ public class ResourceAdminEvent extends AuditingGenericEvent { fields.put(AuditingFieldsKey.AUDIT_RESOURCE_DPREV_STATUS.getDisplayName(), getDprevStatus()); fields.put(AuditingFieldsKey.AUDIT_RESOURCE_TOSCA_NODE_TYPE.getDisplayName(), getToscaNodeType()); fields.put(AuditingFieldsKey.AUDIT_INVARIANT_UUID.getDisplayName(), getInvariantUUID()); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatPattern); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); fields.put(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName(), timestamp1.getTime()); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/UserAccessEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/UserAccessEvent.java index bbf647a525..370336041d 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/UserAccessEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/UserAccessEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,17 +24,16 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.Getter; import lombok.Setter; import lombok.ToString; import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @ToString @@ -44,25 +42,18 @@ public class UserAccessEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn protected Date timestamp1; - @Column(name = "REQUEST_ID") protected String requestId; - @Column(name = "USER") private String userUid; - @Column private String status; - @Column(name = "DESCRIPTION") private String desc; - @Column private String action; - @Column(name = "service_instance_id") private String serviceInstanceId; @@ -93,7 +84,6 @@ public class UserAccessEvent extends AuditingGenericEvent { @Override public void fillFields() { fields.put(AuditingFieldsKey.AUDIT_REQUEST_ID.getDisplayName(), getRequestId()); - fields.put(AuditingFieldsKey.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId()); fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/UserAdminEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/UserAdminEvent.java index f0763fe0b8..f9d72620de 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/UserAdminEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/UserAdminEvent.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing; import com.datastax.driver.core.utils.UUIDs; @@ -25,17 +24,16 @@ import com.datastax.driver.mapping.annotations.ClusteringColumn; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; import lombok.Getter; import lombok.Setter; import lombok.ToString; import org.openecomp.sdc.be.resources.data.auditing.model.CommonAuditData; import org.openecomp.sdc.common.datastructure.AuditingFieldsKey; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.UUID; - @Getter @Setter @ToString @@ -44,30 +42,22 @@ public class UserAdminEvent extends AuditingGenericEvent { @PartitionKey protected UUID timebaseduuid; - @ClusteringColumn protected Date timestamp1; - @Column(name = "REQUEST_ID") protected String requestId; - @Column(name = "SERVICE_INSTANCE_ID") protected String serviceInstanceId; - @Column(name = "ACTION") protected String action; @Column protected String status; - @Column(name = "description") protected String desc; - @Column private String modifier; - @Column(name = "user_before") private String userBefore; - @Column(name = "user_after") private String userAfter; @@ -100,7 +90,6 @@ public class UserAdminEvent extends AuditingGenericEvent { @Override public void fillFields() { fields.put(AuditingFieldsKey.AUDIT_REQUEST_ID.getDisplayName(), getRequestId()); - fields.put(AuditingFieldsKey.AUDIT_SERVICE_INSTANCE_ID.getDisplayName(), getServiceInstanceId()); fields.put(AuditingFieldsKey.AUDIT_ACTION.getDisplayName(), getAction()); fields.put(AuditingFieldsKey.AUDIT_STATUS.getDisplayName(), getStatus()); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditData.java index 6fb64ecce1..e676257742 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/CommonAuditData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,10 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing.model; public class CommonAuditData { + private String description; private String requestId; private String serviceInstanceId; @@ -30,6 +30,10 @@ public class CommonAuditData { //for builder } + public static Builder newBuilder() { + return new Builder(); + } + public String getStatus() { return status; } @@ -38,27 +42,24 @@ public class CommonAuditData { return description; } - public void setRequestId(String requestId) { - this.requestId = requestId; - } - public String getRequestId() { return requestId; } + public void setRequestId(String requestId) { + this.requestId = requestId; + } + public String getServiceInstanceId() { return serviceInstanceId; } public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId ; - } - - public static Builder newBuilder() { - return new Builder(); + this.serviceInstanceId = serviceInstanceId; } public static class Builder { + private final CommonAuditData instance; private Builder() { @@ -93,7 +94,5 @@ public class CommonAuditData { public CommonAuditData build() { return instance; } - } - } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionData.java index 2101a0cf60..118f10b6ef 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing.model; public class DistributionData { diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionTopicData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionTopicData.java index 01436dc3c7..f8dff71bcb 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionTopicData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/DistributionTopicData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,16 +17,20 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing.model; public class DistributionTopicData { + private String statusTopic; private String notificationTopic; private DistributionTopicData() { } + public static Builder newBuilder() { + return new Builder(); + } + public String getStatusTopic() { return statusTopic; } @@ -35,10 +39,6 @@ public class DistributionTopicData { return notificationTopic; } - public static Builder newBuilder() { - return new Builder(); - } - public static class Builder { private final DistributionTopicData instance; @@ -60,6 +60,5 @@ public class DistributionTopicData { public DistributionTopicData build() { return instance; } - } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/OperationalEnvAuditData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/OperationalEnvAuditData.java index 06242481dd..31f2c4fa74 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/OperationalEnvAuditData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/OperationalEnvAuditData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,14 +17,20 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing.model; public class OperationalEnvAuditData { + private String envId; private String vnfWorkloadContext; private String tenant; + public OperationalEnvAuditData(String envId, String vnfWorkloadContext, String tenant) { + this.envId = envId; + this.vnfWorkloadContext = vnfWorkloadContext; + this.tenant = tenant; + } + public String getEnvId() { return envId; } @@ -36,11 +42,4 @@ public class OperationalEnvAuditData { public String getTenant() { return tenant; } - - public OperationalEnvAuditData(String envId, String vnfWorkloadContext, String tenant) { - this.envId = envId; - this.vnfWorkloadContext = vnfWorkloadContext; - this.tenant = tenant; - } - } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceCommonInfo.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceCommonInfo.java index 4ca585ccc1..155ba07ee8 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceCommonInfo.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceCommonInfo.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing.model; import lombok.AllArgsConstructor; diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceVersionInfo.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceVersionInfo.java index 26d28a34a2..abf204b2e7 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceVersionInfo.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/auditing/model/ResourceVersionInfo.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,10 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.auditing.model; public class ResourceVersionInfo { + private String artifactUuid; private String state; private String version; @@ -37,16 +37,21 @@ public class ResourceVersionInfo { public String getArtifactUuid() { return artifactUuid; } + public String getState() { return state; } + public String getVersion() { return version; } - public String getDistributionStatus() { return distributionStatus; } + public String getDistributionStatus() { + return distributionStatus; + } public static class Builder { + private final ResourceVersionInfo instance; private Builder() { diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/CategoryData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/CategoryData.java index 613f91d841..8c4f2076ca 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/CategoryData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/CategoryData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,84 +17,81 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.category; import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.category.CategoryDataDefinition; import org.openecomp.sdc.be.datatypes.category.MetadataKeyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class CategoryData extends GraphNode { - private CategoryDataDefinition categoryDataDefinition; - - public CategoryData(NodeTypeEnum label) { - super(label); - categoryDataDefinition = new CategoryDataDefinition(); - } - public CategoryData(NodeTypeEnum label, CategoryDataDefinition categoryDataDefinition) { - super(label); - this.categoryDataDefinition = categoryDataDefinition; - } + private CategoryDataDefinition categoryDataDefinition; - public CategoryData(Map<String, Object> properties) { - this(NodeTypeEnum.getByName((String) properties.get(GraphPropertiesDictionary.LABEL.getProperty()))); + public CategoryData(NodeTypeEnum label) { + super(label); + categoryDataDefinition = new CategoryDataDefinition(); + } - categoryDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - categoryDataDefinition - .setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); - categoryDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - final Object useServiceSubstitutionForNestedServicesProperty = properties.get(GraphPropertiesDictionary.USE_SERVICE_SUBSTITUTION_FOR_NESTED_SERVICES.getProperty()); - final boolean useServiceSubstitutionForNestedServices = useServiceSubstitutionForNestedServicesProperty != null && (boolean) useServiceSubstitutionForNestedServicesProperty; - categoryDataDefinition.setUseServiceSubstitutionForNestedServices(useServiceSubstitutionForNestedServices); + public CategoryData(NodeTypeEnum label, CategoryDataDefinition categoryDataDefinition) { + super(label); + this.categoryDataDefinition = categoryDataDefinition; + } - Type listType = new TypeToken<List<String>>() { - }.getType(); - List<String> iconsfromJson = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.ICONS.getProperty()), listType); - categoryDataDefinition.setIcons(iconsfromJson); - - final Type metadataKeylistType = new TypeToken<List<MetadataKeyDataDefinition>>() {}.getType(); - final List<MetadataKeyDataDefinition> metadataKeysfromJson = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.METADATA_KEYS.getProperty()), metadataKeylistType); - categoryDataDefinition.setMetadataKeys(metadataKeysfromJson); - } + public CategoryData(Map<String, Object> properties) { + this(NodeTypeEnum.getByName((String) properties.get(GraphPropertiesDictionary.LABEL.getProperty()))); + categoryDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + categoryDataDefinition.setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); + categoryDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + final Object useServiceSubstitutionForNestedServicesProperty = properties + .get(GraphPropertiesDictionary.USE_SERVICE_SUBSTITUTION_FOR_NESTED_SERVICES.getProperty()); + final boolean useServiceSubstitutionForNestedServices = + useServiceSubstitutionForNestedServicesProperty != null && (boolean) useServiceSubstitutionForNestedServicesProperty; + categoryDataDefinition.setUseServiceSubstitutionForNestedServices(useServiceSubstitutionForNestedServices); + Type listType = new TypeToken<List<String>>() { + }.getType(); + List<String> iconsfromJson = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.ICONS.getProperty()), listType); + categoryDataDefinition.setIcons(iconsfromJson); + final Type metadataKeylistType = new TypeToken<List<MetadataKeyDataDefinition>>() { + }.getType(); + final List<MetadataKeyDataDefinition> metadataKeysfromJson = getGson() + .fromJson((String) properties.get(GraphPropertiesDictionary.METADATA_KEYS.getProperty()), metadataKeylistType); + categoryDataDefinition.setMetadataKeys(metadataKeysfromJson); + } - @Override - public String getUniqueId() { - return categoryDataDefinition.getUniqueId(); - } + @Override + public String getUniqueId() { + return categoryDataDefinition.getUniqueId(); + } - public CategoryDataDefinition getCategoryDataDefinition() { - return categoryDataDefinition; - } + public CategoryDataDefinition getCategoryDataDefinition() { + return categoryDataDefinition; + } - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, categoryDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.NAME, categoryDataDefinition.getName()); + addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, categoryDataDefinition.getNormalizedName()); + // String icons=getGson().toJson(categoryDataDefinition.getIcons()); - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, categoryDataDefinition.getUniqueId()); - addIfExists(map, GraphPropertiesDictionary.NAME, categoryDataDefinition.getName()); - addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, categoryDataDefinition.getNormalizedName()); - // String icons=getGson().toJson(categoryDataDefinition.getIcons()); - // addIfExists(map, GraphPropertiesDictionary.ICONS, icons); + // addIfExists(map, GraphPropertiesDictionary.ICONS, icons); addIfExists(map, GraphPropertiesDictionary.ICONS, categoryDataDefinition.getIcons()); - addIfExists(map, GraphPropertiesDictionary.USE_SERVICE_SUBSTITUTION_FOR_NESTED_SERVICES, categoryDataDefinition.isUseServiceSubstitutionForNestedServices()); + addIfExists(map, GraphPropertiesDictionary.USE_SERVICE_SUBSTITUTION_FOR_NESTED_SERVICES, + categoryDataDefinition.isUseServiceSubstitutionForNestedServices()); addIfExists(map, GraphPropertiesDictionary.METADATA_KEYS, categoryDataDefinition.getMetadataKeys()); - return map; - } - - @Override - public String toString() { - return "CategoryData [categoryDataDefinition=" + categoryDataDefinition + "]"; - } + return map; + } + @Override + public String toString() { + return "CategoryData [categoryDataDefinition=" + categoryDataDefinition + "]"; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/GroupingData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/GroupingData.java index 1991c48f48..ce35ecb7e3 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/GroupingData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/GroupingData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,57 +17,51 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.category; +import java.util.HashMap; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.category.GroupingDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.util.HashMap; -import java.util.Map; - public class GroupingData extends GraphNode { - private GroupingDataDefinition groupingDataDefinition; - - public GroupingData(NodeTypeEnum label) { - super(label); - groupingDataDefinition = new GroupingDataDefinition(); - } - - public GroupingData(NodeTypeEnum label, GroupingDataDefinition groupingDataDefinition) { - super(label); - this.groupingDataDefinition = groupingDataDefinition; - } - - public GroupingData(Map<String, Object> properties) { - this(NodeTypeEnum.getByName((String) properties.get(GraphPropertiesDictionary.LABEL.getProperty()))); + private GroupingDataDefinition groupingDataDefinition; - groupingDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - groupingDataDefinition - .setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); - groupingDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); - } + public GroupingData(NodeTypeEnum label) { + super(label); + groupingDataDefinition = new GroupingDataDefinition(); + } - public GroupingDataDefinition getGroupingDataDefinition() { - return groupingDataDefinition; - } + public GroupingData(NodeTypeEnum label, GroupingDataDefinition groupingDataDefinition) { + super(label); + this.groupingDataDefinition = groupingDataDefinition; + } - @Override - public String getUniqueId() { - return groupingDataDefinition.getUniqueId(); - } + public GroupingData(Map<String, Object> properties) { + this(NodeTypeEnum.getByName((String) properties.get(GraphPropertiesDictionary.LABEL.getProperty()))); + groupingDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + groupingDataDefinition.setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); + groupingDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + } - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); + public GroupingDataDefinition getGroupingDataDefinition() { + return groupingDataDefinition; + } - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, groupingDataDefinition.getUniqueId()); - addIfExists(map, GraphPropertiesDictionary.NAME, groupingDataDefinition.getName()); - addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, groupingDataDefinition.getNormalizedName()); - return map; - } + @Override + public String getUniqueId() { + return groupingDataDefinition.getUniqueId(); + } + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, groupingDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.NAME, groupingDataDefinition.getName()); + addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, groupingDataDefinition.getNormalizedName()); + return map; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/SubCategoryData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/SubCategoryData.java index 13976035b6..ed96691804 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/SubCategoryData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/category/SubCategoryData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,76 +17,69 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.category; import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.category.MetadataKeyDataDefinition; import org.openecomp.sdc.be.datatypes.category.SubCategoryDataDefinition; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class SubCategoryData extends GraphNode { - private SubCategoryDataDefinition subCategoryDataDefinition; - - public SubCategoryData(NodeTypeEnum label) { - super(label); - subCategoryDataDefinition = new SubCategoryDataDefinition(); - } - - public SubCategoryData(NodeTypeEnum label, SubCategoryDataDefinition subCategoryDataDefinition) { - super(label); - this.subCategoryDataDefinition = subCategoryDataDefinition; - } + private SubCategoryDataDefinition subCategoryDataDefinition; - public SubCategoryData(Map<String, Object> properties) { - this(NodeTypeEnum.getByName((String) properties.get(GraphPropertiesDictionary.LABEL.getProperty()))); + public SubCategoryData(NodeTypeEnum label) { + super(label); + subCategoryDataDefinition = new SubCategoryDataDefinition(); + } - subCategoryDataDefinition - .setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); - subCategoryDataDefinition - .setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); - subCategoryDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + public SubCategoryData(NodeTypeEnum label, SubCategoryDataDefinition subCategoryDataDefinition) { + super(label); + this.subCategoryDataDefinition = subCategoryDataDefinition; + } - Type listType = new TypeToken<List<String>>() { - }.getType(); - List<String> iconsfromJson = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.ICONS.getProperty()), listType); - subCategoryDataDefinition.setIcons(iconsfromJson); - - final Type metadataKeylistType = new TypeToken<List<MetadataKeyDataDefinition>>() {}.getType(); - final List<MetadataKeyDataDefinition> metadataKeysfromJson = getGson() - .fromJson((String) properties.get(GraphPropertiesDictionary.METADATA_KEYS.getProperty()), metadataKeylistType); - subCategoryDataDefinition.setMetadataKeys(metadataKeysfromJson); - } + public SubCategoryData(Map<String, Object> properties) { + this(NodeTypeEnum.getByName((String) properties.get(GraphPropertiesDictionary.LABEL.getProperty()))); + subCategoryDataDefinition.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty())); + subCategoryDataDefinition.setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty())); + subCategoryDataDefinition.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty())); + Type listType = new TypeToken<List<String>>() { + }.getType(); + List<String> iconsfromJson = getGson().fromJson((String) properties.get(GraphPropertiesDictionary.ICONS.getProperty()), listType); + subCategoryDataDefinition.setIcons(iconsfromJson); + final Type metadataKeylistType = new TypeToken<List<MetadataKeyDataDefinition>>() { + }.getType(); + final List<MetadataKeyDataDefinition> metadataKeysfromJson = getGson() + .fromJson((String) properties.get(GraphPropertiesDictionary.METADATA_KEYS.getProperty()), metadataKeylistType); + subCategoryDataDefinition.setMetadataKeys(metadataKeysfromJson); + } - public SubCategoryDataDefinition getSubCategoryDataDefinition() { - return subCategoryDataDefinition; - } + public SubCategoryDataDefinition getSubCategoryDataDefinition() { + return subCategoryDataDefinition; + } - @Override - public String getUniqueId() { - return subCategoryDataDefinition.getUniqueId(); - } + @Override + public String getUniqueId() { + return subCategoryDataDefinition.getUniqueId(); + } - @Override - public Map<String, Object> toGraphMap() { - Map<String, Object> map = new HashMap<>(); + @Override + public Map<String, Object> toGraphMap() { + Map<String, Object> map = new HashMap<>(); + addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, subCategoryDataDefinition.getUniqueId()); + addIfExists(map, GraphPropertiesDictionary.NAME, subCategoryDataDefinition.getName()); + addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, subCategoryDataDefinition.getNormalizedName()); + // String icons=getGson().toJson(subCategoryDataDefinition.getIcons()); - addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, subCategoryDataDefinition.getUniqueId()); - addIfExists(map, GraphPropertiesDictionary.NAME, subCategoryDataDefinition.getName()); - addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, subCategoryDataDefinition.getNormalizedName()); - // String icons=getGson().toJson(subCategoryDataDefinition.getIcons()); - // addIfExists(map, GraphPropertiesDictionary.ICONS, icons); - addIfExists(map, GraphPropertiesDictionary.ICONS, subCategoryDataDefinition.getIcons()); - addIfExists(map, GraphPropertiesDictionary.METADATA_KEYS, subCategoryDataDefinition.getMetadataKeys()); - return map; - } + // addIfExists(map, GraphPropertiesDictionary.ICONS, icons); + addIfExists(map, GraphPropertiesDictionary.ICONS, subCategoryDataDefinition.getIcons()); + addIfExists(map, GraphPropertiesDictionary.METADATA_KEYS, subCategoryDataDefinition.getMetadataKeys()); + return map; + } } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEvent.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEvent.java index 8fdb576cbe..a92842161b 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEvent.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/togglz/FeatureToggleEvent.java @@ -17,14 +17,15 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.be.resources.data.togglz; import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; +import com.datastax.driver.mapping.annotations.Transient; import com.google.common.base.Joiner; import com.google.common.base.Splitter; +import java.util.Map; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -34,27 +35,21 @@ import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; import org.openecomp.sdc.common.log.wrappers.Logger; import org.togglz.core.Feature; import org.togglz.core.repository.FeatureState; -import com.datastax.driver.mapping.annotations.Transient; - -import java.util.Map; @Getter @Setter @NoArgsConstructor @Table(keyspace = AuditingTypesConstants.REPO_KEYSPACE, name = AuditingTypesConstants.FEATURE_TOGGLE_STATE) public class FeatureToggleEvent { - private static final Logger logger = Logger.getLogger(FeatureToggleEvent.class); + private static final Logger logger = Logger.getLogger(FeatureToggleEvent.class); @PartitionKey @Column(name = "feature_name") private String featureName; - @Column(name = "enabled") private String enabled; - @Column(name = "strategy_id") private String strategyId; - @Column(name = "parameters") private String parameters; @@ -74,22 +69,16 @@ public class FeatureToggleEvent { } FeatureState featureState = new FeatureState(feature, Boolean.valueOf(enabled)); featureState.setStrategyId(strategyId); - setParameters(featureState); return featureState; - } private void setParameters(FeatureState featureState) { try { Map<String, String> paramMap = Splitter.on(",").withKeyValueSeparator("=").split(parameters); - paramMap.keySet().forEach(p->featureState.setParameter(p, paramMap.get(p))); - } - catch(IllegalArgumentException e) { - logger.warn(EcompLoggerErrorCode.DATA_ERROR, "FeatureToggle", - "FeatureState Object generating", e.getMessage()); + paramMap.keySet().forEach(p -> featureState.setParameter(p, paramMap.get(p))); + } catch (IllegalArgumentException e) { + logger.warn(EcompLoggerErrorCode.DATA_ERROR, "FeatureToggle", "FeatureState Object generating", e.getMessage()); } } - - } |