Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titlePersistence Model
collapsetrue
@Data
@EqualsAndHashCode(callSuper = true)
public class DocToscaServiceTemplate extends DocToscaEntity<ToscaServiceTemplate> {

    @SerializedName("data_types")
    private Map<String, @Valid DocToscaDataType> dataTypes;

    -------

    public DocToscaServiceTemplate(ToscaServiceTemplate authorativeConcept) {
        this.fromAuthorativesuper(authorativeConcept);
    }

    @Override
setName(DEFAULT_NAME);
      public ToscaServiceTemplate toAuthorativesetVersion(DEFAULT_VERSION);
 {
        final var toscaServiceTemplate = new ToscaServiceTemplate();
        super.setToscaEntity(toscaServiceTemplate);-------
     }
 
    public DocToscaServiceTemplate(ToscaServiceTemplate authorativeConcept) {
        superthis.toAuthorativefromAuthorative(authorativeConcept);

    }

    ifpublic DocToscaServiceTemplate(dataTypesfinal !=DocToscaServiceTemplate nullcopyConcept) {
        super(copyConcept);
        this.toscaDefinitionsVersion = copyConcept.toscaDefinitionsVersion;
      toscaServiceTemplate.setDataTypes(  this.dataTypes = DocUtil.docMapMapdocMapToMap(copyConcept.dataTypes, DocToscaDataType::toAuthorativenew, new LinkedHashMap<>());
 
       }
     -------
 
        return toscaServiceTemplate;}
    }

      @Override
    public voidToscaServiceTemplate fromAuthorativetoAuthorative(ToscaServiceTemplate toscaServiceTemplate) {
        super.fromAuthorative(toscaServiceTemplate);
 
final var toscaServiceTemplate = new ToscaServiceTemplate();
        super.setToscaEntity(toscaServiceTemplate);
        super.toAuthorative();

        toscaServiceTemplate.setDataTypes(DocUtil.docMapToMap(dataTypes, DocToscaDataType::toAuthorative));
        -------
 
        return toscaServiceTemplate;
    }

    @Override
    public void fromAuthorative(ToscaServiceTemplate toscaServiceTemplate) {
        super.fromAuthorative(toscaServiceTemplate);
 
        if (toscaServiceTemplate.getDataTypes() != null) {
            dataTypes = DocUtil.mapDocMap(toscaServiceTemplate.getDataTypes(), DocToscaDataType::new);
        }
 
        ------- 
    }

    @Override
    public int compareTo(DocToscaEntity<ToscaServiceTemplate> otherConcept) {
        int result = compareToWithoutEntities(otherConcept);
         if (toscaServiceTemplate.getDataTypes()result != null0) {
            dataTypes = DocUtil.mapDocMap(toscaServiceTemplate.getDataTypes(), DocToscaDataType::new)return result;
        }
        final DocToscaServiceTemplate other = (DocToscaServiceTemplate) otherConcept;

         ------- 
        return ObjectUtils.compare(toscaTopologyTemplate, other.toscaTopologyTemplate);
    }
}


In the example below the implementation of JpaToscaServiceTemplate for PostgreSQL/MariaDB (full implementation could be found here: https://gerrit.nordix.org/c/onap/policy/clamp/+/13642)

...