Class BaSyxSubmodel

java.lang.Object
de.iip_ecosphere.platform.support.aas.basyx2.AbstractSubmodel<org.eclipse.digitaltwin.aas4j.v3.model.Submodel>
de.iip_ecosphere.platform.support.aas.basyx2.BaSyxSubmodel
All Implemented Interfaces:
BaSyxElementTranslator.SubmodelElementsRegistrar, BaSyxSubmodelElementParent, de.iip_ecosphere.platform.support.aas.DeferredParent, de.iip_ecosphere.platform.support.aas.Element, de.iip_ecosphere.platform.support.aas.ElementContainer, de.iip_ecosphere.platform.support.aas.ElementsAccess, de.iip_ecosphere.platform.support.aas.HasDataSpecification, de.iip_ecosphere.platform.support.aas.HasKind, de.iip_ecosphere.platform.support.aas.HasSemantics, de.iip_ecosphere.platform.support.aas.Identifiable, de.iip_ecosphere.platform.support.aas.Qualifiable, de.iip_ecosphere.platform.support.aas.Referable, de.iip_ecosphere.platform.support.aas.Submodel

public class BaSyxSubmodel extends AbstractSubmodel<org.eclipse.digitaltwin.aas4j.v3.model.Submodel>
Wraps a BaSyx sub-model.
Author:
Holger Eichelberger, SSE
  • Field Details

    • parent

      private BaSyxSubmodelParent parent
    • repo

      private org.eclipse.digitaltwin.basyx.submodelrepository.client.ConnectedSubmodelRepository repo
  • Constructor Details

    • BaSyxSubmodel

      protected BaSyxSubmodel(org.eclipse.digitaltwin.aas4j.v3.model.Submodel subModel, org.eclipse.digitaltwin.basyx.submodelrepository.client.ConnectedSubmodelRepository repo)
      Creates an instance. Prevents external creation.
      Parameters:
      subModel - the sub-model instance
    • BaSyxSubmodel

      protected BaSyxSubmodel(BaSyxSubmodelParent parent, org.eclipse.digitaltwin.aas4j.v3.model.Submodel instance, org.eclipse.digitaltwin.basyx.submodelrepository.client.ConnectedSubmodelRepository repo)
      Creates an instance based on a given instance.
      Parameters:
      parent - the parent instance
      instance - the BaSyx submodel instance
  • Method Details

    • addSubmodelElement

      static void addSubmodelElement(org.eclipse.digitaltwin.aas4j.v3.model.Submodel submodel, org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement element)
      Adds a submodel element.
      Parameters:
      submodel - the submodel to add the element to
      element - the element to add
    • obtainSubmodelElementCollectionBuilder

      private de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder obtainSubmodelElementCollectionBuilder(BaSyxSubmodelElementContainerBuilder<?> parent, String idShort, boolean ordered, boolean allowDuplicates)
      Creates a builder for a contained sub-model element collection. Calling this method again with the same name shall lead to a builder that allows for modifying the sub-model.
      Parameters:
      parent - the parent builder
      idShort - the short name of the reference element
      ordered - whether the collection is ordered
      allowDuplicates - whether the collection allows duplicates
      Returns:
      the builder
      Throws:
      IllegalArgumentException - if idShort is null or empty; or if modification is not possible
    • obtainSubmodelElementListBuilder

      private de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder obtainSubmodelElementListBuilder(BaSyxSubmodelElementContainerBuilder<?> parent, String idShort)
      Creates a builder for a contained sub-model element list. Calling this method again with the same name shall lead to a builder that allows for modifying the sub-model.
      Parameters:
      parent - the parent builder
      idShort - the short name of the reference element
      Returns:
      the builder
      Throws:
      IllegalArgumentException - if idShort is null or empty; or if modification is not possible
    • createSubmodelElementContainerBuilder

      public de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder createSubmodelElementContainerBuilder(String idShort)
    • createSubmodelElementCollectionBuilder

      public de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder createSubmodelElementCollectionBuilder(String idShort)
    • createSubmodelElementListBuilder

      public de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder createSubmodelElementListBuilder(String idShort)
    • update

      public void update()
    • create

      public boolean create(Consumer<de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder> func, boolean propagate, String... path)
    • iterate

      public <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement> boolean iterate(de.iip_ecosphere.platform.support.aas.Submodel.IteratorFunction<T> func, Class<T> cls, String... path)
    • getAas

      Description copied from class: AbstractSubmodel
      Returns the parent AAS.
      Specified by:
      getAas in class AbstractSubmodel<org.eclipse.digitaltwin.aas4j.v3.model.Submodel>
      Returns:
      the parent AAS
    • setSemanticId

      public void setSemanticId(String semanticId)
    • setRepo

      void setRepo(org.eclipse.digitaltwin.basyx.submodelrepository.client.ConnectedSubmodelRepository repo)
      Sets the repository, emulating a connected submodel.
      Parameters:
      repo - the repository
    • processOnPath

      public org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement processOnPath(List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> path, boolean skipIfNoRepo, BaSyxSubmodelElement.PathFunction function)
      Description copied from interface: BaSyxSubmodelElementParent
      Iterates up the path up to the submodel and calls function on the aggregated path.
      Parameters:
      path - the path accumulated so far
      skipIfNoRepo - skip executing function if there is no repository to pass into
      function - the function to call at the end of the path
      See Also:
    • deleteElement

      public void deleteElement(String idShort)
      Specified by:
      deleteElement in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      Overrides:
      deleteElement in class AbstractSubmodel<org.eclipse.digitaltwin.aas4j.v3.model.Submodel>
    • deleteElement

      public void deleteElement(de.iip_ecosphere.platform.support.aas.SubmodelElement elt)
      Specified by:
      deleteElement in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      Overrides:
      deleteElement in class AbstractSubmodel<org.eclipse.digitaltwin.aas4j.v3.model.Submodel>
    • updateOnDelete

      private void updateOnDelete(String idShortPath)
      Updates this submodel on deleting an element.
      Parameters:
      idShortPath - the path to the element
    • updateInRepo

      private void updateInRepo()
      Updates this submodel in its repository if connected.
    • getParent

      public BaSyxSubmodelElementParent getParent()
      Description copied from interface: BaSyxSubmodelElementParent
      Returns the parent element.
      Returns:
      the parent element
    • getPathElement

      public org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement getPathElement()
      Description copied from interface: BaSyxSubmodelElementParent
      Returns:
      the path element
    • refreshOnUse

      public void refreshOnUse()