Skip to content

Commit

Permalink
Adds Connected Variants of Submodel Elements (eclipse-basyx#280)
Browse files Browse the repository at this point in the history
* Adds ConnectedBlob,Property,Range and Interface

Signed-off-by: Jannik Fried <[email protected]>

* added stubs for connected SubmodelElements

* Adds ConnectedVariants of Submodel Elements

Signed-off-by: FriedJannik <[email protected]>

* added test for ConnectedBlob

* Fixes bug where only Nested SMEs could be Updated

* updated ConnectedBlob

* - Makes test faster
- Adds Property tests

Signed-off-by: FriedJannik <[email protected]>

* Changes Interface to Class to remove redundant constructor
Adds Entity Test stubs

Signed-off-by: FriedJannik <[email protected]>

* added tests for further connected SubmodelElements

* added remaining tests for connectedSubmodelElements

* Fixed dezerialization of SMLs and the respective ConnectedSME tests

* Removed Collection Single Property Test

* Adds JavaDoc

Signed-off-by: FriedJannik <[email protected]>

* Adapts JavaDoc

Signed-off-by: FriedJannik <[email protected]>

* Adapts JavaDoc

Signed-off-by: FriedJannik <[email protected]>

---------

Signed-off-by: Jannik Fried <[email protected]>
Signed-off-by: FriedJannik <[email protected]>
Co-authored-by: Aaron Zielstorff <[email protected]>
  • Loading branch information
FriedJannik and aaronzi authored May 15, 2024
1 parent b3301fc commit 86a4fc5
Show file tree
Hide file tree
Showing 18 changed files with 1,185 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ public void updateSubmodelElement(String idShortPath, SubmodelElement submodelEl
deleteSubmodelElement(idShortPath);

String idShortPathParentSME = parser.getIdShortPathOfParentElement(idShortPath);

if (idShortPath.equals(idShortPathParentSME)) {
createSubmodelElement(submodelElement);
return;
}
createSubmodelElement(idShortPathParentSME, submodelElement);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (C) 2024 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.submodelservice.client.connectedSubmodelElements;

import org.eclipse.digitaltwin.aas4j.v3.model.AnnotatedRelationshipElement;
import org.eclipse.digitaltwin.basyx.submodelservice.value.AnnotatedRelationshipElementValue;

/**
* Connected variant of {@link AnnotatedRelationshipElement}
*
* @author zielstor, fried
*
*/
public class ConnectedAnnotatedRelationshipElement
extends ConnectedSubmodelElement<AnnotatedRelationshipElementValue, AnnotatedRelationshipElement> {
/**
*
* @param submodelServiceUrl URL of the submodel service
* @param idShortPath idShort of the submodel element
*/
public ConnectedAnnotatedRelationshipElement(String submodelServiceUrl, String idShortPath) {
super(submodelServiceUrl, idShortPath);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (C) 2024 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.submodelservice.client.connectedSubmodelElements;

import org.eclipse.digitaltwin.aas4j.v3.model.BasicEventElement;
import org.eclipse.digitaltwin.basyx.submodelservice.value.BasicEventValue;

/**
* Connected variant of {@link BasicEventElement}
*
* @author zielstor, fried
*
*/
public class ConnectedBasicEventElement extends ConnectedSubmodelElement<BasicEventValue, BasicEventElement> {
/**
*
* @param submodelServiceUrl URL of the submodel service
* @param idShortPath idShort of the submodel element
*/
public ConnectedBasicEventElement(String submodelServiceUrl, String idShortPath) {
super(submodelServiceUrl, idShortPath);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (C) 2024 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.submodelservice.client.connectedSubmodelElements;

import org.eclipse.digitaltwin.aas4j.v3.model.Blob;
import org.eclipse.digitaltwin.basyx.submodelservice.value.FileBlobValue;

/**
* Connected variant of {@link Blob}
*
* @author zielstor, fried
*
*/
public class ConnectedBlob extends ConnectedSubmodelElement<FileBlobValue, Blob> {
/**
*
* @param submodelServiceUrl URL of the submodel service
* @param idShortPath idShort of the submodel element
*/
public ConnectedBlob(String submodelServiceUrl, String idShortPath) {
super(submodelServiceUrl, idShortPath);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*******************************************************************************
* Copyright (C) 2024 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.submodelservice.client.connectedSubmodelElements;

import org.eclipse.digitaltwin.aas4j.v3.model.Entity;
import org.eclipse.digitaltwin.basyx.submodelservice.value.EntityValue;
import org.eclipse.digitaltwin.basyx.submodelservice.value.mapper.EntityValueMapper;

/**
* Connected variant of {@link Entity}
*
* @author zielstor, fried
*
*/
public class ConnectedEntity extends ConnectedSubmodelElement<EntityValue, Entity> {
/**
*
* @param submodelServiceUrl URL of the submodel service
* @param idShortPath idShort of the submodel element
*/
public ConnectedEntity(String submodelServiceUrl, String idShortPath) {
super(submodelServiceUrl, idShortPath);
}

@Override
public EntityValue getValue() {
Entity entity = (Entity) service.getSubmodelElement(idShortPath);
EntityValueMapper entityValueMapper = new EntityValueMapper(entity);
return entityValueMapper.getValue();
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (C) 2024 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.submodelservice.client.connectedSubmodelElements;

import org.eclipse.digitaltwin.aas4j.v3.model.File;
import org.eclipse.digitaltwin.basyx.submodelservice.value.FileBlobValue;

/**
* Connected variant of {@link File}
*
* @author zielstor, fried
*
*/
public class ConnectedFile extends ConnectedSubmodelElement<FileBlobValue, File> {
/**
*
* @param submodelServiceUrl URL of the submodel service
* @param idShortPath idShort of the submodel element
*/
public ConnectedFile(String submodelServiceUrl, String idShortPath) {
super(submodelServiceUrl, idShortPath);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (C) 2024 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.submodelservice.client.connectedSubmodelElements;

import org.eclipse.digitaltwin.aas4j.v3.model.MultiLanguageProperty;
import org.eclipse.digitaltwin.basyx.submodelservice.value.MultiLanguagePropertyValue;

/**
* Connected variant of {@link MultiLanguageProperty}
*
* @author zielstor, fried
*
*/
public class ConnectedMultiLanguageProperty extends ConnectedSubmodelElement<MultiLanguagePropertyValue, MultiLanguageProperty> {
/**
*
* @param submodelServiceUrl URL of the submodel service
* @param idShortPath idShort of the submodel element
*/
public ConnectedMultiLanguageProperty(String submodelServiceUrl, String idShortPath) {
super(submodelServiceUrl, idShortPath);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (C) 2024 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.submodelservice.client.connectedSubmodelElements;

import org.eclipse.digitaltwin.aas4j.v3.model.Property;
import org.eclipse.digitaltwin.basyx.submodelservice.value.PropertyValue;

/**
* Connected variant of {@link Property}
*
* @author zielstor, fried
*
*/
public class ConnectedProperty extends ConnectedSubmodelElement<PropertyValue,Property> {
/**
*
* @param submodelServiceUrl URL of the submodel service
* @param idShortPath idShort of the submodel element
*/
public ConnectedProperty(String submodelServiceUrl, String idShortPath) {
super(submodelServiceUrl,idShortPath);
}

}
Loading

0 comments on commit 86a4fc5

Please sign in to comment.