From f46c9d4eb423c7c432028a65199b0179bfef8707 Mon Sep 17 00:00:00 2001 From: Christos Tranoris Date: Fri, 9 Aug 2024 13:12:42 +0300 Subject: [PATCH] fixing model for jpa --- .../osl/tmf/pcm620/model/ProductOffering.java | 8 +- .../osl/tmf/pim637/model/PriceAlteration.java | 82 +- .../etsi/osl/tmf/pim637/model/Product.java | 257 +++-- .../osl/tmf/pim637/model/ProductPrice.java | 114 +-- .../tmf/pim637/model/ProductRefOrValue.java | 886 +----------------- .../tmf/pim637/model/ProductRelationship.java | 94 +- .../osl/tmf/pim637/model/ProductTerm.java | 91 +- .../pim637/model/RelatedPlaceRefOrValue.java | 99 +- .../osl/tmf/po622/model/AgreementItemRef.java | 131 +-- ...ProductOrderAttributeValueChangeEvent.java | 3 + ...OrderAttributeValueChangeNotification.java | 92 ++ .../po622/model/ProductOrderCreateEvent.java | 3 + .../model/ProductOrderCreateNotification.java | 91 ++ .../po622/model/ProductOrderDeleteEvent.java | 3 + .../model/ProductOrderDeleteNotification.java | 92 ++ .../osl/tmf/po622/model/ProductOrderItem.java | 16 +- .../tmf/po622/model/ProductOrderMapper.java | 193 ++-- .../model/ProductOrderStateChangeEvent.java | 3 + .../ProductOrderStateChangeNotification.java | 90 ++ .../po622/model/RelatedProductOrderItem.java | 14 +- 20 files changed, 745 insertions(+), 1617 deletions(-) create mode 100644 src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderAttributeValueChangeNotification.java create mode 100644 src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderCreateNotification.java create mode 100644 src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderDeleteNotification.java create mode 100644 src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderStateChangeNotification.java diff --git a/src/main/java/org/etsi/osl/tmf/pcm620/model/ProductOffering.java b/src/main/java/org/etsi/osl/tmf/pcm620/model/ProductOffering.java index 1efa62f..c05bc86 100644 --- a/src/main/java/org/etsi/osl/tmf/pcm620/model/ProductOffering.java +++ b/src/main/java/org/etsi/osl/tmf/pcm620/model/ProductOffering.java @@ -111,22 +111,22 @@ public class ProductOffering extends BaseEntity { private Set productOfferingTerm = new HashSet<>(); @JsonProperty("productSpecification") - @OneToOne( cascade = {CascadeType.MERGE, CascadeType.DETACH} ) + @OneToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) @JoinColumn(referencedColumnName = "uuid") private ProductSpecificationRef productSpecification = null; @JsonProperty("resourceCandidate") - @OneToOne( cascade = {CascadeType.MERGE, CascadeType.DETACH} ) + @OneToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) @JoinColumn(referencedColumnName = "uuid") private ResourceCandidateRef resourceCandidate = null; @JsonProperty("serviceCandidate") - @OneToOne( cascade = {CascadeType.MERGE, CascadeType.DETACH} ) + @OneToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) @JoinColumn(referencedColumnName = "uuid") private ServiceCandidateRef serviceCandidate = null; @JsonProperty("serviceLevelAgreement") - @OneToOne( cascade = {CascadeType.MERGE, CascadeType.DETACH} ) + @OneToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) @JoinColumn(referencedColumnName = "uuid") private SLARef serviceLevelAgreement = null; diff --git a/src/main/java/org/etsi/osl/tmf/pim637/model/PriceAlteration.java b/src/main/java/org/etsi/osl/tmf/pim637/model/PriceAlteration.java index e42c15a..75c3805 100644 --- a/src/main/java/org/etsi/osl/tmf/pim637/model/PriceAlteration.java +++ b/src/main/java/org/etsi/osl/tmf/pim637/model/PriceAlteration.java @@ -48,15 +48,6 @@ public class PriceAlteration extends BaseRootNamedEntity { @OneToOne(cascade = CascadeType.ALL) private ProductOfferingPriceRef productOfferingPrice = null; - @JsonProperty("@baseType") - private String _atBaseType = null; - - @JsonProperty("@schemaLocation") - private String _atSchemaLocation = null; - - @JsonProperty("@type") - private String _atType = null; - public PriceAlteration applicationDuration(Integer applicationDuration) { this.applicationDuration = applicationDuration; return this; @@ -239,65 +230,6 @@ public class PriceAlteration extends BaseRootNamedEntity { this.productOfferingPrice = productOfferingPrice; } - public PriceAlteration _atBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - return this; - } - - /** - * When sub-classing, this defines the super-class - * @return _atBaseType - **/ - @Schema(description = "When sub-classing, this defines the super-class") - @NotNull - - public String getAtBaseType() { - return _atBaseType; - } - - public void setAtBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - } - - public PriceAlteration _atSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - return this; - } - - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return _atSchemaLocation - **/ - @Schema(description = "A URI to a JSON-Schema file that defines additional attributes and relationships") - @NotNull - - public String getAtSchemaLocation() { - return _atSchemaLocation; - } - - public void setAtSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - } - - public PriceAlteration _atType(String _atType) { - this._atType = _atType; - return this; - } - - /** - * When sub-classing, this defines the sub-class entity name - * @return _atType - **/ - @Schema(description = "When sub-classing, this defines the sub-class entity name") - @NotNull - - public String getAtType() { - return _atType; - } - - public void setAtType(String _atType) { - this._atType = _atType; - } @Override @@ -318,14 +250,14 @@ public class PriceAlteration extends BaseRootNamedEntity { Objects.equals(this.unitOfMeasure, priceAlteration.unitOfMeasure) && Objects.equals(this.price, priceAlteration.price) && Objects.equals(this.productOfferingPrice, priceAlteration.productOfferingPrice) && - Objects.equals(this._atBaseType, priceAlteration._atBaseType) && - Objects.equals(this._atSchemaLocation, priceAlteration._atSchemaLocation) && - Objects.equals(this._atType, priceAlteration._atType); + Objects.equals(this.baseType, priceAlteration.baseType) && + Objects.equals(this.schemaLocation, priceAlteration.schemaLocation) && + Objects.equals(this.type, priceAlteration.type); } @Override public int hashCode() { - return Objects.hash(applicationDuration, description, name, priceType, priority, recurringChargePeriod, unitOfMeasure, price, productOfferingPrice, _atBaseType, _atSchemaLocation, _atType); + return Objects.hash(applicationDuration, description, name, priceType, priority, recurringChargePeriod, unitOfMeasure, price, productOfferingPrice, baseType, schemaLocation, type); } @Override @@ -342,9 +274,9 @@ public class PriceAlteration extends BaseRootNamedEntity { sb.append(" unitOfMeasure: ").append(toIndentedString(unitOfMeasure)).append("\n"); sb.append(" price: ").append(toIndentedString(price)).append("\n"); sb.append(" productOfferingPrice: ").append(toIndentedString(productOfferingPrice)).append("\n"); - sb.append(" _atBaseType: ").append(toIndentedString(_atBaseType)).append("\n"); - sb.append(" _atSchemaLocation: ").append(toIndentedString(_atSchemaLocation)).append("\n"); - sb.append(" _atType: ").append(toIndentedString(_atType)).append("\n"); + sb.append(" _atBaseType: ").append(toIndentedString(baseType)).append("\n"); + sb.append(" _atSchemaLocation: ").append(toIndentedString(schemaLocation)).append("\n"); + sb.append(" _atType: ").append(toIndentedString(type)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/org/etsi/osl/tmf/pim637/model/Product.java b/src/main/java/org/etsi/osl/tmf/pim637/model/Product.java index 3760745..75b40a5 100644 --- a/src/main/java/org/etsi/osl/tmf/pim637/model/Product.java +++ b/src/main/java/org/etsi/osl/tmf/pim637/model/Product.java @@ -2,9 +2,12 @@ package org.etsi.osl.tmf.pim637.model; import java.util.ArrayList; import java.util.Date; +import java.util.HashSet; import java.util.List; import java.util.Objects; +import java.util.Set; import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.tmf.common.model.BaseRootNamedEntity; import org.etsi.osl.tmf.common.model.service.Characteristic; import org.etsi.osl.tmf.common.model.service.ResourceRef; import org.etsi.osl.tmf.common.model.service.ServiceRef; @@ -15,6 +18,11 @@ import org.etsi.osl.tmf.po622.model.RelatedProductOrderItem; import org.etsi.osl.tmf.prm669.model.RelatedParty; import org.springframework.validation.annotation.Validated; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToMany; +import jakarta.persistence.OneToOne; import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; @@ -25,102 +33,106 @@ import jakarta.validation.constraints.NotNull; @Validated @jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") - -public class Product { +@Entity(name = "Product637") +public class Product extends BaseRootNamedEntity { @JsonProperty("id") - private String id = null; + protected String id = null; - @JsonProperty("href") - private String href = null; @JsonProperty("description") - private String description = null; + protected String description = null; @JsonProperty("isBundle") - private Boolean isBundle = null; + protected Boolean isBundle = null; @JsonProperty("isCustomerVisible") - private Boolean isCustomerVisible = null; - - @JsonProperty("name") - private String name = null; + protected Boolean isCustomerVisible = null; @JsonProperty("orderDate") - private Date orderDate = null; + protected Date orderDate = null; @JsonProperty("productSerialNumber") - private String productSerialNumber = null; + protected String productSerialNumber = null; @JsonProperty("startDate") - private Date startDate = null; + protected Date startDate = null; @JsonProperty("terminationDate") - private Date terminationDate = null; + protected Date terminationDate = null; @JsonProperty("agreement") @Valid - private List agreement = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set agreement = new HashSet<>(); @JsonProperty("billingAccount") - private BillingAccountRef billingAccount = null; + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "billing_acc_refuuid", referencedColumnName = "uuid") + protected BillingAccountRef billingAccount = null; @JsonProperty("place") @Valid - private List place = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set place = new HashSet<>(); @JsonProperty("product") @Valid - private List product = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set product = new HashSet<>(); @JsonProperty("productCharacteristic") @Valid - private List productCharacteristic = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set productCharacteristic = new HashSet<>(); @JsonProperty("productOffering") - private ProductOfferingRef productOffering = null; + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "prodoff_refuuid", referencedColumnName = "uuid") + protected ProductOfferingRef productOffering = null; @JsonProperty("productOrderItem") @Valid - private List productOrderItem = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set productOrderItem = new HashSet<>(); @JsonProperty("productPrice") @Valid - private List productPrice = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set productPrice = new HashSet<>(); @JsonProperty("productRelationship") @Valid - private List productRelationship = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set productRelationship = new HashSet<>(); @JsonProperty("productSpecification") - private ProductSpecificationRef productSpecification = null; + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "prodspec_refuuid", referencedColumnName = "uuid") + protected ProductSpecificationRef productSpecification = null; @JsonProperty("productTerm") @Valid - private List productTerm = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set productTerm = new HashSet<>(); @JsonProperty("realizingResource") @Valid - private List realizingResource = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set realizingResource = new HashSet<>(); @JsonProperty("realizingService") @Valid - private List realizingService = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set realizingService = new HashSet<>(); @JsonProperty("relatedParty") @Valid - private List relatedParty = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set relatedParty = new HashSet<>(); @JsonProperty("status") - private ProductStatusType status = null; - - @JsonProperty("@baseType") - private String _atBaseType = null; + protected ProductStatusType status = null; - @JsonProperty("@schemaLocation") - private String _atSchemaLocation = null; - - @JsonProperty("@type") - private String _atType = null; public Product id(String id) { this.id = id; @@ -325,14 +337,14 @@ public class Product { this.terminationDate = terminationDate; } - public Product agreement(List agreement) { + public Product agreement(Set agreement) { this.agreement = agreement; return this; } public Product addAgreementItem(AgreementItemRef agreementItem) { if (this.agreement == null) { - this.agreement = new ArrayList(); + this.agreement = new HashSet(); } this.agreement.add(agreementItem); return this; @@ -345,11 +357,11 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List getAgreement() { + public Set getAgreement() { return agreement; } - public void setAgreement(List agreement) { + public void setAgreement(Set agreement) { this.agreement = agreement; } @@ -374,14 +386,14 @@ public class Product { this.billingAccount = billingAccount; } - public Product place(List place) { + public Product place(Set place) { this.place = place; return this; } public Product addPlaceItem(RelatedPlaceRefOrValue placeItem) { if (this.place == null) { - this.place = new ArrayList(); + this.place = new HashSet(); } this.place.add(placeItem); return this; @@ -394,22 +406,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List getPlace() { + public Set getPlace() { return place; } - public void setPlace(List place) { + public void setPlace(Set place) { this.place = place; } - public Product product(List product) { + public Product product(Set product) { this.product = product; return this; } public Product addProductItem(ProductRefOrValue productItem) { if (this.product == null) { - this.product = new ArrayList(); + this.product = new HashSet(); } this.product.add(productItem); return this; @@ -422,22 +434,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List getProduct() { + public Set getProduct() { return product; } - public void setProduct(List product) { + public void setProduct(Set product) { this.product = product; } - public Product productCharacteristic(List productCharacteristic) { + public Product productCharacteristic(Set productCharacteristic) { this.productCharacteristic = productCharacteristic; return this; } public Product addProductCharacteristicItem(Characteristic productCharacteristicItem) { if (this.productCharacteristic == null) { - this.productCharacteristic = new ArrayList(); + this.productCharacteristic = new HashSet(); } this.productCharacteristic.add(productCharacteristicItem); return this; @@ -450,11 +462,11 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List getProductCharacteristic() { + public Set getProductCharacteristic() { return productCharacteristic; } - public void setProductCharacteristic(List productCharacteristic) { + public void setProductCharacteristic(Set productCharacteristic) { this.productCharacteristic = productCharacteristic; } @@ -479,14 +491,14 @@ public class Product { this.productOffering = productOffering; } - public Product productOrderItem(List productOrderItem) { + public Product productOrderItem(Set productOrderItem) { this.productOrderItem = productOrderItem; return this; } public Product addProductOrderItemItem(RelatedProductOrderItem productOrderItemItem) { if (this.productOrderItem == null) { - this.productOrderItem = new ArrayList(); + this.productOrderItem = new HashSet(); } this.productOrderItem.add(productOrderItemItem); return this; @@ -499,22 +511,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List getProductOrderItem() { + public Set getProductOrderItem() { return productOrderItem; } - public void setProductOrderItem(List productOrderItem) { + public void setProductOrderItem(Set productOrderItem) { this.productOrderItem = productOrderItem; } - public Product productPrice(List productPrice) { + public Product productPrice(Set productPrice) { this.productPrice = productPrice; return this; } public Product addProductPriceItem(ProductPrice productPriceItem) { if (this.productPrice == null) { - this.productPrice = new ArrayList(); + this.productPrice = new HashSet(); } this.productPrice.add(productPriceItem); return this; @@ -527,22 +539,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List getProductPrice() { + public Set getProductPrice() { return productPrice; } - public void setProductPrice(List productPrice) { + public void setProductPrice(Set productPrice) { this.productPrice = productPrice; } - public Product productRelationship(List productRelationship) { + public Product productRelationship(Set productRelationship) { this.productRelationship = productRelationship; return this; } public Product addProductRelationshipItem(ProductRelationship productRelationshipItem) { if (this.productRelationship == null) { - this.productRelationship = new ArrayList(); + this.productRelationship = new HashSet(); } this.productRelationship.add(productRelationshipItem); return this; @@ -555,11 +567,11 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List getProductRelationship() { + public Set getProductRelationship() { return productRelationship; } - public void setProductRelationship(List productRelationship) { + public void setProductRelationship(Set productRelationship) { this.productRelationship = productRelationship; } @@ -584,14 +596,14 @@ public class Product { this.productSpecification = productSpecification; } - public Product productTerm(List productTerm) { + public Product productTerm(Set productTerm) { this.productTerm = productTerm; return this; } public Product addProductTermItem(ProductTerm productTermItem) { if (this.productTerm == null) { - this.productTerm = new ArrayList(); + this.productTerm = new HashSet(); } this.productTerm.add(productTermItem); return this; @@ -604,22 +616,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List getProductTerm() { + public Set getProductTerm() { return productTerm; } - public void setProductTerm(List productTerm) { + public void setProductTerm(Set productTerm) { this.productTerm = productTerm; } - public Product realizingResource(List realizingResource) { + public Product realizingResource(Set realizingResource) { this.realizingResource = realizingResource; return this; } public Product addRealizingResourceItem(ResourceRef realizingResourceItem) { if (this.realizingResource == null) { - this.realizingResource = new ArrayList(); + this.realizingResource = new HashSet(); } this.realizingResource.add(realizingResourceItem); return this; @@ -632,22 +644,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List getRealizingResource() { + public Set getRealizingResource() { return realizingResource; } - public void setRealizingResource(List realizingResource) { + public void setRealizingResource(Set realizingResource) { this.realizingResource = realizingResource; } - public Product realizingService(List realizingService) { + public Product realizingService(Set realizingService) { this.realizingService = realizingService; return this; } public Product addRealizingServiceItem(ServiceRef realizingServiceItem) { if (this.realizingService == null) { - this.realizingService = new ArrayList(); + this.realizingService = new HashSet(); } this.realizingService.add(realizingServiceItem); return this; @@ -660,22 +672,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List getRealizingService() { + public Set getRealizingService() { return realizingService; } - public void setRealizingService(List realizingService) { + public void setRealizingService(Set realizingService) { this.realizingService = realizingService; } - public Product relatedParty(List relatedParty) { + public Product relatedParty(Set relatedParty) { this.relatedParty = relatedParty; return this; } public Product addRelatedPartyItem(RelatedParty relatedPartyItem) { if (this.relatedParty == null) { - this.relatedParty = new ArrayList(); + this.relatedParty = new HashSet(); } this.relatedParty.add(relatedPartyItem); return this; @@ -688,11 +700,11 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List getRelatedParty() { + public Set getRelatedParty() { return relatedParty; } - public void setRelatedParty(List relatedParty) { + public void setRelatedParty(Set relatedParty) { this.relatedParty = relatedParty; } @@ -717,65 +729,9 @@ public class Product { this.status = status; } - public Product _atBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - return this; - } + - /** - * When sub-classing, this defines the super-class - * @return _atBaseType - **/ - @Schema(description = "When sub-classing, this defines the super-class") - @NotNull - - public String getAtBaseType() { - return _atBaseType; - } - - public void setAtBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - } - - public Product _atSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - return this; - } - - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return _atSchemaLocation - **/ - @Schema(description = "A URI to a JSON-Schema file that defines additional attributes and relationships") - @NotNull - - public String getAtSchemaLocation() { - return _atSchemaLocation; - } - - public void setAtSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - } - - public Product _atType(String _atType) { - this._atType = _atType; - return this; - } - - /** - * When sub-classing, this defines the sub-class entity name - * @return _atType - **/ - @Schema(description = "When sub-classing, this defines the sub-class entity name") - @NotNull - - public String getAtType() { - return _atType; - } - - public void setAtType(String _atType) { - this._atType = _atType; - } + @Override @@ -812,15 +768,16 @@ public class Product { Objects.equals(this.realizingService, product.realizingService) && Objects.equals(this.relatedParty, product.relatedParty) && Objects.equals(this.status, product.status) && - Objects.equals(this._atBaseType, product._atBaseType) && - Objects.equals(this._atSchemaLocation, product._atSchemaLocation) && - Objects.equals(this._atType, product._atType); + Objects.equals(this.baseType, product.baseType) && + Objects.equals(this.schemaLocation, product.schemaLocation) && + Objects.equals(this.type, product.type); } - @Override - public int hashCode() { - return Objects.hash(id, href, description, isBundle, isCustomerVisible, name, orderDate, productSerialNumber, startDate, terminationDate, agreement, billingAccount, place, product, productCharacteristic, productOffering, productOrderItem, productPrice, productRelationship, productSpecification, productTerm, realizingResource, realizingService, relatedParty, status, _atBaseType, _atSchemaLocation, _atType); - } +// @Override +// public int hashCode() { +// return Objects.hash(id, href, description, isBundle, isCustomerVisible, name, orderDate, +// productSerialNumber, startDate, terminationDate, agreement, billingAccount, place, product, productCharacteristic, productOffering, productOrderItem, productPrice, productRelationship, productSpecification, productTerm, realizingResource, realizingService, relatedParty, status, baseType, _atSchemaLocation, _atType); +// } @Override public String toString() { @@ -852,9 +809,9 @@ public class Product { sb.append(" realizingService: ").append(toIndentedString(realizingService)).append("\n"); sb.append(" relatedParty: ").append(toIndentedString(relatedParty)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" _atBaseType: ").append(toIndentedString(_atBaseType)).append("\n"); - sb.append(" _atSchemaLocation: ").append(toIndentedString(_atSchemaLocation)).append("\n"); - sb.append(" _atType: ").append(toIndentedString(_atType)).append("\n"); + sb.append(" baseType: ").append(toIndentedString(baseType)).append("\n"); + sb.append(" schemaLocation: ").append(toIndentedString(schemaLocation)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/org/etsi/osl/tmf/pim637/model/ProductPrice.java b/src/main/java/org/etsi/osl/tmf/pim637/model/ProductPrice.java index d60d5da..b871aa6 100644 --- a/src/main/java/org/etsi/osl/tmf/pim637/model/ProductPrice.java +++ b/src/main/java/org/etsi/osl/tmf/pim637/model/ProductPrice.java @@ -1,12 +1,20 @@ package org.etsi.osl.tmf.pim637.model; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Objects; +import java.util.Set; import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.tmf.common.model.BaseRootNamedEntity; import org.etsi.osl.tmf.pcm620.model.ProductOfferingPriceRef; import org.springframework.validation.annotation.Validated; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToMany; +import jakarta.persistence.OneToOne; import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; @@ -17,13 +25,11 @@ import jakarta.validation.constraints.NotNull; @Validated @jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") - -public class ProductPrice { +@Entity(name = "ProdPrice637") +public class ProductPrice extends BaseRootNamedEntity { @JsonProperty("description") private String description = null; - @JsonProperty("name") - private String name = null; @JsonProperty("priceType") private String priceType = null; @@ -35,26 +41,24 @@ public class ProductPrice { private String unitOfMeasure = null; @JsonProperty("billingAccount") + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "billing_acc_refuuid", referencedColumnName = "uuid") private BillingAccountRef billingAccount = null; @JsonProperty("price") + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "price_uuid", referencedColumnName = "uuid") private Price price = null; @JsonProperty("productOfferingPrice") + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "prodoffprice_refuuid", referencedColumnName = "uuid") private ProductOfferingPriceRef productOfferingPrice = null; @JsonProperty("productPriceAlteration") @Valid - private List productPriceAlteration = null; - - @JsonProperty("@baseType") - private String _atBaseType = null; - - @JsonProperty("@schemaLocation") - private String _atSchemaLocation = null; - - @JsonProperty("@type") - private String _atType = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + private Set productPriceAlteration = new HashSet<>(); public ProductPrice description(String description) { this.description = description; @@ -219,14 +223,14 @@ public class ProductPrice { this.productOfferingPrice = productOfferingPrice; } - public ProductPrice productPriceAlteration(List productPriceAlteration) { + public ProductPrice productPriceAlteration(Set productPriceAlteration) { this.productPriceAlteration = productPriceAlteration; return this; } public ProductPrice addProductPriceAlterationItem(PriceAlteration productPriceAlterationItem) { if (this.productPriceAlteration == null) { - this.productPriceAlteration = new ArrayList(); + this.productPriceAlteration = new HashSet(); } this.productPriceAlteration.add(productPriceAlterationItem); return this; @@ -239,73 +243,15 @@ public class ProductPrice { @Schema(description = "") @NotNull @Valid - public List getProductPriceAlteration() { + public Set getProductPriceAlteration() { return productPriceAlteration; } - public void setProductPriceAlteration(List productPriceAlteration) { + public void setProductPriceAlteration(Set productPriceAlteration) { this.productPriceAlteration = productPriceAlteration; } - public ProductPrice _atBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - return this; - } - - /** - * When sub-classing, this defines the super-class - * @return _atBaseType - **/ - @Schema(description = "When sub-classing, this defines the super-class") - @NotNull - - public String getAtBaseType() { - return _atBaseType; - } - - public void setAtBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - } - - public ProductPrice _atSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - return this; - } - - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return _atSchemaLocation - **/ - @Schema(description = "A URI to a JSON-Schema file that defines additional attributes and relationships") - @NotNull - - public String getAtSchemaLocation() { - return _atSchemaLocation; - } - - public void setAtSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - } - - public ProductPrice _atType(String _atType) { - this._atType = _atType; - return this; - } - - /** - * When sub-classing, this defines the sub-class entity name - * @return _atType - **/ - @Schema(description = "When sub-classing, this defines the sub-class entity name") - @NotNull - - public String getAtType() { - return _atType; - } - - public void setAtType(String _atType) { - this._atType = _atType; - } + @Override @@ -326,14 +272,14 @@ public class ProductPrice { Objects.equals(this.price, productPrice.price) && Objects.equals(this.productOfferingPrice, productPrice.productOfferingPrice) && Objects.equals(this.productPriceAlteration, productPrice.productPriceAlteration) && - Objects.equals(this._atBaseType, productPrice._atBaseType) && - Objects.equals(this._atSchemaLocation, productPrice._atSchemaLocation) && - Objects.equals(this._atType, productPrice._atType); + Objects.equals(this.baseType, productPrice.baseType) && + Objects.equals(this.schemaLocation, productPrice.schemaLocation) && + Objects.equals(this.baseType, productPrice.baseType); } @Override public int hashCode() { - return Objects.hash(description, name, priceType, recurringChargePeriod, unitOfMeasure, billingAccount, price, productOfferingPrice, productPriceAlteration, _atBaseType, _atSchemaLocation, _atType); + return Objects.hash(description, name, priceType, recurringChargePeriod, unitOfMeasure, billingAccount, price, productOfferingPrice, productPriceAlteration, baseType, schemaLocation, baseType); } @Override @@ -350,9 +296,9 @@ public class ProductPrice { sb.append(" price: ").append(toIndentedString(price)).append("\n"); sb.append(" productOfferingPrice: ").append(toIndentedString(productOfferingPrice)).append("\n"); sb.append(" productPriceAlteration: ").append(toIndentedString(productPriceAlteration)).append("\n"); - sb.append(" _atBaseType: ").append(toIndentedString(_atBaseType)).append("\n"); - sb.append(" _atSchemaLocation: ").append(toIndentedString(_atSchemaLocation)).append("\n"); - sb.append(" _atType: ").append(toIndentedString(_atType)).append("\n"); + sb.append(" _atBaseType: ").append(toIndentedString(baseType)).append("\n"); + sb.append(" _atSchemaLocation: ").append(toIndentedString(schemaLocation)).append("\n"); + sb.append(" _atType: ").append(toIndentedString(baseType)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/org/etsi/osl/tmf/pim637/model/ProductRefOrValue.java b/src/main/java/org/etsi/osl/tmf/pim637/model/ProductRefOrValue.java index 932f571..c95f059 100644 --- a/src/main/java/org/etsi/osl/tmf/pim637/model/ProductRefOrValue.java +++ b/src/main/java/org/etsi/osl/tmf/pim637/model/ProductRefOrValue.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import org.etsi.osl.tmf.common.model.service.Characteristic; import org.etsi.osl.tmf.common.model.service.ResourceRef; @@ -15,883 +16,68 @@ import org.etsi.osl.tmf.po622.model.RelatedProductOrderItem; import org.etsi.osl.tmf.prm669.model.RelatedParty; import org.springframework.validation.annotation.Validated; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.Entity; import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; /** - * A product to be created defined by value or existing defined by reference. The polymorphic attributes @type, @schemaLocation & @referredType are related to the product entity and not the RelatedProductRefOrValue class itself + * A product to be created defined by value or existing defined by reference. The polymorphic + * attributes @type, @schemaLocation & @referredType are related to the product entity and not + * the RelatedProductRefOrValue class itself */ -@Schema(description = "A product to be created defined by value or existing defined by reference. The polymorphic attributes @type, @schemaLocation & @referredType are related to the product entity and not the RelatedProductRefOrValue class itself") +@Schema( + description = "A product to be created defined by value or existing defined by reference. The polymorphic attributes @type, @schemaLocation & @referredType are related to the product entity and not the RelatedProductRefOrValue class itself") @Validated -@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +@jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", + date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") +@Entity(name = "ProdRefOrVal637") +@JsonIgnoreProperties({"uuid"}) +public class ProductRefOrValue extends Product { -public class ProductRefOrValue { - @JsonProperty("id") - private String id = null; - @JsonProperty("href") - private String href = null; - - @JsonProperty("description") - private String description = null; - - @JsonProperty("isBundle") - private Boolean isBundle = null; - - @JsonProperty("isCustomerVisible") - private Boolean isCustomerVisible = null; - - @JsonProperty("name") - private String name = null; - - @JsonProperty("orderDate") - private Date orderDate = null; - - @JsonProperty("productSerialNumber") - private String productSerialNumber = null; - - @JsonProperty("startDate") - private Date startDate = null; - - @JsonProperty("terminationDate") - private Date terminationDate = null; - - @JsonProperty("agreement") - @Valid - private List agreement = null; - - @JsonProperty("billingAccount") - private BillingAccountRef billingAccount = null; - - @JsonProperty("place") - @Valid - private List place = null; - - @JsonProperty("product") - @Valid - private List product = null; - - @JsonProperty("productCharacteristic") - @Valid - private List productCharacteristic = null; - - @JsonProperty("productOffering") - private ProductOfferingRef productOffering = null; - - @JsonProperty("productOrderItem") - @Valid - private List productOrderItem = null; - - @JsonProperty("productPrice") - @Valid - private List productPrice = null; - - @JsonProperty("productRelationship") - @Valid - private List productRelationship = null; - - @JsonProperty("productSpecification") - private ProductSpecificationRef productSpecification = null; - - @JsonProperty("productTerm") - @Valid - private List productTerm = null; - - @JsonProperty("realizingResource") - @Valid - private List realizingResource = null; - - @JsonProperty("realizingService") - @Valid - private List realizingService = null; - - @JsonProperty("relatedParty") - @Valid - private List relatedParty = null; - - @JsonProperty("status") - private ProductStatusType status = null; - - @JsonProperty("@baseType") - private String _atBaseType = null; - - @JsonProperty("@schemaLocation") - private String _atSchemaLocation = null; - - @JsonProperty("@type") - private String _atType = null; - - @JsonProperty("@referredType") - private String _atReferredType = null; - - public ProductRefOrValue id(String id) { - this.id = id; - return this; - } - - /** - * Unique identifier of the product - * @return id - **/ @Schema(description = "Unique identifier of the product") - @NotNull + @NotNull - public String getId() { - return id; + public String getId() { + if (id == null) { + return super.getId(); + } + return this.id; } public void setId(String id) { this.id = id; } - public ProductRefOrValue href(String href) { - this.href = href; - return this; - } - - /** - * Reference of the product - * @return href - **/ - @Schema(description = "Reference of the product") - @NotNull - - public String getHref() { - return href; - } - - public void setHref(String href) { - this.href = href; - } - - public ProductRefOrValue description(String description) { - this.description = description; - return this; - } - - /** - * Is the description of the product. It could be copied from the description of the Product Offering. - * @return description - **/ - @Schema(description = "Is the description of the product. It could be copied from the description of the Product Offering.") - @NotNull - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public ProductRefOrValue isBundle(Boolean isBundle) { - this.isBundle = isBundle; - return this; - } - - /** - * If true, the product is a ProductBundle which is an instantiation of a BundledProductOffering. If false, the product is a ProductComponent which is an instantiation of a SimpleProductOffering. - * @return isBundle - **/ - @Schema(description = "If true, the product is a ProductBundle which is an instantiation of a BundledProductOffering. If false, the product is a ProductComponent which is an instantiation of a SimpleProductOffering.") - @NotNull - - public Boolean isIsBundle() { - return isBundle; - } - - public void setIsBundle(Boolean isBundle) { - this.isBundle = isBundle; - } - - public ProductRefOrValue isCustomerVisible(Boolean isCustomerVisible) { - this.isCustomerVisible = isCustomerVisible; - return this; - } - - /** - * If true, the product is visible by the customer. - * @return isCustomerVisible - **/ - @Schema(description = "If true, the product is visible by the customer.") - @NotNull - - public Boolean isIsCustomerVisible() { - return isCustomerVisible; - } - - public void setIsCustomerVisible(Boolean isCustomerVisible) { - this.isCustomerVisible = isCustomerVisible; - } - - public ProductRefOrValue name(String name) { - this.name = name; - return this; - } - - /** - * Name of the product. It could be the same as the name of the product offering - * @return name - **/ - @Schema(description = "Name of the product. It could be the same as the name of the product offering") - @NotNull - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public ProductRefOrValue orderDate(Date orderDate) { - this.orderDate = orderDate; - return this; - } - - /** - * Is the date when the product was ordered - * @return orderDate - **/ - @Schema(description = "Is the date when the product was ordered") - @NotNull - - @Valid - public Date getOrderDate() { - return orderDate; - } - - public void setOrderDate(Date orderDate) { - this.orderDate = orderDate; - } - - public ProductRefOrValue productSerialNumber(String productSerialNumber) { - this.productSerialNumber = productSerialNumber; - return this; - } - - /** - * Is the serial number for the product. This is typically applicable to tangible products e.g. Broadband Router. - * @return productSerialNumber - **/ - @Schema(description = "Is the serial number for the product. This is typically applicable to tangible products e.g. Broadband Router.") - @NotNull - - public String getProductSerialNumber() { - return productSerialNumber; - } - - public void setProductSerialNumber(String productSerialNumber) { - this.productSerialNumber = productSerialNumber; - } - - public ProductRefOrValue startDate(Date startDate) { - this.startDate = startDate; - return this; - } - - /** - * Is the date from which the product starts - * @return startDate - **/ - @Schema(description = "Is the date from which the product starts") - @NotNull - - @Valid - public Date getStartDate() { - return startDate; - } - - public void setStartDate(Date startDate) { - this.startDate = startDate; - } - - public ProductRefOrValue terminationDate(Date terminationDate) { - this.terminationDate = terminationDate; - return this; - } - - /** - * Is the date when the product was terminated - * @return terminationDate - **/ - @Schema(description = "Is the date when the product was terminated") - @NotNull - - @Valid - public Date getTerminationDate() { - return terminationDate; - } - - public void setTerminationDate(Date terminationDate) { - this.terminationDate = terminationDate; - } - - public ProductRefOrValue agreement(List agreement) { - this.agreement = agreement; - return this; - } - - public ProductRefOrValue addAgreementItem(AgreementItemRef agreementItem) { - if (this.agreement == null) { - this.agreement = new ArrayList(); + public Characteristic findCharacteristicByName(String aName) { + for (Characteristic c : productCharacteristic) { + if (c.getName().equals(aName)) { + return c; + } } - this.agreement.add(agreementItem); - return this; - } - - /** - * Get agreement - * @return agreement - **/ - @Schema(description = "") - @NotNull - @Valid - public List getAgreement() { - return agreement; - } - - public void setAgreement(List agreement) { - this.agreement = agreement; - } - public ProductRefOrValue billingAccount(BillingAccountRef billingAccount) { - this.billingAccount = billingAccount; - return this; + return null; } - /** - * Get billingAccount - * @return billingAccount - **/ - @Schema(description = "") - @NotNull - - @Valid - public BillingAccountRef getBillingAccount() { - return billingAccount; - } - - public void setBillingAccount(BillingAccountRef billingAccount) { - this.billingAccount = billingAccount; + public Object getRealizingServiceById(@NotNull String id) { + for (ServiceRef sr : realizingService) { + if ( sr.getId().equals(id)) { + return sr; + } } - - public ProductRefOrValue place(List place) { - this.place = place; - return this; + return null; } - public ProductRefOrValue addPlaceItem(RelatedPlaceRefOrValue placeItem) { - if (this.place == null) { - this.place = new ArrayList(); - } - this.place.add(placeItem); - return this; + public Object getRealizingResourceById(@NotNull String id) { + for (ResourceRef sr : realizingResource) { + if ( sr.getId().equals(id)) { + return sr; + } } - - /** - * Get place - * @return place - **/ - @Schema(description = "") - @NotNull - @Valid - public List getPlace() { - return place; + return null; } - public void setPlace(List place) { - this.place = place; - } - public ProductRefOrValue product(List product) { - this.product = product; - return this; - } - public ProductRefOrValue addProductItem(ProductRefOrValue productItem) { - if (this.product == null) { - this.product = new ArrayList(); - } - this.product.add(productItem); - return this; - } - - /** - * Get product - * @return product - **/ - @Schema(description = "") - @NotNull - @Valid - public List getProduct() { - return product; - } - - public void setProduct(List product) { - this.product = product; - } - - public ProductRefOrValue productCharacteristic(List productCharacteristic) { - this.productCharacteristic = productCharacteristic; - return this; - } - - public ProductRefOrValue addProductCharacteristicItem(Characteristic productCharacteristicItem) { - if (this.productCharacteristic == null) { - this.productCharacteristic = new ArrayList(); - } - this.productCharacteristic.add(productCharacteristicItem); - return this; - } - - /** - * Get productCharacteristic - * @return productCharacteristic - **/ - @Schema(description = "") - @NotNull - @Valid - public List getProductCharacteristic() { - return productCharacteristic; - } - - public void setProductCharacteristic(List productCharacteristic) { - this.productCharacteristic = productCharacteristic; - } - - public ProductRefOrValue productOffering(ProductOfferingRef productOffering) { - this.productOffering = productOffering; - return this; - } - - /** - * Get productOffering - * @return productOffering - **/ - @Schema(description = "") - @NotNull - - @Valid - public ProductOfferingRef getProductOffering() { - return productOffering; - } - - public void setProductOffering(ProductOfferingRef productOffering) { - this.productOffering = productOffering; - } - - public ProductRefOrValue productOrderItem(List productOrderItem) { - this.productOrderItem = productOrderItem; - return this; - } - - public ProductRefOrValue addProductOrderItemItem(RelatedProductOrderItem productOrderItemItem) { - if (this.productOrderItem == null) { - this.productOrderItem = new ArrayList(); - } - this.productOrderItem.add(productOrderItemItem); - return this; - } - - /** - * Get productOrderItem - * @return productOrderItem - **/ - @Schema(description = "") - @NotNull - @Valid - public List getProductOrderItem() { - return productOrderItem; - } - - public void setProductOrderItem(List productOrderItem) { - this.productOrderItem = productOrderItem; - } - - public ProductRefOrValue productPrice(List productPrice) { - this.productPrice = productPrice; - return this; - } - - public ProductRefOrValue addProductPriceItem(ProductPrice productPriceItem) { - if (this.productPrice == null) { - this.productPrice = new ArrayList(); - } - this.productPrice.add(productPriceItem); - return this; - } - - /** - * Get productPrice - * @return productPrice - **/ - @Schema(description = "") - @NotNull - @Valid - public List getProductPrice() { - return productPrice; - } - - public void setProductPrice(List productPrice) { - this.productPrice = productPrice; - } - - public ProductRefOrValue productRelationship(List productRelationship) { - this.productRelationship = productRelationship; - return this; - } - - public ProductRefOrValue addProductRelationshipItem(ProductRelationship productRelationshipItem) { - if (this.productRelationship == null) { - this.productRelationship = new ArrayList(); - } - this.productRelationship.add(productRelationshipItem); - return this; - } - - /** - * Get productRelationship - * @return productRelationship - **/ - @Schema(description = "") - @NotNull - @Valid - public List getProductRelationship() { - return productRelationship; - } - - public void setProductRelationship(List productRelationship) { - this.productRelationship = productRelationship; - } - - public ProductRefOrValue productSpecification(ProductSpecificationRef productSpecification) { - this.productSpecification = productSpecification; - return this; - } - - /** - * Get productSpecification - * @return productSpecification - **/ - @Schema(description = "") - @NotNull - - @Valid - public ProductSpecificationRef getProductSpecification() { - return productSpecification; - } - - public void setProductSpecification(ProductSpecificationRef productSpecification) { - this.productSpecification = productSpecification; - } - - public ProductRefOrValue productTerm(List productTerm) { - this.productTerm = productTerm; - return this; - } - - public ProductRefOrValue addProductTermItem(ProductTerm productTermItem) { - if (this.productTerm == null) { - this.productTerm = new ArrayList(); - } - this.productTerm.add(productTermItem); - return this; - } - - /** - * Get productTerm - * @return productTerm - **/ - @Schema(description = "") - @NotNull - @Valid - public List getProductTerm() { - return productTerm; - } - - public void setProductTerm(List productTerm) { - this.productTerm = productTerm; - } - - public ProductRefOrValue realizingResource(List realizingResource) { - this.realizingResource = realizingResource; - return this; - } - - public ProductRefOrValue addRealizingResourceItem(ResourceRef realizingResourceItem) { - if (this.realizingResource == null) { - this.realizingResource = new ArrayList(); - } - this.realizingResource.add(realizingResourceItem); - return this; - } - - /** - * Get realizingResource - * @return realizingResource - **/ - @Schema(description = "") - @NotNull - @Valid - public List getRealizingResource() { - return realizingResource; - } - - public void setRealizingResource(List realizingResource) { - this.realizingResource = realizingResource; - } - - public ProductRefOrValue realizingService(List realizingService) { - this.realizingService = realizingService; - return this; - } - - public ProductRefOrValue addRealizingServiceItem(ServiceRef realizingServiceItem) { - if (this.realizingService == null) { - this.realizingService = new ArrayList(); - } - this.realizingService.add(realizingServiceItem); - return this; - } - - /** - * Get realizingService - * @return realizingService - **/ - @Schema(description = "") - @NotNull - @Valid - public List getRealizingService() { - return realizingService; - } - - public void setRealizingService(List realizingService) { - this.realizingService = realizingService; - } - - public ProductRefOrValue relatedParty(List relatedParty) { - this.relatedParty = relatedParty; - return this; - } - - public ProductRefOrValue addRelatedPartyItem(RelatedParty relatedPartyItem) { - if (this.relatedParty == null) { - this.relatedParty = new ArrayList(); - } - this.relatedParty.add(relatedPartyItem); - return this; - } - - /** - * Get relatedParty - * @return relatedParty - **/ - @Schema(description = "") - @NotNull - @Valid - public List getRelatedParty() { - return relatedParty; - } - - public void setRelatedParty(List relatedParty) { - this.relatedParty = relatedParty; - } - - public ProductRefOrValue status(ProductStatusType status) { - this.status = status; - return this; - } - - /** - * Get status - * @return status - **/ - @Schema(description = "") - @NotNull - - @Valid - public ProductStatusType getStatus() { - return status; - } - - public void setStatus(ProductStatusType status) { - this.status = status; - } - - public ProductRefOrValue _atBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - return this; - } - - /** - * When sub-classing, this defines the super-class - * @return _atBaseType - **/ - @Schema(description = "When sub-classing, this defines the super-class") - @NotNull - - public String getAtBaseType() { - return _atBaseType; - } - - public void setAtBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - } - - public ProductRefOrValue _atSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - return this; - } - - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return _atSchemaLocation - **/ - @Schema(description = "A URI to a JSON-Schema file that defines additional attributes and relationships") - @NotNull - - public String getAtSchemaLocation() { - return _atSchemaLocation; - } - - public void setAtSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - } - - public ProductRefOrValue _atType(String _atType) { - this._atType = _atType; - return this; - } - - /** - * When sub-classing, this defines the sub-class entity name - * @return _atType - **/ - @Schema(description = "When sub-classing, this defines the sub-class entity name") - @NotNull - - public String getAtType() { - return _atType; - } - - public void setAtType(String _atType) { - this._atType = _atType; - } - - public ProductRefOrValue _atReferredType(String _atReferredType) { - this._atReferredType = _atReferredType; - return this; - } - - /** - * The actual type of the target instance when needed for disambiguation. - * @return _atReferredType - **/ - @Schema(description = "The actual type of the target instance when needed for disambiguation.") - @NotNull - - public String getAtReferredType() { - return _atReferredType; - } - - public void setAtReferredType(String _atReferredType) { - this._atReferredType = _atReferredType; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ProductRefOrValue productRefOrValue = (ProductRefOrValue) o; - return Objects.equals(this.id, productRefOrValue.id) && - Objects.equals(this.href, productRefOrValue.href) && - Objects.equals(this.description, productRefOrValue.description) && - Objects.equals(this.isBundle, productRefOrValue.isBundle) && - Objects.equals(this.isCustomerVisible, productRefOrValue.isCustomerVisible) && - Objects.equals(this.name, productRefOrValue.name) && - Objects.equals(this.orderDate, productRefOrValue.orderDate) && - Objects.equals(this.productSerialNumber, productRefOrValue.productSerialNumber) && - Objects.equals(this.startDate, productRefOrValue.startDate) && - Objects.equals(this.terminationDate, productRefOrValue.terminationDate) && - Objects.equals(this.agreement, productRefOrValue.agreement) && - Objects.equals(this.billingAccount, productRefOrValue.billingAccount) && - Objects.equals(this.place, productRefOrValue.place) && - Objects.equals(this.product, productRefOrValue.product) && - Objects.equals(this.productCharacteristic, productRefOrValue.productCharacteristic) && - Objects.equals(this.productOffering, productRefOrValue.productOffering) && - Objects.equals(this.productOrderItem, productRefOrValue.productOrderItem) && - Objects.equals(this.productPrice, productRefOrValue.productPrice) && - Objects.equals(this.productRelationship, productRefOrValue.productRelationship) && - Objects.equals(this.productSpecification, productRefOrValue.productSpecification) && - Objects.equals(this.productTerm, productRefOrValue.productTerm) && - Objects.equals(this.realizingResource, productRefOrValue.realizingResource) && - Objects.equals(this.realizingService, productRefOrValue.realizingService) && - Objects.equals(this.relatedParty, productRefOrValue.relatedParty) && - Objects.equals(this.status, productRefOrValue.status) && - Objects.equals(this._atBaseType, productRefOrValue._atBaseType) && - Objects.equals(this._atSchemaLocation, productRefOrValue._atSchemaLocation) && - Objects.equals(this._atType, productRefOrValue._atType) && - Objects.equals(this._atReferredType, productRefOrValue._atReferredType); - } - - @Override - public int hashCode() { - return Objects.hash(id, href, description, isBundle, isCustomerVisible, name, orderDate, productSerialNumber, startDate, terminationDate, agreement, billingAccount, place, product, productCharacteristic, productOffering, productOrderItem, productPrice, productRelationship, productSpecification, productTerm, realizingResource, realizingService, relatedParty, status, _atBaseType, _atSchemaLocation, _atType, _atReferredType); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ProductRefOrValue {\n"); - - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" href: ").append(toIndentedString(href)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" isBundle: ").append(toIndentedString(isBundle)).append("\n"); - sb.append(" isCustomerVisible: ").append(toIndentedString(isCustomerVisible)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" orderDate: ").append(toIndentedString(orderDate)).append("\n"); - sb.append(" productSerialNumber: ").append(toIndentedString(productSerialNumber)).append("\n"); - sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); - sb.append(" terminationDate: ").append(toIndentedString(terminationDate)).append("\n"); - sb.append(" agreement: ").append(toIndentedString(agreement)).append("\n"); - sb.append(" billingAccount: ").append(toIndentedString(billingAccount)).append("\n"); - sb.append(" place: ").append(toIndentedString(place)).append("\n"); - sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" productCharacteristic: ").append(toIndentedString(productCharacteristic)).append("\n"); - sb.append(" productOffering: ").append(toIndentedString(productOffering)).append("\n"); - sb.append(" productOrderItem: ").append(toIndentedString(productOrderItem)).append("\n"); - sb.append(" productPrice: ").append(toIndentedString(productPrice)).append("\n"); - sb.append(" productRelationship: ").append(toIndentedString(productRelationship)).append("\n"); - sb.append(" productSpecification: ").append(toIndentedString(productSpecification)).append("\n"); - sb.append(" productTerm: ").append(toIndentedString(productTerm)).append("\n"); - sb.append(" realizingResource: ").append(toIndentedString(realizingResource)).append("\n"); - sb.append(" realizingService: ").append(toIndentedString(realizingService)).append("\n"); - sb.append(" relatedParty: ").append(toIndentedString(relatedParty)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" _atBaseType: ").append(toIndentedString(_atBaseType)).append("\n"); - sb.append(" _atSchemaLocation: ").append(toIndentedString(_atSchemaLocation)).append("\n"); - sb.append(" _atType: ").append(toIndentedString(_atType)).append("\n"); - sb.append(" _atReferredType: ").append(toIndentedString(_atReferredType)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(java.lang.Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } } diff --git a/src/main/java/org/etsi/osl/tmf/pim637/model/ProductRelationship.java b/src/main/java/org/etsi/osl/tmf/pim637/model/ProductRelationship.java index e0da3df..331b8fb 100644 --- a/src/main/java/org/etsi/osl/tmf/pim637/model/ProductRelationship.java +++ b/src/main/java/org/etsi/osl/tmf/pim637/model/ProductRelationship.java @@ -2,8 +2,14 @@ package org.etsi.osl.tmf.pim637.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.tmf.common.model.BaseRootEntity; +import org.etsi.osl.tmf.common.model.BaseRootNamedEntity; import org.springframework.validation.annotation.Validated; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.CascadeType; +import jakarta.persistence.Entity; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.OneToOne; import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; @@ -14,22 +20,16 @@ import jakarta.validation.constraints.NotNull; @Validated @jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") - -public class ProductRelationship { +@Entity(name = "ProdRel637") +public class ProductRelationship extends BaseRootEntity { @JsonProperty("relationshipType") private String relationshipType = null; @JsonProperty("product") + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "prod_refuuid", referencedColumnName = "uuid") private ProductRefOrValue product = null; - @JsonProperty("@baseType") - private String _atBaseType = null; - - @JsonProperty("@schemaLocation") - private String _atSchemaLocation = null; - - @JsonProperty("@type") - private String _atType = null; public ProductRelationship relationshipType(String relationshipType) { this.relationshipType = relationshipType; @@ -72,65 +72,7 @@ public class ProductRelationship { this.product = product; } - public ProductRelationship _atBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - return this; - } - - /** - * When sub-classing, this defines the super-class - * @return _atBaseType - **/ - @Schema(description = "When sub-classing, this defines the super-class") - @NotNull - - public String getAtBaseType() { - return _atBaseType; - } - - public void setAtBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - } - - public ProductRelationship _atSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - return this; - } - - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return _atSchemaLocation - **/ - @Schema(description = "A URI to a JSON-Schema file that defines additional attributes and relationships") - @NotNull - - public String getAtSchemaLocation() { - return _atSchemaLocation; - } - - public void setAtSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - } - - public ProductRelationship _atType(String _atType) { - this._atType = _atType; - return this; - } - - /** - * When sub-classing, this defines the sub-class entity name - * @return _atType - **/ - @Schema(description = "When sub-classing, this defines the sub-class entity name") - @NotNull - - public String getAtType() { - return _atType; - } - - public void setAtType(String _atType) { - this._atType = _atType; - } + @Override @@ -144,14 +86,14 @@ public class ProductRelationship { ProductRelationship productRelationship = (ProductRelationship) o; return Objects.equals(this.relationshipType, productRelationship.relationshipType) && Objects.equals(this.product, productRelationship.product) && - Objects.equals(this._atBaseType, productRelationship._atBaseType) && - Objects.equals(this._atSchemaLocation, productRelationship._atSchemaLocation) && - Objects.equals(this._atType, productRelationship._atType); + Objects.equals(this.baseType, productRelationship.baseType) && + Objects.equals(this.schemaLocation, productRelationship.schemaLocation) && + Objects.equals(this.type, productRelationship.type); } @Override public int hashCode() { - return Objects.hash(relationshipType, product, _atBaseType, _atSchemaLocation, _atType); + return Objects.hash(relationshipType, product, baseType, schemaLocation, type); } @Override @@ -161,9 +103,9 @@ public class ProductRelationship { sb.append(" relationshipType: ").append(toIndentedString(relationshipType)).append("\n"); sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" _atBaseType: ").append(toIndentedString(_atBaseType)).append("\n"); - sb.append(" _atSchemaLocation: ").append(toIndentedString(_atSchemaLocation)).append("\n"); - sb.append(" _atType: ").append(toIndentedString(_atType)).append("\n"); + sb.append(" _atBaseType: ").append(toIndentedString(baseType)).append("\n"); + sb.append(" _atSchemaLocation: ").append(toIndentedString(schemaLocation)).append("\n"); + sb.append(" _atType: ").append(toIndentedString(type)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/org/etsi/osl/tmf/pim637/model/ProductTerm.java b/src/main/java/org/etsi/osl/tmf/pim637/model/ProductTerm.java index be680b1..4207102 100644 --- a/src/main/java/org/etsi/osl/tmf/pim637/model/ProductTerm.java +++ b/src/main/java/org/etsi/osl/tmf/pim637/model/ProductTerm.java @@ -2,10 +2,12 @@ package org.etsi.osl.tmf.pim637.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.tmf.common.model.BaseRootNamedEntity; import org.etsi.osl.tmf.common.model.Quantity; import org.etsi.osl.tmf.common.model.TimePeriod; import org.springframework.validation.annotation.Validated; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.Entity; import jakarta.validation.Valid; import jakarta.validation.constraints.NotNull; /** @@ -15,13 +17,11 @@ import jakarta.validation.constraints.NotNull; @Validated @jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") - -public class ProductTerm { +@Entity(name = "ProdTerm637") +public class ProductTerm extends BaseRootNamedEntity { @JsonProperty("description") private String description = null; - @JsonProperty("name") - private String name = null; @JsonProperty("duration") private Quantity duration = null; @@ -29,15 +29,6 @@ public class ProductTerm { @JsonProperty("validFor") private TimePeriod validFor = null; - @JsonProperty("@baseType") - private String _atBaseType = null; - - @JsonProperty("@schemaLocation") - private String _atSchemaLocation = null; - - @JsonProperty("@type") - private String _atType = null; - public ProductTerm description(String description) { this.description = description; return this; @@ -120,65 +111,7 @@ public class ProductTerm { this.validFor = validFor; } - public ProductTerm _atBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - return this; - } - - /** - * When sub-classing, this defines the super-class - * @return _atBaseType - **/ - @Schema(description = "When sub-classing, this defines the super-class") - @NotNull - - public String getAtBaseType() { - return _atBaseType; - } - - public void setAtBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - } - - public ProductTerm _atSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - return this; - } - - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return _atSchemaLocation - **/ - @Schema(description = "A URI to a JSON-Schema file that defines additional attributes and relationships") - @NotNull - - public String getAtSchemaLocation() { - return _atSchemaLocation; - } - - public void setAtSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - } - - public ProductTerm _atType(String _atType) { - this._atType = _atType; - return this; - } - - /** - * When sub-classing, this defines the sub-class entity name - * @return _atType - **/ - @Schema(description = "When sub-classing, this defines the sub-class entity name") - @NotNull - - public String getAtType() { - return _atType; - } - - public void setAtType(String _atType) { - this._atType = _atType; - } + @Override @@ -194,14 +127,14 @@ public class ProductTerm { Objects.equals(this.name, productTerm.name) && Objects.equals(this.duration, productTerm.duration) && Objects.equals(this.validFor, productTerm.validFor) && - Objects.equals(this._atBaseType, productTerm._atBaseType) && - Objects.equals(this._atSchemaLocation, productTerm._atSchemaLocation) && - Objects.equals(this._atType, productTerm._atType); + Objects.equals(this.baseType, productTerm.baseType) && + Objects.equals(this.schemaLocation, productTerm.schemaLocation) && + Objects.equals(this.type, productTerm.type); } @Override public int hashCode() { - return Objects.hash(description, name, duration, validFor, _atBaseType, _atSchemaLocation, _atType); + return Objects.hash(description, name, duration, validFor, baseType, schemaLocation, type); } @Override @@ -213,9 +146,9 @@ public class ProductTerm { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); sb.append(" validFor: ").append(toIndentedString(validFor)).append("\n"); - sb.append(" _atBaseType: ").append(toIndentedString(_atBaseType)).append("\n"); - sb.append(" _atSchemaLocation: ").append(toIndentedString(_atSchemaLocation)).append("\n"); - sb.append(" _atType: ").append(toIndentedString(_atType)).append("\n"); + sb.append(" _atBaseType: ").append(toIndentedString(baseType)).append("\n"); + sb.append(" _atSchemaLocation: ").append(toIndentedString(schemaLocation)).append("\n"); + sb.append(" _atType: ").append(toIndentedString(type)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/org/etsi/osl/tmf/pim637/model/RelatedPlaceRefOrValue.java b/src/main/java/org/etsi/osl/tmf/pim637/model/RelatedPlaceRefOrValue.java index 7aebfcb..ccdae25 100644 --- a/src/main/java/org/etsi/osl/tmf/pim637/model/RelatedPlaceRefOrValue.java +++ b/src/main/java/org/etsi/osl/tmf/pim637/model/RelatedPlaceRefOrValue.java @@ -2,8 +2,10 @@ package org.etsi.osl.tmf.pim637.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.tmf.common.model.BaseRootNamedEntity; import org.springframework.validation.annotation.Validated; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.Entity; import jakarta.validation.constraints.NotNull; /** @@ -13,29 +15,15 @@ import jakarta.validation.constraints.NotNull; @Validated @jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2024-08-04T00:27:07.324017400+03:00[Europe/Athens]") - -public class RelatedPlaceRefOrValue { +@Entity(name = "RelPlaceROrV637") +public class RelatedPlaceRefOrValue extends BaseRootNamedEntity { @JsonProperty("id") private String id = null; - @JsonProperty("href") - private String href = null; - - @JsonProperty("name") - private String name = null; @JsonProperty("role") private String role = null; - @JsonProperty("@baseType") - private String _atBaseType = null; - - @JsonProperty("@schemaLocation") - private String _atSchemaLocation = null; - - @JsonProperty("@type") - private String _atType = null; - @JsonProperty("@referredType") private String _atReferredType = null; @@ -119,70 +107,7 @@ public class RelatedPlaceRefOrValue { this.role = role; } - public RelatedPlaceRefOrValue _atBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - return this; - } - - /** - * When sub-classing, this defines the super-class - * @return _atBaseType - **/ - @Schema(description = "When sub-classing, this defines the super-class") - @NotNull - - public String getAtBaseType() { - return _atBaseType; - } - - public void setAtBaseType(String _atBaseType) { - this._atBaseType = _atBaseType; - } - - public RelatedPlaceRefOrValue _atSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - return this; - } - - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return _atSchemaLocation - **/ - @Schema(description = "A URI to a JSON-Schema file that defines additional attributes and relationships") - @NotNull - - public String getAtSchemaLocation() { - return _atSchemaLocation; - } - - public void setAtSchemaLocation(String _atSchemaLocation) { - this._atSchemaLocation = _atSchemaLocation; - } - - public RelatedPlaceRefOrValue _atType(String _atType) { - this._atType = _atType; - return this; - } - - /** - * When sub-classing, this defines the sub-class entity name - * @return _atType - **/ - @Schema(description = "When sub-classing, this defines the sub-class entity name") - @NotNull - - public String getAtType() { - return _atType; - } - - public void setAtType(String _atType) { - this._atType = _atType; - } - - public RelatedPlaceRefOrValue _atReferredType(String _atReferredType) { - this._atReferredType = _atReferredType; - return this; - } + /** * The actual type of the target instance when needed for disambiguation. @@ -213,15 +138,15 @@ public class RelatedPlaceRefOrValue { Objects.equals(this.href, relatedPlaceRefOrValue.href) && Objects.equals(this.name, relatedPlaceRefOrValue.name) && Objects.equals(this.role, relatedPlaceRefOrValue.role) && - Objects.equals(this._atBaseType, relatedPlaceRefOrValue._atBaseType) && - Objects.equals(this._atSchemaLocation, relatedPlaceRefOrValue._atSchemaLocation) && - Objects.equals(this._atType, relatedPlaceRefOrValue._atType) && + Objects.equals(this.baseType, relatedPlaceRefOrValue.baseType) && + Objects.equals(this.schemaLocation, relatedPlaceRefOrValue.schemaLocation) && + Objects.equals(this.type, relatedPlaceRefOrValue.type) && Objects.equals(this._atReferredType, relatedPlaceRefOrValue._atReferredType); } @Override public int hashCode() { - return Objects.hash(id, href, name, role, _atBaseType, _atSchemaLocation, _atType, _atReferredType); + return Objects.hash(id, href, name, role, baseType, schemaLocation, type, _atReferredType); } @Override @@ -233,9 +158,9 @@ public class RelatedPlaceRefOrValue { sb.append(" href: ").append(toIndentedString(href)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" role: ").append(toIndentedString(role)).append("\n"); - sb.append(" _atBaseType: ").append(toIndentedString(_atBaseType)).append("\n"); - sb.append(" _atSchemaLocation: ").append(toIndentedString(_atSchemaLocation)).append("\n"); - sb.append(" _atType: ").append(toIndentedString(_atType)).append("\n"); + sb.append(" _atBaseType: ").append(toIndentedString(baseType)).append("\n"); + sb.append(" _atSchemaLocation: ").append(toIndentedString(schemaLocation)).append("\n"); + sb.append(" _atType: ").append(toIndentedString(type)).append("\n"); sb.append(" _atReferredType: ").append(toIndentedString(_atReferredType)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/AgreementItemRef.java b/src/main/java/org/etsi/osl/tmf/po622/model/AgreementItemRef.java index 27a09bb..f4c8d6a 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/model/AgreementItemRef.java +++ b/src/main/java/org/etsi/osl/tmf/po622/model/AgreementItemRef.java @@ -21,8 +21,10 @@ package org.etsi.osl.tmf.po622.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.tmf.common.model.BaseRootNamedEntity; import org.springframework.validation.annotation.Validated; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.Entity; import jakarta.validation.constraints.NotNull; /** @@ -31,27 +33,14 @@ import jakarta.validation.constraints.NotNull; @Schema(description = "Agreement reference. An agreement represents a contract or arrangement, either written or verbal and sometimes enforceable by law, such as a service level agreement or a customer price agreement. An agreement involves a number of other business entities, such as products, services, and resources and/or their specifications.") @Validated @jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-10-30T10:29:21.184964400+02:00[Europe/Athens]") -public class AgreementItemRef { +@Entity(name = "AgrItemRef622") +public class AgreementItemRef extends BaseRootNamedEntity { @JsonProperty("id") private String id = null; - @JsonProperty("href") - private String href = null; - @JsonProperty("agreementItemId") private String agreementItemId = null; - @JsonProperty("name") - private String name = null; - - @JsonProperty("@baseType") - private String baseType = null; - - @JsonProperty("@schemaLocation") - private String schemaLocation = null; - - @JsonProperty("@type") - private String type = null; @JsonProperty("@referredType") private String _atReferredType = null; @@ -76,119 +65,7 @@ public class AgreementItemRef { this.id = id; } - public AgreementItemRef href(String href) { - this.href = href; - return this; - } - - /** - * Reference of the related entity. - * @return href - **/ - @Schema(description = "Reference of the related entity.") - - public String getHref() { - return href; - } - - public void setHref(String href) { - this.href = href; - } - - public AgreementItemRef agreementItemId(String agreementItemId) { - this.agreementItemId = agreementItemId; - return this; - } - - /** - * Identifier of the agreement - * @return agreementItemId - **/ - @Schema(description = "Identifier of the agreement") - - public String getAgreementItemId() { - return agreementItemId; - } - - public void setAgreementItemId(String agreementItemId) { - this.agreementItemId = agreementItemId; - } - - public AgreementItemRef name(String name) { - this.name = name; - return this; - } - - /** - * Name of the related entity. - * @return name - **/ - @Schema(description = "Name of the related entity.") - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public AgreementItemRef baseType(String baseType) { - this.baseType = baseType; - return this; - } - - /** - * When sub-classing, this defines the super-class - * @return baseType - **/ - @Schema(description = "When sub-classing, this defines the super-class") - public String getAtBaseType() { - return baseType; - } - - public void setAtBaseType(String baseType) { - this.baseType = baseType; - } - - public AgreementItemRef schemaLocation(String schemaLocation) { - this.schemaLocation = schemaLocation; - return this; - } - - /** - * A URI to a JSON-Schema file that defines additional attributes and relationships - * @return schemaLocation - **/ - @Schema(description = "A URI to a JSON-Schema file that defines additional attributes and relationships") - - public String getAtSchemaLocation() { - return schemaLocation; - } - - public void setAtSchemaLocation(String schemaLocation) { - this.schemaLocation = schemaLocation; - } - - public AgreementItemRef type(String type) { - this.type = type; - return this; - } - - /** - * When sub-classing, this defines the sub-class entity name - * @return type - **/ - @Schema(description = "When sub-classing, this defines the sub-class entity name") - - public String getAtType() { - return type; - } - - public void setAtType(String type) { - this.type = type; - } public AgreementItemRef _atReferredType(String _atReferredType) { this._atReferredType = _atReferredType; diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderAttributeValueChangeEvent.java b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderAttributeValueChangeEvent.java index b0c7a8e..f2fe095 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderAttributeValueChangeEvent.java +++ b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderAttributeValueChangeEvent.java @@ -271,6 +271,9 @@ public class ProductOrderAttributeValueChangeEvent { @Valid public ProductOrderAttributeValueChangeEventPayload getEvent() { + if (event==null) { + event = new ProductOrderAttributeValueChangeEventPayload(); + } return event; } diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderAttributeValueChangeNotification.java b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderAttributeValueChangeNotification.java new file mode 100644 index 0000000..1f240a1 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderAttributeValueChangeNotification.java @@ -0,0 +1,92 @@ +package org.etsi.osl.tmf.po622.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.tmf.common.model.Notification; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; + +public class ProductOrderAttributeValueChangeNotification extends Notification { + + + @JsonProperty("event") + private ProductOrderAttributeValueChangeEvent event = null; + + public ProductOrderAttributeValueChangeNotification eventId(String eventId) { + this.eventId = eventId; + return this; + } + + + + public ProductOrderAttributeValueChangeNotification event(ProductOrderAttributeValueChangeEvent event) { + this.event = event; + return this; + } + + /** + * The event linked to the involved resource object + * @return event + **/ + @Schema(description = "The event linked to the involved resource object") + + @Valid + + public ProductOrderAttributeValueChangeEvent getEvent() { + return event; + } + + public void setEvent(ProductOrderAttributeValueChangeEvent event) { + this.event = event; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOrderAttributeValueChangeNotification productOrderAttributeValueChangeNotification = (ProductOrderAttributeValueChangeNotification) o; + return Objects.equals(this.eventId, productOrderAttributeValueChangeNotification.eventId) && + Objects.equals(this.eventTime, productOrderAttributeValueChangeNotification.eventTime) && + Objects.equals(this.eventType, productOrderAttributeValueChangeNotification.eventType) && + Objects.equals(this.fieldPath, productOrderAttributeValueChangeNotification.fieldPath) && + Objects.equals(this.resourcePath, productOrderAttributeValueChangeNotification.resourcePath) && + Objects.equals(this.event, productOrderAttributeValueChangeNotification.event); + } + + @Override + public int hashCode() { + return Objects.hash(eventId, eventTime, eventType, fieldPath, resourcePath, event); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOrderAttributeValueChangeNotification {\n"); + + sb.append(" eventId: ").append(toIndentedString(eventId)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" fieldPath: ").append(toIndentedString(fieldPath)).append("\n"); + sb.append(" resourcePath: ").append(toIndentedString(resourcePath)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderCreateEvent.java b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderCreateEvent.java index 1e519b2..f49750d 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderCreateEvent.java +++ b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderCreateEvent.java @@ -293,6 +293,9 @@ public class ProductOrderCreateEvent { @Valid public ProductOrderCreateEventPayload getEvent() { + if (event==null) { + event = new ProductOrderCreateEventPayload(); + } return event; } diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderCreateNotification.java b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderCreateNotification.java new file mode 100644 index 0000000..29d4522 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderCreateNotification.java @@ -0,0 +1,91 @@ +package org.etsi.osl.tmf.po622.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.tmf.common.model.Notification; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; + +public class ProductOrderCreateNotification extends Notification { + + @JsonProperty("event") + private ProductOrderCreateEvent event = null; + + public ProductOrderCreateNotification eventId(String eventId) { + this.eventId = eventId; + return this; + } + + + + public ProductOrderCreateNotification event(ProductOrderCreateEvent event) { + this.event = event; + return this; + } + + /** + * The event linked to the involved resource object + * @return event + **/ + @Schema(description = "The event linked to the involved resource object") + + @Valid + + public ProductOrderCreateEvent getEvent() { + return event; + } + + public void setEvent(ProductOrderCreateEvent event) { + this.event = event; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOrderCreateNotification prodOrderCreateNotification = (ProductOrderCreateNotification) o; + return Objects.equals(this.eventId, prodOrderCreateNotification.eventId) && + Objects.equals(this.eventTime, prodOrderCreateNotification.eventTime) && + Objects.equals(this.eventType, prodOrderCreateNotification.eventType) && + Objects.equals(this.fieldPath, prodOrderCreateNotification.fieldPath) && + Objects.equals(this.resourcePath, prodOrderCreateNotification.resourcePath) && + Objects.equals(this.event, prodOrderCreateNotification.event); + } + + @Override + public int hashCode() { + return Objects.hash(eventId, eventTime, eventType, fieldPath, resourcePath, event); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOrderCreateNotification {\n"); + + sb.append(" eventId: ").append(toIndentedString(eventId)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" fieldPath: ").append(toIndentedString(fieldPath)).append("\n"); + sb.append(" resourcePath: ").append(toIndentedString(resourcePath)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderDeleteEvent.java b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderDeleteEvent.java index c434043..e4f4d29 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderDeleteEvent.java +++ b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderDeleteEvent.java @@ -293,6 +293,9 @@ public class ProductOrderDeleteEvent { @Valid public ProductOrderDeleteEventPayload getEvent() { + if (event==null) { + event = new ProductOrderDeleteEventPayload(); + } return event; } diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderDeleteNotification.java b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderDeleteNotification.java new file mode 100644 index 0000000..a88c4b5 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderDeleteNotification.java @@ -0,0 +1,92 @@ +package org.etsi.osl.tmf.po622.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.tmf.common.model.Notification; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; + +public class ProductOrderDeleteNotification extends Notification { + + + @JsonProperty("event") + private ProductOrderDeleteEvent event = null; + + public ProductOrderDeleteNotification eventId(String eventId) { + this.eventId = eventId; + return this; + } + + + + public ProductOrderDeleteNotification event(ProductOrderDeleteEvent event) { + this.event = event; + return this; + } + + /** + * The event linked to the involved resource object + * @return event + **/ + @Schema(description = "The event linked to the involved resource object") + + @Valid + + public ProductOrderDeleteEvent getEvent() { + return event; + } + + public void setEvent(ProductOrderDeleteEvent event) { + this.event = event; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOrderDeleteNotification productOrderDeleteNotification = (ProductOrderDeleteNotification) o; + return Objects.equals(this.eventId, productOrderDeleteNotification.eventId) && + Objects.equals(this.eventTime, productOrderDeleteNotification.eventTime) && + Objects.equals(this.eventType, productOrderDeleteNotification.eventType) && + Objects.equals(this.fieldPath, productOrderDeleteNotification.fieldPath) && + Objects.equals(this.resourcePath, productOrderDeleteNotification.resourcePath) && + Objects.equals(this.event, productOrderDeleteNotification.event); + } + + @Override + public int hashCode() { + return Objects.hash(eventId, eventTime, eventType, fieldPath, resourcePath, event); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOrderDeleteNotification {\n"); + + sb.append(" eventId: ").append(toIndentedString(eventId)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" fieldPath: ").append(toIndentedString(fieldPath)).append("\n"); + sb.append(" resourcePath: ").append(toIndentedString(resourcePath)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderItem.java b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderItem.java index 5278912..a9042a2 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderItem.java +++ b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderItem.java @@ -88,7 +88,7 @@ public class ProductOrderItem extends BaseRootEntity { @JsonProperty("product") @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = "prod_refuuid", referencedColumnName = "uuid") - private ProductRef product = null; + private ProductRefOrValue product = null; @JsonProperty("productOffering") @OneToOne(cascade = CascadeType.ALL) @@ -124,11 +124,6 @@ public class ProductOrderItem extends BaseRootEntity { private ProductOrderItemStateType state = ProductOrderItemStateType.INITIAL; - public ProductOrderItem id(String id) { - this.id = id; - return this; - } - /** * Identifier of the line item (generally it is a sequence number 01, 02, 03, ...) * @return id @@ -329,7 +324,7 @@ public class ProductOrderItem extends BaseRootEntity { this.payment = payment; } - public ProductOrderItem product(ProductRef product) { + public ProductOrderItem product(ProductRefOrValue product) { this.product = product; return this; } @@ -341,11 +336,11 @@ public class ProductOrderItem extends BaseRootEntity { @Schema(description = "") @Valid - public ProductRef getProduct() { + public ProductRefOrValue getProduct() { return product; } - public void setProduct(ProductRef product) { + public void setProduct(ProductRefOrValue product) { this.product = product; } @@ -395,9 +390,6 @@ public class ProductOrderItem extends BaseRootEntity { } public ProductOrderItem addProductOrderItemItem(ProductOrderItem productOrderItemItem) { - if (this.productOrderItem == null) { - this.productOrderItem = new HashSet<>(); - } this.productOrderItem.add(productOrderItemItem); return this; } diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderMapper.java b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderMapper.java index 1271c87..f6c7a41 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderMapper.java +++ b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderMapper.java @@ -2,8 +2,13 @@ package org.etsi.osl.tmf.po622.model; import java.util.List; import java.util.Set; +import org.etsi.osl.tmf.common.model.Any; +import org.etsi.osl.tmf.common.model.service.Characteristic; import org.etsi.osl.tmf.common.model.service.Note; +import org.etsi.osl.tmf.common.model.service.ResourceRef; +import org.etsi.osl.tmf.common.model.service.ServiceRef; import org.etsi.osl.tmf.prm669.model.RelatedParty; +import org.etsi.osl.tmf.so641.model.ServiceOrderRelationship; import org.mapstruct.BeanMapping; import org.mapstruct.Mapper; import org.mapstruct.Mapping; @@ -12,79 +17,139 @@ import org.mapstruct.NullValueCheckStrategy; import org.mapstruct.NullValueMappingStrategy; import org.mapstruct.NullValuePropertyMappingStrategy; -@Mapper( - nullValueMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT, - nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS ) +@Mapper(nullValueMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT, + nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS) public interface ProductOrderMapper { - - @Mapping(target = "uuid", ignore = true) - @Mapping(target = "baseType", ignore = true) - @Mapping(target = "href", ignore = true) - @Mapping(target = "schemaLocation", ignore = true) - @Mapping(target = "type", ignore = true) - ProductOrder fromProductOrderUpdate( ProductOrderUpdate rpdto ); - - - - @Mapping(target = "baseType", ignore = true) - @Mapping(target = "schemaLocation", ignore = true) - @Mapping(target = "href", ignore = true) - @Mapping(target = "type", ignore = true) - @Mapping(target = "uuid", ignore = true) - @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE) - @Mapping(target = "productOrderItem", expression = "java(updateProductOrderItem(entity, updateEntity))") - @Mapping(target = "note", expression = "java(updateNote(entity, updateEntity))") - @Mapping(target = "relatedParty", expression = "java(updateRelatedParty(entity, updateEntity))") - ProductOrder updateProductOrder(@MappingTarget ProductOrder entity, ProductOrderUpdate updateEntity); - - default Set updateProductOrderItem( ProductOrder so, ProductOrderUpdate updateEntity ){ - if ( updateEntity.getProductOrderItem() != null ) { - for (ProductOrderItem soiUpd : updateEntity.getProductOrderItem()) { - ProductOrderItem soiOrigin = so.findOrderItemById( soiUpd.getId() ); - if (soiOrigin!=null) { - //updateOrderItem(soiOrigin, soiUpd); - if ( soiUpd.getAction()!=null) { - soiOrigin.setAction( soiUpd.getAction() ); - } - /** - * When we patch the order and see a MODIFY or DELETE action, we set the state to ACKNOWLEDGED - */ - if ( soiOrigin.getAction().equals( OrderItemActionType.MODIFY ) || - soiOrigin.getAction().equals( OrderItemActionType.DELETE )) { - soiOrigin.setState( ProductOrderItemStateType.ACKNOWLEDGED ); - so.setState( ProductOrderStateType.ACKNOWLEDGED ); - - - } - - } + + @Mapping(target = "uuid", ignore = true) + @Mapping(target = "baseType", ignore = true) + @Mapping(target = "href", ignore = true) + @Mapping(target = "schemaLocation", ignore = true) + @Mapping(target = "type", ignore = true) + ProductOrder fromProductOrderUpdate(ProductOrderUpdate rpdto); + + + + @Mapping(target = "baseType", ignore = true) + @Mapping(target = "schemaLocation", ignore = true) + @Mapping(target = "href", ignore = true) + @Mapping(target = "type", ignore = true) + @Mapping(target = "uuid", ignore = true) + @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE) + @Mapping(target = "productOrderItem", expression = "java(updateProductOrderItem(entity, updateEntity))") + @Mapping(target = "note", expression = "java(updateNote(entity, updateEntity))") + @Mapping(target = "relatedParty", expression = "java(updateRelatedParty(entity, updateEntity))") + ProductOrder updateProductOrder(@MappingTarget ProductOrder entity, + ProductOrderUpdate updateEntity); + + default Set updateProductOrderItem(ProductOrder so, + ProductOrderUpdate updateEntity) { + if (updateEntity.getProductOrderItem() != null) { + for (ProductOrderItem soiUpd : updateEntity.getProductOrderItem()) { + ProductOrderItem soiOrigin = so.findOrderItemById(soiUpd.getId()); + if (soiOrigin != null) { + soiOrigin = updateOrderItem(soiOrigin, soiUpd); + + + /** + * When we patch the order and see a MODIFY or DELETE action, we set the state to + * ACKNOWLEDGED + */ + if (soiOrigin.getAction().equals(OrderItemActionType.MODIFY) + || soiOrigin.getAction().equals(OrderItemActionType.DELETE)) { + soiOrigin.setState(ProductOrderItemStateType.ACKNOWLEDGED); + so.setState(ProductOrderStateType.ACKNOWLEDGED); + + + } + + }else { + so.addProductOrderItemItem(soiUpd); } } - return so.getProductOrderItem(); - } - - - default Set updateNote( ProductOrder so, ProductOrderUpdate updateEntity ){ - if (updateEntity.getNote() != null) { - for (Note n : updateEntity.getNote()) { - if (n.getUuid() == null) { - so.addNoteItem(n); + } + return so.getProductOrderItem(); + } + + + default ProductOrderItem updateOrderItem(final ProductOrderItem soi, final ProductOrderItem soiUpd) { + ProductOrderItem soiOrigin = soi; + if (soiUpd.getAction() != null) { + soiOrigin.setAction(soiUpd.getAction()); + } + + + + if (soiUpd.getProductOffering() != null) { + soiOrigin.setProductOffering(soiUpd.getProductOffering()); + } + + if (soiUpd.getProduct() != null) { + if (soiOrigin.getProduct() == null) { + soiOrigin.setProduct(soiUpd.getProduct()); + } else { + soiOrigin.getProduct().setStatus(soiUpd.getProduct().getStatus());// this probably will + // change only + soiOrigin.getProduct().setName(soiUpd.getProduct().getName()); + + + for (Characteristic updChar : soiUpd.getProduct().getProductCharacteristic()) { + String charname = updChar.getName(); + Characteristic originChar = soiOrigin.getProduct().findCharacteristicByName(charname); + if ((originChar != null) && (updChar != null) && (originChar.getValue() != null) + && (originChar.getValue().getValue() != null) && (updChar.getValue() != null)) { + if (!originChar.getValue().getValue().equals(updChar.getValue().getValue())) { + originChar.setValue(new Any(updChar.getValue())); } + } else if ((originChar != null) && (originChar.getValue() == null) + && (updChar.getValue() != null)) { + originChar.setValue(new Any(updChar.getValue())); + } + } + + // we need also to update supportingServices + for (ServiceRef serviceRef : soiUpd.getProduct().getRealizingService()) { + if (soiOrigin.getProduct().getRealizingServiceById(serviceRef.getId()) == null) { + soiOrigin.getProduct().addRealizingServiceItem(serviceRef); + } + } + + for (ResourceRef resourceRef : soiUpd.getProduct().getRealizingResource()) { + if (soiOrigin.getProduct().getRealizingResourceById(resourceRef.getId()) == null) { + soiOrigin.getProduct().addRealizingResourceItem(resourceRef); + } } + } - return so.getNote(); } - - default Set updateRelatedParty( ProductOrder so, ProductOrderUpdate updateEntity ){ - if (updateEntity.getRelatedParty() != null) { - for (RelatedParty n : updateEntity.getRelatedParty()) { - if (n.getUuid() == null) { - so.addRelatedPartyItem(n); - } + return soiOrigin; + } + + + + default Set updateNote(ProductOrder so, ProductOrderUpdate updateEntity) { + if (updateEntity.getNote() != null) { + for (Note n : updateEntity.getNote()) { + if (n.getUuid() == null) { + so.addNoteItem(n); } } - return so.getRelatedParty(); + } - + return so.getNote(); + } + + default Set updateRelatedParty(ProductOrder so, ProductOrderUpdate updateEntity) { + if (updateEntity.getRelatedParty() != null) { + for (RelatedParty n : updateEntity.getRelatedParty()) { + if (n.getUuid() == null) { + so.addRelatedPartyItem(n); + } + } + } + return so.getRelatedParty(); + } + + } diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderStateChangeEvent.java b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderStateChangeEvent.java index 68f304d..00b751a 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderStateChangeEvent.java +++ b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderStateChangeEvent.java @@ -293,6 +293,9 @@ public class ProductOrderStateChangeEvent { @Valid public ProductOrderStateChangeEventPayload getEvent() { + if (event==null) { + event = new ProductOrderStateChangeEventPayload(); + } return event; } diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderStateChangeNotification.java b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderStateChangeNotification.java new file mode 100644 index 0000000..4fb2115 --- /dev/null +++ b/src/main/java/org/etsi/osl/tmf/po622/model/ProductOrderStateChangeNotification.java @@ -0,0 +1,90 @@ +package org.etsi.osl.tmf.po622.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.tmf.common.model.Notification; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.Valid; + +public class ProductOrderStateChangeNotification extends Notification { + + @JsonProperty("event") + private ProductOrderStateChangeEvent event = null; + + public ProductOrderStateChangeNotification eventId(String eventId) { + this.eventId = eventId; + return this; + } + + + + public ProductOrderStateChangeNotification event(ProductOrderStateChangeEvent event) { + this.event = event; + return this; + } + + /** + * The event linked to the involved resource object + * @return event + **/ + @Schema(description = "The event linked to the involved resource object") + + @Valid + + public ProductOrderStateChangeEvent getEvent() { + return event; + } + + public void setEvent(ProductOrderStateChangeEvent event) { + this.event = event; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ProductOrderStateChangeNotification productOrderStateChangeNotification = (ProductOrderStateChangeNotification) o; + return Objects.equals(this.eventId, productOrderStateChangeNotification.eventId) && + Objects.equals(this.eventTime, productOrderStateChangeNotification.eventTime) && + Objects.equals(this.eventType, productOrderStateChangeNotification.eventType) && + Objects.equals(this.fieldPath, productOrderStateChangeNotification.fieldPath) && + Objects.equals(this.resourcePath, productOrderStateChangeNotification.resourcePath) && + Objects.equals(this.event, productOrderStateChangeNotification.event); + } + + @Override + public int hashCode() { + return Objects.hash(eventId, eventTime, eventType, fieldPath, resourcePath, event); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductOrderStateChangeNotification {\n"); + + sb.append(" eventId: ").append(toIndentedString(eventId)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" fieldPath: ").append(toIndentedString(fieldPath)).append("\n"); + sb.append(" resourcePath: ").append(toIndentedString(resourcePath)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/org/etsi/osl/tmf/po622/model/RelatedProductOrderItem.java b/src/main/java/org/etsi/osl/tmf/po622/model/RelatedProductOrderItem.java index a265d9c..11efb01 100644 --- a/src/main/java/org/etsi/osl/tmf/po622/model/RelatedProductOrderItem.java +++ b/src/main/java/org/etsi/osl/tmf/po622/model/RelatedProductOrderItem.java @@ -21,8 +21,11 @@ package org.etsi.osl.tmf.po622.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; +import org.etsi.osl.tmf.common.model.BaseRootEntity; +import org.etsi.osl.tmf.common.model.BaseRootNamedEntity; import org.springframework.validation.annotation.Validated; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.Entity; import jakarta.validation.constraints.NotNull; /** @@ -31,7 +34,8 @@ import jakarta.validation.constraints.NotNull; @Schema(description = "RelatedProductOrderItem (ProductOrder item) .The product order item which triggered product creation/change/termination.") @Validated @jakarta.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2020-10-30T10:29:21.184964400+02:00[Europe/Athens]") -public class RelatedProductOrderItem { +@Entity(name = "RelatedProdOrdItem622") +public class RelatedProductOrderItem extends BaseRootEntity { @JsonProperty("orderItemAction") private String orderItemAction = null; @@ -47,14 +51,6 @@ public class RelatedProductOrderItem { @JsonProperty("role") private String role = null; - @JsonProperty("@baseType") - private String baseType = null; - - @JsonProperty("@schemaLocation") - private String schemaLocation = null; - - @JsonProperty("@type") - private String type = null; @JsonProperty("@referredType") private String _atReferredType = null; -- GitLab