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

type-safe UiAsset #512

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
82dc775
chore: Refactoring of Asset Dto
SaadEGI Sep 5, 2023
fe98859
chore: Asset Deserializer
SaadEGI Sep 8, 2023
87e7692
chore: Asset Deserializer + Asset Mapper Test + Test Cases
SaadEGI Sep 12, 2023
6e96d18
fix: Refactor AssetMapperTest + minor fixes
SaadEGI Sep 13, 2023
2ef5b4a
fix: Pipeline (Unused Imports)
SaadEGI Sep 13, 2023
3de17dc
Merge branch 'main' of https://github.com/sovity/edc-extensions into …
SaadEGI Sep 13, 2023
ef56352
fix: remove dead code
SaadEGI Sep 13, 2023
1292bb7
chore: refactor CreateAsset Endpoint
SaadEGI Sep 13, 2023
50c6d12
fix: newLines
SaadEGI Sep 13, 2023
f616982
chore: ContractAgreementPageCardBuilder UiAsset Refactoring
SaadEGI Sep 13, 2023
bd1667e
chore: Asset e2e Test
SaadEGI Sep 14, 2023
d8fa49d
chore: AssetMapper
SaadEGI Sep 14, 2023
b819c8a
ci: try fix test parallelity issues (4)
richardtreier Sep 14, 2023
3187376
Merge branch 'main' of https://github.com/sovity/edc-extensions into …
SaadEGI Sep 15, 2023
c6ec76a
chore: AssetMapper
SaadEGI Sep 15, 2023
212e363
fix: UiWrapperTest
SaadEGI Sep 15, 2023
6e8238a
fix: PR Revision
SaadEGI Sep 15, 2023
a7dedd3
fix: PR Revision
SaadEGI Sep 15, 2023
77af54a
fix: PR Revision (Asset Mapper + Asset Mapper Test)
SaadEGI Sep 18, 2023
43189c0
fix: PR Revision (Asset Mapper + Asset Mapper Test)
SaadEGI Sep 18, 2023
1eb6d57
Merge branch '459-backend-ui-api-wrapper-refactor-assetdto-to-be-a-ty…
richardtreier Sep 18, 2023
83190bc
test: fix AssetApiServiceTest#testAssetCreation
richardtreier Sep 18, 2023
b518efc
fix: PR Revision (Asset Mapper + Asset Mapper Test)
SaadEGI Sep 18, 2023
90ef84f
Merge branch '459-backend-ui-api-wrapper-refactor-assetdto-to-be-a-ty…
SaadEGI Sep 18, 2023
b93c368
fix: PR Revision (Asset Mapper + Asset Mapper Test+ UiApiWrapperTest)
SaadEGI Sep 18, 2023
7b17731
fix: layout
SaadEGI Sep 18, 2023
5036d44
fix: Naming
SaadEGI Sep 18, 2023
e01b930
fix: Naming
SaadEGI Sep 18, 2023
daa0097
fix: Naming
SaadEGI Sep 18, 2023
8c7f156
fix: Naming + Creator And Publisher Mapping
SaadEGI Sep 19, 2023
10759a0
fix: Failing tests
SaadEGI Sep 19, 2023
03b0a54
fix: Undo changes
SaadEGI Sep 19, 2023
65baad2
fix: (Temporary) Pipeline
SaadEGI Sep 19, 2023
82db764
fix: (Temporary) Pipeline
SaadEGI Sep 19, 2023
dfb94e3
fix: Style
SaadEGI Sep 19, 2023
8efed62
fix: contract definition operator mapping
richardtreier Sep 19, 2023
f37b8cc
Merge branch '459-backend-ui-api-wrapper-refactor-assetdto-to-be-a-ty…
richardtreier Sep 19, 2023
fb7c92e
fix: contract definition literal mapping
richardtreier Sep 19, 2023
5e51ebc
fix: asset json-ld handling
richardtreier Sep 19, 2023
a72cd04
docs: fix wording
richardtreier Sep 19, 2023
c92359f
chore: improve code quality
richardtreier Sep 19, 2023
541e865
chore: update CHANGELOG.md
richardtreier Sep 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void assetPage(AssetService assetStore) {
var assets = result.getAssets();
assertThat(assets).hasSize(1);
var asset = assets.get(0);
assertThat(asset.getProperties()).isEqualTo(properties);
assertThat(asset.getAdditionalProperties()).isEqualTo(properties);
assertThat(asset.getPrivateProperties()).isEqualTo(privateProperties);
}

