Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
feat: add DSC UI enum paymentmethod as possbile value (#521)
Browse files Browse the repository at this point in the history
* feat: add DSC UI enum paymentmethod as possbile value

* fix: set alias for paymentModality

* chore: add missing log level guards

* chore: fix log levels in SubscriberNotificationService

* fix: remove endpoint definition from bootstrapping files

* release: increase version from v6.1.0 to v6.1.1

Co-authored-by: Julia Pampus <[email protected]>
Co-authored-by: Pampus, Julia <[email protected]>
  • Loading branch information
3 people authored Aug 19, 2021
1 parent 5b80090 commit f657a40
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 36 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog
All notable changes to this project will be documented in this file.

## [6.1.1] - 2021-08-19

### Added
- Add `paymentModality` enums to GUI controller.

### Fixed
- Remove ids endpoint definition from Bootstrapping files.

## [6.1.0] - 2021-08-16

### Added
Expand Down
4 changes: 2 additions & 2 deletions charts/dataspace-connector/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.7
version: 0.1.8

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "6.1.0"
appVersion: "6.1.1"

dependencies:
- name: postgresql
Expand Down
7 changes: 0 additions & 7 deletions docs/pages/deployment/bootstrapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,6 @@ sample files are provided at `test/resources/bootstrap`.
"ids:modified": "2016-10-03T15:10:40.000Z"
}
],
"ids:resourceEndpoint": [
{
"@type": "ids:ConnectorEndpoint",
"@id": "https://w3id.org/idsa/autogen/connectorEndpoint/4458078e-c2f2-4d9f-afbe-54e9daa4c1b8",
"ids:accessURL": "https://example.com"
}
],
"ids:standardLicense": "https://example.com",
"ids:contractOffer": [
{
Expand Down
2 changes: 1 addition & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ info:
license:
name: "Apache License, Version 2.0"
url: https://www.apache.org/licenses/LICENSE-2.0.txt
version: 6.1.0
version: 6.1.1
servers:
- url: https://localhost:8080
description: Generated server url
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

<properties>
<!-- General -->
<revision>6.1.0</revision>
<revision>6.1.1</revision>
<email>[email protected]</email>

<!-- Build info -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import io.dataspaceconnector.model.configuration.DeployMethod;
import io.dataspaceconnector.model.configuration.DeployMode;
import io.dataspaceconnector.model.configuration.LogLevel;
import io.dataspaceconnector.model.resource.PaymentMethod;
import lombok.extern.log4j.Log4j2;
import net.minidev.json.JSONArray;
import net.minidev.json.JSONObject;
Expand Down Expand Up @@ -87,13 +88,38 @@ public static String getSpecificEnum(final String enumName) {
case "securityprofile":
sortedJsonArray = getSecurityProfile();
break;
case "paymentmethod":
sortedJsonArray = getPaymentMethod();
break;
default:
break;
}

return sortedJsonArray != null ? sortedJsonArray.toJSONString() : null;
}

private static JSONArray getPaymentMethod() {
final var jsonArray = new JSONArray();
final var paymentmethods = PaymentMethod.values();

for (final var paymentmethod : paymentmethods) {
try {
var jsonObject = new JSONObject();
jsonObject.put("originalName", paymentmethod.name());
jsonObject.put("displayName", PaymentMethod.class.getField(paymentmethod.name())
.getAnnotation(JsonProperty.class).value());
jsonArray.add(jsonObject);
} catch (NoSuchFieldException e) {
if (log.isDebugEnabled()) {
log.debug("Missing JsonProperty found for paymentmethod!");
}
}
}


return sortJsonArray(jsonArray);
}

private static JSONArray getSecurityProfile() {
final var jsonArray = new JSONArray();
final var securityProfiles = SecurityProfile.values();
Expand Down Expand Up @@ -166,7 +192,9 @@ private static JSONArray getConnectorDeployMode() {
.getAnnotation(JsonProperty.class).value());
jsonArray.add(jsonObject);
} catch (NoSuchFieldException e) {
log.debug("Missing JsonProperty found for connectorDeployMode!");
if (log.isDebugEnabled()) {
log.debug("Missing JsonProperty found for connectorDeployMode!");
}
}
}

