ORABaseDataContainer Class Referenceabstract

Inherited by ORACoreDataContainer.

Public Member Functions

  ORABaseDataContainer (Context context)
abstract String  getModuleID ()
abstract IORAConfigSetting  getConfig (String key)
boolean  putValue (IORAConfigSetting key, String value)
String  getValue (IORAConfigSetting key)
void  loadConfig (Map<? extends IORAConfigSetting, String > settingsMap, int newVersion)
void  loadFromConfigFile ()

Detailed Description

ORABaseDataContainer is the central abstract class. Its central purpose is to save and retrieve Config data. Since its an abstract class, we can't use it without subclassing. So to use the methods mentioned in the class, we need to subclass it and override getModuleId method. In the implementation of getModuleId method, just return the module id which is provided via documentation.

Constructor & Destructor Documentation

◆ ORABaseDataContainer()

ORABaseDataContainer ( Context  context )

Constructor

Parameters
context context

Member Function Documentation

◆ getConfig()

abstract IORAConfigSetting getConfig ( String  key )
abstract

Necessary method to implement. This method should return the IORAConfigSetting for the key

Parameters
key key of the config
Returns
IORAConfigSetting config for the key

◆ getModuleID()

abstract String getModuleID ( )
abstract

Necessary method to implement and return Module id

Returns
String which is module id to to determine the identifier for the module
Attention
If this value is empty or null, calling other methods will throw ORAModuleIDException.

◆ getValue()

String getValue ( IORAConfigSetting  key )

Used to retrieve key and value from storage layer.

Throws ORAModuleIDException if getModuleID() is not implemented.

Parameters
key is the key to store.
Returns
ORAConfigSettings object. If the key already exist in store, returns its value. If key is not there in store previously, then it returns default value.

◆ loadConfig()

void loadConfig ( Map<? extends IORAConfigSetting, String >  settingsMap,
int  newVersion 
)
Parameters
settingsMap
newVersion this should be greater than 0.
Deprecated:
replaced by loadFromConfigFile() This method loads bulk data into store. And this is the one time operation While loading it will check for the version. If the newVersion is greater than existing version then only it will store the data. Default version code id 0. So to loadConfig new config need to pass the value greater than 0(Start with 1). Increase the newVersion number if you want to modify existing config or addRequest new config. This method is useful to store the default / mandatory config. This can be called in android.app.Application class. To set individual config at run time refer ORABaseDataContainer::putValue()

Throws ORAModuleIDException if getModuleID() is not implemented.

◆ loadFromConfigFile()

void loadFromConfigFile ( )

Call this method to read the configuration file from assets and store.

It will throw ORARuntimeException if oracle.json is not present in assets folder, or the oracle.json contains invalid json text.

◆ putValue()

boolean putValue ( IORAConfigSetting  key,
String  value 
)

Used to store key and value in storage layer. This method is to store individual configs. To store multiple configs at a time, refer loadFromConfigFile()

Throws ORAModuleIDException if getModuleID() is not implemented.

Parameters
key is the key to store.
value is the value to store.
Returns
true if stored successfully and false if storing failed.
 
The documentation for this class was generated from the following file:
  • ORABaseDataContainer.java