Skip to content

Commit

Permalink
feat(irs-api):[#199] update
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-psosnowski committed Mar 12, 2024
2 parents f9a886b + d79aa1e commit 4975d01
Show file tree
Hide file tree
Showing 31 changed files with 343 additions and 205 deletions.
4 changes: 3 additions & 1 deletion .config/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ page at http://checkstyle.sourceforge.net/config.html -->
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>

<module name="MagicNumber"/>
<module name="MagicNumber">
<property name="ignoreNumbers" value="-1, 0, 1, 2, 3"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ _**For better traceability add the corresponding GitHub issue number in each cha
## [Unreleased]
### Changed

- EdcPolicyDefinitionService, EdcContractDefinitionService and EdcAssetService return existing resource if it exists in
EDC
- EdcPolicyDefinitionService, EdcContractDefinitionService and EdcAssetService return existing resource if it exists in EDC
- Added AssetAdministrationShellDescriptor specificAssetIds support for externalSubjectId required for data provisioning
- Registering a job - aspects array is now accepting full urn of aspect model instead of name only, eg. 'urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt' instead 'SingleLevelBomAsBuilt'. #439
- Policies can now be registered for certain bpnls. #199


Expand Down
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ If you need ideas for contributions, you can check the following links:
- [open documentation stories](https://github.com/orgs/eclipse-tractusx/projects/8/views/4?filterQuery=label%3Adocumentation++status%3Ainbox%2Cbacklog)
- [discussion page concerning documentation improvements](https://github.com/eclipse-tractusx/item-relationship-service/discussions/407)

### Maintaining [CHANGELOG.md](CHANGELOG.md)
All notable changes to this project will be documented in this file.

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).

_**For better traceability add the corresponding GitHub issue number in each changelog entry, please.**_

## Contributing as a Consultant

Expand Down
3 changes: 1 addition & 2 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ maven/mavencentral/com.typesafe.akka/akka-slf4j_2.13/2.6.20, Apache-2.0, approve
maven/mavencentral/com.typesafe.scala-logging/scala-logging_2.13/3.9.5, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.typesafe/config/1.4.2, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.vaadin.external.google/android-json/0.0.20131108.vaadin1, Apache-2.0, approved, CQ21310
maven/mavencentral/com.vdurmont/semver4j/3.1.0, MIT, approved, clearlydefined
maven/mavencentral/commons-beanutils/commons-beanutils/1.9.4, Apache-2.0, approved, CQ12654
maven/mavencentral/commons-codec/commons-codec/1.15, Apache-2.0 AND BSD-3-Clause AND LicenseRef-Public-Domain, approved, CQ22641
maven/mavencentral/commons-collections/commons-collections/3.2.2, Apache-2.0, approved, CQ10385
Expand Down Expand Up @@ -436,7 +437,6 @@ maven/mavencentral/org.springframework.boot/spring-boot-starter-json/3.1.9, Apac
maven/mavencentral/org.springframework.boot/spring-boot-starter-log4j2/3.1.9, Apache-2.0, approved, #8800
maven/mavencentral/org.springframework.boot/spring-boot-starter-logging/3.1.9, Apache-2.0, approved, #9343
maven/mavencentral/org.springframework.boot/spring-boot-starter-oauth2-client/3.1.9, Apache-2.0, approved, #8806
maven/mavencentral/org.springframework.boot/spring-boot-starter-oauth2-resource-server/3.1.9, Apache-2.0, approved, #8804
maven/mavencentral/org.springframework.boot/spring-boot-starter-security/3.1.9, Apache-2.0, approved, #9337
maven/mavencentral/org.springframework.boot/spring-boot-starter-test/3.1.9, Apache-2.0, approved, #9353
maven/mavencentral/org.springframework.boot/spring-boot-starter-tomcat/3.1.9, Apache-2.0, approved, #9351
Expand All @@ -453,7 +453,6 @@ maven/mavencentral/org.springframework.security/spring-security-crypto/6.1.7, Ap
maven/mavencentral/org.springframework.security/spring-security-oauth2-client/6.1.7, Apache-2.0, approved, #9740
maven/mavencentral/org.springframework.security/spring-security-oauth2-core/6.1.7, Apache-2.0, approved, #9741
maven/mavencentral/org.springframework.security/spring-security-oauth2-jose/6.1.7, Apache-2.0, approved, #9345
maven/mavencentral/org.springframework.security/spring-security-oauth2-resource-server/6.1.7, Apache-2.0, approved, #8798
maven/mavencentral/org.springframework.security/spring-security-test/6.1.7, Apache-2.0, approved, #10674
maven/mavencentral/org.springframework.security/spring-security-web/6.1.7, Apache-2.0, approved, #9800
maven/mavencentral/org.springframework/spring-aop/6.0.17, Apache-2.0, approved, #5940
Expand Down
60 changes: 37 additions & 23 deletions docs/src/api/irs-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ info:
description: The API of the Item Relationship Service (IRS) for retrieving item
graphs along the value chain of CATENA-X partners.
title: IRS API
version: "4.7.0"
version: 4.7.0
servers:
- url: http://localhost:8080
security:
Expand Down Expand Up @@ -1032,8 +1032,8 @@ components:
lastModifiedOn: 2022-02-03T14:48:54.709Z
parameter:
aspects:
- SerialPart
- AddressAspect
- urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
- urn:bamm:io.catenax.serial_part:1.0.1#SerialPart
auditContractNegotiation: false
bomLifecycle: asBuilt
collectAspects: false
Expand Down Expand Up @@ -1083,8 +1083,8 @@ components:
lastModifiedOn: 2022-02-03T14:48:54.709Z
parameter:
aspects:
- SerialPart
- AddressAspect
- urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
- urn:bamm:io.catenax.serial_part:1.0.1#SerialPart
auditContractNegotiation: false
bomLifecycle: asBuilt
collectAspects: false
Expand Down Expand Up @@ -1165,7 +1165,7 @@ components:
semanticId:
keys:
- type: Submodel
value: urn:bamm:com.catenax.vehicle:0.1.1#PartDetails
value: urn:bamm:io.catenax.vehicle:0.1.1#PartDetails
type: ModelReference
submodels:
- aspectType: supply_chain_impacted
Expand Down Expand Up @@ -1209,8 +1209,8 @@ components:
lastModifiedOn: 2022-02-03T14:48:54.709Z
parameter:
aspects:
- SerialPart
- AddressAspect
- urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
- urn:bamm:io.catenax.serial_part:1.0.1#SerialPart
auditContractNegotiation: false
bomLifecycle: asBuilt
collectAspects: false
Expand Down Expand Up @@ -1288,10 +1288,10 @@ components:
semanticId:
keys:
- type: Submodel
value: urn:bamm:com.catenax.vehicle:0.1.1#PartDetails
value: urn:bamm:io.catenax.vehicle:0.1.1#PartDetails
type: ModelReference
submodels:
- aspectType: urn:bamm:io.catenax.single_level_bom_as_built:1.0.0
- aspectType: urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
contractAgreementId: f253718e-a270-4367-901b-9d50d9bd8462
identification: urn:uuid:fc784d2a-5506-4e61-8e34-21600f8cdeff
payload:
Expand Down Expand Up @@ -1363,8 +1363,8 @@ components:
lastModifiedOn: 2022-02-03T14:48:54.709Z
parameter:
aspects:
- SerialPart
- AddressAspect
- urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
- urn:bamm:io.catenax.serial_part:1.0.1#SerialPart
auditContractNegotiation: false
bomLifecycle: asBuilt
collectAspects: false
Expand Down Expand Up @@ -1401,8 +1401,8 @@ components:
lastModifiedOn: 2022-02-03T14:48:54.709Z
parameter:
aspects:
- SerialPart
- AddressAspect
- urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
- urn:bamm:io.catenax.serial_part:1.0.1#SerialPart
auditContractNegotiation: false
bomLifecycle: asBuilt
collectAspects: false
Expand Down Expand Up @@ -1479,9 +1479,9 @@ components:
type: ModelReference
keys:
- type: Submodel
value: urn:bamm:com.catenax.vehicle:0.1.1#PartDetails
value: urn:bamm:io.catenax.vehicle:0.1.1#PartDetails
submodels:
- aspectType: urn:bamm:io.catenax.single_level_bom_as_built:1.0.0
- aspectType: urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
contractAgreementId: f253718e-a270-4367-901b-9d50d9bd8462
identification: urn:uuid:fc784d2a-5506-4e61-8e34-21600f8cdeff
payload:
Expand Down Expand Up @@ -1519,8 +1519,8 @@ components:
lastModifiedOn: 2022-02-03T14:48:54.709Z
parameter:
aspects:
- SerialPart
- AddressAspect
- urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
- urn:bamm:io.catenax.serial_part:1.0.1#SerialPart
auditContractNegotiation: false
bomLifecycle: asBuilt
collectAspects: false
Expand All @@ -1541,16 +1541,16 @@ components:
value:
lastUpdated: 2023-02-13T08:18:11.990659500Z
models:
- urn: urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt
- urn: urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
name: SingleLevelBomAsBuilt
status: RELEASED
type: BAMM
version: 1.0.0
- urn: urn:bamm:io.catenax.serial_part:1.0.0#SerialPart
version: 2.0.0
- urn: urn:bamm:io.catenax.serial_part:1.0.1#SerialPart
name: SerialPart
status: RELEASED
type: BAMM
version: 1.0.0
version: 1.0.1
schemas:
AdministrativeInformation:
type: object
Expand Down Expand Up @@ -2431,9 +2431,15 @@ components:
properties:
aspects:
type: array
description: List of aspect names that will be collected if \<collectAspects\>
flag is set to true.
example:
- urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
items:
type: string
pattern: ^(urn:[bs]amm:.*\d\.\d\.\d)?(#)?(\w+)?$
maxItems: 2147483647
pattern: ^(urn:[bs]amm:.*\d\.\d\.\d)?(#)?(\w+)?$
batchSize:
type: integer
format: int32
Expand Down Expand Up @@ -2575,14 +2581,14 @@ components:
description: The requested job definition.
properties:
bomLifecycle:
example: asPlanned
type: string
description: The lifecycle context in which the child part was assembled
into the parent part.
enum:
- asBuilt
- asPlanned
- asSpecified
example: asPlanned
callbackUrl:
type: string
description: "Callback url to notify requestor when job processing is finished.\
Expand All @@ -2593,10 +2599,14 @@ components:
$ref: '#/components/schemas/PartChainIdentificationKey'
incidentBPNSs:
type: array
description: Array of BPNS numbers.
example:
- BPNS000000000DDD
items:
type: string
pattern: "(BPN)[LSA][\\w\\d]{10}[\\w\\d]{2}"
maxItems: 2147483647
pattern: "(BPN)[LSA][\\w\\d]{10}[\\w\\d]{2}"
required:
- incidentBPNSs
- key
Expand All @@ -2609,9 +2619,13 @@ components:
type: array
description: List of aspect names that will be collected if \<collectAspects\>
flag is set to true.
example:
- urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
items:
type: string
pattern: ^(urn:[bs]amm:.*\d\.\d\.\d)?(#)?(\w+)?$
maxItems: 2147483647
pattern: ^(urn:[bs]amm:.*\d\.\d\.\d)?(#)?(\w+)?$
auditContractNegotiation:
type: boolean
description: Flag enables and disables auditing, including provisioning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ skinparam shadowing false
"identification": "dae4d249-6d66-4818-b576-bf52f3b9ae90",
"semanticId": {
"value": [
"urn:bamm:com.catenax.vehicle:0.1.1#PartDetails"
"urn:bamm:io.catenax.vehicle:0.1.1#PartDetails"
]
},
"endpoints": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import org.eclipse.tractusx.irs.component.assetadministrationshell.Reference;
import org.eclipse.tractusx.irs.component.assetadministrationshell.SemanticId;
import org.eclipse.tractusx.irs.component.assetadministrationshell.SubmodelDescriptor;
import org.eclipse.tractusx.irs.component.enums.AspectType;
import org.eclipse.tractusx.irs.component.enums.BomLifecycle;
import org.eclipse.tractusx.irs.component.enums.Direction;
import org.eclipse.tractusx.irs.component.enums.JobState;
Expand Down Expand Up @@ -92,6 +91,8 @@ public class OpenApiExamples {
private static final String SUPPLY_CHAIN_IMPACTED_ASPECT_TYPE = "supply_chain_impacted";
private static final String SUPPLY_CHAIN_IMPACTED_KEY = "supplyChainImpacted";
private static final String SUPPLY_CHAIN_IMPACTER_RESULT = "YES";
private static final String SINGLE_LEVEL_BOM_AS_BUILT_ASPECT = "urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt";
private static final String SERIAL_PART_ASPECT = "urn:bamm:io.catenax.serial_part:1.0.1#SerialPart";
private static final int FETCHED_ITEMS_SIZE = 3;
private static final int NO_RUNNING_OR_FAILED_ITEMS = 0;
private static final int SENT_NOTIFICATIONS_SIZE = 6;
Expand Down Expand Up @@ -136,15 +137,15 @@ public void createExamples(final Components components) {
private Example createAspectModelsResult() {
final AspectModel assemblyPartRelationship = AspectModel.builder()
.name("SingleLevelBomAsBuilt")
.urn("urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt")
.version("1.0.0")
.urn(SINGLE_LEVEL_BOM_AS_BUILT_ASPECT)
.version("2.0.0")
.status("RELEASED")
.type("BAMM")
.build();
final AspectModel serialPart = AspectModel.builder()
.name("SerialPart")
.urn("urn:bamm:io.catenax.serial_part:1.0.0#SerialPart")
.version("1.0.0")
.urn(SERIAL_PART_ASPECT)
.version("1.0.1")
.status("RELEASED")
.type("BAMM")
.build();
Expand Down Expand Up @@ -207,7 +208,7 @@ private JobParameter createJobParameter() {
return JobParameter.builder()
.bomLifecycle(BomLifecycle.AS_BUILT)
.depth(1)
.aspects(List.of(AspectType.SERIAL_PART.toString(), AspectType.ADDRESS_ASPECT.toString()))
.aspects(List.of(SINGLE_LEVEL_BOM_AS_BUILT_ASPECT, SERIAL_PART_ASPECT))
.direction(Direction.DOWNWARD)
.collectAspects(false)
.build();
Expand Down Expand Up @@ -345,20 +346,20 @@ private Example createCanceledJobResponse() {
private Submodel createSubmodel() {
return Submodel.builder()
.contractAgreementId(EXAMPLE_ID)
.aspectType("urn:bamm:io.catenax.single_level_bom_as_built:1.0.0")
.aspectType(SINGLE_LEVEL_BOM_AS_BUILT_ASPECT)
.identification(SUBMODEL_IDENTIFICATION)
.payload(createAssemblyPartRelationshipPayloadMap())
.payload(createSingleLevelBomAsBuiltPayloadMap())
.build();
}

private Map<String, Object> createAssemblyPartRelationshipPayloadMap() {
final String assemblyPartRelationshipPayload =
private Map<String, Object> createSingleLevelBomAsBuiltPayloadMap() {
final String singleLevelBomAsBuiltPayload =
"{\"catenaXId\": \"urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447\", "
+ "\"childItems\": [ { \"createdOn\": \"2022-02-03T14:48:54.709Z\", \"catenaXId\": \"urn:uuid:d9bec1c6-e47c-4d18-ba41-0a5fe8b7f447\", "
+ "\"lastModifiedOn\": \"2022-02-03T14:48:54.709Z\", \"lifecycleContext\": \"AsBuilt\", \"quantity\": "
+ "{\"measurementUnit\": {\"datatypeURI\": \"urn:bamm:io.openmanufacturing:meta-model:1.0.0#piece\",\"lexicalValue\": \"piece\"},\"quantityNumber\": 1}}]}";

return new JsonUtil().fromString(assemblyPartRelationshipPayload, Map.class);
return new JsonUtil().fromString(singleLevelBomAsBuiltPayload, Map.class);
}

private Tombstone createTombstone() {
Expand Down Expand Up @@ -468,7 +469,7 @@ private SubmodelDescriptor createPartSubmodelDescriptor() {
.semanticId(Reference.builder()
.keys(List.of(SemanticId.builder()
.type("Submodel")
.value("urn:bamm:com.catenax.vehicle:0.1.1#PartDetails")
.value("urn:bamm:io.catenax.vehicle:0.1.1#PartDetails")
.build()))
.type("ModelReference")
.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ public List<AspectModel> getAllAspectModels() {
return List.of(
new AspectModel("urn:bamm:io.catenax.serial_part:1.0.1#SerialPart", "1.0.1",
"SerialPart", MODEL_TYPE, MODEL_STATUS),
new AspectModel("urn:bamm:com.catenax.esr_certificates.esr_certificate:1.0.0#EsrCertificate", "1.0.0",
new AspectModel("urn:bamm:io.catenax.esr_certificates.esr_certificate:1.0.0#EsrCertificate", "1.0.0",
"EsrCertificate", MODEL_TYPE, MODEL_STATUS),
new AspectModel("urn:bamm:io.catenax.single_level_bom_as_built:1.0.0#SingleLevelBomAsBuilt",
"1.0.0", "SingleLevelBomAsBuilt", MODEL_TYPE, MODEL_STATUS),
new AspectModel("urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt",
"2.0.0", "SingleLevelBomAsBuilt", MODEL_TYPE, MODEL_STATUS),
new AspectModel("urn:bamm:io.catenax.part_as_specified:2.0.0#PartAsSpecified",
"2.0.0", "PartAsSpecified", MODEL_TYPE, MODEL_STATUS),
new AspectModel("urn:bamm:io.catenax.part_as_planned:1.0.1#PartAsPlanned",
Expand Down
Loading

0 comments on commit 4975d01

Please sign in to comment.