Skip to content

Commit

Permalink
feat(impl):[#439] update api examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-ext-kmassalski committed Mar 7, 2024
1 parent 5524be2 commit 453349b
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 37 deletions.
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
45 changes: 24 additions & 21 deletions docs/src/api/irs-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -994,8 +994,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 @@ -1045,8 +1045,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 @@ -1171,8 +1171,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 @@ -1253,7 +1253,7 @@ components:
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 @@ -1325,8 +1325,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 @@ -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 @@ -1443,7 +1443,7 @@ components:
- type: Submodel
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 @@ -1481,8 +1481,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 @@ -1503,16 +1503,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 @@ -2369,7 +2369,8 @@ components:
type: array
description: List of aspect names that will be collected if \<collectAspects\>
flag is set to true.
example: urn:samm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
example:
- urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
items:
type: string
pattern: ^(urn:(b|s)amm:.*\d\.\d\.\d)?(#)?(\w+)?$
Expand Down Expand Up @@ -2535,7 +2536,8 @@ components:
incidentBPNSs:
type: array
description: Array of BPNS numbers.
example: BPNS000000000DDD
example:
- BPNS000000000DDD
items:
type: string
pattern: "(BPN)[LSA][\\w\\d]{10}[\\w\\d]{2}"
Expand All @@ -2553,7 +2555,8 @@ components:
type: array
description: List of aspect names that will be collected if \<collectAspects\>
flag is set to true.
example: urn:samm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
example:
- urn:bamm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt
items:
type: string
pattern: ^(urn:(b|s)amm:.*\d\.\d\.\d)?(#)?(\w+)?$
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
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ public class RegisterBatchOrder {
@Schema(description = "BoM Lifecycle of the result tree.", implementation = BomLifecycle.class)
private BomLifecycle bomLifecycle;

@ArraySchema(schema = @Schema(description = "List of aspect names that will be collected if \\<collectAspects\\> flag is set to true.", example = "urn:samm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt",
@ArraySchema(arraySchema = @Schema(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\"]",
implementation = String.class, pattern = ASPECT_MODEL_REGEX), maxItems = Integer.MAX_VALUE)
private List<@Pattern(regexp = ASPECT_MODEL_REGEX) String> aspects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class RegisterBpnInvestigationJob {
private PartChainIdentificationKey key;

@NotEmpty
@ArraySchema(schema = @Schema(description = "Array of BPNS numbers.", example = "BPNS000000000DDD",
@ArraySchema(arraySchema = @Schema(description = "Array of BPNS numbers.", example = "[\"BPNS000000000DDD\"]",
implementation = String.class, pattern = BPN_REGEX), maxItems = Integer.MAX_VALUE)
private List<@Pattern(regexp = BPN_REGEX) String> incidentBPNSs;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public class RegisterJob {
@Schema(description = "BoM Lifecycle of the result tree.", implementation = BomLifecycle.class)
private BomLifecycle bomLifecycle;

@ArraySchema(schema = @Schema(description = "List of aspect names that will be collected if \\<collectAspects\\> flag is set to true.", example = "urn:samm:io.catenax.single_level_bom_as_built:2.0.0#SingleLevelBomAsBuilt",
@ArraySchema(arraySchema = @Schema(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\"]",
implementation = String.class, pattern = ASPECT_MODEL_REGEX), maxItems = Integer.MAX_VALUE)
private List<@Pattern(regexp = ASPECT_MODEL_REGEX) String> aspects;

Expand Down

0 comments on commit 453349b

Please sign in to comment.