Skip to content

Commit

Permalink
Reapply "Merge pull request #611 from catenax-ng/feat/510-dont-filter…
Browse files Browse the repository at this point in the history
…-submodel-descriptors-from-shell"

This reverts commit e78fb6c.
  • Loading branch information
ds-jhartmann committed May 17, 2024
1 parent 7cd3c53 commit 5ffd59c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 30 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ _**For better traceability add the corresponding GitHub issue number in each cha

- Updated default accepted policy to latest traceability framework agreement #596
- BPN summary was removed from Job response #568
- Shells in Job response will contain all submodel descriptors returned by provider, instead filtered by aspect-type parameter. #510


## [5.1.1] - 2024-05-08
Expand All @@ -58,7 +59,6 @@ _**For better traceability add the corresponding GitHub issue number in each cha
### Added

- Cucumber test step definitions for Policy Store API (Happy Path) including some test helper utilities. #518


## [5.1.0] - 2024-05-06

Expand All @@ -75,7 +75,6 @@ _**For better traceability add the corresponding GitHub issue number in each cha
- Update bouncycastle to 1.78 to fix CVE's.
- Fixed validation of json-schemas - IRS is creating tombstone instead collecting Submodel payload, when it not passes validation of schema #522


## [5.0.0] - 2024-04-16

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ public ItemContainer process(final ItemContainer.ItemContainerBuilder itemContai
// DigitalTwinRegistryKey here
.findFirst().orElseThrow();

if (!expectedDepthOfTreeIsNotReached(jobData.getDepth(), aasTransferProcess.getDepth())) {
// filter submodel descriptors if next delegate will not be executed
shell.payload().withFilteredSubmodelDescriptors(jobData.getAspects());
}

itemContainerBuilder.shell(
jobData.isAuditContractNegotiation() ? shell : shell.withoutContractAgreementId());
} catch (final RegistryServiceException | RuntimeException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
/**
* Builds submodels array for AAShell from previous steps.
* All submodels are being retrieved from EDC's components.
* Additionally submodel descriptors from shell are being filtered to requested aspect types.
*/
@Slf4j
public class SubmodelDelegate extends AbstractDelegate {
Expand Down Expand Up @@ -86,21 +85,19 @@ public ItemContainer process(final ItemContainer.ItemContainerBuilder itemContai
final List<SubmodelDescriptor> aasSubmodelDescriptors = shell.payload().getSubmodelDescriptors();
log.info("Retrieved {} SubmodelDescriptor for itemId {}", aasSubmodelDescriptors.size(), itemId);

final List<SubmodelDescriptor> filteredSubmodelDescriptorsByAspectType = shell.payload()
.filterDescriptorsByAspectTypes(
jobData.getAspects());

if (jobData.isCollectAspects()) {
log.info("Collecting Submodels.");
final List<SubmodelDescriptor> filteredSubmodelDescriptorsByAspectType = shell.payload()
.filterDescriptorsByAspectTypes(
jobData.getAspects());

filteredSubmodelDescriptorsByAspectType.forEach(submodelDescriptor -> itemContainerBuilder.submodels(
getSubmodels(submodelDescriptor, itemContainerBuilder, itemId.getGlobalAssetId(),
itemId.getBpn(), jobData.isAuditContractNegotiation())));
}
log.trace("Unfiltered SubmodelDescriptor: {}", aasSubmodelDescriptors);
log.trace("Filtered SubmodelDescriptor: {}", filteredSubmodelDescriptorsByAspectType);

shell.payload().setSubmodelDescriptors(filteredSubmodelDescriptorsByAspectType);

log.trace("Unfiltered SubmodelDescriptor: {}", aasSubmodelDescriptors);
log.trace("Filtered SubmodelDescriptor: {}", filteredSubmodelDescriptorsByAspectType);
}
});

return next(itemContainerBuilder, jobData, aasTransferProcess, itemId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void shouldFillItemContainerWithShellAndContractAgreementIdWhenAuditFlag() throw
}

@Test
void shouldFillItemContainerWithShellAndFilteredSubmodelDescriptorsWhenDepthReached() throws RegistryServiceException {
void shouldFillItemContainerWithShellAndSubmodelDescriptorsWhenDepthReached() throws RegistryServiceException {
// given
when(digitalTwinRegistryService.fetchShells(any())).thenReturn(
List.of(shell("", shellDescriptor(List.of(submodelDescriptorWithoutHref("any"))))));
Expand All @@ -99,7 +99,7 @@ void shouldFillItemContainerWithShellAndFilteredSubmodelDescriptorsWhenDepthReac
// then
assertThat(result).isNotNull();
assertThat(result.getShells()).isNotEmpty();
assertThat(result.getShells().get(0).payload().getSubmodelDescriptors()).isEmpty();
assertThat(result.getShells().get(0).payload().getSubmodelDescriptors()).isNotEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SubmodelDelegateTest {
jsonValidatorService, new JsonUtil(), connectorEndpointsService);

@Test
void shouldFilterSubmodelDescriptorsByAspectTypeFilter() {
void shouldNotFilterSubmodelDescriptorsByAspectTypeFilter() {
// given
final ItemContainer.ItemContainerBuilder itemContainerShellWithTwoSubmodels = ItemContainer.builder()
.shell(shell("", shellDescriptor(
Expand All @@ -85,7 +85,7 @@ void shouldFilterSubmodelDescriptorsByAspectTypeFilter() {

// then
assertThat(result).isNotNull();
assertThat(result.getShells().get(0).payload().getSubmodelDescriptors()).isEmpty();
assertThat(result.getShells().get(0).payload().getSubmodelDescriptors()).isNotEmpty();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,6 @@ public Optional<String> findManufacturerId() {
.findFirst();
}

/**
* @param aspectTypes the aspect types which should be filtered by
* @return AssetAdministrationShellDescriptor with filtered submodel descriptors
*/
public AssetAdministrationShellDescriptor withFilteredSubmodelDescriptors(final List<String> aspectTypes) {
setSubmodelDescriptors(filterDescriptorsByAspectTypes(aspectTypes));
return this;
}

/**
* @param relationshipAspect filter for aspect type
* @return The filtered list of submodel addresses
Expand Down

0 comments on commit 5ffd59c

Please sign in to comment.