java.lang.Object
org.gcube.informationsystem.resourceregistry.persistence.orientdb.statistics.StatisticsConfigurationStore

public class StatisticsConfigurationStore extends Object
The configuration of the public statistics, one record of the class "StatisticsConfiguration" in the database of the registry, read at every computation so that a change shows at the next one, with no restart: today the label of each depth of the Context tree, in a long form ("depthLabels", depth → label) and a short one ("depthShortLabels"). The database migration creates the class and the record with the default labels (ensure(ODatabaseDocument)); an operator changes them with UPDATE StatisticsConfiguration SET depthLabels = {"1": "...", ...}, depthShortLabels = {"1": "...", ...} WHERE id = "statistics".
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • CONFIGURATION_CLASS

      public static final String CONFIGURATION_CLASS
      The class of the record.
      See Also:
    • ID_PROPERTY

      public static final String ID_PROPERTY
      The property identifying the record.
      See Also:
    • CONFIGURATION_ID

      public static final String CONFIGURATION_ID
      The id of the one record.
      See Also:
    • DEPTH_LABELS_PROPERTY

      public static final String DEPTH_LABELS_PROPERTY
      The property holding the long label of each depth.
      See Also:
    • DEPTH_SHORT_LABELS_PROPERTY

      public static final String DEPTH_SHORT_LABELS_PROPERTY
      The property holding the short label of each depth.
      See Also:
    • DEFAULT_DEPTH_LABELS

      public static final Map<String,String> DEFAULT_DEPTH_LABELS
      The long labels the migration writes, the levels of a D4Science infrastructure.
    • DEFAULT_DEPTH_SHORT_LABELS

      public static final Map<String,String> DEFAULT_DEPTH_SHORT_LABELS
      The short labels the migration writes.
  • Constructor Details

    • StatisticsConfigurationStore

      public StatisticsConfigurationStore()
  • Method Details

    • ensure

      public void ensure(com.orientechnologies.orient.core.db.document.ODatabaseDocument session)
      Creates the class and the record when they are missing, and gives the record the default labels of each property it does not have. Labels already in the record are kept, so running it again changes nothing.
      Parameters:
      session - an administrative session able to change the schema
    • depthLabels

      public Map<String,String> depthLabels() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Reads the long label of each depth.
      Returns:
      the labels, depth (as text) → label; empty when the record or the property is missing
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database cannot be read
    • depthShortLabels

      public Map<String,String> depthShortLabels() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Reads the short label of each depth.
      Returns:
      the labels, depth (as text) → label; empty when the record or the property is missing
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the database cannot be read