Class FWSystemModel

java.lang.Object
net.simplace.pipe.system.FWSystemModel

public class FWSystemModel extends Object
Model of a system of the GUI framework (a group of functions, chart/feature/grid styles and scenarios), read from its system element. The functions can be defined in the element itself or in a separate client configuration (attribute clientconfig, class path resource or file). Scenarios are stored in <cache dir>/<system id>/scenario_config.xml.
Author:
Andreas Enders
  • Constructor Details

    • FWSystemModel

      public FWSystemModel(org.jdom2.Element aSystemElement) throws SystemNotFoundException
      Reads the system element and, if needed, the client configuration.
      Parameters:
      aSystemElement - the system element
      Throws:
      SystemNotFoundException - if the client configuration cannot be found or parsed
  • Method Details

    • clone

      public FWSystemModel clone()
      Overrides:
      clone in class Object
      Returns:
      a new model from the same element with a copy of the parameters, or null if it cannot be created
    • getID

      public String getID()
      Returns:
      the id of the system
    • getParameterMap

      public Map<String,Object> getParameterMap()
      Returns:
      the parameters of the system
    • getFunction

      public FWFunctionalityModel getFunction(String aID)
      Parameters:
      aID - id of the function
      Returns:
      the model of the function (functions/function[@id]), or null
    • getChartStyle

      public ChartStyle getChartStyle(String aKey, net.simplace.core.FWObservable aObservable)
      Parameters:
      aKey - id of the chart style (charts/style[@id])
      aObservable - parameters for the style
      Returns:
      the chart style, or null if not found or invalid
    • getScenarioByName

      public org.jdom2.Element getScenarioByName(String aName)
      Parameters:
      aName - name of the scenario (attribute scenarioname)
      Returns:
      the scenario element, or null
    • getFeatureStyle

      public org.jdom2.Element getFeatureStyle(String aKey)
      Returns a feature style of the system.
      Parameters:
      aKey - id of the style (features/featurestyle[@id])
      Returns:
      the style element, or null
    • getGridStyle

      public org.jdom2.Element getGridStyle(String aKey)
      Returns a grid style of the system.
      Parameters:
      aKey - id of the style (grids/gridstyle[@id])
      Returns:
      the style element, or null
    • getStartFunctionModel

      public FWFunctionalityModel getStartFunctionModel()
      Returns:
      the model of the function <system id>.start, or null
    • getRemoveFunctionModel

      public FWFunctionalityModel getRemoveFunctionModel()
      Returns:
      the model of the function <system id>.remove, or null
    • getScenarioFunctionModel

      public FWFunctionalityModel getScenarioFunctionModel()
      Returns:
      the model of the function <system id>.scenario (or .start), or null
    • getResultsFunctionModel

      public FWFunctionalityModel getResultsFunctionModel()
      Returns:
      the model of the function <system id>.results, or null
    • getOID

      public String getOID()
      Returns:
      the object id of the system (currently always null)
    • getRessourcPartList

      public List<String> getRessourcPartList()
      Returns:
      the resource parts of the system
    • getClientConfigName

      public String getClientConfigName()
      Returns:
      the name of the client configuration, or null
    • getInfoLocation

      public String getInfoLocation()
      Returns:
      the URL leading to Infos to the System
    • getClientConfigElement

      public void getClientConfigElement() throws SystemNotFoundException
      Replaces the system element by the client configuration (class path resource or file), if one is given and the system element has no functions; id and info attribute are kept.
      Throws:
      SystemNotFoundException - if the client configuration cannot be found or parsed
    • initScenarioConfig

      public void initScenarioConfig()
      Loads the scenario configuration from the cache directory (or creates an empty one) and fills the scenario map by OID (attribute OID or parameter OID/scenarioOID); does nothing if scenarios are already loaded.
    • getScenarioCount

      public int getScenarioCount()
      Returns:
      the number of scenarios in system
    • saveScenarioConfig

      public void saveScenarioConfig()
      Writes the scenario configuration to <cache dir>/<system id>/scenario_config.xml.
    • saveScenario

      public void saveScenario(Map<String,Object> aParameterMap) throws AlreadyExistingException
      Creates a scenario from the parameters (OID from scenarioOID or new, name and description from scenarioname/scenariodesc with tokens replaced, current date) and adds it.
      Parameters:
      aParameterMap - parameters of the scenario
      Throws:
      AlreadyExistingException - if a scenario with the OID exists
    • removeScenario

      public void removeScenario(String aOID)
      Removes a scenario, runs the remove function of the system (if any), saves the configuration and updates the scenario tree.
      Parameters:
      aOID - OID of the scenario
    • getScenarioMap

      public Map<String,Object> getScenarioMap()
      Returns:
      the scenario elements by OID (loaded if necessary)
    • doesScenarioNameExist

      public boolean doesScenarioNameExist(String aName)
      Parameters:
      aName - scenario name
      Returns:
      true if a scenario with this name exists