Package com.microstrategy.utils
Class DeltaProperties
- java.lang.Object
-
- com.microstrategy.utils.DeltaProperties
-
- All Implemented Interfaces:
java.lang.Cloneable
public class DeltaProperties extends java.lang.Object implements java.lang.Cloneable
This class provides a means to detect property changes such that we can tell exactly which properties have changed from the original values.
This is achieved by using two
Map
collections:original
andmodified
. Various setters and getters simplify property resolution. It also provides a visitor paradigm for traversing the properties, identifying which have changed, and which have not.Initial values are declared using the
initialize
methods. Changes are made using theset
methods.Class is not thread safe.
- Since:
- MicroStrategy Web 9.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DeltaProperties.Visitor
Implement this interface, and use eithervisit(com.microstrategy.utils.DeltaProperties.Visitor, boolean)
orvisitAll(com.microstrategy.utils.DeltaProperties.Visitor)
to traverse the contents of aDeltaProperties
object.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TAG_DELTA_PROPERTIES
-
Constructor Summary
Constructors Constructor Description DeltaProperties()
DeltaProperties(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildXMLState(XMLBuilder builder)
void
clear()
java.lang.Object
clone()
AbstractHandler
createStateHandler()
java.lang.String
get(java.lang.String key)
boolean
getBoolean(java.lang.String key)
int
getInt(java.lang.String key)
int
getInt(java.lang.String key, int dvalue)
java.util.Set<java.lang.String>
getModifiedKeys()
java.lang.String
getName()
void
initialize(java.lang.String key, boolean isTrue)
void
initialize(java.lang.String key, int value)
void
initialize(java.lang.String key, java.lang.String value)
Configures the baseline value.boolean
isModified()
boolean
isModified(java.lang.String key)
void
persistModifications()
Replaces all original values with new modified values.void
set(java.lang.String key, boolean isTrue)
Boolean values are internally stored as "1" for true, and "0" for false.void
set(java.lang.String key, int value)
void
set(java.lang.String key, java.lang.String value)
Properties are key-value pairs.void
visit(DeltaProperties.Visitor v, boolean onlyChangedProperties)
-
-
-
Field Detail
-
TAG_DELTA_PROPERTIES
public static final java.lang.String TAG_DELTA_PROPERTIES
- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
public java.lang.String getName()
-
initialize
public void initialize(java.lang.String key, java.lang.String value)
Configures the baseline value.- Parameters:
key
- name of propertyvalue
- value of property
-
initialize
public void initialize(java.lang.String key, boolean isTrue)
-
initialize
public void initialize(java.lang.String key, int value)
-
clear
public void clear()
-
set
public void set(java.lang.String key, java.lang.String value)
Properties are key-value pairs. Note that the zero length string "" will get converted into null upon save/restore state, so "" and null should be treated as synonymous, i.e. as defined byStringUtils.isEmpty(String)
.- Parameters:
key
- unique name of propertyvalue
- property value
-
get
public java.lang.String get(java.lang.String key)
-
getInt
public int getInt(java.lang.String key)
-
getInt
public int getInt(java.lang.String key, int dvalue)
- Since:
- MicroStrategy Web 9.0.1
-
set
public void set(java.lang.String key, int value)
-
getBoolean
public boolean getBoolean(java.lang.String key)
-
set
public void set(java.lang.String key, boolean isTrue)
Boolean values are internally stored as "1" for true, and "0" for false.
-
isModified
public boolean isModified(java.lang.String key)
-
isModified
public boolean isModified()
-
buildXMLState
public void buildXMLState(XMLBuilder builder)
-
createStateHandler
public AbstractHandler createStateHandler()
-
visit
public void visit(DeltaProperties.Visitor v, boolean onlyChangedProperties)
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
-
persistModifications
public void persistModifications()
Replaces all original values with new modified values. As a result,isModified()
will return false.
-
getModifiedKeys
public java.util.Set<java.lang.String> getModifiedKeys()
- Returns:
- the set of keys that have been flagged as modified.
-
-