Skip to content

Commit

Permalink
Merge pull request #145 from catenax-ng/A1SDS-2451_Aspect_model_changes
Browse files Browse the repository at this point in the history
[A1-SDE-2451] refactoring/rename of submodel
  • Loading branch information
adityagajbhiye9 authored Jun 27, 2023
2 parents a51989b + 9e38331 commit a697cf3
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 60 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Assembly Part Relationship (SDE Maven module)
# Single Level BoM As Built (SDE Maven module)
---
## Description

This module use for AssemblyPartRelationship submodel specification and descriptors. It's contain the codes related to AssemblyPartRelationship to validate, parse and transfer data for DigitalTwins and EDC to create aspect twins and data offer.
This module use for SingleLevelBoMAsBuilt submodel specification and descriptors. It's contain the codes related to SingleLevelBoMAsBuilt to validate, parse and transfer data for DigitalTwins and EDC to create aspect twins and data offer.

---
#### Version: 1.1.1
#### AssemblyPartRelationship Aspect Model URN: urn:bamm:io.catenax.assembly_part_relationship:1.1.1#AssemblyPartRelationship
#### Semantic Id: urn:bamm:io.catenax.assembly_part_relationship:1.1.1
#### Version: 1.0.0
#### SingleLevelBoMAsBuilt Aspect Model URN: urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt
#### Semantic Id: urn:bamm:io.catenax.single_level_bom_as_built:1.0.0
---

### Schema
Expand All @@ -31,7 +31,6 @@ Please find below links for schema details:
| manufacturer_part_id | Yes | 8 |
| optional_identifier_key | No | 9 |
| optional_identifier_value | No | 10 |
| lifecycle_context | Yes | 11 |
| quantity_number | Yes | 12 |
| measurement_unit | Yes | 13 |
| created_on | Yes | 14 |
Expand All @@ -40,7 +39,7 @@ Please find below links for schema details:

#### [CSV Sample File Link]

#### Example for submodel AssemblyPartRelationship
#### Example for submodel SingleLevelBoMAsBuilt

<br/><br/><img src="src/main/resources/images/assemblypartrelationship.png" height="60%" width="80%"/><br/><br/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.eclipse.tractusx.sde.submodels.apr.entity.AspectRelationshipEntity;
import org.eclipse.tractusx.sde.submodels.apr.model.AspectRelationship;
import org.eclipse.tractusx.sde.submodels.apr.model.AspectRelationshipResponse;
import org.eclipse.tractusx.sde.submodels.apr.model.ChildPart;
import org.eclipse.tractusx.sde.submodels.apr.model.ChildItems;
import org.eclipse.tractusx.sde.submodels.apr.model.Quantity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
Expand Down Expand Up @@ -70,26 +70,31 @@ public JsonObject mapToResponse(String parentCatenaXUuid, List<AspectRelationshi
return null;
}

Set<ChildPart> childParts = aspectRelationships.stream().map(this::toChildPart).collect(Collectors.toSet());
Set<ChildItems> childItems = aspectRelationships.stream().map(this::toChildItems).collect(Collectors.toSet());
return new Gson().toJsonTree(
AspectRelationshipResponse.builder().catenaXId(parentCatenaXUuid).childParts(childParts).build())
.getAsJsonObject();
AspectRelationshipResponse.builder()
.catenaXId(parentCatenaXUuid)
.childItems(childItems)
.build()).getAsJsonObject();

}

public AspectRelationshipResponse mapforResponse(JsonObject entity) {
return new Gson().fromJson(entity, AspectRelationshipResponse.class);
}