Expand All @@ -83,7 +83,7 @@ void assetPageSorting(AssetService assetService) {

// assert
assertThat(result.getAssets())
.extracting(asset -> asset.getProperties().get(Asset.PROPERTY_ID))
.extracting(asset -> asset.getAdditionalProperties().get(Asset.PROPERTY_ID))
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved
.containsExactly("asset-3", "asset-2", "asset-1");
}

Expand Down
1 change: 1 addition & 0 deletions extensions/wrapper/wrapper-common-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies {
annotationProcessor("org.projectlombok:lombok:${lombokVersion}")
compileOnly("org.projectlombok:lombok:${lombokVersion}")


api("jakarta.ws.rs:jakarta.ws.rs-api:3.1.0")
api("jakarta.validation:jakarta.validation-api:3.0.2")
api("io.swagger.core.v3:swagger-annotations-jakarta:2.2.15")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* Copyright (c) 2022 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.common.model;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import java.util.List;
import java.util.Map;

@Getter
@Setter
@ToString
@AllArgsConstructor
@Builder(toBuilder = true)
@RequiredArgsConstructor
@Schema(description = "Asset Details")
public class UiAsset {

@Schema(description = "Asset Name", requiredMode = Schema.RequiredMode.REQUIRED)
private String name;
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved

@Schema(description = "Asset Title", requiredMode = Schema.RequiredMode.REQUIRED)
private String title;
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved

@Schema(description = "Asset Language", requiredMode = Schema.RequiredMode.REQUIRED)
private String language;

@Schema(description = "Asset Description", requiredMode = Schema.RequiredMode.REQUIRED)
private String description;

@Schema(description = "Asset Creator", requiredMode = Schema.RequiredMode.REQUIRED)
private String creator;
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved

@Schema(description = "Asset Publisher", requiredMode = Schema.RequiredMode.REQUIRED)
private String publisher;
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved

SaadEGI marked this conversation as resolved.
Show resolved Hide resolved
@Schema(description = "License URL", requiredMode = Schema.RequiredMode.REQUIRED)
private String license;
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved

@Schema(description = "Version", requiredMode = Schema.RequiredMode.REQUIRED)
private String version;

@Schema(description = "Asset Keywords", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> keywords;

@Schema(description = "Distribution", requiredMode = Schema.RequiredMode.REQUIRED)
private String distribution;

@Schema(description = "Landing Page URL", requiredMode = Schema.RequiredMode.REQUIRED)
private String landingPage;

SaadEGI marked this conversation as resolved.
Show resolved Hide resolved
@Schema(description = "HTTP Datasource Hints Proxy Method", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean httpDatasourceHintsProxyMethod;

@Schema(description = "HTTP Datasource Hints Proxy Path", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean httpDatasourceHintsProxyPath;

@Schema(description = "HTTP Datasource Hints Proxy Query Params", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean httpDatasourceHintsProxyQueryParams;

@Schema(description = "HTTP Datasource Hints Proxy Body", requiredMode = Schema.RequiredMode.REQUIRED)
private Boolean httpDatasourceHintsProxyBody;

@Schema(description = "Data Category", requiredMode = Schema.RequiredMode.REQUIRED)
private String dataCategory;

@Schema(description = "Data Subcategory", requiredMode = Schema.RequiredMode.REQUIRED)
private String dataSubcategory;

@Schema(description = "Data Model", requiredMode = Schema.RequiredMode.REQUIRED)
private String dataModel;

@Schema(description = "Geo-Reference Method", requiredMode = Schema.RequiredMode.REQUIRED)
private String geoReferenceMethod;

@Schema(description = "Transport Mode", requiredMode = Schema.RequiredMode.REQUIRED)
private String transportMode;

@Schema(description = "Asset JsonLd", requiredMode = Schema.RequiredMode.REQUIRED)
private String assetJsonLd;
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved

@Schema(description = "Asset additional Properties", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> additionalProperties;

@Schema(description = "Asset Private Properties", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> privateProperties;
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved

@Schema(description = "Asset Json Properties", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> additionalJsonProperties;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2022 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.common.model;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Map;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "Type-Safe OpenAPI generator friendly Asset Create DTO that supports an opinionated\"\n" +
" + \" subset of the original EDC Asset Entity.")
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved
public class UiAssetCreateRequest {
@Schema(description = "Data Address", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> dataAddressProperties;

@Schema(description = "Properties of the Data Address", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> properties;

@Schema(description = "Private Asset Properties", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, String> privateProperties;
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved
}
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package de.sovity.edc.ext.wrapper.api.common.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;


@Getter
@Setter
@ToString
@AllArgsConstructor
@Builder(toBuilder = true)
@RequiredArgsConstructor
@Schema(description = "Asset Creator Details")
public class UiAssetCreator {

@JsonProperty("@type")
@Schema(description = "Type", requiredMode = Schema.RequiredMode.REQUIRED)
private String type;

@JsonProperty("http://xmlns.com/foaf/0.1/name")
@Schema(description = "Name", requiredMode = Schema.RequiredMode.REQUIRED)
private String name;
}
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package de.sovity.edc.ext.wrapper.api.common.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;


@Getter
@Setter
@ToString
@AllArgsConstructor
@Builder(toBuilder = true)
@RequiredArgsConstructor
@Schema(description = "Asset Distribution Details")
public class UiAssetDistribution {

@JsonProperty("@type")
@Schema(description = "Type", requiredMode = Schema.RequiredMode.REQUIRED)
private String type;

@JsonProperty("http://www.w3.org/ns/dcat#mediaType")
@Schema(description = "Media Type", requiredMode = Schema.RequiredMode.REQUIRED)
private String name;
}
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package de.sovity.edc.ext.wrapper.api.common.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import de.sovity.edc.ext.wrapper.api.common.model.utils.CustomDeserializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import java.util.List;


@Getter
@Setter
@ToString
@AllArgsConstructor
@Builder(toBuilder = true)
@RequiredArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class UiAssetHelperDto {

@JsonProperty("https://w3id.org/edc/v0.0.1/ns/")
private String ns;

@JsonProperty("http://purl.org/dc/terms/identifier")
private String identifier;

@JsonProperty("http://purl.org/dc/terms/title")
@JsonDeserialize(using = CustomDeserializer.class)
private String title;

@JsonProperty("http://purl.org/dc/terms/language")
private String language;

@JsonProperty("http://purl.org/dc/terms/description")
private String description;

@JsonProperty("http://purl.org/dc/terms/creator")
private UiAssetCreator creator;

@JsonProperty("http://purl.org/dc/terms/publisher")
private UiAssetPublisher publisher;

@JsonProperty("http://purl.org/dc/terms/license")
private String license;

@JsonProperty("http://www.w3.org/ns/dcat#version")
private String version;

@JsonProperty("http://www.w3.org/ns/dcat#keyword")
@JsonDeserialize(using = CustomDeserializer.class)
private List<String> keywords;

@JsonProperty("http://www.w3.org/ns/dcat#distribution")
private UiAssetDistribution distribution;

@JsonProperty("http://www.w3.org/ns/dcat#landingPage")
private String landingPage;

@JsonProperty("https://semantic.sovity.io/dcat-ext#httpDatasourceHintsProxyMethod")
@JsonDeserialize(using = CustomDeserializer.class)
private Boolean httpDatasourceHintsProxyMethod;

@JsonProperty("https://semantic.sovity.io/dcat-ext#httpDatasourceHintsProxyPath")
@JsonDeserialize(using = CustomDeserializer.class)
private Boolean httpDatasourceHintsProxyPath;

@JsonProperty("https://semantic.sovity.io/dcat-ext#httpDatasourceHintsProxyQueryParams")
@JsonDeserialize(using = CustomDeserializer.class)
private Boolean httpDatasourceHintsProxyQueryParams;

@JsonProperty("https://semantic.sovity.io/dcat-ext#httpDatasourceHintsProxyBody")
@JsonDeserialize(using = CustomDeserializer.class)
private Boolean httpDatasourceHintsProxyBody;

@JsonProperty("http://w3id.org/mds#dataCategory")
private String dataCategory;

@JsonProperty("http://w3id.org/mds#dataSubcategory")
private String dataSubcategory;

@JsonProperty("http://w3id.org/mds#dataModel")
private String dataModel;

@JsonProperty("http://w3id.org/mds#geoReferenceMethod")
private String geoReferenceMethod;

@JsonProperty("http://w3id.org/mds#transportMode")
private String transportMode;
}

SaadEGI marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package de.sovity.edc.ext.wrapper.api.common.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;


@Getter
@Setter
@ToString
@AllArgsConstructor
@Builder(toBuilder = true)
@RequiredArgsConstructor
@Schema(description = "Asset Publisher Details")
public class UiAssetPublisher {

@JsonProperty("@type")
@Schema(description = "Type", requiredMode = Schema.RequiredMode.REQUIRED)
private String type;

@JsonProperty("http://xmlns.com/foaf/0.1/homepage")
@Schema(description = "Homepage URL", requiredMode = Schema.RequiredMode.REQUIRED)
private String name;
}
SaadEGI marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading