Skip to content

Commit

Permalink
cp-adapter : code review, rollbacke name change
Browse files Browse the repository at this point in the history
  • Loading branch information
marcingajek-zf committed Jan 11, 2023
1 parent 586751f commit df2988f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ApiAdapterConfig {
private static final String CATALOG_EXPIRE_AFTER_TIME =
"edc.cp.adapter.cache.catalog.expire.after";
private static final String CATALOG_REQUEST_LIMIT = "edc.cp.adapter.catalog.request.limit";
private static final String CACHE_CONTRACT_AGREEMENT = "edc.cp.adapter.cache.contract.agreement";
private static final String REUSE_CONTRACT_AGREEMENT = "edc.cp.adapter.reuse.contract.agreement";

private final ServiceExtensionContext context;

Expand All @@ -46,8 +46,8 @@ public int getInMemoryMessageBusThreadNumber() {
return context.getSetting(IN_MEMORY_MESSAGE_BUS_THREAD_NUMBER, 10);
}

public boolean isContractAgreementCacheOn() {
return context.getSetting(CACHE_CONTRACT_AGREEMENT, 1) != 0;
public boolean isContractAgreementReuseOn() {
return context.getSetting(REUSE_CONTRACT_AGREEMENT, 1) != 0;
}

public int getCatalogExpireAfterTime() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ public Response getAssetSynchronous(
@PathParam("assetId") String assetId,
@QueryParam("providerUrl") String providerUrl,
@QueryParam("contractAgreementId") String contractAgreementId,
@QueryParam("contractAgreementCache") String contractAgreementCache) {
@QueryParam("contractAgreementReuse") String contractAgreementReuse) {

if (invalidParams(assetId, providerUrl)) {
return badRequestResponse();
}

String traceId =
initiateProcess(assetId, providerUrl, contractAgreementId, contractAgreementCache);
initiateProcess(assetId, providerUrl, contractAgreementId, contractAgreementReuse);

try {
ProcessData processData = resultService.pull(traceId);
Expand Down Expand Up @@ -87,13 +87,13 @@ private String initiateProcess(
String assetId,
String providerUrl,
String contractAgreementId,
String contractAgreementCache) {
String contractAgreementReuse) {
ProcessData processData =
ProcessData.builder()
.assetId(assetId)
.provider(providerUrl)
.contractAgreementId(contractAgreementId)
.contractAgreementCacheOn(isContractAgreementCacheOn(contractAgreementCache))
.contractAgreementReuseOn(isContractAgreementReuseOn(contractAgreementReuse))
.catalogExpiryTime(config.getCatalogExpireAfterTime())
.build();

Expand All @@ -103,8 +103,8 @@ private String initiateProcess(
return message.getTraceId();
}

private boolean isContractAgreementCacheOn(String contractAgreementCache) {
return !"0".equals(contractAgreementCache) && config.isContractAgreementCacheOn();
private boolean isContractAgreementReuseOn(String contractAgreementReuse) {
return !"0".equals(contractAgreementReuse) && config.isContractAgreementReuseOn();
}

private Response notFoundResponse() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ProcessData {
private final String provider;
private String contractOfferId;
private int catalogExpiryTime;
private boolean contractAgreementCacheOn;
private boolean contractAgreementReuseOn;

// contract data
@Setter private String contractNegotiationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private ProcessData getProcessData() {
.assetId("assetId")
.provider("provider")
.catalogExpiryTime(30)
.contractAgreementCacheOn(true)
.contractAgreementReuseOn(true)
.build();
}

Expand Down

0 comments on commit df2988f

Please sign in to comment.