X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=models-tosca%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fmodels%2Ftosca%2Fsimple%2Fconcepts%2FJpaToscaProperty.java;h=48ee9d4a2f182c2ba20d1ef75ea496b075bc5556;hb=ec488290e3aa12cc7fcdf44cc7744bceae89af7f;hp=93da035a54486149c37c82ecc4d2fee6ba479dcf;hpb=fd809717ca774dfabeddd3984fbbbbdfd029601e;p=policy%2Fmodels.git diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java index 93da035a5..48ee9d4a2 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java @@ -3,7 +3,7 @@ * ONAP Policy Model * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,10 @@ package org.onap.policy.models.tosca.simple.concepts; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.EmbeddedId; @@ -36,6 +39,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; import org.apache.commons.lang3.ObjectUtils; +import org.onap.policy.common.utils.coder.YamlJsonTranslator; import org.onap.policy.models.base.PfAuthorative; import org.onap.policy.models.base.PfConcept; import org.onap.policy.models.base.PfConceptKey; @@ -82,11 +86,14 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative constraints; + private List constraints = new ArrayList<>(); @Column private JpaToscaEntrySchema entrySchema; + @ElementCollection + private Map metadata = new LinkedHashMap<>(); + /** * The Default Constructor creates a {@link JpaToscaProperty} object with a null key. */ @@ -106,7 +113,7 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative(copyConcept.constraints) : null); this.entrySchema = (copyConcept.entrySchema != null ? new JpaToscaEntrySchema(copyConcept.entrySchema) : null); + this.metadata = (copyConcept.metadata != null ? new LinkedHashMap<>(copyConcept.metadata) : null); } /** @@ -152,9 +160,12 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative toscaConstraints = new ArrayList<>(); @@ -169,6 +180,10 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative(metadata)); + } + return toscaProperty; } @@ -185,9 +200,14 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative(); @@ -199,6 +219,12 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative(toscaProperty.getMetadata()); + } + } @Override @@ -231,6 +257,12 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative metadataEntry : metadata.entrySet()) { + metadataEntry.setValue(metadataEntry.getValue().trim()); + } + } } @Override @@ -239,14 +271,14 @@ public class JpaToscaProperty extends PfConcept implements PfAuthorative