Class IvmlDashboardMapper

java.lang.Object
de.iip_ecosphere.platform.configuration.IvmlDashboardMapper

public class IvmlDashboardMapper extends Object
IVML-to-AAS/submodel mapper for dashboard creation with ReGaP/Bitmotec. Not realized as VTL as intended to provide application dashboard submodels also at runtime. May be integrated with the configuration maven build processes or as VTL Java extension.
Author:
Holger Eichelberger, SSE
  • Field Details

    • projectFolder

      private File projectFolder
    • factory

      private de.iip_ecosphere.platform.support.aas.AasFactory factory
    • unitMapping

      private Map<String,Object> unitMapping
    • targetMapping

      private String targetMapping
    • displayRows

      private List<IvmlDashboardMapper.DisplayRow> displayRows
    • appName

      private transient String appName
    • appId

      private transient String appId
    • appVersion

      private transient String appVersion
    • panelCount

      private transient int panelCount
    • aliasType

      private transient net.ssehub.easy.varModel.model.datatypes.IDatatype aliasType
  • Constructor Details

    • IvmlDashboardMapper

      public IvmlDashboardMapper(de.iip_ecosphere.platform.support.aas.AasFactory factory, File projectFolder)
      Creates a mapper instance.
      Parameters:
      factory - the AAS factory to use
  • Method Details

    • clear

      private void clear()
      Clears this instance for reuse.
    • process

      public void process(net.ssehub.easy.varModel.confModel.Configuration cfg, de.iip_ecosphere.platform.support.aas.Aas aas, IvmlDashboardMapper.ResultConsumer consumer) throws net.ssehub.easy.varModel.model.ModelQueryException, ExecutionException
      Processes a given configuration.
      Parameters:
      cfg - the configuration to process
      aas - the AAS to hook the dashboard submodel into, may be null if an AAS shall be created, e.g., for JSON export
      consumer - consumer for the result, may be null
      Throws:
      net.ssehub.easy.varModel.model.ModelQueryException - if accessing the configuration fails
      ExecutionException - if creating AAS parts fails
    • collectDisplayRows

      private List<IvmlDashboardMapper.DisplayRow> collectDisplayRows(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
      Collects the display rows.
      Parameters:
      var - the (application) variable to get the display rows from
      Returns:
      the display rows
    • isNotBlank

      private static boolean isNotBlank(CharSequence text)
      Returns whether text is not blank. Repeated from StringUtils as long as plugin loading for this app is not clear.
      Parameters:
      text - the text to check
      Returns:
      true for blank, false else
    • isBlank

      private static boolean isBlank(CharSequence text)
      Returns whether text is blank. Repeated from StringUtils as long as plugin loading for this app is not clear.
      Parameters:
      text - the text to check
      Returns:
      true for blank, false else
    • createHeader

      private void createHeader(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smB)
      Creates submodel header information.
      Parameters:
      smB - the parent submodel builder
    • createDisplayRows

      private void createDisplayRows(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smB)
      Creates the display rows submodel.
      Parameters:
      smB - the parent submodel builder
    • createDashboardSpec

      private de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder createDashboardSpec(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smB)
      Creates the dashboard specification collection.
      Parameters:
      smB - the parent submodel builder
    • processNode

      private void processNode(IvmlGraphMapper.IvmlGraphNode node, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder panelsB, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder dbsB, Map<String,String> dbMapping)
      Processes an IVML graph node, filters influx connectors and transfers the information into individual panels.
      Parameters:
      node - the node to process
      panelsB - the panels (parent) builder
    • processDb

      private String processDb(net.ssehub.easy.varModel.confModel.IDecisionVariable impl, IvmlDashboardMapper.ConnectorInfo connInfo, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder dbsB)
      Processes a database entry.
      Parameters:
      impl - the service/connector implementation
      connInfo - the connector information
      dbsB - the databases collection builder
      Returns:
      the database uid
    • resolveConnector

      private IvmlDashboardMapper.ConnectorInfo resolveConnector(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
      Resolves connector information.
      Parameters:
      var - the IVML variable representing the connector, may be null
      Returns:
      the resolved connector information, may be null
    • getSemanticId

      private String getSemanticId(net.ssehub.easy.varModel.confModel.IDecisionVariable var, String semanticId)
      Returns a the semantic id from the given var.
      Parameters:
      var - the IVML variable
      semanticId - the actual semantic id (do not overwrite if not null)
      Returns:
      the retrieved semantic id or semanticid
    • resolveType

      private IvmlDashboardMapper.RecordType resolveType(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
      Resolves an IVML type to dashboard relevant information.
      Parameters:
      var - the variable representing the type, may be null
      Returns:
      the resolved information, may be null
    • resolvePanelType

      private String resolvePanelType(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
      Resolves the panel type.
      Parameters:
      var - the variable to take the panel type/display enum from
      Returns:
      the panel type
    • mapSemanticIdToUnit

      private String mapSemanticIdToUnit(String semId)
      Resolves the (inherited/refined) semantic id to a display unit.
      Parameters:
      semId - the semantic id to map
      Returns:
      the mapped semantic id
    • resolveSemanticIdToUnit

      private String resolveSemanticIdToUnit(net.ssehub.easy.varModel.confModel.IDecisionVariable var)
      Resolves the (inherited/refined) semantic id to a display unit.
      Parameters:
      var - the variable to take the type from
      Returns:
      the mapped semantic id
    • processType

      private void processType(IvmlDashboardMapper.RecordType type, IvmlDashboardMapper.ConnectorInfo influx, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder panelsB, String influxDb)
      Turns a resolved record type into AAS.
      Parameters:
      type - the record type, may be null or not qualified for dashbording
      influx - the influx connector information
      panelsB - the parent panels builder
    • processLegend

      private void processLegend(IvmlDashboardMapper.Legend legend, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder panelB)
      Turns a panel legend into AAS.
      Parameters:
      legend - the legend
      panelB - the parent builder
    • processPanelPosition

      private void processPanelPosition(IvmlDashboardMapper.PanelPosition position, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder panelB)
      Turns a panel position into AAS.
      Parameters:
      position - the position
      panelB - the parent builder
    • createProperty

      private void createProperty(de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder parent, String idShort, de.iip_ecosphere.platform.support.aas.Type type, Object value, String description)
      Creates an AAS property.
      Parameters:
      parent - the parent builder
      idShort - the idShort
      type - the property type
      value - the property value, may be null, call is ignored then
      description - the description to be added
    • main

      public static void main(String[] args) throws ExecutionException, IOException
      Performs the dashboard AAS-JSON instantiation.
      Parameters:
      args - command line arguments
      Throws:
      ExecutionException - in case that the VIL instantiation fails, shall not occur here as handled by default PlatformInstantiator.InstantiationConfigurer
      IOException - if files cannot be located/written
    • mainImpl

      private static void mainImpl(String[] args) throws ExecutionException, IOException
      Main functionality without returning exit code/output of help for re-use. Could be with explicit parameters...
      Parameters:
      args - command line arguments
      Throws:
      ExecutionException - in case that the VIL instantiation fails, shall not occur here as handled by default PlatformInstantiator.InstantiationConfigurer
      IOException - if files cannot be located/written
    • getLogger

      private static de.iip_ecosphere.platform.support.logging.Logger getLogger()
      Returns the logger instance.
      Returns:
      the logger instance
    • getAasFactory

      private static de.iip_ecosphere.platform.support.aas.AasFactory getAasFactory(String aasFactoryPluginId)
      Returns the AAS factory to use, based on aasFactoryPluginId.
      Parameters:
      aasFactoryPluginId - the plugin id of the AAS factory to use
      Returns:
      the factory to use