Package com.onenetwork.platform.data.tlv
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 Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.String>
params
protected PlatformUserContext
platformUserContext
protected Timeline
timeline
protected java.lang.String
timelineViewName
-
Constructor Summary
Constructors Constructor Description BaseTLVEditHandler()
-
Method Summary
Modifier and Type Method Description java.lang.String
getParam(java.lang.String param)
Returns the value for the given param namePlatformUserContext
getPlatformUserContext()
Returns the user's contextTimeline
getTimeline()
Returns the Timeline upon which this handler is operating - set automatically by the framework before callingsave(List)
java.lang.String
getTimelineViewName()
Returns the name of the timeline upon which this handler is operating.boolean
isEditable(DataMeasure dm)
Provides additional condition for developers to decide whether a data measure should be editable or not.boolean
isEditable(DataMeasure dm, Bucket b)
Provides additional condition for developers to decide whether a data measure should be editable or not.abstract void
save(java.util.List<DataMeasure> dms)
Called whenDataMeasure
is editable and user hits the save button.void
setParam(java.lang.String param, java.lang.String value)
Utility method to set the param name and valuevoid
setPlatformUserContext(PlatformUserContext platformUserContext)
Sets the user's contextvoid
setTimeline(Timeline timeline)
void
setTimelineViewName(java.lang.String timelineViewName)
-
Field Details
-
platformUserContext
-
params
protected java.util.Map<java.lang.String,java.lang.String> params -
timeline
-
timelineViewName
protected java.lang.String timelineViewName
-
-
Constructor Details
-
BaseTLVEditHandler
public BaseTLVEditHandler()
-
-
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 namevalue
- param value
-
setPlatformUserContext
Sets the user's context- Parameters:
the
- user's context
-
getPlatformUserContext
Returns the user's context- Returns:
- the user's context
-
save
Called whenDataMeasure
is editable and user hits the save button.DataMeasure
will have all the updated values from UI. User can throwDMSaveException
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
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
Provides additional condition for developers to decide whether a data measure should be editable or not. Default implementation returns isEditable(dm).- Parameters:
dm
- data measureb
- bucket- Returns:
- whether the data measure is editable - by default this always returns true
-
getTimeline
Returns the Timeline upon which this handler is operating - set automatically by the framework before callingsave(List)
-
setTimeline
- Parameters:
the
- Timeline upon which this handler is operating - called automatically by the framework before callingsave(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 callingsave(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 callingsave(List)
.
-