From 11d326b3ab6c429fa1e14dbe64bf6c55b3de365e Mon Sep 17 00:00:00 2001 From: Michael Jacoby Date: Thu, 16 Jan 2025 16:31:17 +0100 Subject: [PATCH] [Bugfix] HTTP PATCH on /$value not working (#1013) * Fix HTTP PATCH for valueOnly not working * renames SetSubmodelElementValueByPath... to PatchSubmodelElementValueByPath... * include PatchSubmodelElementValueByPathRequest in service profiles so it is available via HTTP * update changelog --- .../AssetConnectionManager.java | 4 ++-- ...modelElementValueByPathRequestHandler.java} | 16 ++++++++-------- .../handler/RequestHandlerManagerTest.java | 10 +++++----- docs/source/other/release-notes.md | 1 + ...bmodelElementValueByPathRequestMapper.java} | 17 +++++++++-------- .../request/RequestMappingManagerTest.java | 14 +++++++------- .../service/endpoint/opcua/OpcUaEndpoint.java | 4 ++-- .../model/ServiceSpecificationProfile.java | 5 +++++ ...atchSubmodelElementValueByPathRequest.java} | 18 +++++++++--------- ...tchSubmodelElementValueByPathResponse.java} | 10 +++++----- 10 files changed, 53 insertions(+), 46 deletions(-) rename core/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/request/handler/submodel/{SetSubmodelElementValueByPathRequestHandler.java => PatchSubmodelElementValueByPathRequestHandler.java} (83%) rename endpoint/http/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/http/request/mapper/submodel/{SetSubmodelElementValueByPathRequestMapper.java => PatchSubmodelElementValueByPathRequestMapper.java} (86%) rename model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/request/{SetSubmodelElementValueByPathRequest.java => PatchSubmodelElementValueByPathRequest.java} (79%) rename model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/response/{SetSubmodelElementValueByPathResponse.java => PatchSubmodelElementValueByPathResponse.java} (71%) diff --git a/core/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/assetconnection/AssetConnectionManager.java b/core/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/assetconnection/AssetConnectionManager.java index 8ae9357c6..cf2f2e113 100644 --- a/core/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/assetconnection/AssetConnectionManager.java +++ b/core/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/assetconnection/AssetConnectionManager.java @@ -23,7 +23,7 @@ import de.fraunhofer.iosb.ilt.faaast.service.exception.ConfigurationException; import de.fraunhofer.iosb.ilt.faaast.service.exception.InvalidConfigurationException; import de.fraunhofer.iosb.ilt.faaast.service.model.api.Response; -import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.SetSubmodelElementValueByPathRequest; +import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.PatchSubmodelElementValueByPathRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.value.DataElementValue; import de.fraunhofer.iosb.ilt.faaast.service.model.value.ElementValue; import de.fraunhofer.iosb.ilt.faaast.service.util.ElementValueHelper; @@ -221,7 +221,7 @@ private void setupSubscription(Reference reference, AssetSubscriptionProvider pr } try { provider.addNewDataListener((DataElementValue data) -> { - Response response = service.execute(SetSubmodelElementValueByPathRequest.builder() + Response response = service.execute(PatchSubmodelElementValueByPathRequest.builder() .submodelId(ReferenceHelper.findFirstKeyType(reference, KeyTypes.SUBMODEL)) .path(ReferenceHelper.toPath(reference)) .disableSyncWithAsset() diff --git a/core/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/request/handler/submodel/SetSubmodelElementValueByPathRequestHandler.java b/core/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/request/handler/submodel/PatchSubmodelElementValueByPathRequestHandler.java similarity index 83% rename from core/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/request/handler/submodel/SetSubmodelElementValueByPathRequestHandler.java rename to core/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/request/handler/submodel/PatchSubmodelElementValueByPathRequestHandler.java index 583ce4ae3..9311b097d 100644 --- a/core/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/request/handler/submodel/SetSubmodelElementValueByPathRequestHandler.java +++ b/core/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/request/handler/submodel/PatchSubmodelElementValueByPathRequestHandler.java @@ -17,8 +17,8 @@ import de.fraunhofer.iosb.ilt.faaast.service.model.api.StatusCode; import de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Extent; import de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier; -import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.SetSubmodelElementValueByPathRequest; -import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.SetSubmodelElementValueByPathResponse; +import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.PatchSubmodelElementValueByPathRequest; +import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PatchSubmodelElementValueByPathResponse; import de.fraunhofer.iosb.ilt.faaast.service.model.messagebus.event.change.ValueChangeEventMessage; import de.fraunhofer.iosb.ilt.faaast.service.model.value.ElementValue; import de.fraunhofer.iosb.ilt.faaast.service.model.value.mapper.ElementValueMapper; @@ -31,20 +31,20 @@ /** * Class to handle a - * {@link de.fraunhofer.iosb.ilt.faaast.service.model.api.request.SetSubmodelElementValueByPathRequest} in the service + * {@link de.fraunhofer.iosb.ilt.faaast.service.model.api.request.PatchSubmodelElementValueByPathRequest} in the service * and to send the corresponding response - * {@link de.fraunhofer.iosb.ilt.faaast.service.model.api.response.SetSubmodelElementValueByPathResponse}. Is + * {@link de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PatchSubmodelElementValueByPathResponse}. Is * responsible for communication with the persistence and sends the corresponding events to the message bus. */ -public class SetSubmodelElementValueByPathRequestHandler - extends AbstractSubmodelInterfaceRequestHandler, SetSubmodelElementValueByPathResponse> { +public class PatchSubmodelElementValueByPathRequestHandler + extends AbstractSubmodelInterfaceRequestHandler, PatchSubmodelElementValueByPathResponse> { @Override - public SetSubmodelElementValueByPathResponse doProcess(SetSubmodelElementValueByPathRequest request, RequestExecutionContext context) throws Exception { + public PatchSubmodelElementValueByPathResponse doProcess(PatchSubmodelElementValueByPathRequest request, RequestExecutionContext context) throws Exception { if (request == null || request.getValueParser() == null) { throw new IllegalArgumentException("value parser of request must be non-null"); } - SetSubmodelElementValueByPathResponse response = new SetSubmodelElementValueByPathResponse(); + PatchSubmodelElementValueByPathResponse response = new PatchSubmodelElementValueByPathResponse(); Reference reference = new ReferenceBuilder() .submodel(request.getSubmodelId()) .idShortPath(request.getPath()) diff --git a/core/src/test/java/de/fraunhofer/iosb/ilt/faaast/service/request/handler/RequestHandlerManagerTest.java b/core/src/test/java/de/fraunhofer/iosb/ilt/faaast/service/request/handler/RequestHandlerManagerTest.java index d9d8fe355..a3ecaebc4 100644 --- a/core/src/test/java/de/fraunhofer/iosb/ilt/faaast/service/request/handler/RequestHandlerManagerTest.java +++ b/core/src/test/java/de/fraunhofer/iosb/ilt/faaast/service/request/handler/RequestHandlerManagerTest.java @@ -47,7 +47,7 @@ import de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.QueryModifier; import de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.OperationHandle; import de.fraunhofer.iosb.ilt.faaast.service.model.api.paging.Page; -import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.SetSubmodelElementValueByPathRequest; +import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.PatchSubmodelElementValueByPathRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.aas.DeleteSubmodelReferenceRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.aas.DeleteThumbnailRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.aas.GetAllSubmodelReferencesRequest; @@ -94,7 +94,7 @@ import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.submodelrepository.GetSubmodelByIdRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.submodelrepository.PostSubmodelRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.submodelrepository.PutSubmodelByIdRequest; -import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.SetSubmodelElementValueByPathResponse; +import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PatchSubmodelElementValueByPathResponse; import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.aas.DeleteSubmodelReferenceResponse; import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.aas.DeleteThumbnailResponse; import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.aas.GetAllSubmodelReferencesResponse; @@ -1054,14 +1054,14 @@ public void testPutSubmodelElementByPathRequest() throws ResourceNotFoundExcepti @Test - public void testSetSubmodelElementValueByPathRequest() throws ResourceNotFoundException, AssetConnectionException, Exception { + public void testPatchSubmodelElementValueByPathRequest() throws ResourceNotFoundException, AssetConnectionException, Exception { when(persistence.getSubmodelElement((SubmodelElementIdentifier) any(), any())) .thenReturn(environment.getSubmodels().get(0).getSubmodelElements().get(0)); when(assetConnectionManager.hasValueProvider(any())).thenReturn(true); PropertyValue propertyValue = new PropertyValue.Builder() .value(new StringValue("Test")) .build(); - SetSubmodelElementValueByPathRequest request = new SetSubmodelElementValueByPathRequest.Builder() + PatchSubmodelElementValueByPathRequest request = new PatchSubmodelElementValueByPathRequest.Builder() .submodelId(environment.getSubmodels().get(0).getId()) .value(propertyValue) .valueParser(new ElementValueParser() { @@ -1074,7 +1074,7 @@ public U parse(ElementValue raw, Class type) { .build(); Response actual = manager.execute(request, context); - SetSubmodelElementValueByPathResponse expected = new SetSubmodelElementValueByPathResponse.Builder() + PatchSubmodelElementValueByPathResponse expected = new PatchSubmodelElementValueByPathResponse.Builder() .statusCode(StatusCode.SUCCESS_NO_CONTENT) .build(); Assert.assertTrue(ResponseHelper.equalsIgnoringTime(expected, actual)); diff --git a/docs/source/other/release-notes.md b/docs/source/other/release-notes.md index ab178782f..1a6058513 100644 --- a/docs/source/other/release-notes.md +++ b/docs/source/other/release-notes.md @@ -7,6 +7,7 @@ - HTTP - URL query parameters are now correctly URL-decoded - Enabled `level` query parameter for calls to /submodels/{submodelIdentifier}/$reference as this is not explicitely forbidden in the specification although the parameter does not have any actual effect + - fixed bug that disabled any HTTP PATCH request to /$value ## 1.2.0 diff --git a/endpoint/http/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/http/request/mapper/submodel/SetSubmodelElementValueByPathRequestMapper.java b/endpoint/http/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/http/request/mapper/submodel/PatchSubmodelElementValueByPathRequestMapper.java similarity index 86% rename from endpoint/http/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/http/request/mapper/submodel/SetSubmodelElementValueByPathRequestMapper.java rename to endpoint/http/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/http/request/mapper/submodel/PatchSubmodelElementValueByPathRequestMapper.java index 8365477a2..d59d72aac 100644 --- a/endpoint/http/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/http/request/mapper/submodel/SetSubmodelElementValueByPathRequestMapper.java +++ b/endpoint/http/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/http/request/mapper/submodel/PatchSubmodelElementValueByPathRequestMapper.java @@ -20,8 +20,8 @@ import de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.model.HttpRequest; import de.fraunhofer.iosb.ilt.faaast.service.endpoint.http.request.mapper.AbstractSubmodelInterfaceRequestMapper; import de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier; -import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.SetSubmodelElementValueByPathRequest; -import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.SetSubmodelElementValueByPathResponse; +import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.PatchSubmodelElementValueByPathRequest; +import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PatchSubmodelElementValueByPathResponse; import de.fraunhofer.iosb.ilt.faaast.service.model.exception.InvalidRequestException; import de.fraunhofer.iosb.ilt.faaast.service.model.exception.PersistenceException; import de.fraunhofer.iosb.ilt.faaast.service.model.exception.ResourceNotFoundException; @@ -37,25 +37,26 @@ /** - * class to map HTTP-PUT-Request path: submodels/{submodelIdentifier}/submodel-elements/{idShortPath}, + * class to map HTTP-PATCH-Request path: submodels/{submodelIdentifier}/submodel-elements/{idShortPath}, * shells/{aasIdentifier}/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}. */ -public class SetSubmodelElementValueByPathRequestMapper - extends AbstractSubmodelInterfaceRequestMapper, SetSubmodelElementValueByPathResponse> { +public class PatchSubmodelElementValueByPathRequestMapper + extends AbstractSubmodelInterfaceRequestMapper, PatchSubmodelElementValueByPathResponse> { private static final String SUBMODEL_ELEMENT_PATH = RegExHelper.uniqueGroupName(); private static final String PATTERN = String.format("submodel-elements/%s/\\$value", pathElement(SUBMODEL_ELEMENT_PATH)); - public SetSubmodelElementValueByPathRequestMapper(ServiceContext serviceContext) { + public PatchSubmodelElementValueByPathRequestMapper(ServiceContext serviceContext) { super(serviceContext, HttpMethod.PATCH, PATTERN); } @Override - public SetSubmodelElementValueByPathRequest doParse(HttpRequest httpRequest, Map urlParameters, OutputModifier outputModifier) throws InvalidRequestException { + public PatchSubmodelElementValueByPathRequest doParse(HttpRequest httpRequest, Map urlParameters, OutputModifier outputModifier) + throws InvalidRequestException { final String path = EncodingHelper.urlDecode(urlParameters.get(SUBMODEL_ELEMENT_PATH)); final String identifier = getParameterBase64UrlEncoded(urlParameters, SUBMODEL_ID); - return SetSubmodelElementValueByPathRequest.builder() + return PatchSubmodelElementValueByPathRequest.builder() .path(path) .value(httpRequest.getBodyAsString()) .valueParser(new ElementValueParser() { diff --git a/endpoint/http/src/test/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/http/request/RequestMappingManagerTest.java b/endpoint/http/src/test/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/http/request/RequestMappingManagerTest.java index 90fd114fe..a12852843 100644 --- a/endpoint/http/src/test/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/http/request/RequestMappingManagerTest.java +++ b/endpoint/http/src/test/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/http/request/RequestMappingManagerTest.java @@ -35,7 +35,7 @@ import de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.Level; import de.fraunhofer.iosb.ilt.faaast.service.model.api.modifier.OutputModifier; import de.fraunhofer.iosb.ilt.faaast.service.model.api.operation.OperationHandle; -import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.SetSubmodelElementValueByPathRequest; +import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.PatchSubmodelElementValueByPathRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.aas.DeleteSubmodelReferenceRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.aas.DeleteThumbnailRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.aas.GetAllSubmodelReferencesRequest; @@ -1109,8 +1109,8 @@ public void testPutThumbnail() throws SerializationException, InvalidRequestExce @Test - public void testSetSubmodelElementValueByPathContentNormal() throws Exception { - SetSubmodelElementValueByPathRequest expected = SetSubmodelElementValueByPathRequest. builder() + public void testPatchSubmodelElementValueByPathContentNormal() throws Exception { + PatchSubmodelElementValueByPathRequest expected = PatchSubmodelElementValueByPathRequest. builder() .submodelId(SUBMODEL.getId()) .path(ReferenceHelper.toPath(SUBMODEL_ELEMENT_REF)) .build(); @@ -1122,7 +1122,7 @@ public void testSetSubmodelElementValueByPathContentNormal() throws Exception { + "/$value") .body(serializer.write(SUBMODEL_ELEMENT).getBytes()) .build()); - SetSubmodelElementValueByPathRequest actual = (SetSubmodelElementValueByPathRequest) temp; + PatchSubmodelElementValueByPathRequest actual = (PatchSubmodelElementValueByPathRequest) temp; Assert.assertEquals(expected.getSubmodelId(), actual.getSubmodelId()); Assert.assertEquals(expected.getPath(), actual.getPath()); Assert.assertEquals(ElementValueMapper.toValue(SUBMODEL_ELEMENT), actual.getValueParser().parse(actual.getRawValue(), ElementValue.class)); @@ -1130,8 +1130,8 @@ public void testSetSubmodelElementValueByPathContentNormal() throws Exception { @Test - public void testSetSubmodelElementValueByPathContentValue() throws Exception { - SetSubmodelElementValueByPathRequest expected = SetSubmodelElementValueByPathRequest. builder() + public void testPatchSubmodelElementValueByPathContentValue() throws Exception { + PatchSubmodelElementValueByPathRequest expected = PatchSubmodelElementValueByPathRequest. builder() .submodelId(SUBMODEL.getId()) .path(ReferenceHelper.toPath(SUBMODEL_ELEMENT_REF)) .build(); @@ -1143,7 +1143,7 @@ public void testSetSubmodelElementValueByPathContentValue() throws Exception { + "/$value") .body(serializer.write(ElementValueMapper.toValue(SUBMODEL_ELEMENT)).getBytes()) .build()); - SetSubmodelElementValueByPathRequest actual = (SetSubmodelElementValueByPathRequest) temp; + PatchSubmodelElementValueByPathRequest actual = (PatchSubmodelElementValueByPathRequest) temp; Assert.assertEquals(expected.getSubmodelId(), actual.getSubmodelId()); Assert.assertEquals(expected.getPath(), actual.getPath()); Assert.assertEquals(ElementValueMapper.toValue(SUBMODEL_ELEMENT), actual.getValueParser().parse(actual.getRawValue(), ElementValue.class)); diff --git a/endpoint/opcua/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/opcua/OpcUaEndpoint.java b/endpoint/opcua/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/opcua/OpcUaEndpoint.java index 67c007eb8..7ae199ff0 100644 --- a/endpoint/opcua/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/opcua/OpcUaEndpoint.java +++ b/endpoint/opcua/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/endpoint/opcua/OpcUaEndpoint.java @@ -21,7 +21,7 @@ import de.fraunhofer.iosb.ilt.faaast.service.messagebus.MessageBus; import de.fraunhofer.iosb.ilt.faaast.service.model.api.Response; import de.fraunhofer.iosb.ilt.faaast.service.model.api.StatusCode; -import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.SetSubmodelElementValueByPathRequest; +import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.PatchSubmodelElementValueByPathRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.submodel.GetSubmodelElementByPathRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.submodel.InvokeOperationSyncRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.submodel.GetSubmodelElementByPathResponse; @@ -135,7 +135,7 @@ public boolean writeValue(SubmodelElement element, Submodel submodel, Reference if (LOGGER.isDebugEnabled()) { LOGGER.debug("writeValue: Reference {}; Path {}", ReferenceHelper.toString(refElement), path); } - SetSubmodelElementValueByPathRequest request = new SetSubmodelElementValueByPathRequest(); + PatchSubmodelElementValueByPathRequest request = new PatchSubmodelElementValueByPathRequest(); request.setSubmodelId(submodel.getId()); request.setPath(path); diff --git a/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/ServiceSpecificationProfile.java b/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/ServiceSpecificationProfile.java index aa604d77f..b73c63543 100644 --- a/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/ServiceSpecificationProfile.java +++ b/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/ServiceSpecificationProfile.java @@ -15,6 +15,7 @@ package de.fraunhofer.iosb.ilt.faaast.service.model; import de.fraunhofer.iosb.ilt.faaast.service.model.api.Request; +import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.PatchSubmodelElementValueByPathRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.aas.DeleteSubmodelReferenceRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.aas.DeleteThumbnailRequest; import de.fraunhofer.iosb.ilt.faaast.service.model.api.request.aas.GetAllSubmodelReferencesRequest; @@ -130,6 +131,7 @@ public enum ServiceSpecificationProfile { InvokeOperationRequest.class, InvokeOperationSyncRequest.class, PatchSubmodelElementByPathRequest.class, + PatchSubmodelElementValueByPathRequest.class, PatchSubmodelRequest.class, PostSubmodelElementByPathRequest.class, PostSubmodelElementRequest.class, @@ -184,6 +186,7 @@ public enum ServiceSpecificationProfile { InvokeOperationRequest.class, InvokeOperationSyncRequest.class, PatchSubmodelElementByPathRequest.class, + PatchSubmodelElementValueByPathRequest.class, PatchSubmodelRequest.class, PostSubmodelElementByPathRequest.class, PostSubmodelElementRequest.class, @@ -312,6 +315,7 @@ public enum ServiceSpecificationProfile { InvokeOperationRequest.class, InvokeOperationSyncRequest.class, PatchSubmodelElementByPathRequest.class, + PatchSubmodelElementValueByPathRequest.class, PatchSubmodelRequest.class, PostSubmodelElementByPathRequest.class, PostSubmodelElementRequest.class, @@ -395,6 +399,7 @@ public enum ServiceSpecificationProfile { InvokeOperationRequest.class, InvokeOperationSyncRequest.class, PatchSubmodelElementByPathRequest.class, + PatchSubmodelElementValueByPathRequest.class, PatchSubmodelRequest.class, PostSubmodelElementByPathRequest.class, PostSubmodelElementRequest.class, diff --git a/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/request/SetSubmodelElementValueByPathRequest.java b/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/request/PatchSubmodelElementValueByPathRequest.java similarity index 79% rename from model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/request/SetSubmodelElementValueByPathRequest.java rename to model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/request/PatchSubmodelElementValueByPathRequest.java index 20c386a71..467ce9cef 100644 --- a/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/request/SetSubmodelElementValueByPathRequest.java +++ b/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/request/PatchSubmodelElementValueByPathRequest.java @@ -14,22 +14,22 @@ */ package de.fraunhofer.iosb.ilt.faaast.service.model.api.request; -import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.SetSubmodelElementValueByPathResponse; +import de.fraunhofer.iosb.ilt.faaast.service.model.api.response.PatchSubmodelElementValueByPathResponse; import de.fraunhofer.iosb.ilt.faaast.service.model.value.ElementValueParser; import java.util.Objects; /** - * Request class for SetSubmodelElementValueByPath requests. + * Request class for PatchSubmodelElementValueByPath requests. */ -public class SetSubmodelElementValueByPathRequest extends AbstractSubmodelInterfaceRequest { +public class PatchSubmodelElementValueByPathRequest extends AbstractSubmodelInterfaceRequest { private String path; private T rawValue; private ElementValueParser valueParser; private boolean syncWithAsset; - public SetSubmodelElementValueByPathRequest() { + public PatchSubmodelElementValueByPathRequest() { this.syncWithAsset = true; this.path = ""; this.valueParser = ElementValueParser.DEFAULT; @@ -84,7 +84,7 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - SetSubmodelElementValueByPathRequest that = (SetSubmodelElementValueByPathRequest) o; + PatchSubmodelElementValueByPathRequest that = (PatchSubmodelElementValueByPathRequest) o; return super.equals(that) && Objects.equals(path, that.path) && Objects.equals(rawValue, that.rawValue); @@ -101,7 +101,7 @@ public static Builder builder() { return new Builder<>(); } - public abstract static class AbstractBuilder, B extends AbstractBuilder> + public abstract static class AbstractBuilder, B extends AbstractBuilder> extends AbstractSubmodelInterfaceRequest.AbstractBuilder { public B path(String value) { @@ -128,7 +128,7 @@ public B disableSyncWithAsset() { } } - public static class Builder extends AbstractBuilder, Builder> { + public static class Builder extends AbstractBuilder, Builder> { @Override protected Builder getSelf() { @@ -137,8 +137,8 @@ protected Builder getSelf() { @Override - protected SetSubmodelElementValueByPathRequest newBuildingInstance() { - return new SetSubmodelElementValueByPathRequest<>(); + protected PatchSubmodelElementValueByPathRequest newBuildingInstance() { + return new PatchSubmodelElementValueByPathRequest<>(); } } } diff --git a/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/response/SetSubmodelElementValueByPathResponse.java b/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/response/PatchSubmodelElementValueByPathResponse.java similarity index 71% rename from model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/response/SetSubmodelElementValueByPathResponse.java rename to model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/response/PatchSubmodelElementValueByPathResponse.java index c27630e4b..1a182151c 100644 --- a/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/response/SetSubmodelElementValueByPathResponse.java +++ b/model/src/main/java/de/fraunhofer/iosb/ilt/faaast/service/model/api/response/PatchSubmodelElementValueByPathResponse.java @@ -15,15 +15,15 @@ package de.fraunhofer.iosb.ilt.faaast.service.model.api.response; /** - * Response class for SetSubmodelElementValueByPath requests. + * Response class for PatchSubmodelElementValueByPath requests. */ -public class SetSubmodelElementValueByPathResponse extends AbstractResponse { +public class PatchSubmodelElementValueByPathResponse extends AbstractResponse { public static Builder builder() { return new Builder(); } - public static class Builder extends AbstractBuilder { + public static class Builder extends AbstractBuilder { @Override protected Builder getSelf() { @@ -32,8 +32,8 @@ protected Builder getSelf() { @Override - protected SetSubmodelElementValueByPathResponse newBuildingInstance() { - return new SetSubmodelElementValueByPathResponse(); + protected PatchSubmodelElementValueByPathResponse newBuildingInstance() { + return new PatchSubmodelElementValueByPathResponse(); } } }