diff --git a/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/RelationshipDelegate.java b/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/RelationshipDelegate.java index 7f774d410f..2e24d90714 100644 --- a/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/RelationshipDelegate.java +++ b/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/RelationshipDelegate.java @@ -41,6 +41,7 @@ import org.eclipse.tractusx.irs.data.JsonParseException; import org.eclipse.tractusx.irs.edc.client.EdcSubmodelFacade; import org.eclipse.tractusx.irs.edc.client.exceptions.EdcClientException; +import org.eclipse.tractusx.irs.edc.client.exceptions.UsagePolicyExpiredException; import org.eclipse.tractusx.irs.edc.client.exceptions.UsagePolicyPermissionException; import org.eclipse.tractusx.irs.edc.client.relationships.RelationshipAspect; import org.eclipse.tractusx.irs.registryclient.discovery.ConnectorEndpointsService; @@ -115,7 +116,13 @@ private void processEndpoint(final Endpoint endpoint, final RelationshipAspect r itemContainerBuilder.relationships(relationships); itemContainerBuilder.bpns(getBpnsFrom(relationships)); } catch (final UsagePolicyPermissionException e) { - log.info("Encountered usage policy exception: {}. Creating Tombstone.", e.getMessage()); + log.info("Encountered usage policy permission exception: {}. Creating Tombstone.", e.getMessage()); + itemContainerBuilder.tombstone( + Tombstone.from(itemId.getGlobalAssetId(), endpoint.getProtocolInformation().getHref(), e, 0, + ProcessStep.USAGE_POLICY_VALIDATION, e.getBusinessPartnerNumber(), + jsonUtil.asMap(e.getPolicy()))); + } catch (final UsagePolicyExpiredException e) { + log.info("Encountered usage policy expired exception: {}. Creating Tombstone.", e.getMessage()); itemContainerBuilder.tombstone( Tombstone.from(itemId.getGlobalAssetId(), endpoint.getProtocolInformation().getHref(), e, 0, ProcessStep.USAGE_POLICY_VALIDATION, e.getBusinessPartnerNumber(), diff --git a/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegate.java b/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegate.java index f9f0f2d3a9..0ecd3740b4 100644 --- a/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegate.java +++ b/irs-api/src/main/java/org/eclipse/tractusx/irs/aaswrapper/job/delegate/SubmodelDelegate.java @@ -41,6 +41,7 @@ import org.eclipse.tractusx.irs.data.JsonParseException; import org.eclipse.tractusx.irs.edc.client.EdcSubmodelFacade; import org.eclipse.tractusx.irs.edc.client.exceptions.EdcClientException; +import org.eclipse.tractusx.irs.edc.client.exceptions.UsagePolicyExpiredException; import org.eclipse.tractusx.irs.edc.client.exceptions.UsagePolicyPermissionException; import org.eclipse.tractusx.irs.registryclient.discovery.ConnectorEndpointsService; import org.eclipse.tractusx.irs.semanticshub.SemanticsHubFacade; @@ -143,7 +144,12 @@ private List getSubmodels(final SubmodelDescriptor submodelDescriptor, ProcessStep.SCHEMA_REQUEST)); log.info("Cannot load JSON schema for validation. Creating Tombstone."); } catch (final UsagePolicyPermissionException e) { - log.info("Encountered usage policy exception: {}. Creating Tombstone.", e.getMessage()); + log.info("Encountered usage policy permission exception: {}. Creating Tombstone.", e.getMessage()); + itemContainerBuilder.tombstone(Tombstone.from(itemId, endpoint.getProtocolInformation().getHref(), e, 0, + ProcessStep.USAGE_POLICY_VALIDATION, e.getBusinessPartnerNumber(), + jsonUtil.asMap(e.getPolicy()))); + } catch (final UsagePolicyExpiredException e) { + log.info("Encountered usage policy expired exception: {}. Creating Tombstone.", e.getMessage()); itemContainerBuilder.tombstone(Tombstone.from(itemId, endpoint.getProtocolInformation().getHref(), e, 0, ProcessStep.USAGE_POLICY_VALIDATION, e.getBusinessPartnerNumber(), jsonUtil.asMap(e.getPolicy())));