private ChildPart toChildPart(AspectRelationshipEntity entity) {
Quantity quantity = Quantity.builder().quantityNumber(entity.getQuantityNumber())
private ChildItems toChildItems(AspectRelationshipEntity entity) {
Quantity quantity = Quantity.builder()
.quantityNumber(entity.getQuantityNumber())
.measurementUnit(entity.getMeasurementUnit())
.build();

return ChildPart.builder()
.lifecycleContext(entity.getLifecycleContext())
return ChildItems.builder()
.createdOn(entity.getCreatedOn())
.childCatenaXId(entity.getChildCatenaXId()).quantity(quantity).build();
.businessPartner(entity.getChildManufacturerId())
.catenaXId(entity.getChildCatenaXId())
.quantity(quantity)
.build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
@AllArgsConstructor
public class AspectRelationshipResponse {
private String catenaXId;
private Set<ChildPart> childParts;
private Set<ChildItems> childItems;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
@Data
@AllArgsConstructor
@Builder
public class ChildPart {
public class ChildItems {

private String lifecycleContext;
private Quantity quantity;
private String createdOn;
private String lastModifiedOn;
private String childCatenaXId;
private String catenaXId;
private String businessPartner;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "http://example.com/example.json",
"type": "array",
"id": "assemblypartrelationship",
"idShort": "assemblyPartRelationship",
"version": "1.1.1",
"semantic_id": "urn:bamm:io.catenax.assembly_part_relationship:1.1.1#AssemblyPartRelationship",
"title": "Assembly Part Relationship",
"shortDescription": "BoM AsBuilt - Submodel AssemblyPartRelationship",
"id": "singlelevelbomasbuilt",
"idShort": "singleLevelBoMAsBuilt",
"version": "1.0.0",
"semantic_id": "urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt",
"title": "Single Level BoM as Built",
"shortDescription": "BoM AsBuilt - Submodel SingleLevelBoMAsBuilt",
"description": "The aspect provides the child parts (one structural level down) which the given object assembles.",
"items": {
"type": "object",
Expand All @@ -17,7 +17,6 @@
"part_instance_id",
"manufacturer_part_id",
"manufacturer_id",
"lifecycle_context",
"quantity_number",
"measurement_unit",
"created_on"
Expand Down Expand Up @@ -146,25 +145,6 @@
"Value"
]
},
"lifecycle_context": {
"type": [
"string"
],
"enum": [
"AsRequired",
"AsDesigned",
"AsPlanned",
"AsBuilt",
"AsMaintained",
"AsRecycled"
],
"minLength": 1,
"title": "Lifecycle Context",
"description": "The lifecycle context in which the child part was assembled into the parent part.",
"examples": [
"lifecycle"
]
},
"quantity_number": {
"type": [
"number"
Expand Down Expand Up @@ -224,7 +204,6 @@
"manufacturer_id": "BPNL00000000001",
"optional_identifier_key": "",
"optional_identifier_value": "",
"lifecycle_context": "AsRequired",
"quantity_number": 2.5,
"measurement_unit": "litre",
"created_on": "2022-02-03T14:48:54.709Z",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Serial Part Typization (SDE Maven module)
# Serial Part (SDE Maven module)
---
## Description

This module use for SerialPartTypization submodel specification and descriptors. It's contain the codes related to SerialPartTypization to validate, parse and transfer data for DigitalTwins and EDC to create aspect twins and data offer.
This module use for SerialPart submodel specification and descriptors. It's contain the codes related to SerialPart to validate, parse and transfer data for DigitalTwins and EDC to create aspect twins and data offer.

---
#### Version: 1.1.0
#### SerialPartTypization Aspect Model URN: urn:bamm:io.catenax.serial_part_typization:1.1.0#SerialPartTypization
#### Semantic Id: urn:bamm:io.catenax.serial_part_typization:1.1.0
#### Version: 1.0.0
#### SerialPart Aspect Model URN: urn:bamm:io.catenax.serial_part:1.0.0#SerialPart
#### Semantic Id: urn:bamm:io.catenax.serial_part:1.0.0
---

### Schema
Expand All @@ -17,7 +17,7 @@ Please find below links for schema details:
- [schema](src/main/resources/serial-part-typization.json)


### SerialPartTypization CSV file headers
### SerialPart CSV file headers

| Headers Name | Mandatory | Position |
|------------------------------- |----------------------------- |-------- |
Expand All @@ -36,7 +36,7 @@ Please find below links for schema details:

#### [CSV Sample File Link]

#### Example for submodel SerialPartTypization
#### Example for submodel SerialPart

<br/><br/><img src="src/main/resources/images/serialparttypization.png" height="60%" width="80%"/><br/><br/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "http://example.com/example.json",
"type": "array",
"id": "serialparttypization",
"idShort": "serialPartTypization",
"version": "1.1.1",
"semantic_id": "urn:bamm:io.catenax.serial_part_typization:1.1.1#SerialPartTypization",
"title": "Serial Part Typizations",
"shortDescription": "BoM As-Built - Submodel SerialPartTypization",
"id": "serialpart",
"idShort": "serialPart",
"version": "1.0.0",
"semantic_id": "urn:bamm:io.catenax.serial_part:1.0.0#SerialPart",
"title": "Serial Part",
"shortDescription": "BoM As-Built - Submodel SerialPart",
"description": "A serialized part is an instantiation of a (design-) part, where the particular instantiation can be uniquely identified by means of a serial numbers or a similar identifier (e.g. VAN) or a combination of multiple identifiers (e.g. combination of manufacturer, date and number)",
"items": {
"type": "object",
Expand Down

0 comments on commit a697cf3

Please sign in to comment.