diff --git a/CHANGELOG.md b/CHANGELOG.md index 64d2e0a3d..7075293a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog All notable changes to this project will be documented in this file. +## [6.1.2] - 2021-08-19 + +### Fixed +- Add null checking to object mappers. + ## [6.1.1] - 2021-08-19 ### Added diff --git a/charts/dataspace-connector/Chart.yaml b/charts/dataspace-connector/Chart.yaml index af0c459da..ceaaafa96 100644 --- a/charts/dataspace-connector/Chart.yaml +++ b/charts/dataspace-connector/Chart.yaml @@ -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.8 +version: 0.1.9 # 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.1" +appVersion: "6.1.2" dependencies: - name: postgresql diff --git a/openapi.yaml b/openapi.yaml index 47e53d111..0e35590c3 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -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.1 + version: 6.1.2 servers: - url: https://localhost:8080 description: Generated server url @@ -5633,6 +5633,10 @@ components: modificationDate: type: string format: date-time + title: + type: string + description: + type: string target: type: string format: uri @@ -5786,12 +5790,6 @@ components: endpointDocumentation: type: string format: uri - paymentMethod: - type: string - enum: - - fixedPrice - - free - - negotiationBasis samples: type: array items: @@ -5801,6 +5799,13 @@ components: type: string format: uri readOnly: true + paymentMethod: + type: string + enum: + - undefined + - fixedPrice + - free + - negotiationBasis RequestedResourceView: type: object properties: @@ -5841,6 +5846,7 @@ components: paymentModality: type: string enum: + - undefined - fixedPrice - free - negotiationBasis @@ -5923,17 +5929,18 @@ components: endpointDocumentation: type: string format: uri + samples: + type: array + items: + type: string + format: uri paymentMethod: type: string enum: + - undefined - fixedPrice - free - negotiationBasis - samples: - type: array - items: - type: string - format: uri OfferedResourceView: type: object properties: @@ -5971,6 +5978,7 @@ components: paymentModality: type: string enum: + - undefined - fixedPrice - free - negotiationBasis @@ -6565,32 +6573,10 @@ components: - $ref: '#/components/schemas/AbstractConstraint' - type: object properties: - ids:leftOperand: - type: string - enum: - - https://w3id.org/idsa/code/ABSOLUTE_SPATIAL_POSITION - - https://w3id.org/idsa/code/COUNT - - https://w3id.org/idsa/code/DELAY - - https://w3id.org/idsa/code/ELAPSED_TIME - - https://w3id.org/idsa/code/ENDPOINT - - https://w3id.org/idsa/code/EVENT - - https://w3id.org/idsa/code/PATH - - https://w3id.org/idsa/code/PAYMENT - - https://w3id.org/idsa/code/PAY_AMOUNT - - https://w3id.org/idsa/code/POLICY_EVALUATION_TIME - - https://w3id.org/idsa/code/PURPOSE - - https://w3id.org/idsa/code/QUANTITY - - https://w3id.org/idsa/code/RECURRENCE_RATE - - https://w3id.org/idsa/code/SECURITY_LEVEL - - https://w3id.org/idsa/code/STATE - - https://w3id.org/idsa/code/SYSTEM - - https://w3id.org/idsa/code/USER - ids:unit: + ids:rightOperandReference: type: string format: uri - ids:rightOperand: - $ref: '#/components/schemas/RdfResource' - ids:pipEndpoint: + ids:unit: type: string format: uri ids:operator: @@ -6642,7 +6628,29 @@ components: - https://w3id.org/idsa/code/STRING_IS_CONTAINED - https://w3id.org/idsa/code/TEMPORAL_DISJOINT - https://w3id.org/idsa/code/TEMPORAL_EQUALS - ids:rightOperandReference: + ids:leftOperand: + type: string + enum: + - https://w3id.org/idsa/code/ABSOLUTE_SPATIAL_POSITION + - https://w3id.org/idsa/code/COUNT + - https://w3id.org/idsa/code/DELAY + - https://w3id.org/idsa/code/ELAPSED_TIME + - https://w3id.org/idsa/code/ENDPOINT + - https://w3id.org/idsa/code/EVENT + - https://w3id.org/idsa/code/PATH + - https://w3id.org/idsa/code/PAYMENT + - https://w3id.org/idsa/code/PAY_AMOUNT + - https://w3id.org/idsa/code/POLICY_EVALUATION_TIME + - https://w3id.org/idsa/code/PURPOSE + - https://w3id.org/idsa/code/QUANTITY + - https://w3id.org/idsa/code/RECURRENCE_RATE + - https://w3id.org/idsa/code/SECURITY_LEVEL + - https://w3id.org/idsa/code/STATE + - https://w3id.org/idsa/code/SYSTEM + - https://w3id.org/idsa/code/USER + ids:rightOperand: + $ref: '#/components/schemas/RdfResource' + ids:pipEndpoint: type: string format: uri '@type': @@ -6748,12 +6756,20 @@ components: type: array items: $ref: '#/components/schemas/TypedLiteral' - ids:assignee: + ids:target: + type: string + format: uri + ids:constraint: + type: array + items: + oneOf: + - $ref: '#/components/schemas/LogicalConstraint' + ids:assigner: type: array items: type: string format: uri - ids:assigner: + ids:assignee: type: array items: type: string @@ -6779,18 +6795,10 @@ components: - https://w3id.org/idsa/code/TRACK_PROVENANCE - https://w3id.org/idsa/code/USE - https://w3id.org/idsa/code/WRITE - ids:constraint: - type: array - items: - oneOf: - - $ref: '#/components/schemas/LogicalConstraint' ids:assetRefinement: oneOf: - $ref: '#/components/schemas/Constraint' - $ref: '#/components/schemas/LogicalConstraint' - ids:target: - type: string - format: uri ids:description: type: array items: diff --git a/pom.xml b/pom.xml index eaed73866..fc62ee330 100644 --- a/pom.xml +++ b/pom.xml @@ -85,7 +85,7 @@ - 6.1.1 + 6.1.2 info@dataspace-connector.de diff --git a/src/main/java/io/dataspaceconnector/common/ids/mapping/FromIdsObjectMapper.java b/src/main/java/io/dataspaceconnector/common/ids/mapping/FromIdsObjectMapper.java index 1b7b325f1..4b2cf6e92 100644 --- a/src/main/java/io/dataspaceconnector/common/ids/mapping/FromIdsObjectMapper.java +++ b/src/main/java/io/dataspaceconnector/common/ids/mapping/FromIdsObjectMapper.java @@ -596,6 +596,10 @@ public static ConfigurationDesc fromIdsConfig(final ConfigurationModel configMod * @return The internal log level. */ private static LogLevel fromIdsLogLevel(final de.fraunhofer.iais.eis.LogLevel logLevel) { + if (logLevel == null) { + return LogLevel.OFF; + } + switch (logLevel) { // TODO infomodel has less log levels than DSC, info will get lost case MINIMAL_LOGGING: @@ -615,6 +619,10 @@ private static LogLevel fromIdsLogLevel(final de.fraunhofer.iais.eis.LogLevel lo */ private static SecurityProfile fromIdsSecurityProfile( final de.fraunhofer.iais.eis.SecurityProfile securityProfile) { + if (securityProfile == null) { + return SecurityProfile.BASE_SECURITY; + } + switch (securityProfile) { case TRUST_SECURITY_PROFILE: return SecurityProfile.TRUST_SECURITY; @@ -627,11 +635,16 @@ private static SecurityProfile fromIdsSecurityProfile( /** * Get dsc connector status from ids connector status. + * * @param status The ids connector status. * @return The internal connector status. */ public static ConnectorStatus fromIdsConnectorStatus( final de.fraunhofer.iais.eis.ConnectorStatus status) { + if (status == null) { + return ConnectorStatus.FAULTY; + } + switch (status) { case CONNECTOR_ONLINE: return ConnectorStatus.ONLINE; diff --git a/src/main/java/io/dataspaceconnector/common/ids/mapping/ToIdsObjectMapper.java b/src/main/java/io/dataspaceconnector/common/ids/mapping/ToIdsObjectMapper.java index d00ed24e5..1d77747eb 100644 --- a/src/main/java/io/dataspaceconnector/common/ids/mapping/ToIdsObjectMapper.java +++ b/src/main/java/io/dataspaceconnector/common/ids/mapping/ToIdsObjectMapper.java @@ -173,6 +173,7 @@ public static LogLevel getLogLevel( /** * Get the ids connector status from dsc connector status. + * * @param status The internal connector status. * @return The ids connector status. */ @@ -226,7 +227,9 @@ public static Connector getConnectorFromConfiguration(final Configuration config ._description_(Util.asList(new TypedLiteral(config.getDescription()))) ._curator_(config.getCurator()) ._maintainer_(config.getMaintainer()) - ._securityProfile_(getSecurityProfile(config.getSecurityProfile())) + ._securityProfile_(config.getSecurityProfile() == null + ? SecurityProfile.BASE_SECURITY_PROFILE + : getSecurityProfile(config.getSecurityProfile())) ._hasDefaultEndpoint_(new ConnectorEndpointBuilder() ._accessURL_(config.getDefaultEndpoint()) .build()) @@ -261,10 +264,6 @@ private static SecurityProfile getSecurityProfile( * @return The ids payment modality. */ public static PaymentModality getPaymentModality(final PaymentMethod paymentMethod) { - if (paymentMethod == null) { - return null; - } - switch (paymentMethod) { case FREE: return PaymentModality.FREE; diff --git a/src/main/java/io/dataspaceconnector/service/resource/ids/builder/IdsConfigModelBuilder.java b/src/main/java/io/dataspaceconnector/service/resource/ids/builder/IdsConfigModelBuilder.java index c843ce09a..37ee6b6bc 100644 --- a/src/main/java/io/dataspaceconnector/service/resource/ids/builder/IdsConfigModelBuilder.java +++ b/src/main/java/io/dataspaceconnector/service/resource/ids/builder/IdsConfigModelBuilder.java @@ -41,9 +41,11 @@ protected ConfigurationModel createInternal(final Configuration config, throws ConstraintViolationException { // Prepare configuration attributes. final var deployMode = ToIdsObjectMapper.getConnectorDeployMode(config.getDeployMode()); - final var logLevel = ToIdsObjectMapper.getLogLevel(config.getLogLevel()); + final var logLevel = config.getLogLevel() == null + ? null : ToIdsObjectMapper.getLogLevel(config.getLogLevel()); final var connector = ToIdsObjectMapper.getConnectorFromConfiguration(config); - final var status = ToIdsObjectMapper.getConnectorStatus(config.getStatus()); + final var status = config.getStatus() == null + ? null : ToIdsObjectMapper.getConnectorStatus(config.getStatus()); final var configBuilder = new ConfigurationModelBuilder() ._connectorDeployMode_(deployMode) @@ -58,7 +60,8 @@ protected ConfigurationModel createInternal(final Configuration config, ._connectorDescription_(connector); if (config.getProxy() != null) { - configBuilder._connectorProxy_(List.of(ToIdsObjectMapper.getProxy(config.getProxy()))); + configBuilder._connectorProxy_(config.getProxy() == null + ? null : List.of(ToIdsObjectMapper.getProxy(config.getProxy()))); } return configBuilder.build(); diff --git a/src/main/java/io/dataspaceconnector/service/resource/ids/builder/IdsResourceBuilder.java b/src/main/java/io/dataspaceconnector/service/resource/ids/builder/IdsResourceBuilder.java index c92f9232f..8a590448a 100644 --- a/src/main/java/io/dataspaceconnector/service/resource/ids/builder/IdsResourceBuilder.java +++ b/src/main/java/io/dataspaceconnector/service/resource/ids/builder/IdsResourceBuilder.java @@ -79,8 +79,8 @@ protected de.fraunhofer.iais.eis.Resource createInternal(final Resource resource final var keywords = ToIdsObjectMapper.getKeywordsAsTypedLiteral(resource.getKeywords(), language); final var license = resource.getLicense(); - final var paymentModality - = ToIdsObjectMapper.getPaymentModality(resource.getPaymentModality()); + final var paymentModality = resource.getPaymentModality() == null + ? null : ToIdsObjectMapper.getPaymentModality(resource.getPaymentModality()); final var publisher = resource.getPublisher(); final var sovereign = resource.getSovereign(); final var title = resource.getTitle();