Class AbstractSubmodel<S extends org.eclipse.digitaltwin.aas4j.v3.model.Submodel>

java.lang.Object
de.iip_ecosphere.platform.support.aas.basyx2.AbstractSubmodel<S>
Type Parameters:
S - the BaSyx type implementing the sub-model
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
Direct Known Subclasses:
BaSyxSubmodel

public abstract class AbstractSubmodel<S extends org.eclipse.digitaltwin.aas4j.v3.model.Submodel> extends Object implements de.iip_ecosphere.platform.support.aas.Submodel, BaSyxElementTranslator.SubmodelElementsRegistrar, BaSyxSubmodelElementParent
Basic sub-model implementation.
Author:
Holger Eichelberger, SSE
  • Field Details

    • submodel

      private S extends org.eclipse.digitaltwin.aas4j.v3.model.Submodel submodel
    • operations

      private Map<String,de.iip_ecosphere.platform.support.aas.Operation> operations
    • dataElements

      private Map<String,de.iip_ecosphere.platform.support.aas.DataElement> dataElements
    • properties

      private Map<String,de.iip_ecosphere.platform.support.aas.Property> properties
    • submodelElements

      private Map<String,de.iip_ecosphere.platform.support.aas.SubmodelElement> submodelElements
    • deferred

      private Map<String,de.iip_ecosphere.platform.support.Builder<?>> deferred
  • Constructor Details

    • AbstractSubmodel

      protected AbstractSubmodel(S submodel)
      Creates an instance. Prevents external creation.
      Parameters:
      submodel - the submodel instance
  • Method Details

    • reset

      protected void reset(S submodel)
      Resets this submodel with a new instance.
      Parameters:
      submodel - the new submodel instance
    • getSubmodel

      public S getSubmodel()
      Returns the sub-model instance.
      Returns:
      the sub-model instance
    • warn

      private void warn(String msg)
      Emits a warning.
      Parameters:
      msg - the message to be emitted
    • register

      public BaSyxFile register(BaSyxFile file)
      Description copied from interface: BaSyxElementTranslator.SubmodelElementsRegistrar
      Registers a file data element.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Parameters:
      file - the file data element
      Returns:
      file
    • register

      public BaSyxRange register(BaSyxRange range)
      Description copied from interface: BaSyxElementTranslator.SubmodelElementsRegistrar
      Registers a range element.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Parameters:
      range - the range element
      Returns:
      range
    • register

      public BaSyxBlob register(BaSyxBlob blob)
      Description copied from interface: BaSyxElementTranslator.SubmodelElementsRegistrar
      Registers a BLOB data element.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Parameters:
      blob - the BLOB data element
      Returns:
      blob
    • register

      public BaSyxRelationshipElement register(BaSyxRelationshipElement relationship)
      Description copied from interface: BaSyxElementTranslator.SubmodelElementsRegistrar
      Registers a relationship element.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Parameters:
      relationship - the relationship element
      Returns:
      relationship
    • registerElement

      public <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement> T registerElement(T elt)
      Description copied from interface: BaSyxElementTranslator.SubmodelElementsRegistrar
      Registers an element. Default for all remaining registration functions in this interface.
      Specified by:
      registerElement in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Type Parameters:
      T - the actual type of the element
      Parameters:
      elt - the element
      Returns:
      elt
    • register

      public BaSyxEntity register(BaSyxEntity entity)
      Description copied from interface: BaSyxElementTranslator.SubmodelElementsRegistrar
      Registers an entity.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Parameters:
      entity - the entity
      Returns:
      entity
    • register

      public BaSyxOperation register(BaSyxOperation operation)
      Description copied from interface: BaSyxElementTranslator.SubmodelElementsRegistrar
      Registers an operation.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Parameters:
      operation - the operation
      Returns:
      operation
    • register

      public BaSyxProperty register(BaSyxProperty property)
      Description copied from interface: BaSyxElementTranslator.SubmodelElementsRegistrar
      Registers a property.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Parameters:
      property - the property
      Returns:
      property
    • register

      Description copied from interface: BaSyxElementTranslator.SubmodelElementsRegistrar
      Registers a multi-language property.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Parameters:
      property - the property
      Returns:
      property
    • register

      public BaSyxReferenceElement register(BaSyxReferenceElement reference)
      Description copied from interface: BaSyxElementTranslator.SubmodelElementsRegistrar
      Registers a reference element.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Parameters:
      reference - the reference
      Returns:
      reference
    • register

      Registers a sub-model element collection.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Parameters:
      collection - the element collection
      Returns:
      collection
    • register

      Registers a sub-model element list.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Parameters:
      list - the element list
      Returns:
      collection
    • register

      public <D extends org.eclipse.digitaltwin.aas4j.v3.model.DataElement> BaSyxDataElement<D> register(BaSyxDataElement<D> dataElement)
      Description copied from interface: BaSyxElementTranslator.SubmodelElementsRegistrar
      Registers a data element.
      Specified by:
      register in interface BaSyxElementTranslator.SubmodelElementsRegistrar
      Type Parameters:
      D - the element type
      Parameters:
      dataElement - the element to register
      Returns:
      dataElement
    • reg

      private <T extends BaSyxSubmodelElement> T reg(T elt)
      Generic registration actions on elt.
      Type Parameters:
      T - the element type
      Parameters:
      elt - the element to register
      Returns:
      elt
    • getIdShort

      public String getIdShort()
      Description copied from interface: BaSyxSubmodelElementParent
      Returns the short id of the element.
      Specified by:
      getIdShort in interface BaSyxSubmodelElementParent
      Specified by:
      getIdShort in interface de.iip_ecosphere.platform.support.aas.Element
      Specified by:
      getIdShort in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      Returns:
      the short id
    • submodelElements

      public Iterable<de.iip_ecosphere.platform.support.aas.SubmodelElement> submodelElements()
      Specified by:
      submodelElements in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • properties

      public Iterable<de.iip_ecosphere.platform.support.aas.Property> properties()
      Specified by:
      properties in interface de.iip_ecosphere.platform.support.aas.ElementContainer
    • dataElements

      public Iterable<de.iip_ecosphere.platform.support.aas.DataElement> dataElements()
      Specified by:
      dataElements in interface de.iip_ecosphere.platform.support.aas.ElementContainer
    • operations

      public Iterable<de.iip_ecosphere.platform.support.aas.Operation> operations()
      Specified by:
      operations in interface de.iip_ecosphere.platform.support.aas.ElementContainer
    • getSubmodelElementsCount

      public int getSubmodelElementsCount()
      Specified by:
      getSubmodelElementsCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
    • getDataElementsCount

      public int getDataElementsCount()
      Specified by:
      getDataElementsCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
    • getOperationsCount

      public int getOperationsCount()
      Specified by:
      getOperationsCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
    • getDataElement

      public de.iip_ecosphere.platform.support.aas.DataElement getDataElement(String idShort)
      Specified by:
      getDataElement in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • getProperty

      public de.iip_ecosphere.platform.support.aas.Property getProperty(String idShort)
      Specified by:
      getProperty in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • getPropertiesCount

      public int getPropertiesCount()
      Specified by:
      getPropertiesCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
    • getReferenceElement

      public de.iip_ecosphere.platform.support.aas.ReferenceElement getReferenceElement(String idShort)
      Specified by:
      getReferenceElement in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • getRelationshipElement

      public de.iip_ecosphere.platform.support.aas.RelationshipElement getRelationshipElement(String idShort)
      Specified by:
      getRelationshipElement in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • getOperation

      public de.iip_ecosphere.platform.support.aas.Operation getOperation(String idShort)
      Specified by:
      getOperation in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • getSubmodelElement

      public de.iip_ecosphere.platform.support.aas.SubmodelElement getSubmodelElement(String idShort)
      Specified by:
      getSubmodelElement in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • getSubmodelElementCollection

      public de.iip_ecosphere.platform.support.aas.SubmodelElementCollection getSubmodelElementCollection(String idShort)
      Specified by:
      getSubmodelElementCollection in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • getSubmodelElementList

      public de.iip_ecosphere.platform.support.aas.SubmodelElementList getSubmodelElementList(String idShort)
      Specified by:
      getSubmodelElementList in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • getEntity

      public de.iip_ecosphere.platform.support.aas.Entity getEntity(String idShort)
      Specified by:
      getEntity in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • accept

      public void accept(de.iip_ecosphere.platform.support.aas.AasVisitor visitor)
      Specified by:
      accept in interface de.iip_ecosphere.platform.support.aas.Element
      Specified by:
      accept in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • createReference

      public de.iip_ecosphere.platform.support.aas.Reference createReference()
      Specified by:
      createReference in interface de.iip_ecosphere.platform.support.aas.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
    • deleteElement

      public void deleteElement(String idShort)
      Specified by:
      deleteElement in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
    • deleteSubmodelElement

      void deleteSubmodelElement(String idShort)
      Removes a submodel element through its idShort.
      Parameters:
      idShort - the idshort to remove
    • getSubmodelEndpoint

      public static String getSubmodelEndpoint(de.iip_ecosphere.platform.support.ServerAddress server, de.iip_ecosphere.platform.support.aas.Aas aas, de.iip_ecosphere.platform.support.aas.Submodel submodel)
      Returns an AAS sub-model URI according to the BaSyx naming schema. [public for testing, debugging]
      Parameters:
      server - the server address
      aas - the AAS
      submodel - the sub-model
      Returns:
      the endpoint URI
    • defer

      void defer(String shortId, de.iip_ecosphere.platform.support.Builder<?> builder)
      Registers a sub-build as deferred.
      Parameters:
      shortId - the shortId of the element
      builder - the sub-builder to be registered
      See Also:
    • buildDeferred

      public void buildDeferred()
      Calls Builder.build() on all deferred builders.
      Specified by:
      buildDeferred in interface de.iip_ecosphere.platform.support.aas.DeferredParent
      See Also:
    • getDeferred

      public <B extends de.iip_ecosphere.platform.support.Builder<?>> B getDeferred(String shortId, Class<B> cls)
      Returns a deferred builder.
      Type Parameters:
      B - the builder type
      Parameters:
      shortId - the short id
      cls - the builder type
      Returns:
      the builder or null if no builder for shortId with the respective type is registered
    • getIdentification

      public String getIdentification()
      Returns the identification of the submodel.
      Specified by:
      getIdentification in interface de.iip_ecosphere.platform.support.aas.Identifiable
      Returns:
      the identification (prefixed according to IdentifierType, custom if none matches). Can e.g. be used with Registry if not null.
    • getAas

      abstract BaSyxSubmodelParent getAas()
      Returns the parent AAS.
      Returns:
      the parent AAS
    • getSemanticId

      public String getSemanticId(boolean stripPrefix)
      Specified by:
      getSemanticId in interface de.iip_ecosphere.platform.support.aas.HasSemantics