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 1efa62fc6e8035777bc63d69cdf43c779505608e..c05bc86f2d86fecb69e19082282d6146a1edc83e 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> 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 e42c15a26e890b491dcb1fb5e0bbf789e9832ae0..75c3805993c5572b7d3123deea5f94c5f844f0a3 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 37607452e970a63ec7f05f878e645ef6c8e76913..75b40a5ca0d816940ab97f77866a0abb2cf936bc 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<AgreementItemRef> agreement = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set<AgreementItemRef> 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<RelatedPlaceRefOrValue> place = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set<RelatedPlaceRefOrValue> place = new HashSet<>(); @JsonProperty("product") @Valid - private List<ProductRefOrValue> product = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set<ProductRefOrValue> product = new HashSet<>(); @JsonProperty("productCharacteristic") @Valid - private List<Characteristic> productCharacteristic = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set<Characteristic> 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<RelatedProductOrderItem> productOrderItem = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set<RelatedProductOrderItem> productOrderItem = new HashSet<>(); @JsonProperty("productPrice") @Valid - private List<ProductPrice> productPrice = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set<ProductPrice> productPrice = new HashSet<>(); @JsonProperty("productRelationship") @Valid - private List<ProductRelationship> productRelationship = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set<ProductRelationship> 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> productTerm = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set<ProductTerm> productTerm = new HashSet<>(); @JsonProperty("realizingResource") @Valid - private List<ResourceRef> realizingResource = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set<ResourceRef> realizingResource = new HashSet<>(); @JsonProperty("realizingService") @Valid - private List<ServiceRef> realizingService = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set<ServiceRef> realizingService = new HashSet<>(); @JsonProperty("relatedParty") @Valid - private List<RelatedParty> relatedParty = null; + @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}) + protected Set<RelatedParty> 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<AgreementItemRef> agreement) { + public Product agreement(Set<AgreementItemRef> agreement) { this.agreement = agreement; return this; } public Product addAgreementItem(AgreementItemRef agreementItem) { if (this.agreement == null) { - this.agreement = new ArrayList<AgreementItemRef>(); + this.agreement = new HashSet<AgreementItemRef>(); } this.agreement.add(agreementItem); return this; @@ -345,11 +357,11 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List<AgreementItemRef> getAgreement() { + public Set<AgreementItemRef> getAgreement() { return agreement; } - public void setAgreement(List<AgreementItemRef> agreement) { + public void setAgreement(Set<AgreementItemRef> agreement) { this.agreement = agreement; } @@ -374,14 +386,14 @@ public class Product { this.billingAccount = billingAccount; } - public Product place(List<RelatedPlaceRefOrValue> place) { + public Product place(Set<RelatedPlaceRefOrValue> place) { this.place = place; return this; } public Product addPlaceItem(RelatedPlaceRefOrValue placeItem) { if (this.place == null) { - this.place = new ArrayList<RelatedPlaceRefOrValue>(); + this.place = new HashSet<RelatedPlaceRefOrValue>(); } this.place.add(placeItem); return this; @@ -394,22 +406,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List<RelatedPlaceRefOrValue> getPlace() { + public Set<RelatedPlaceRefOrValue> getPlace() { return place; } - public void setPlace(List<RelatedPlaceRefOrValue> place) { + public void setPlace(Set<RelatedPlaceRefOrValue> place) { this.place = place; } - public Product product(List<ProductRefOrValue> product) { + public Product product(Set<ProductRefOrValue> product) { this.product = product; return this; } public Product addProductItem(ProductRefOrValue productItem) { if (this.product == null) { - this.product = new ArrayList<ProductRefOrValue>(); + this.product = new HashSet<ProductRefOrValue>(); } this.product.add(productItem); return this; @@ -422,22 +434,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List<ProductRefOrValue> getProduct() { + public Set<ProductRefOrValue> getProduct() { return product; } - public void setProduct(List<ProductRefOrValue> product) { + public void setProduct(Set<ProductRefOrValue> product) { this.product = product; } - public Product productCharacteristic(List<Characteristic> productCharacteristic) { + public Product productCharacteristic(Set<Characteristic> productCharacteristic) { this.productCharacteristic = productCharacteristic; return this; } public Product addProductCharacteristicItem(Characteristic productCharacteristicItem) { if (this.productCharacteristic == null) { - this.productCharacteristic = new ArrayList<Characteristic>(); + this.productCharacteristic = new HashSet<Characteristic>(); } this.productCharacteristic.add(productCharacteristicItem); return this; @@ -450,11 +462,11 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List<Characteristic> getProductCharacteristic() { + public Set<Characteristic> getProductCharacteristic() { return productCharacteristic; } - public void setProductCharacteristic(List<Characteristic> productCharacteristic) { + public void setProductCharacteristic(Set<Characteristic> productCharacteristic) { this.productCharacteristic = productCharacteristic; } @@ -479,14 +491,14 @@ public class Product { this.productOffering = productOffering; } - public Product productOrderItem(List<RelatedProductOrderItem> productOrderItem) { + public Product productOrderItem(Set<RelatedProductOrderItem> productOrderItem) { this.productOrderItem = productOrderItem; return this; } public Product addProductOrderItemItem(RelatedProductOrderItem productOrderItemItem) { if (this.productOrderItem == null) { - this.productOrderItem = new ArrayList<RelatedProductOrderItem>(); + this.productOrderItem = new HashSet<RelatedProductOrderItem>(); } this.productOrderItem.add(productOrderItemItem); return this; @@ -499,22 +511,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List<RelatedProductOrderItem> getProductOrderItem() { + public Set<RelatedProductOrderItem> getProductOrderItem() { return productOrderItem; } - public void setProductOrderItem(List<RelatedProductOrderItem> productOrderItem) { + public void setProductOrderItem(Set<RelatedProductOrderItem> productOrderItem) { this.productOrderItem = productOrderItem; } - public Product productPrice(List<ProductPrice> productPrice) { + public Product productPrice(Set<ProductPrice> productPrice) { this.productPrice = productPrice; return this; } public Product addProductPriceItem(ProductPrice productPriceItem) { if (this.productPrice == null) { - this.productPrice = new ArrayList<ProductPrice>(); + this.productPrice = new HashSet<ProductPrice>(); } this.productPrice.add(productPriceItem); return this; @@ -527,22 +539,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List<ProductPrice> getProductPrice() { + public Set<ProductPrice> getProductPrice() { return productPrice; } - public void setProductPrice(List<ProductPrice> productPrice) { + public void setProductPrice(Set<ProductPrice> productPrice) { this.productPrice = productPrice; } - public Product productRelationship(List<ProductRelationship> productRelationship) { + public Product productRelationship(Set<ProductRelationship> productRelationship) { this.productRelationship = productRelationship; return this; } public Product addProductRelationshipItem(ProductRelationship productRelationshipItem) { if (this.productRelationship == null) { - this.productRelationship = new ArrayList<ProductRelationship>(); + this.productRelationship = new HashSet<ProductRelationship>(); } this.productRelationship.add(productRelationshipItem); return this; @@ -555,11 +567,11 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List<ProductRelationship> getProductRelationship() { + public Set<ProductRelationship> getProductRelationship() { return productRelationship; } - public void setProductRelationship(List<ProductRelationship> productRelationship) { + public void setProductRelationship(Set<ProductRelationship> productRelationship) { this.productRelationship = productRelationship; } @@ -584,14 +596,14 @@ public class Product { this.productSpecification = productSpecification; } - public Product productTerm(List<ProductTerm> productTerm) { + public Product productTerm(Set<ProductTerm> productTerm) { this.productTerm = productTerm; return this; } public Product addProductTermItem(ProductTerm productTermItem) { if (this.productTerm == null) { - this.productTerm = new ArrayList<ProductTerm>(); + this.productTerm = new HashSet<ProductTerm>(); } this.productTerm.add(productTermItem); return this; @@ -604,22 +616,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List<ProductTerm> getProductTerm() { + public Set<ProductTerm> getProductTerm() { return productTerm; } - public void setProductTerm(List<ProductTerm> productTerm) { + public void setProductTerm(Set<ProductTerm> productTerm) { this.productTerm = productTerm; } - public Product realizingResource(List<ResourceRef> realizingResource) { + public Product realizingResource(Set<ResourceRef> realizingResource) { this.realizingResource = realizingResource; return this; } public Product addRealizingResourceItem(ResourceRef realizingResourceItem) { if (this.realizingResource == null) { - this.realizingResource = new ArrayList<ResourceRef>(); + this.realizingResource = new HashSet<ResourceRef>(); } this.realizingResource.add(realizingResourceItem); return this; @@ -632,22 +644,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List<ResourceRef> getRealizingResource() { + public Set<ResourceRef> getRealizingResource() { return realizingResource; } - public void setRealizingResource(List<ResourceRef> realizingResource) { + public void setRealizingResource(Set<ResourceRef> realizingResource) { this.realizingResource = realizingResource; } - public Product realizingService(List<ServiceRef> realizingService) { + public Product realizingService(Set<ServiceRef> realizingService) { this.realizingService = realizingService; return this; } public Product addRealizingServiceItem(ServiceRef realizingServiceItem) { if (this.realizingService == null) { - this.realizingService = new ArrayList<ServiceRef>(); + this.realizingService = new HashSet<ServiceRef>(); } this.realizingService.add(realizingServiceItem); return this; @@ -660,22 +672,22 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List<ServiceRef> getRealizingService() { + public Set<ServiceRef> getRealizingService() { return realizingService; } - public void setRealizingService(List<ServiceRef> realizingService) { + public void setRealizingService(Set<ServiceRef> realizingService) { this.realizingService = realizingService; } - public Product relatedParty(List<RelatedParty> relatedParty) { + public Product relatedParty(Set<RelatedParty> relatedParty) { this.relatedParty = relatedParty; return this; } public Product addRelatedPartyItem(RelatedParty relatedPartyItem) { if (this.relatedParty == null) { - this.relatedParty = new ArrayList<RelatedParty>(); + this.relatedParty = new HashSet<RelatedParty>(); } this.relatedParty.add(relatedPartyItem); return this; @@ -688,11 +700,11 @@ public class Product { @Schema(description = "") @NotNull @Valid - public List<RelatedParty> getRelatedParty() { + public Set<RelatedParty> getRelatedParty() { return relatedParty; } - public void setRelatedParty(List<RelatedParty> relatedParty) { + public void setRelatedParty(Set<RelatedParty> 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 d60d5dadbe0defb2fc58d52325a42a9e497e3b94..b871aa6db1af9eed1ee245c9454da4044b097a52 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<PriceAlteration> 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<PriceAlteration> 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<PriceAlteration> productPriceAlteration) { + public ProductPrice productPriceAlteration(Set<PriceAlteration> productPriceAlteration) { this.productPriceAlteration = productPriceAlteration; return this; } public ProductPrice addProductPriceAlterationItem(PriceAlteration productPriceAlterationItem) { if (this.productPriceAlteration == null) { - this.productPriceAlteration = new ArrayList<PriceAlteration>(); + this.productPriceAlteration = new HashSet<PriceAlteration>(); } this.productPriceAlteration.add(productPriceAlterationItem); return this; @@ -239,73 +243,15 @@ public class ProductPrice { @Schema(description = "") @NotNull @Valid - public List<PriceAlteration> getProductPriceAlteration() { + public Set<PriceAlteration> getProductPriceAlteration() { return productPriceAlteration; } - public void setProductPriceAlteration(List<PriceAlteration> productPriceAlteration) { + public void setProductPriceAlteration(Set<PriceAlteration> 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 932f57130da8c7590de9fc68ab0a723cb0f571ee..c95f059d0594f6e09ab2cb752ff06aa4a65acb27 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<AgreementItemRef> agreement = null; - - @JsonProperty("billingAccount") - private BillingAccountRef billingAccount = null; - - @JsonProperty("place") - @Valid - private List<RelatedPlaceRefOrValue> place = null; - - @JsonProperty("product") - @Valid - private List<ProductRefOrValue> product = null; - - @JsonProperty("productCharacteristic") - @Valid - private List<Characteristic> productCharacteristic = null; - - @JsonProperty("productOffering") - private ProductOfferingRef productOffering = null; - - @JsonProperty("productOrderItem") - @Valid - private List<RelatedProductOrderItem> productOrderItem = null; - - @JsonProperty("productPrice") - @Valid - private List<ProductPrice> productPrice = null; - - @JsonProperty("productRelationship") - @Valid - private List<ProductRelationship> productRelationship = null; - - @JsonProperty("productSpecification") - private ProductSpecificationRef productSpecification = null; - - @JsonProperty("productTerm") - @Valid - private List<ProductTerm> productTerm = null; - - @JsonProperty("realizingResource") - @Valid - private List<ResourceRef> realizingResource = null; - - @JsonProperty("realizingService") - @Valid - private List<ServiceRef> realizingService = null; - - @JsonProperty("relatedParty") - @Valid - private List<RelatedParty> 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<AgreementItemRef> agreement) { - this.agreement = agreement; - return this; - } - - public ProductRefOrValue addAgreementItem(AgreementItemRef agreementItem) { - if (this.agreement == null) { - this.agreement = new ArrayList<AgreementItemRef>(); + 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<AgreementItemRef> getAgreement() { - return agreement; - } - - public void setAgreement(List<AgreementItemRef> 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<RelatedPlaceRefOrValue> place) { - this.place = place; - return this; + return null; } - public ProductRefOrValue addPlaceItem(RelatedPlaceRefOrValue placeItem) { - if (this.place == null) { - this.place = new ArrayList<RelatedPlaceRefOrValue>(); - } - 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<RelatedPlaceRefOrValue> getPlace() { - return place; + return null; } - public void setPlace(List<RelatedPlaceRefOrValue> place) { - this.place = place; - } - public ProductRefOrValue product(List<ProductRefOrValue> product) { - this.product = product; - return this; - } - public ProductRefOrValue addProductItem(ProductRefOrValue productItem) { - if (this.product == null) { - this.product = new ArrayList<ProductRefOrValue>(); - } - this.product.add(productItem); - return this; - } - - /** - * Get product - * @return product - **/ - @Schema(description = "") - @NotNull - @Valid - public List<ProductRefOrValue> getProduct() { - return product; - } - - public void setProduct(List<ProductRefOrValue> product) { - this.product = product; - } - - public ProductRefOrValue productCharacteristic(List<Characteristic> productCharacteristic) { - this.productCharacteristic = productCharacteristic; - return this; - } - - public ProductRefOrValue addProductCharacteristicItem(Characteristic productCharacteristicItem) { - if (this.productCharacteristic == null) { - this.productCharacteristic = new ArrayList<Characteristic>(); - } - this.productCharacteristic.add(productCharacteristicItem); - return this; - } - - /** - * Get productCharacteristic - * @return productCharacteristic - **/ - @Schema(description = "") - @NotNull - @Valid - public List<Characteristic> getProductCharacteristic() { - return productCharacteristic; - } - - public void setProductCharacteristic(List<Characteristic> 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<RelatedProductOrderItem> productOrderItem) { - this.productOrderItem = productOrderItem; - return this; - } - - public ProductRefOrValue addProductOrderItemItem(RelatedProductOrderItem productOrderItemItem) { - if (this.productOrderItem == null) { - this.productOrderItem = new ArrayList<RelatedProductOrderItem>(); - } - this.productOrderItem.add(productOrderItemItem); - return this; - } - - /** - * Get productOrderItem - * @return productOrderItem - **/ - @Schema(description = "") - @NotNull - @Valid - public List<RelatedProductOrderItem> getProductOrderItem() { - return productOrderItem; - } - - public void setProductOrderItem(List<RelatedProductOrderItem> productOrderItem) { - this.productOrderItem = productOrderItem; - } - - public ProductRefOrValue productPrice(List<ProductPrice> productPrice) { - this.productPrice = productPrice; - return this; - } - - public ProductRefOrValue addProductPriceItem(ProductPrice productPriceItem) { - if (this.productPrice == null) { - this.productPrice = new ArrayList<ProductPrice>(); - } - this.productPrice.add(productPriceItem); - return this; - } - - /** - * Get productPrice - * @return productPrice - **/ - @Schema(description = "") - @NotNull - @Valid - public List<ProductPrice> getProductPrice() { - return productPrice; - } - - public void setProductPrice(List<ProductPrice> productPrice) { - this.productPrice = productPrice; - } - - public ProductRefOrValue productRelationship(List<ProductRelationship> productRelationship) { - this.productRelationship = productRelationship; - return this; - } - - public ProductRefOrValue addProductRelationshipItem(ProductRelationship productRelationshipItem) { - if (this.productRelationship == null) { - this.productRelationship = new ArrayList<ProductRelationship>(); - } - this.productRelationship.add(productRelationshipItem); - return this; - } - - /** - * Get productRelationship - * @return productRelationship - **/ - @Schema(description = "") - @NotNull - @Valid - public List<ProductRelationship> getProductRelationship() { - return productRelationship; - } - - public void setProductRelationship(List<ProductRelationship> 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> productTerm) { - this.productTerm = productTerm; - return this; - } - - public ProductRefOrValue addProductTermItem(ProductTerm productTermItem) { - if (this.productTerm == null) { - this.productTerm = new ArrayList<ProductTerm>(); - } - this.productTerm.add(productTermItem); - return this; - } - - /** - * Get productTerm - * @return productTerm - **/ - @Schema(description = "") - @NotNull - @Valid - public List<ProductTerm> getProductTerm() { - return productTerm; - } - - public void setProductTerm(List<ProductTerm> productTerm) { - this.productTerm = productTerm; - } - - public ProductRefOrValue realizingResource(List<ResourceRef> realizingResource) { - this.realizingResource = realizingResource; - return this; - } - - public ProductRefOrValue addRealizingResourceItem(ResourceRef realizingResourceItem) { - if (this.realizingResource == null) { - this.realizingResource = new ArrayList<ResourceRef>(); - } - this.realizingResource.add(realizingResourceItem); - return this; - } - - /** - * Get realizingResource - * @return realizingResource - **/ - @Schema(description = "") - @NotNull - @Valid - public List<ResourceRef> getRealizingResource() { - return realizingResource; - } - - public void setRealizingResource(List<ResourceRef> realizingResource) { - this.realizingResource = realizingResource; - } - - public ProductRefOrValue realizingService(List<ServiceRef> realizingService) { - this.realizingService = realizingService; - return this; - } - - public ProductRefOrValue addRealizingServiceItem(ServiceRef realizingServiceItem) { - if (this.realizingService == null) { - this.realizingService = new ArrayList<ServiceRef>(); - } - this.realizingService.add(realizingServiceItem); - return this; - } - - /** - * Get realizingService - * @return realizingService - **/ - @Schema(description = "") - @NotNull - @Valid - public List<ServiceRef> getRealizingService() { - return realizingService; - } - - public void setRealizingService(List<ServiceRef> realizingService) { - this.realizingService = realizingService; - } - - public ProductRefOrValue relatedParty(List<RelatedParty> relatedParty) { - this.relatedParty = relatedParty; - return this; - } - - public ProductRefOrValue addRelatedPartyItem(RelatedParty relatedPartyItem) { - if (this.relatedParty == null) { - this.relatedParty = new ArrayList<RelatedParty>(); - } - this.relatedParty.add(relatedPartyItem); - return this; - } - - /** - * Get relatedParty - * @return relatedParty - **/ - @Schema(description = "") - @NotNull - @Valid - public List<RelatedParty> getRelatedParty() { - return relatedParty; - } - - public void setRelatedParty(List<RelatedParty> 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 e0da3dfb99a817bfb0a394634a26869ae16a9d69..331b8fb5070609e14630fdcdb3207301d1033ea1 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 be680b159b57a8a502844b3ffb8341f1b06c4c55..4207102702166c26b6f10723ed14afdea2f89436 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 7aebfcb217de1f70f0ccc9eab74657b219cad427..ccdae2577800303eb0ab94568502f92ce399e113 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 27a09bbdfc7076f0aaa4fd6cadb53a11002203c0..f4c8d6a2a16a87da97a2dccd454dd2c5aaadb258 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 b0c7a8e2b939d2fad839c21099e6d80458a23195..f2fe095351e5c29573f580d6e4ff6c8ca6be4b09 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 0000000000000000000000000000000000000000..1f240a148d8e31d38b6c4e21361d3bd684ba7262 --- /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 1e519b2ba9935467b208ed2f18acc212131f2140..f49750ddae92c9bb1a94bc4d5fc1313c800a338f 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 0000000000000000000000000000000000000000..29d452210bf6dbe9107d0f5c0116232e3909d4e4 --- /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 c434043b365717d0fcc9969e51a5bfbc87ea1572..e4f4d2965521a9c108c59eeb871583e991f313b8 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 0000000000000000000000000000000000000000..a88c4b578f309e4d1f14017cfaf5ba105198722c --- /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 527891293ba50c9c9862d49a6bf5d20107ae92ca..a9042a24d7dd0931597a77ba54bdc6e955b51904 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 1271c87607bc1257803b4d892e9b4a84954b2365..f6c7a411c40d62fd3839d68c0405e3d9cce1f989 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<ProductOrderItem> 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<ProductOrderItem> 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<Note> 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<RelatedParty> 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<Note> 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<RelatedParty> 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 68f304dc070281cc757183f5304ddb7ef99f7094..00b751a34a488fe038a9654a23019fd41ea986fb 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 0000000000000000000000000000000000000000..4fb2115154dffbc8190ff30fb4905f7be2d784f2 --- /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 a265d9c72c2f03c54b8c8c4a3ac62833504f03a4..11efb010f2a010ce6aa29aac1b489b878c82e9ae 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;