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
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractPersistenceRecipe(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> voidaddAsset(de.iip_ecosphere.platform.support.aas.Aas aas, Collection<T> assetList, Class<T> assetCls)Adds the asset fromaastoassetListif feasible.Collection<de.iip_ecosphere.platform.support.FileFormat>getSupportedFormats()protected static booleanisValidForWriting(org.eclipse.basyx.aas.metamodel.api.parts.asset.IAsset asset)Returns whether the givenassetis valid for writing.protected voidtransform(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 relatedaasandsubmodelsto a list ofAasinstances of the abstraction.
-
Field Details
-
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
- Specified by:
getSupportedFormatsin interfacede.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 IOExceptionTransforms a list of relatedaasandsubmodelsto a list ofAasinstances of the abstraction.- Parameters:
aas- the AAS to transformsubmodels- the sub-models to transform/link toaasassets- the assets to transform/link toaasresult- the resultingAasinstances (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 fromaastoassetListif feasible.- Type Parameters:
T- the type of the asset- Parameters:
aas- the AAS to take the asset fromassetList- the asset list to be modified as a side effectassetCls- 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 givenassetis valid for writing.- Parameters:
asset- the asset to check- Returns:
trueif valid,falseelse
-