Expand Down Expand Up @@ -199,7 +227,9 @@ private static JSONArray getLogLevel() {
.getAnnotation(JsonProperty.class).value());
jsonArray.add(jsonObject);
} catch (NoSuchFieldException e) {
log.debug("Missing JsonProperty found for logLevel!");
if (log.isDebugEnabled()) {
log.debug("Missing JsonProperty found for logLevel!");
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package io.dataspaceconnector.model.resource;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dataspaceconnector.model.named.NamedDescription;
import lombok.Data;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -62,6 +64,8 @@ public class ResourceDesc extends NamedDescription {
/**
* The payment modality.
*/
@JsonProperty("paymentMethod")
@JsonAlias("paymentModality")
private PaymentMethod paymentMethod;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private void notifyIdsSubscribers(final List<Subscription> subscriptions, final
}
}
} catch (Exception e) {
if (log.isWarnEnabled()) {
if (log.isDebugEnabled()) {
log.debug("{} [url=({}), exception=({})]",
ErrorMessage.UPDATE_MESSAGE_FAILED, recipient, e.getMessage());
}
Expand Down Expand Up @@ -285,7 +285,9 @@ private InputStream retrieveDataByArtifact(final Entity entity) {
try {
return artifactSvc.getData(accessVerifier, dataReceiver, id, new QueryInput());
} catch (IOException exception) {
log.debug("Failed to retrieve data. [exception=({})]", exception.getMessage());
if (log.isDebugEnabled()) {
log.debug("Failed to retrieve data. [exception=({})]", exception.getMessage());
}
}
}
return InputStream.nullInputStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@ void getSpecificEnum() throws Exception {
mockMvc.perform(
get("/api/configmanager/enum/securityprofile"))
.andExpect(status().isOk()).andReturn();
mockMvc.perform(
get("/api/configmanager/enum/paymentmethod"))
.andExpect(status().isOk()).andReturn();
}
}
14 changes: 0 additions & 14 deletions src/test/resources/bootstrap/catalog1.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@
"ids:modified": "2017-10-03T15:10:40.000Z"
}
],
"ids:resourceEndpoint": [
{
"@type": "ids:ConnectorEndpoint",
"@id": "https://w3id.org/idsa/autogen/connectorEndpoint/c02d9dd2-9ab6-41d6-80f1-1844d64ba6ff",
"ids:accessURL": "https://example.com"
}
],
"ids:standardLicense": "https://example.com",
"ids:contractOffer": [
{
Expand Down Expand Up @@ -180,13 +173,6 @@
"ids:modified": "2016-10-03T15:10:40.000Z"
}
],
"ids:resourceEndpoint": [
{
"@type": "ids:ConnectorEndpoint",
"@id": "https://w3id.org/idsa/autogen/connectorEndpoint/755d877e-94aa-49e0-90d8-bec2a5186b48",
"ids:accessURL": "https://example.com"
}
],
"ids:standardLicense": "https://example.com",
"ids:contractOffer": [
{
Expand Down
7 changes: 0 additions & 7 deletions src/test/resources/bootstrap/catalog2.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@
"ids:modified": "2016-10-03T15:10:40.000Z"
}
],
"ids:resourceEndpoint": [
{
"@type": "ids:ConnectorEndpoint",
"@id": "https://w3id.org/idsa/autogen/connectorEndpoint/4458078e-c2f2-4d9f-afbe-54e9daa4c1b8",
"ids:accessURL": "https://example.com"
}
],
"ids:standardLicense": "https://example.com",
"ids:contractOffer": [
{
Expand Down

0 comments on commit f657a40

Please sign in to comment.