Class AbstractPersistenceRecipe

java.lang.Object
de.iip_ecosphere.platform.support.aas.basyx.AbstractPersistenceRecipe
All Implemented Interfaces:
de.iip_ecosphere.platform.support.aas.PersistenceRecipe
Direct Known Subclasses:
AasxPersistenceRecipe, JsonPersistenceRecipe, XmlPersistenceRecipe

public abstract class AbstractPersistenceRecipe
extends Object
implements de.iip_ecosphere.platform.support.aas.PersistenceRecipe
Basic supporting functions for persistency.
Author:
Holger Eichelberger, SSE
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private List<de.iip_ecosphere.platform.support.FileFormat> formats  
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected AbstractPersistenceRecipe​(de.iip_ecosphere.platform.support.FileFormat... formats)
    Creates a persistence recipe instance with given file formats.
  • Method Summary

    Modifier and Type Method Description
    protected static <T> void addAsset​(de.iip_ecosphere.platform.support.aas.Aas aas, Collection<T> assetList, Class<T> assetCls)
    Adds the asset from aas to assetList if feasible.
    Collection<de.iip_ecosphere.platform.support.FileFormat> getSupportedFormats()  
    protected static boolean isValidForWriting​(org.eclipse.basyx.aas.metamodel.api.parts.asset.IAsset asset)
    Returns whether the given asset is valid for writing.
    protected void transform​(List<? extends org.eclipse.basyx.aas.metamodel.api.IAssetAdministrationShell> aas, List<? extends org.eclipse.basyx.submodel.metamodel.api.ISubModel> submodels, List<? extends org.eclipse.basyx.aas.metamodel.api.parts.asset.IAsset> assets, List<de.iip_ecosphere.platform.support.aas.Aas> result)
    Transforms a list of related aas and submodels to a list of Aas instances of the abstraction.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface de.iip_ecosphere.platform.support.aas.PersistenceRecipe

    readFrom, writeTo
  • Field Details

    • formats

      private List<de.iip_ecosphere.platform.support.FileFormat> formats
  • Constructor Details

    • AbstractPersistenceRecipe

      protected AbstractPersistenceRecipe​(de.iip_ecosphere.platform.support.FileFormat... formats)
      Creates a persistence recipe instance with given file formats.
      Parameters:
      formats - the supported formats
  • Method Details

    • getSupportedFormats

      public Collection<de.iip_ecosphere.platform.support.FileFormat> getSupportedFormats()
      Specified by:
      getSupportedFormats in interface de.iip_ecosphere.platform.support.aas.PersistenceRecipe
    • transform

      protected void transform​(List<? extends org.eclipse.basyx.aas.metamodel.api.IAssetAdministrationShell> aas, List<? extends org.eclipse.basyx.submodel.metamodel.api.ISubModel> submodels, List<? extends org.eclipse.basyx.aas.metamodel.api.parts.asset.IAsset> assets, List<de.iip_ecosphere.platform.support.aas.Aas> result) throws IOException
      Transforms a list of related aas and submodels to a list of Aas instances of the abstraction.
      Parameters:
      aas - the AAS to transform
      submodels - the sub-models to transform/link to aas
      assets - the assets to transform/link to aas
      result - the resulting Aas instances (to be modified as a side effect)
      Throws:
      IOException - in case that something goes wrong
    • addAsset

      protected static <T> void addAsset​(de.iip_ecosphere.platform.support.aas.Aas aas, Collection<T> assetList, Class<T> assetCls)
      Adds the asset from aas to assetList if feasible.
      Type Parameters:
      T - the type of the asset
      Parameters:
      aas - the AAS to take the asset from
      assetList - the asset list to be modified as a side effect
      assetCls - the asset class
      Throws:
      IllegalArgumentException - if the wrong asset instance comes in
      See Also:
      isValidForWriting(IAsset)
    • isValidForWriting

      protected static boolean isValidForWriting​(org.eclipse.basyx.aas.metamodel.api.parts.asset.IAsset asset)
      Returns whether the given asset is valid for writing.
      Parameters:
      asset - the asset to check
      Returns:
      true if valid, false else