Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(impl):[#296] has alternatives support #678

Merged
merged 6 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Added support for `hasAlternatives` property in SingleLevelBomAsBuilt aspect

## [4.2.0] - 2023-11-28
### Changed
Expand Down
11 changes: 9 additions & 2 deletions docs/src/api/irs-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ components:
linkedItem:
assembledOn: 2022-02-03T14:48:54.709Z
childCatenaXId: urn:uuid:a45a2246-f6e1-42da-b47d-5c3b58ed62e9
hasAlternatives: false
lastModifiedOn: 2022-02-03T14:48:54.709Z
lifecycleContext: asBuilt
quantity:
Expand Down Expand Up @@ -1187,6 +1188,7 @@ components:
linkedItem:
assembledOn: 2022-02-03T14:48:54.709Z
childCatenaXId: urn:uuid:a45a2246-f6e1-42da-b47d-5c3b58ed62e9
hasAlternatives: false
lastModifiedOn: 2022-02-03T14:48:54.709Z
lifecycleContext: asBuilt
quantity:
Expand Down Expand Up @@ -1375,6 +1377,7 @@ components:
linkedItem:
assembledOn: 2022-02-03T14:48:54.709Z
childCatenaXId: urn:uuid:a45a2246-f6e1-42da-b47d-5c3b58ed62e9
hasAlternatives: false
lastModifiedOn: 2022-02-03T14:48:54.709Z
lifecycleContext: asBuilt
quantity:
Expand Down Expand Up @@ -2105,20 +2108,24 @@ components:
maxLength: 45
minLength: 45
pattern: "^urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
hasAlternatives:
type: boolean
description: Expresses whether the part is built-in or whether it is one
of several options.
lastModifiedOn:
type: string
example: 2022-02-03T14:48:54.709Z
format: date-time
description: Last datetime item was modified.
example: 2022-02-03T14:48:54.709Z
lifecycleContext:
type: string
example: asBuilt
description: The lifecycle context in which the child part was assembled
into the parent part.
enum:
- asBuilt
- asPlanned
- asSpecified
example: asBuilt
quantity:
$ref: '#/components/schemas/Quantity'
MeasurementUnit:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ public List<Relationship> asRelationships() {
private ZonedDateTime lastModifiedOn;
private String catenaXId;
private String businessPartner;
private boolean hasAlternatives;

public Relationship toRelationship(final String catenaXId) {
final LinkedItem.LinkedItemBuilder linkedItem = LinkedItem.builder()
.childCatenaXId(GlobalAssetIdentification.of(this.catenaXId))
.lifecycleContext(BomLifecycle.AS_BUILT)
.lifecycleContext(this.hasAlternatives ? BomLifecycle.AS_PLANNED : BomLifecycle.AS_BUILT)
ds-ext-kmassalski marked this conversation as resolved.
Show resolved Hide resolved
.hasAlternatives(this.hasAlternatives)
.assembledOn(this.createdOn)
.lastModifiedOn(this.lastModifiedOn);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public Relationship toRelationship(final String catenaXId) {
final LinkedItem.LinkedItemBuilder linkedItem = LinkedItem.builder()
.childCatenaXId(GlobalAssetIdentification.of(this.catenaXId))
.lifecycleContext(BomLifecycle.AS_PLANNED)
.hasAlternatives(Boolean.FALSE)
.assembledOn(this.createdOn)
.lastModifiedOn(this.lastModifiedOn);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public Relationship toRelationship(final String catenaXId) {
final LinkedItem.LinkedItemBuilder linkedItem = LinkedItem.builder()
.childCatenaXId(GlobalAssetIdentification.of(this.childCatenaXId))
.lifecycleContext(BomLifecycle.AS_SPECIFIED)
.hasAlternatives(Boolean.FALSE)
.assembledOn(childPart.getCreatedOn())
.lastModifiedOn(childPart.getLastModifiedOn());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public Relationship toRelationship(final String catenaXId, final String business
final LinkedItem.LinkedItemBuilder linkedItem = LinkedItem.builder()
.childCatenaXId(GlobalAssetIdentification.of(catenaXId))
.lifecycleContext(BomLifecycle.AS_BUILT)
.hasAlternatives(Boolean.FALSE)
.assembledOn(this.createdOn)
.lastModifiedOn(this.lastModifiedOn);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ public class LinkedItem {
@JsonUnwrapped
private GlobalAssetIdentification childCatenaXId;

@Schema(description = "Expresses whether the part is built-in or whether it is one of several options.", implementation = Boolean.class)
private boolean hasAlternatives;

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static class CxTestData {
public static final String SINGLE_LEVEL_BOM_AS_BUILT_ASPECT_TYPE = "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt";
public static final String SINGLE_LEVEL_USAGE_BUILT_ASPECT_TYPE = "urn:bamm:io.catenax.single_level_usage_as_built:2.0.0#SingleLevelUsageAsBuilt";
public static final String SINGLE_LEVEL_BOM_AS_SPECIFIED_ASPECT_TYPE = "urn:bamm:io.catenax.single_level_bom_as_specified:1.0.0#SingleLevelBomAsSpecified";
public static final String PART_AS_PLANNED_ASPECT_TYPE = "urn:bamm:io.catenax.part_as_planned:1.0.0#PartAsPlanned";
public static final String PART_AS_PLANNED_ASPECT_TYPE = "urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned";
public static final String SINGLE_LEVEL_BOM_AS_PLANNED_ASPECT_TYPE = "urn:bamm:io.catenax.single_level_bom_as_planned:2.0.0#SingleLevelBomAsPlanned";
public static final String BATCH_ASPECT_TYPE = "urn:bamm:io.catenax.batch:2.0.0#Batch";
public static final String MATERIAL_FOR_RECYCLING_ASPECT_TYPE = "urn:bamm:io.catenax.material_for_recycling:1.1.0#MaterialForRecycling";
Expand Down
13 changes: 12 additions & 1 deletion irs-models/src/main/resources/test_data/CX_Testdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -331371,7 +331371,18 @@
"businessPartner" : "BPNL00000003B0Q0",
"createdOn" : "2022-02-03T14:48:54.709Z",
"lastModifiedOn" : "2022-02-03T14:48:54.709Z"
} ]
},
{
"catenaXId" : "urn:uuid:72ec2897-4e20-475c-a28b-019cf5b42a18",
"quantity" : {
"quantityNumber" : 2.5,
"measurementUnit" : "unit:litre"
},
"hasAlternatives" : true,
"businessPartner" : "BPNL00000003CNKC",
"createdOn" : "2022-02-03T14:48:54.709Z",
"lastModifiedOn" : "2022-02-03T14:48:54.709Z"
} ]
} ],
"urn:bamm:io.catenax.battery.product_description:1.0.1#ProductDescription" : [ {
"minimalStateOfHealth" : {
Expand Down