Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consumer-Asset with the same ID as a Provider-Asset Cannot Be Deleted After Contract Negotiation #4583

Open
efiege opened this issue Oct 25, 2024 · 0 comments
Labels
triage all new issues awaiting classification

Comments

@efiege
Copy link

efiege commented Oct 25, 2024

Bug Report

Describe the Bug

After a Contract for an Asset of a Provider has successfully been negotiated, an Asset reciding at the Consumer with the same ID and not being part of a Contract, can not be deleted anymore.

Expected Behavior

Asset can be deleted, because it has not been part of a contract.

Observed Behavior

Asset can't be deleted.

Steps to Reproduce

  1. Create and negotiate a Contract for Asset-A reciding at the Provider
  2. Create Asset-B with the same ID as Asset-A at the Consumer
  3. Try to delete Asset-B using the Management-API

Context Information

  • Used version: v0.7.2

Possible Implementation

Query just for Assets with ContractNegotations of type PROVIDER in the AssetServiceImpl.

var query = QuerySpec.Builder.newInstance()
.filter(List.of(new Criterion(ASSET_ID_QUERY, "=", assetId)))
.build();
try (var negotiationsOnAsset = contractNegotiationStore.queryNegotiations(query)) {
if (negotiationsOnAsset.findAny().isPresent()) {
return ServiceResult.conflict(format("Asset %s cannot be deleted as it is referenced by at least one contract agreement", assetId));
}
}

@github-actions github-actions bot added the triage all new issues awaiting classification label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage all new issues awaiting classification
Projects
None yet
Development

No branches or pull requests

1 participant