forked from sovity/edc-ce
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API Wrapper: filter expressions on catalog fetch (sovity#923)
* feat: implemented use case catalog fetch with filterExpressions
- Loading branch information
1 parent
80d298e
commit ec338b4
Showing
23 changed files
with
993 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...pi/src/main/java/de/sovity/edc/ext/wrapper/api/usecase/model/CatalogFilterExpression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2024 sovity GmbH | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* sovity GmbH - initial API and implementation | ||
* | ||
*/ | ||
|
||
package de.sovity.edc.ext.wrapper.api.usecase.model; | ||
|
||
import de.sovity.edc.utils.jsonld.vocab.Prop; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@RequiredArgsConstructor | ||
@Schema(description = "Generic expression for filtering the data offers in the catalog", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | ||
public class CatalogFilterExpression { | ||
@Schema(description = "Asset property name", requiredMode = Schema.RequiredMode.REQUIRED, example = Prop.Edc.ASSET_ID) | ||
private String operandLeft; | ||
|
||
@Schema(description = "Operator", requiredMode = Schema.RequiredMode.REQUIRED) | ||
private CatalogFilterExpressionOperator operator; | ||
|
||
@Schema(description = "Right Operand", requiredMode = Schema.RequiredMode.REQUIRED) | ||
private CatalogFilterExpressionLiteral operandRight; | ||
} |
50 changes: 50 additions & 0 deletions
50
...main/java/de/sovity/edc/ext/wrapper/api/usecase/model/CatalogFilterExpressionLiteral.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2024 sovity GmbH | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* sovity GmbH - initial API and implementation | ||
* | ||
*/ | ||
|
||
package de.sovity.edc.ext.wrapper.api.usecase.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.NonNull; | ||
import lombok.ToString; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@ToString | ||
@Schema(description = "FilterExpression Criterion Literal") | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class CatalogFilterExpressionLiteral { | ||
|
||
private CatalogFilterExpressionLiteralType type; | ||
|
||
@Schema(description = "Only for type VALUE. The single value representation.") | ||
private String value; | ||
|
||
@Schema(description = "Only for type VALUE_LIST. List of values, e.g. for the IN-Operator.") | ||
private List<String> valueList; | ||
|
||
public static CatalogFilterExpressionLiteral ofValue(@NonNull String value) { | ||
return new CatalogFilterExpressionLiteral(CatalogFilterExpressionLiteralType.VALUE, value, null); | ||
} | ||
|
||
public static CatalogFilterExpressionLiteral ofValueList(@NonNull List<String> valueList) { | ||
return new CatalogFilterExpressionLiteral(CatalogFilterExpressionLiteralType.VALUE_LIST, null, valueList); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
.../java/de/sovity/edc/ext/wrapper/api/usecase/model/CatalogFilterExpressionLiteralType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2024 sovity GmbH | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* sovity GmbH - initial API and implementation | ||
* | ||
*/ | ||
|
||
package de.sovity.edc.ext.wrapper.api.usecase.model; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "Value type of a filter expression criterion", enumAsRef = true) | ||
public enum CatalogFilterExpressionLiteralType { | ||
VALUE, VALUE_LIST | ||
} |
26 changes: 26 additions & 0 deletions
26
...ain/java/de/sovity/edc/ext/wrapper/api/usecase/model/CatalogFilterExpressionOperator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) 2024 sovity GmbH | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* sovity GmbH - initial API and implementation | ||
* | ||
*/ | ||
|
||
package de.sovity.edc.ext.wrapper.api.usecase.model; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
@Schema(description = "Operator for filter expressions", enumAsRef = true) | ||
public enum CatalogFilterExpressionOperator { | ||
LIKE, EQ, IN | ||
} |
40 changes: 40 additions & 0 deletions
40
...r/wrapper-api/src/main/java/de/sovity/edc/ext/wrapper/api/usecase/model/CatalogQuery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2024 sovity GmbH | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* sovity GmbH - initial API and implementation | ||
* | ||
*/ | ||
|
||
package de.sovity.edc.ext.wrapper.api.usecase.model; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@RequiredArgsConstructor | ||
@Schema(description = "Catalog query parameters") | ||
public class CatalogQuery { | ||
@Schema(description = "Target EDC DSP endpoint URL", requiredMode = Schema.RequiredMode.REQUIRED) | ||
private String connectorEndpoint; | ||
|
||
@Schema(description = "Limit the number of results", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | ||
private Integer limit; | ||
|
||
@Schema(description = "Offset for returned results, e.g. start at result 2", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | ||
private Integer offset; | ||
|
||
@Schema(description = "Filter expressions for catalog filtering", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | ||
private List<CatalogFilterExpression> filterExpressions; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.