Remove nested variant from ISubModelAPI
Change-Id: Ia92838e22a1a7f602856aec862bfb50890c28c38
Signed-off-by: Müller-Zhang <zai.mueller-zhang@iese.fraunhofer.de>
diff --git a/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/mongodb/MongoDBSubmodelAPI.java b/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/mongodb/MongoDBSubmodelAPI.java
index 2211d42..0e7bcdf 100644
--- a/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/mongodb/MongoDBSubmodelAPI.java
+++ b/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/mongodb/MongoDBSubmodelAPI.java
@@ -3,6 +3,7 @@
import static org.springframework.data.mongodb.core.query.Criteria.where;
import static org.springframework.data.mongodb.core.query.Query.query;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -24,6 +25,7 @@
import org.eclipse.basyx.submodel.restapi.api.ISubmodelAPI;
import org.eclipse.basyx.vab.exception.provider.MalformedRequestException;
import org.eclipse.basyx.vab.exception.provider.ResourceNotFoundException;
+import org.eclipse.basyx.vab.modelprovider.VABPathTools;
import org.eclipse.basyx.vab.modelprovider.api.IModelProvider;
import org.eclipse.basyx.vab.modelprovider.map.VABMapProvider;
import org.springframework.data.mongodb.core.MongoOperations;
@@ -153,8 +155,7 @@
mongoOps.findAndReplace(hasId, sm, collection);
}
- @Override
- public ISubmodelElement getSubmodelElement(String idShort) {
+ private ISubmodelElement getTopLevelSubmodelElement(String idShort) {
SubModel sm = (SubModel) getSubmodel();
Map<String, ISubmodelElement> submodelElements = sm.getSubmodelElements();
ISubmodelElement element = submodelElements.get(idShort);
@@ -173,8 +174,7 @@
return SubmodelElement.createAsFacade((Map<String, Object>) elementVABObj);
}
- @Override
- public void deleteSubmodelElement(String idShort) {
+ private void deleteTopLevelSubmodelElement(String idShort) {
// Get sm from db
SubModel sm = (SubModel) getSubmodel();
// Remove element
@@ -191,8 +191,7 @@
}
- @Override
- public void addSubmodelElement(List<String> idShorts, ISubmodelElement elem) {
+ private void addNestedSubmodelElement(List<String> idShorts, ISubmodelElement elem) {
SubModel sm = (SubModel) getSubmodel();
// > 1 idShorts => add new sm element to an existing sm element
if (idShorts.size() > 1) {
@@ -220,8 +219,7 @@
return sm.getSubmodelElements().values();
}
- @Override
- public void updateSubmodelElement(String idShort, Object newValue) {
+ private void updateTopLevelSubmodelElement(String idShort, Object newValue) {
// Get sm from db
SubModel sm = (SubModel) getSubmodel();
// Unwrap value
@@ -234,8 +232,7 @@
}
@SuppressWarnings("unchecked")
- @Override
- public void updateNestedSubmodelElement(List<String> idShorts, Object newValue) {
+ private void updateNestedSubmodelElement(List<String> idShorts, Object newValue) {
SubModel sm = (SubModel) getSubmodel();
// Get parent SM element
@@ -251,15 +248,13 @@
mongoOps.findAndReplace(hasId, sm, collection);
}
- @Override
- public Object getSubmodelElementValue(String idShort) {
+ private Object getTopLevelSubmodelElementValue(String idShort) {
SubModel sm = (SubModel) getSubmodel();
return getElementProvider(sm, idShort).getModelPropertyValue("/value");
}
@SuppressWarnings("unchecked")
- @Override
- public Object getNestedSubmodelElementValue(List<String> idShorts) {
+ private Object getNestedSubmodelElementValue(List<String> idShorts) {
ISubmodelElement lastElement = getNestedSubmodelElement(idShorts);
IModelProvider mapProvider = new VABMapProvider((Map<String, Object>) lastElement);
return SubmodelElementProvider.getElementProvider(mapProvider).getModelPropertyValue("/value");
@@ -306,22 +301,19 @@
return elemMap.get(lastIdShort);
}
- @Override
- public ISubmodelElement getNestedSubmodelElement(List<String> idShorts) {
+ private ISubmodelElement getNestedSubmodelElement(List<String> idShorts) {
// Get sm from db
SubModel sm = (SubModel) getSubmodel();
// Get nested sm element from this sm
return convertSubmodelElement(getNestedSubmodelElement(sm, idShorts));
}
- @Override
- public Object invokeOperation(String idShort, Object... params) {
+ private Object invokeTopLevelOperation(String idShort, Object... params) {
// not possible to invoke operations on a submodel that is stored in a db
throw new MalformedRequestException("Invoke not supported by this backend");
}
- @Override
- public void deleteNestedSubmodelElement(List<String> idShorts) {
+ private void deleteNestedSubmodelElement(List<String> idShorts) {
if ( idShorts.size() == 1 ) {
deleteSubmodelElement(idShorts.get(0));
return;
@@ -340,21 +332,88 @@
mongoOps.findAndReplace(hasId, sm, collection);
}
- @Override
- public Object invokeNestedOperation(List<String> idShorts, Object... params) {
+ private Object invokeNestedOperation(List<String> idShorts, Object... params) {
+ // not possible to invoke operations on a submodel that is stored in a db
+ throw new MalformedRequestException("Invoke not supported by this backend");
+ }
+
+ private Object invokeNestedOperationAsync(List<String> idShorts, Object... params) {
// not possible to invoke operations on a submodel that is stored in a db
throw new MalformedRequestException("Invoke not supported by this backend");
}
@Override
- public Object invokeNestedOperationAsync(List<String> idShorts, Object... params) {
+ public Object getOperationResult(String idShort, String requestId) {
// not possible to invoke operations on a submodel that is stored in a db
throw new MalformedRequestException("Invoke not supported by this backend");
}
@Override
- public Object getOperationResult(List<String> idShorts, String requestId) {
- // not possible to invoke operations on a submodel that is stored in a db
- throw new MalformedRequestException("Invoke not supported by this backend");
+ public ISubmodelElement getSubmodelElement(String idShortPath) {
+ if(idShortPath.contains("/")) {
+ String[] splitted = VABPathTools.splitPath(idShortPath);
+ List<String> idShorts = Arrays.asList(splitted);
+ return getNestedSubmodelElement(idShorts);
+ }else {
+ return getTopLevelSubmodelElement(idShortPath);
+ }
+ }
+
+ @Override
+ public void deleteSubmodelElement(String idShortPath) {
+ if(idShortPath.contains("/")) {
+ String[] splitted = VABPathTools.splitPath(idShortPath);
+ List<String> idShorts = Arrays.asList(splitted);
+ deleteNestedSubmodelElement(idShorts);
+ }else {
+ deleteTopLevelSubmodelElement(idShortPath);
+ }
+ }
+
+ @Override
+ public void updateSubmodelElement(String idShortPath, Object newValue) {
+ if(idShortPath.contains("/")) {
+ String[] splitted = VABPathTools.splitPath(idShortPath);
+ List<String> idShorts = Arrays.asList(splitted);
+ updateNestedSubmodelElement(idShorts, newValue);
+ }else {
+ updateTopLevelSubmodelElement(idShortPath, newValue);
+ }
+ }
+
+ @Override
+ public Object getSubmodelElementValue(String idShortPath) {
+ if(idShortPath.contains("/")) {
+ String[] splitted = VABPathTools.splitPath(idShortPath);
+ List<String> idShorts = Arrays.asList(splitted);
+ return getNestedSubmodelElementValue(idShorts);
+ }else {
+ return getTopLevelSubmodelElementValue(idShortPath);
+ }
+ }
+
+ @Override
+ public Object invokeOperation(String idShortPath, Object... params) {
+ if(idShortPath.contains("/")) {
+ String[] splitted = VABPathTools.splitPath(idShortPath);
+ List<String> idShorts = Arrays.asList(splitted);
+ return invokeNestedOperation(idShorts, params);
+ }else {
+ return invokeTopLevelOperation(idShortPath, params);
+ }
+ }
+
+ @Override
+ public Object invokeAsync(String idShortPath, Object... params) {
+ String[] splitted = VABPathTools.splitPath(idShortPath);
+ List<String> idShorts = Arrays.asList(splitted);
+ return invokeNestedOperationAsync(idShorts, params);
+ }
+
+ @Override
+ public void addSubmodelElement(String idShortPath, ISubmodelElement elem) {
+ String[] splitted = VABPathTools.splitPath(idShortPath);
+ List<String> idShorts = Arrays.asList(splitted);
+ addNestedSubmodelElement(idShorts, elem);
}
}
diff --git a/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/SubModelProvider.java b/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/SubModelProvider.java
index 2669bcd..2cdfdd2 100644
--- a/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/SubModelProvider.java
+++ b/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/SubModelProvider.java
@@ -10,6 +10,7 @@
import org.eclipse.basyx.submodel.metamodel.map.SubModel;
import org.eclipse.basyx.submodel.metamodel.map.submodelelement.SubmodelElement;
import org.eclipse.basyx.submodel.metamodel.map.submodelelement.dataelement.property.Property;
+import org.eclipse.basyx.submodel.metamodel.map.submodelelement.operation.Operation;
import org.eclipse.basyx.submodel.restapi.api.ISubmodelAPI;
import org.eclipse.basyx.submodel.restapi.vab.VABSubmodelAPI;
import org.eclipse.basyx.vab.exception.provider.MalformedRequestException;
@@ -112,31 +113,25 @@
} else if (splitted.length == 1 && splitted[0].equals(MultiSubmodelElementProvider.ELEMENTS)) {
return submodelAPI.getSubmodelElements();
} else if (splitted.length >= 2 && isQualifier(splitted[0])) { // Request for element with specific idShort
- String idShort = splitted[1];
- if (splitted.length == 2) {
- return submodelAPI.getSubmodelElement(idShort);
- } else if (isPropertyValuePath(splitted)) { // Request for the value of an property
- return submodelAPI.getSubmodelElementValue(idShort);
- } else if (isInvocationListPath(splitted)) {
- List<String> idShorts = getIdShorts(splitted);
+ // Remove initial "/submodelElements"
+ path = removeSMElementPrefix(path);
- // Remove invocationList/{requestId} from the idShorts
- idShorts.remove(idShorts.size() - 1);
- idShorts.remove(idShorts.size() - 1);
- return submodelAPI.getOperationResult(idShorts, splitted[splitted.length - 1]);
- } else if (isSubmodelElementListPath(splitted)) {
- // Create list from array and wrap it in ArrayList to ensure modifiability
- List<String> idShorts = getIdShorts(splitted);
-
- if (endsWithValue(splitted)) {
- return submodelAPI.getNestedSubmodelElementValue(idShorts);
- } else {
- return submodelAPI.getNestedSubmodelElement(idShorts);
- }
- }
- }
- }
- throw new MalformedRequestException("Unknown path " + path + " was requested");
+ if (endsWithValue(splitted)) { // Request for the value of an property
+ String idShortPath = path.replace("/value", "");
+ return submodelAPI.getSubmodelElementValue(idShortPath);
+ } else if (isInvocationListPath(splitted)) {
+ List<String> idShorts = getIdShorts(splitted);
+
+ // Remove invocationList/{requestId} from the idShorts
+ idShorts.remove(idShorts.size() - 1);
+ idShorts.remove(idShorts.size() - 1);
+ return submodelAPI.getOperationResult(idShorts.get(0), splitted[splitted.length - 1]);
+ } else {
+ return submodelAPI.getSubmodelElement(path);
+ }
+ }
+ }
+ throw new MalformedRequestException("Unknown path " + path + " was requested");
}
private List<String> getIdShorts(String[] splitted) {
@@ -153,17 +148,11 @@
return idShorts;
}
- private boolean isPropertyValuePath(String[] splitted) {
- return splitted.length == 3 && splitted[0].equals(MultiSubmodelElementProvider.ELEMENTS) && endsWithValue(splitted);
- }
private boolean endsWithValue(String[] splitted) {
return splitted[splitted.length - 1].equals(Property.VALUE);
}
- private boolean isSubmodelElementListPath(String[] splitted) {
- return splitted.length > 2 && splitted[0].equals(MultiSubmodelElementProvider.ELEMENTS);
- }
private boolean isInvocationListPath(String[] splitted) {
return splitted.length > 2 && splitted[splitted.length - 2].equals(OperationProvider.INVOCATION_LIST);
@@ -177,8 +166,10 @@
throw new MalformedRequestException("Set on \"submodel\" not supported");
} else {
String[] splitted = VABPathTools.splitPath(path);
+ path = removeSMElementPrefix(path);
+ String idshortPath = path.replace("/value", "");
if (endsWithValue(splitted)) {
- submodelAPI.updateNestedSubmodelElement(getIdShorts(splitted), newValue);
+ submodelAPI.updateSubmodelElement(idshortPath, newValue);
} else {
SubmodelElement element = SubmodelElement.createAsFacade((Map<String, Object>) newValue);
@@ -188,7 +179,7 @@
+ element.getIdShort() + "' does not match the ending of the given path '" + path + "'");
}
- submodelAPI.addSubmodelElement(getIdShorts(splitted), element);
+ submodelAPI.addSubmodelElement(idshortPath, element);
}
}
}
@@ -205,7 +196,8 @@
String[] splitted = VABPathTools.splitPath(path);
if (isQualifier(splitted[0])) {
if (splitted.length > 2) {
- submodelAPI.deleteNestedSubmodelElement(getIdShorts(splitted));
+ path = removeSMElementPrefix(path);
+ submodelAPI.deleteSubmodelElement(path);
} else {
submodelAPI.deleteSubmodelElement(splitted[1]);
}
@@ -232,14 +224,14 @@
if (path.isEmpty()) {
throw new MalformedRequestException("Given path must not be empty");
} else {
- String[] splitted = VABPathTools.splitPath(path);
if (VABPathTools.isOperationInvokationPath(path)) {
if(path.endsWith(OperationProvider.ASYNC)) {
- List<String> idShorts = getIdShorts(splitted);
- idShorts.remove(idShorts.size() - 1);
- return submodelAPI.invokeNestedOperationAsync(idShorts, parameters);
+ path = removeSMElementPrefix(path);
+ path = path.replace(Operation.INVOKE + OperationProvider.ASYNC, "");
+ return submodelAPI.invokeAsync(path, parameters);
} else {
- return submodelAPI.invokeNestedOperation(getIdShorts(splitted), parameters);
+ path = removeSMElementPrefix(path);
+ return submodelAPI.invokeOperation(path, parameters);
}
} else {
throw new MalformedRequestException("Given path '" + path + "' does not end in /invoke");
@@ -250,4 +242,8 @@
protected void setAPI(ISubmodelAPI api) {
this.submodelAPI = api;
}
+
+ private String removeSMElementPrefix(String path) {
+ return path.replace("submodelElements", "");
+ }
}
diff --git a/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/api/ISubmodelAPI.java b/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/api/ISubmodelAPI.java
index 116dca1..5f53baa 100644
--- a/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/api/ISubmodelAPI.java
+++ b/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/api/ISubmodelAPI.java
@@ -1,7 +1,6 @@
package org.eclipse.basyx.submodel.restapi.api;
import java.util.Collection;
-import java.util.List;
import org.eclipse.basyx.submodel.metamodel.api.ISubModel;
import org.eclipse.basyx.submodel.metamodel.api.submodelelement.ISubmodelElement;
@@ -33,37 +32,30 @@
/**
* Adds a submodelElement to the submodel
*
- * @param idShorts
+ * @param idShortPath
* the idShort path to the submodelElement
* @param elem
* the submodelElement to be added
*/
- public void addSubmodelElement(List<String> idShorts, ISubmodelElement elem);
+ public void addSubmodelElement(String idShortPath, ISubmodelElement elem);
/**
* Retrieves a submodelElement
*
- * @param idShort
- * of the submodelElement
+ * @param idShortPath
+ * the idShort Path to the submodelElement
* @return the submodelElement
*/
- public ISubmodelElement getSubmodelElement(String idShort);
+ public ISubmodelElement getSubmodelElement(String idShortPath);
/**
* Removes a submodelElement from the submodel
*
- * @param idShort
- * of the submodelElement to be removed
+ * @param idShortPath
+ * the idShort path to the submodelElement, which is to be removed
*/
- public void deleteSubmodelElement(String idShort);
+ public void deleteSubmodelElement(String idShortPath);
- /**
- * Removes a submodelElement from a SubmodelElementCollection
- *
- * @param idShort
- * of the submodelElement to be removed
- */
- public void deleteNestedSubmodelElement(List<String> idShorts);
/**
* Helper function for quick access of operations
@@ -82,91 +74,55 @@
/**
* Updates the value of a submodelElement
*
- * @param idShort
- * of the submodelElement
- * @param newValue
- * new value of the submodelElement
- */
- public void updateSubmodelElement(String idShort, Object newValue);
-
- /**
- * Updates the value of a submodelElement nested inside a SubmodelElementCollection.
- *
- * @param idShorts
+ * @param idShortPath
* the idShort path to the submodelElement
* @param newValue
* new value of the submodelElement
*/
- public void updateNestedSubmodelElement(List<String> idShorts, Object newValue);
+ public void updateSubmodelElement(String idShortPath, Object newValue);
/**
* Retrieves the value of a submodelElement
*
- * @param idShort
- * of the submodelElement
+ * @param idShortPath
+ * the idShort path to the submodelElement
* @return submodelElement value
*/
- public Object getSubmodelElementValue(String idShort);
+ public Object getSubmodelElementValue(String idShortPath);
- /**
- * Retrieves the value of a submodelElement nested inside a SubmodelElementCollection.
- *
- * @param idShorts
- * the idShort path to the submodelElement
- */
- public Object getNestedSubmodelElementValue(List<String> idShorts);
-
- /**
- * Retrieves a submodel element nested inside a SubmodelElementCollection
- *
- * @param idShorts
- * the idShort path to the submodelElement
- * @return
- */
- public ISubmodelElement getNestedSubmodelElement(List<String> idShorts);
/**
* Invokes an operation
*
- * @param idShort
- * of the operation
- * @param params
- * to be passed to the operation
- * @return the result of the operation
- */
- public Object invokeOperation(String idShort, Object... params);
-
- /**
- * Invokes an operation
- *
- * @param idShorts
+ * @param idShortPath
* the idShort path to the operation
* @param params
* to be passed to the operation
* @return the result of the operation
*/
- public Object invokeNestedOperation(List<String> idShorts, Object... params);
+ public Object invokeOperation(String idShortPath, Object... params);
+
/**
- * Invokes an operation asynchronously
+ * Invoke an operation asynchronously
*
- * @param idShorts
- * the idShort path to the operation
+ * @param idShortPath
+ * the idShort path to the operation
* @param params
- * to be passed to the operation
+ * to be passed to the operation
* @return the requestId of the invocation
*/
- public Object invokeNestedOperationAsync(List<String> idShorts, Object... params);
+ public Object invokeAsync(String idShortPath, Object... params);
/**
* Gets the result of an asynchronously invoked operation
*
- * @param idShorts
- * the idShort path to the operation
+ * @param idShort
+ * of the operation
* @param requestId
* the requestId of the invocation
* @return the result of the Operation or a Message that it is not finished yet
*/
- public Object getOperationResult(List<String> idShorts, String requestId);
+ public Object getOperationResult(String idShort, String requestId);
}
diff --git a/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/vab/VABSubmodelAPI.java b/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/vab/VABSubmodelAPI.java
index a094e8d..ef20c2d 100644
--- a/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/vab/VABSubmodelAPI.java
+++ b/sdks/java/basys.sdk/src/main/java/org/eclipse/basyx/submodel/restapi/vab/VABSubmodelAPI.java
@@ -2,7 +2,6 @@
import java.util.Collection;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -17,7 +16,6 @@
import org.eclipse.basyx.submodel.restapi.OperationProvider;
import org.eclipse.basyx.submodel.restapi.api.ISubmodelAPI;
import org.eclipse.basyx.vab.modelprovider.VABElementProxy;
-import org.eclipse.basyx.vab.modelprovider.VABPathTools;
import org.eclipse.basyx.vab.modelprovider.api.IModelProvider;
/**
@@ -73,19 +71,15 @@
}
@Override
- public void addSubmodelElement(List<String> idShorts, ISubmodelElement elem) {
- getElementProvider().createValue(buildNestedElementPath(idShorts), elem);
+ public void addSubmodelElement(String idShortPath, ISubmodelElement elem) {
+ getElementProvider().createValue(MultiSubmodelElementProvider.ELEMENTS + "/" + idShortPath, elem);
}
@Override
- public void deleteSubmodelElement(String idShort) {
- getElementProvider().deleteValue(MultiSubmodelElementProvider.ELEMENTS + "/" + idShort);
+ public void deleteSubmodelElement(String idShortPath) {
+ getElementProvider().deleteValue(MultiSubmodelElementProvider.ELEMENTS + "/" + idShortPath);
}
- @Override
- public void deleteNestedSubmodelElement(List<String> idShorts) {
- getElementProvider().deleteValue(buildNestedElementPath(idShorts));
- }
@Override
public Collection<IOperation> getOperations() {
@@ -101,68 +95,41 @@
}
@Override
- public void updateSubmodelElement(String idShort, Object newValue) {
- getElementProvider().setModelPropertyValue(buildValuePathForProperty(idShort), newValue);
+ public void updateSubmodelElement(String idShortPath, Object newValue) {
+ getElementProvider().setModelPropertyValue(buildValuePathForProperty(idShortPath), newValue);
}
@Override
- public void updateNestedSubmodelElement(List<String> idShorts, Object newValue) {
- getElementProvider().setModelPropertyValue(buildNestedElementPath(idShorts) + "/" + Property.VALUE, newValue);
- }
-
- @Override
- public Object getSubmodelElementValue(String idShort) {
- return getElementProvider().getModelPropertyValue(buildValuePathForProperty(idShort));
+ public Object getSubmodelElementValue(String idShortPath) {
+ return getElementProvider().getModelPropertyValue(buildValuePathForProperty(idShortPath));
}
@SuppressWarnings("unchecked")
@Override
- public ISubmodelElement getSubmodelElement(String idShort) {
- return SubmodelElement.createAsFacade((Map<String, Object>) getElementProvider().getModelPropertyValue(MultiSubmodelElementProvider.ELEMENTS + "/" + idShort));
+ public ISubmodelElement getSubmodelElement(String idShortPath) {
+ return SubmodelElement.createAsFacade((Map<String, Object>) getElementProvider().getModelPropertyValue(MultiSubmodelElementProvider.ELEMENTS + "/" + idShortPath));
}
@Override
- public Object invokeOperation(String idShort, Object... params) {
- return getElementProvider().invokeOperation(MultiSubmodelElementProvider.ELEMENTS + "/" + idShort, params);
+ public Object invokeOperation(String idShortPath, Object... params) {
+ return getElementProvider().invokeOperation(MultiSubmodelElementProvider.ELEMENTS + "/" + idShortPath, params);
}
- @Override
- public Object invokeNestedOperation(List<String> idShorts, Object... params) {
- return getElementProvider().invokeOperation(buildNestedElementPath(idShorts), params);
- }
@Override
- public Object invokeNestedOperationAsync(List<String> idShorts, Object... params) {
- return getElementProvider().invokeOperation(buildNestedElementPath(idShorts) + "/" + Operation.INVOKE + OperationProvider.ASYNC, params);
+ public Object invokeAsync(String idShortPath, Object... params) {
+ return getElementProvider().invokeOperation(MultiSubmodelElementProvider.ELEMENTS + "/" + idShortPath +"/" + Operation.INVOKE + OperationProvider.ASYNC, params);
}
- private String buildValuePathForProperty(String idShort) {
- return MultiSubmodelElementProvider.ELEMENTS + "/" + idShort + "/" + Property.VALUE;
+ private String buildValuePathForProperty(String idShortPath) {
+ return MultiSubmodelElementProvider.ELEMENTS + "/" + idShortPath + "/" + Property.VALUE;
}
- @Override
- public Object getNestedSubmodelElementValue(List<String> idShorts) {
- return getElementProvider().getModelPropertyValue(buildNestedElementPath(idShorts) + "/" + Property.VALUE);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public ISubmodelElement getNestedSubmodelElement(List<String> idShorts) {
- Map<String, Object> map = (Map<String, Object>) getElementProvider().getModelPropertyValue(buildNestedElementPath(idShorts));
- return SubmodelElement.createAsFacade(map);
- }
@Override
- public Object getOperationResult(List<String> idShorts, String requestId) {
- return getElementProvider().getModelPropertyValue(buildNestedElementPath(idShorts) + "/" + OperationProvider.INVOCATION_LIST + "/" + requestId);
+ public Object getOperationResult(String idShortPath, String requestId) {
+ return getElementProvider().getModelPropertyValue(MultiSubmodelElementProvider.ELEMENTS + "/" + idShortPath + "/" + OperationProvider.INVOCATION_LIST + "/" + requestId);
}
- /**
- * @param idShorts
- * @return
- */
- private String buildNestedElementPath(List<String> idShorts) {
- return MultiSubmodelElementProvider.ELEMENTS + "/" + VABPathTools.concatenatePaths(idShorts.toArray(new String[0]));
- }
}