diff --git a/basyx.aasenvironment/Readme.md b/basyx.aasenvironment/Readme.md index 0d0e54a3d..f3f889c03 100644 --- a/basyx.aasenvironment/Readme.md +++ b/basyx.aasenvironment/Readme.md @@ -21,7 +21,7 @@ The Aggregated Swagger UI for the endpoint is available at: http://{host}:{port}/swagger-ui/index.html For a configuration example, see [application.properties](./basyx.aasenvironment.component/src/main/resources/application.properties) -The Health Endpoint an -d CORS Documentation can be found [here](../docs/Readme.md). +The Health Endpoint and CORS Documentation can be found [here](../docs/Readme.md). -Right now, no additional input parameters modifying the output (e.g., cursor, serializationModifier) are supported. +## Preconfiguration of AAS Environments +The AAS Environment Component supports the preconfiguration of AAS Environments (e.g., XML, JSON, AASX) via the _basyx.environment_ parameter. For examples, see [application.properties](./basyx.aasenvironment.component/src/main/resources/application.properties) diff --git a/basyx.aasenvironment/basyx.aasenvironment-core/pom.xml b/basyx.aasenvironment/basyx.aasenvironment-core/pom.xml index 43088a121..5ad0e4346 100644 --- a/basyx.aasenvironment/basyx.aasenvironment-core/pom.xml +++ b/basyx.aasenvironment/basyx.aasenvironment-core/pom.xml @@ -9,7 +9,8 @@ ${revision} - basyx.aasenvironment-core + + basyx.aasenvironment-core @@ -20,7 +21,7 @@ org.eclipse.digitaltwin.basyx basyx.submodelrepository-backend-inmemory test - + org.eclipse.digitaltwin.basyx basyx.submodelservice-core @@ -58,7 +59,7 @@ org.eclipse.digitaltwin.basyx basyx.conceptdescriptionrepository-core - + org.eclipse.digitaltwin.aas4j dataformat-json @@ -78,37 +79,59 @@ org.eclipse.digitaltwin.aas4j model - - - org.slf4j - slf4j-api - - - com.google.guava - guava - 30.1.1-jre - test - - - org.apache.poi - poi-ooxml - 4.1.2 - - - org.springframework - spring-beans - - - org.springframework - spring-core - - - org.springframework - spring-context - - - jakarta.validation - jakarta.validation-api - - - \ No newline at end of file + + + javax.validation + validation-api + + + org.slf4j + slf4j-api + + + com.google.guava + guava + 30.1.1-jre + test + + + org.apache.poi + poi-ooxml + 4.1.2 + + + org.springframework + spring-beans + + + org.springframework + spring-core + + + org.springframework + spring-context + + + jakarta.validation + jakarta.validation-api + + + junit + junit + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + junit:junit + + + + + + >>>>>>> upstream/main \ No newline at end of file diff --git a/basyx.aasrepository/basyx.aasrepository.component/pom.xml b/basyx.aasrepository/basyx.aasrepository.component/pom.xml index 7ae9c320e..d1f9210f2 100644 --- a/basyx.aasrepository/basyx.aasrepository.component/pom.xml +++ b/basyx.aasrepository/basyx.aasrepository.component/pom.xml @@ -64,6 +64,11 @@ org.eclipse.digitaltwin.basyx basyx.aasservice-core + + org.junit.vintage + junit-vintage-engine + test + org.springframework.boot spring-boot-autoconfigure diff --git a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml index 72ff12d15..2c2ac7f25 100644 --- a/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml +++ b/basyx.conceptdescriptionrepository/basyx.conceptdescriptionrepository.component/pom.xml @@ -18,8 +18,7 @@ http://localhost:${docker.host.port}/concept-descriptions - - + org.eclipse.digitaltwin.basyx basyx.conceptdescriptionrepository-core @@ -28,7 +27,43 @@ org.eclipse.digitaltwin.basyx basyx.conceptdescriptionrepository-backend-inmemory - + + org.eclipse.digitaltwin.basyx + basyx.conceptdescriptionrepository-backend-mongodb + + + org.eclipse.digitaltwin.basyx + basyx.conceptdescriptionrepository-http + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + test + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.eclipse.digitaltwin.basyx + basyx.conceptdescriptionrepository-core + tests + test + org.eclipse.digitaltwin.basyx basyx.conceptdescriptionrepository-http @@ -40,23 +75,19 @@ basyx.conceptdescriptionrepository-tck tests test - - + org.slf4j slf4j-api - org.springframework.boot spring-boot - org.springframework.boot spring-boot-autoconfigure - org.springframework spring-beans diff --git a/basyx.submodelrepository/basyx.submodelrepository-backend-mongodb/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/MongoDBSubmodelRepositoryConfiguration.java b/basyx.submodelrepository/basyx.submodelrepository-backend-mongodb/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/MongoDBSubmodelRepositoryConfiguration.java index c3a6c4f64..43c6ef743 100644 --- a/basyx.submodelrepository/basyx.submodelrepository-backend-mongodb/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/MongoDBSubmodelRepositoryConfiguration.java +++ b/basyx.submodelrepository/basyx.submodelrepository-backend-mongodb/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/MongoDBSubmodelRepositoryConfiguration.java @@ -44,7 +44,7 @@ @ConditionalOnExpression("'${basyx.backend}'.equals('MongoDB')") public class MongoDBSubmodelRepositoryConfiguration { @Bean - public SubmodelServiceFactory getSubmodelServiceFactory() { + public SubmodelServiceFactory getInMemorySubmodelServiceFactory() { return new InMemorySubmodelServiceFactory(); } } diff --git a/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryHTTPSerializationExtension.java b/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryHTTPSerializationExtension.java index aa59624b5..683d83c2e 100644 --- a/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryHTTPSerializationExtension.java +++ b/basyx.submodelrepository/basyx.submodelrepository-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelrepository/http/SubmodelRepositoryHTTPSerializationExtension.java @@ -23,15 +23,16 @@ * SPDX-License-Identifier: MIT ******************************************************************************/ - package org.eclipse.digitaltwin.basyx.submodelrepository.http; import org.eclipse.digitaltwin.basyx.deserialization.SubmodelElementValueJsonDeserializer; import org.eclipse.digitaltwin.basyx.deserialization.ValueOnlyJsonDeserializer; +import org.eclipse.digitaltwin.basyx.deserialization.SpecificAssetIDValueJsonDeserializer; import org.eclipse.digitaltwin.basyx.http.SerializationExtension; import org.eclipse.digitaltwin.basyx.mixins.ReferenceElementValueMixIn; import org.eclipse.digitaltwin.basyx.serialization.MultiLanguagePropertyValueSerializer; import org.eclipse.digitaltwin.basyx.serialization.PropertyValueSerializer; +import org.eclipse.digitaltwin.basyx.serialization.SpecificAssetIDValueSerializer; import org.eclipse.digitaltwin.basyx.serialization.SubmodelElementCollectionValueSerializer; import org.eclipse.digitaltwin.basyx.serialization.SubmodelElementListValueSerializer; import org.eclipse.digitaltwin.basyx.serialization.SubmodelValueOnlySerializer; @@ -39,6 +40,7 @@ import org.eclipse.digitaltwin.basyx.submodelservice.value.MultiLanguagePropertyValue; import org.eclipse.digitaltwin.basyx.submodelservice.value.PropertyValue; import org.eclipse.digitaltwin.basyx.submodelservice.value.ReferenceElementValue; +import org.eclipse.digitaltwin.basyx.submodelservice.value.SpecificAssetIDValue; import org.eclipse.digitaltwin.basyx.submodelservice.value.SubmodelElementCollectionValue; import org.eclipse.digitaltwin.basyx.submodelservice.value.SubmodelElementListValue; import org.eclipse.digitaltwin.basyx.submodelservice.value.SubmodelElementValue; @@ -68,6 +70,8 @@ public void extend(Jackson2ObjectMapperBuilder builder) { builder.serializerByType(SubmodelElementListValue.class, new SubmodelElementListValueSerializer()); builder.mixIn(ReferenceElementValue.class, ReferenceElementValueMixIn.class); builder.serializerByType(SubmodelValueOnly.class, new SubmodelValueOnlySerializer()); + builder.deserializerByType(SpecificAssetIDValue.class, new SpecificAssetIDValueJsonDeserializer()); + builder.serializerByType(SpecificAssetIDValue.class, new SpecificAssetIDValueSerializer()); } } diff --git a/basyx.submodelrepository/basyx.submodelrepository-tck/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/tck/SubmodelRepositorySubmodelElementsTestDefinedURL.java b/basyx.submodelrepository/basyx.submodelrepository-tck/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/tck/SubmodelRepositorySubmodelElementsTestDefinedURL.java index 47562940a..9bb5e8629 100644 --- a/basyx.submodelrepository/basyx.submodelrepository-tck/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/tck/SubmodelRepositorySubmodelElementsTestDefinedURL.java +++ b/basyx.submodelrepository/basyx.submodelrepository-tck/src/test/java/org/eclipse/digitaltwin/basyx/submodelrepository/tck/SubmodelRepositorySubmodelElementsTestDefinedURL.java @@ -26,6 +26,10 @@ package org.eclipse.digitaltwin.basyx.submodelrepository.tck; +import java.io.FileNotFoundException; +import java.io.IOException; + +import org.apache.hc.core5.http.ParseException; import org.eclipse.digitaltwin.basyx.submodelrepository.http.BaSyxSubmodelHttpTestUtils; import org.eclipse.digitaltwin.basyx.submodelservice.http.SubmodelServiceSubmodelElementsTestSuiteHTTP; import org.junit.After; @@ -42,16 +46,21 @@ public class SubmodelRepositorySubmodelElementsTestDefinedURL extends SubmodelSe @Before public void createSubmodelOnRepo() { - SubmodelTCKHelper.createSubmodelOnRepository(getURL(), createSubmodel()); + SubmodelTCKHelper.createSubmodelOnRepository(url, createSubmodel()); } @After public void removeSubmodelFromRepo() { - SubmodelTCKHelper.deleteAllSubmodelsOnRepository(getURL()); + SubmodelTCKHelper.deleteAllSubmodelsOnRepository(url); } @Override protected String getURL() { return BaSyxSubmodelHttpTestUtils.getSpecificSubmodelAccessPath(url, createSubmodel().getId()); } + + @Override + public void invokeOperation() throws FileNotFoundException, IOException, ParseException { + // Not supported on OTS Components for now + } } diff --git a/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml b/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml index 84d339367..a3c6fb361 100644 --- a/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml +++ b/basyx.submodelrepository/basyx.submodelrepository.component/pom.xml @@ -34,11 +34,43 @@ org.eclipse.digitaltwin.basyx basyx.submodelrepository-backend-mongodb + + org.eclipse.digitaltwin.basyx + basyx.submodelrepository-feature-mqtt + + + org.eclipse.digitaltwin.basyx + basyx.submodelrepository-http + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-test + test + org.junit.vintage junit-vintage-engine test + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-actuator + + + org.eclipse.digitaltwin.basyx + basyx.submodelservice-core + tests + test + org.eclipse.digitaltwin.basyx basyx.submodelrepository-http @@ -102,13 +134,17 @@ maven-dependency-plugin - org.eclipse.digitaltwin.basyx:basyx.submodelrepository-backend-inmemory + + org.eclipse.digitaltwin.basyx:basyx.submodelrepository-backend-inmemory org.eclipse.digitaltwin.basyx:basyx.http org.junit.vintage:junit-vintage-engine - org.eclipse.digitaltwin.basyx:basyx.submodelrepository-http + + org.eclipse.digitaltwin.basyx:basyx.submodelrepository-http commons-io:commons-io - org.eclipse.digitaltwin.basyx:basyx.submodelrepository-backend-mongodb - org.eclipse.digitaltwin.basyx:basyx.submodelservice-backend-inmemory + + org.eclipse.digitaltwin.basyx:basyx.submodelrepository-backend-mongodb + + org.eclipse.digitaltwin.basyx:basyx.submodelservice-backend-inmemory diff --git a/basyx.submodelservice/basyx.submodelservice-core/pom.xml b/basyx.submodelservice/basyx.submodelservice-core/pom.xml index d94915938..d44a2b58e 100644 --- a/basyx.submodelservice/basyx.submodelservice-core/pom.xml +++ b/basyx.submodelservice/basyx.submodelservice-core/pom.xml @@ -20,7 +20,6 @@ org.eclipse.digitaltwin.aas4j model - com.fasterxml.jackson.core jackson-databind diff --git a/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/deserialization/SpecificAssetIDValueJsonDeserializer.java b/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/deserialization/SpecificAssetIDValueJsonDeserializer.java new file mode 100644 index 000000000..d5472731c --- /dev/null +++ b/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/deserialization/SpecificAssetIDValueJsonDeserializer.java @@ -0,0 +1,85 @@ +/******************************************************************************* + * Copyright (C) 2023 the Eclipse BaSyx Authors + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * SPDX-License-Identifier: MIT + ******************************************************************************/ + +package org.eclipse.digitaltwin.basyx.deserialization; + +import java.io.IOException; +import java.util.Iterator; +import java.util.Map.Entry; + +import org.eclipse.digitaltwin.aas4j.v3.model.Reference; +import org.eclipse.digitaltwin.basyx.submodelservice.value.ReferenceValue; +import org.eclipse.digitaltwin.basyx.submodelservice.value.SpecificAssetIDValue; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * @author jungjan, witt + */ +public class SpecificAssetIDValueJsonDeserializer extends JsonDeserializer { + private final String EXTERNAL_SUBJECT_ID_KEY = "externalSubjectId"; + + @Override + public SpecificAssetIDValue deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + try { + ObjectMapper mapper = (ObjectMapper) p.getCodec(); + JsonNode node = mapper.readTree(p); + + Iterator> jsnonFields = node.fields(); + Entry nameValueMap = jsnonFields.next(); + + String name = nameValueMap.getKey(); + String value = nameValueMap.getValue() + .asText(); + ReferenceValue externalSubjectIdValue = null; + + if (jsonContainsExternalSubjectId(node)) { + externalSubjectIdValue = handleExternalSubjectId(mapper, node); + } + + return new SpecificAssetIDValue(name, value, externalSubjectIdValue); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private boolean jsonContainsExternalSubjectId(JsonNode node) { + return node.get(EXTERNAL_SUBJECT_ID_KEY) != null; + } + + private ReferenceValue handleExternalSubjectId(ObjectMapper mapper, JsonNode node) throws JsonProcessingException, JsonMappingException { + JsonNode externalSubjectIdNode = node.get(EXTERNAL_SUBJECT_ID_KEY); + Reference externalSubjectId = mapper.readValue(externalSubjectIdNode.toString(), new TypeReference() { + }); + return new ReferenceValue(externalSubjectId.getType(), externalSubjectId.getKeys()); + } +} \ No newline at end of file diff --git a/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/serialization/SpecificAssetIDValueSerializer.java b/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/serialization/SpecificAssetIDValueSerializer.java new file mode 100644 index 000000000..a7251c241 --- /dev/null +++ b/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/serialization/SpecificAssetIDValueSerializer.java @@ -0,0 +1,57 @@ +/******************************************************************************* +* Copyright (C) 2023 the Eclipse BaSyx Authors +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +* +* SPDX-License-Identifier: MIT +******************************************************************************/ + +package org.eclipse.digitaltwin.basyx.serialization; + +import java.io.IOException; + +import org.eclipse.digitaltwin.aas4j.v3.model.Reference; +import org.eclipse.digitaltwin.basyx.submodelservice.value.ReferenceValue; +import org.eclipse.digitaltwin.basyx.submodelservice.value.SpecificAssetIDValue; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +/** + * @author witt, jungjan + */ +public class SpecificAssetIDValueSerializer extends JsonSerializer { + + @Override + public void serialize(SpecificAssetIDValue value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + gen.writeStartObject(); + gen.writePOJOField(value.getName(), value.getValue()); + + Reference externalSubjectId = value.getExternalSubjectId(); + + if (externalSubjectId != null) { + ReferenceValue externalSubjectIdValue = new ReferenceValue(externalSubjectId.getType(), externalSubjectId.getKeys()); + gen.writeObjectField("externalSubjectId", externalSubjectIdValue); + } + gen.writeEndObject(); + } + +} diff --git a/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/value/EntityValue.java b/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/value/EntityValue.java index f2d034f80..77e389e12 100644 --- a/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/value/EntityValue.java +++ b/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/value/EntityValue.java @@ -40,7 +40,7 @@ public class EntityValue implements SubmodelElementValue { private List statements; private EntityType entityType; private Optional globalAssetId = Optional.empty(); - private Optional> specificAssetIds = Optional.empty(); + private Optional> specificAssetIds = Optional.empty(); @SuppressWarnings("unused") private EntityValue() { @@ -48,7 +48,7 @@ private EntityValue() { } public EntityValue(List statements, EntityType entityType, String globalAssetId, - List specificAssetIds) { + List< SpecificAssetIDValue> specificAssetIds) { this.statements = statements; this.entityType = entityType; this.globalAssetId = Optional.ofNullable(globalAssetId); diff --git a/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/value/mapper/EntityValueMapper.java b/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/value/mapper/EntityValueMapper.java index cdc5a06f0..227263ade 100644 --- a/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/value/mapper/EntityValueMapper.java +++ b/basyx.submodelservice/basyx.submodelservice-core/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/value/mapper/EntityValueMapper.java @@ -47,8 +47,7 @@ public EntityValueMapper(Entity entity) { @Override public EntityValue getValue() { - return new EntityValue(ValueMapperUtil.createValueOnlyCollection(entity.getStatements()), entity.getEntityType(), - entity.getGlobalAssetID(), getSpecificAssetIdValue(entity.getSpecificAssetIds())); + return new EntityValue(ValueMapperUtil.createValueOnlyCollection(entity.getStatements()), entity.getEntityType(), entity.getGlobalAssetID(), getSpecificAssetIdValue(entity.getSpecificAssetIds())); } @Override diff --git a/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPSerializationExtension.java b/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPSerializationExtension.java index b2b52f03c..a9fafca77 100644 --- a/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPSerializationExtension.java +++ b/basyx.submodelservice/basyx.submodelservice-http/src/main/java/org/eclipse/digitaltwin/basyx/submodelservice/http/SubmodelServiceHTTPSerializationExtension.java @@ -26,11 +26,13 @@ package org.eclipse.digitaltwin.basyx.submodelservice.http; import org.eclipse.digitaltwin.basyx.deserialization.SubmodelElementValueJsonDeserializer; +import org.eclipse.digitaltwin.basyx.deserialization.SpecificAssetIDValueJsonDeserializer; import org.eclipse.digitaltwin.basyx.deserialization.ValueOnlyJsonDeserializer; import org.eclipse.digitaltwin.basyx.http.SerializationExtension; import org.eclipse.digitaltwin.basyx.mixins.ReferenceElementValueMixIn; import org.eclipse.digitaltwin.basyx.serialization.MultiLanguagePropertyValueSerializer; import org.eclipse.digitaltwin.basyx.serialization.PropertyValueSerializer; +import org.eclipse.digitaltwin.basyx.serialization.SpecificAssetIDValueSerializer; import org.eclipse.digitaltwin.basyx.serialization.SubmodelElementCollectionValueSerializer; import org.eclipse.digitaltwin.basyx.serialization.SubmodelElementListValueSerializer; import org.eclipse.digitaltwin.basyx.serialization.SubmodelValueOnlySerializer; @@ -38,6 +40,7 @@ import org.eclipse.digitaltwin.basyx.submodelservice.value.MultiLanguagePropertyValue; import org.eclipse.digitaltwin.basyx.submodelservice.value.PropertyValue; import org.eclipse.digitaltwin.basyx.submodelservice.value.ReferenceElementValue; +import org.eclipse.digitaltwin.basyx.submodelservice.value.SpecificAssetIDValue; import org.eclipse.digitaltwin.basyx.submodelservice.value.SubmodelElementCollectionValue; import org.eclipse.digitaltwin.basyx.submodelservice.value.SubmodelElementListValue; import org.eclipse.digitaltwin.basyx.submodelservice.value.SubmodelElementValue; @@ -67,6 +70,8 @@ public void extend(Jackson2ObjectMapperBuilder builder) { builder.serializerByType(SubmodelElementListValue.class, new SubmodelElementListValueSerializer()); builder.mixIn(ReferenceElementValue.class, ReferenceElementValueMixIn.class); builder.serializerByType(SubmodelValueOnly.class, new SubmodelValueOnlySerializer()); + builder.deserializerByType(SpecificAssetIDValue.class, new SpecificAssetIDValueJsonDeserializer()); + builder.serializerByType(SpecificAssetIDValue.class, new SpecificAssetIDValueSerializer()); } } diff --git a/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedEntityValue.json b/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedEntityValue.json index 94085d5ef..9ec7f2ca8 100644 --- a/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedEntityValue.json +++ b/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedEntityValue.json @@ -14,8 +14,7 @@ "globalAssetId": "globalAssetID", "specificAssetIds": [ { - "name": "specificAssetIdName", - "value": "specificValue" + "specificAssetIdName" : "specificValue" } ] } \ No newline at end of file diff --git a/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedUpdatedMRPEntityValue.json b/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedUpdatedMRPEntityValue.json index 74aa6641c..a83e90e8d 100644 --- a/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedUpdatedMRPEntityValue.json +++ b/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedUpdatedMRPEntityValue.json @@ -14,8 +14,7 @@ "globalAssetId": "globalAssetId", "specificAssetIds": [ { - "name": "specificAssetIdName", - "value": "specificValue" + "specificAssetIdName": "specificValue" } ] } \ No newline at end of file diff --git a/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedValueOnlySerializationOfSubmodel.json b/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedValueOnlySerializationOfSubmodel.json index 986aad48b..c2fff9f68 100644 --- a/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedValueOnlySerializationOfSubmodel.json +++ b/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/expectedValueOnlySerializationOfSubmodel.json @@ -16,8 +16,7 @@ "globalAssetId": "globalAssetID", "specificAssetIds": [ { - "name": "specificAssetIdName", - "value": "specificValue" + "specificAssetIdName": "specificValue" } ] }, diff --git a/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/setEntityValue.json b/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/setEntityValue.json index 1895e2540..21de2c469 100644 --- a/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/setEntityValue.json +++ b/basyx.submodelservice/basyx.submodelservice-http/src/test/resources/value/setEntityValue.json @@ -14,8 +14,7 @@ "globalAssetId": "globalAssetId", "specificAssetIds": [ { - "name": "assetName", - "value": "assetValue", + "assetName" : "assetValue", "externalSubjectId": { "type": "ExternalReference", "keys": [