Class BaseTLVEditHandler

java.lang.Object
com.onenetwork.platform.data.tlv.BaseTLVEditHandler

public abstract class BaseTLVEditHandler
extends java.lang.Object
Base class for handlers which implement save operations on a Timeline View. Subclasses must implement the #save(DataMeasure) method.
  • Field Details

  • Constructor Details

  • Method Details

    • getParam

      public java.lang.String getParam​(java.lang.String param)
      Returns the value for the given param name
      Parameters:
      param - the param name
      Returns:
      param value
    • setParam

      public void setParam​(java.lang.String param, java.lang.String value)
      Utility method to set the param name and value
      Parameters:
      param - the param name
      value - param value
    • setPlatformUserContext

      public void setPlatformUserContext​(PlatformUserContext platformUserContext)
      Sets the user's context
      Parameters:
      the - user's context
    • getPlatformUserContext

      public PlatformUserContext getPlatformUserContext()
      Returns the user's context
      Returns:
      the user's context
    • save

      public abstract void save​(java.util.List<DataMeasure> dms) throws DMSaveException
      Called when DataMeasure is editable and user hits the save button. DataMeasure will have all the updated values from UI. User can throw DMSaveException to rollback entire transaction and errors will be displayed on UI.

      Please note that only datameasures with one or more modified buckets are passed to this method. By default, if no buckets are modified, this method is not called. To override this behavior and pass all editable DMs to save() even when no buckets are modified, set the saveWithoutMods attribute of EditableTLV to "true" in your TLV xml.

      Parameters:
      dm - editable data measures which were actually modified (or all editable dms if saveWithoutMods = true)
      Throws:
      DMSaveException - can be thrown to rollback the transaction and show an error
    • isEditable

      public boolean isEditable​(DataMeasure dm)
      Provides additional condition for developers to decide whether a data measure should be editable or not. Default implementation returns true. This method is not invoked directly but rather as part of the default implementation of the two argument version. If the other method is overridden, then this method is not automaically called.
      Parameters:
      dm - data measure
      Returns:
      whether the data measure is editable - by default this always returns true
    • isEditable

      public boolean isEditable​(DataMeasure dm, Bucket b)
      Provides additional condition for developers to decide whether a data measure should be editable or not. Default implementation returns isEditable(dm).
      Parameters:
      dm - data measure
      b - bucket
      Returns:
      whether the data measure is editable - by default this always returns true
    • getTimeline

      public Timeline getTimeline()
      Returns the Timeline upon which this handler is operating - set automatically by the framework before calling save(List)
    • setTimeline

      public void setTimeline​(Timeline timeline)
      Parameters:
      the - Timeline upon which this handler is operating - called automatically by the framework before calling save(List)
    • getTimelineViewName

      public java.lang.String getTimelineViewName()
      Returns the name of the timeline upon which this handler is operating. It's set automatically by the framework before calling save(List).
    • setTimelineViewName

      public void setTimelineViewName​(java.lang.String timelineViewName)
      Parameters:
      the - name of the timeline upon which this handler is operating. It's called automatically by the framework before calling save(List).