Skip to content

Commit

Permalink
JNG-5879 Eliminate rest of the optional type (#183)
Browse files Browse the repository at this point in the history
* remove optional attribute from transfer object
  • Loading branch information
gaborflorian authored Aug 16, 2024
1 parent 6f9ce2d commit bc40454
Show file tree
Hide file tree
Showing 10 changed files with 935 additions and 330 deletions.
1,106 changes: 929 additions & 177 deletions model/model/psm.aird

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions model/model/psm.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,6 @@
eType="#//service/TransferOperation" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="actorType" eType="#//accesspoint/AbstractActorType"
eOpposite="#//accesspoint/AbstractActorType/transferObjectType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="optional" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
defaultValueLiteral="false"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="override" eType="#//service/TransferObjectType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="queryCustomizer" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
Expand Down
1 change: 0 additions & 1 deletion model/model/psm.emf
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ package service {
val TransferAttribute[*] attributes;
val TransferOperation[*] operations;
ref accesspoint.AbstractActorType#transferObjectType actorType;
attr boolean[1] optional = false;
ref TransferObjectType override;
attr boolean[1] queryCustomizer = false;
}
Expand Down
1 change: 0 additions & 1 deletion model/model/psm.genmodel
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference psm.ecore#//service/TransferObjectType/operations"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true"
ecoreFeature="ecore:EReference psm.ecore#//service/TransferObjectType/actorType"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute psm.ecore#//service/TransferObjectType/optional"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true"
ecoreFeature="ecore:EReference psm.ecore#//service/TransferObjectType/override"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute psm.ecore#//service/TransferObjectType/queryCustomizer"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ context PSM!TransferAttribute {
}

constraint RequiredFlagMatchesBindingRequiredFlag {
guard: self.binding.isDefined() and not self.eContainer.optional
guard: self.binding.isDefined()
check: self.required == self.binding.required
message: "Required flag of transfer attribute " + self.name + " must equal required flag of its binding."
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ context PSM!TransferObjectRelation {
}

constraint CardinalityMatchesBindingCardinality {
guard: self.binding.isDefined() and not self.eContainer.optional
guard: self.binding.isDefined()
check: (self.cardinality.lower == self.binding.cardinality.lower) and
(self.cardinality.upper == self.binding.cardinality.upper)
message: "Transfer object relation " + self.name + " and its binding must have the same cardinality."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ public class Demo {
private Types types = new Types();
private Services services = new Services();
private Measured measured = new Measured();
private Optional optional = new Optional();
private hu.blackbelt.model.northwind.optional.Services optionalServices = new hu.blackbelt.model.northwind.optional.Services();
private Extension extension = new Extension();
private hu.blackbelt.model.northwind.extension.Services extensionServices = new hu.blackbelt.model.northwind.extension.Services();

Expand Down Expand Up @@ -125,7 +123,6 @@ public class Demo {
private hu.blackbelt.model.northwind.services.Product product_ = new hu.blackbelt.model.northwind.services.Product();
private ProductInfo productInfo = new ProductInfo();
private GetRangeInputProductInfoCategory getRangeInputProductInfoCategory = new GetRangeInputProductInfoCategory();
private hu.blackbelt.model.northwind.optional.services.ProductInfo optionaProductInfo = new hu.blackbelt.model.northwind.optional.services.ProductInfo();
private ShipmentChange shipmentChange = new ShipmentChange();
private ShipperInfo shipperInfo = new ShipperInfo();
private AreaStoredInSquareMetre areaStoredInSquareMetre = new AreaStoredInSquareMetre();
Expand Down Expand Up @@ -183,8 +180,6 @@ public PsmModel fullDemo() {
types.init($);
services.init($);
measured.init(types.$);
optional.init($);
optionalServices.init(optional.$);
extension.init($);
extensionServices.init(extension.$);

Expand Down Expand Up @@ -277,17 +272,15 @@ public PsmModel fullDemo() {
// Unmapped transfer object type
shipmentChange.init(services.$, string, timeStamp);
comment.init(services.$, string, text, timeStamp);
getRangeInputProductInfoCategory.init(extensionServices.$, optionaProductInfo);
getRangeInputProductInfoCategory.init(extensionServices.$, productInfo);

// Mapped transfer objects
category_.init(services.$, string, category, product_);
categoryInfo.init(services.$, string, category, productInfo, allProducts);
shipperInfo.init(services.$, string, shipper, company, gps);
product_.init(services.$, string, double_, massStoredInKilograms, product, category_, allCategories);
optionaProductInfo.init(optionalServices.$, string, integer, double_, boolean_, massStoredInKilograms, product, categoryInfo, allCategories);

productInfo.init(services.$, string, integer, double_, boolean_, massStoredInKilograms, product, categoryInfo, allCategories, getRangeInputProductInfoCategory);
optionaProductInfo.$.setOverride(productInfo.$);
territoryInfo.init(services.$, string, territory);
orderItem.init(services.$, string, integer, double_, boolean_, massStoredInGrams, orderDetail, productInfo, categoryInfo, allProducts, allCategories, orderItem);
orderInfo.init(services.$, string, timeStamp, priority, boolean_, gps, integer, double_, massStoredInGrams, order, orderItem, shipperInfo, categoryInfo, shipmentChange, comment, timetype);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import hu.blackbelt.judo.meta.psm.namespace.Package;
import hu.blackbelt.judo.meta.psm.service.TransferObjectRelation;
import hu.blackbelt.judo.meta.psm.service.UnmappedTransferObjectType;
import hu.blackbelt.model.northwind.optional.services.ProductInfo;
import hu.blackbelt.model.northwind.services.ProductInfo;

import static hu.blackbelt.judo.meta.psm.namespace.util.builder.NamespaceBuilders.usePackage;
import static hu.blackbelt.judo.meta.psm.service.util.builder.ServiceBuilders.*;
Expand All @@ -34,13 +34,13 @@ public class GetRangeInputProductInfoCategory {
public UnmappedTransferObjectType $ = newUnmappedTransferObjectTypeBuilder().build();
public TransferObjectRelation owner = newTransferObjectRelationBuilder().build();

public void init(Package $package, ProductInfo $optionalProductInfo) {
public void init(Package $package, ProductInfo $productInfo) {

useUnmappedTransferObjectType($)
.withName("_GetRangeInputProductInfoCategory")
.withRelations(useTransferObjectRelation(owner)
.withName("owner")
.withTarget($optionalProductInfo.$)
.withTarget($productInfo.$)
.withEmbedded(true)
.withCardinality(newCardinalityBuilder()
.withLower(0)
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit bc40454

Please sign in to comment.