|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.app.Listener
danger.app.SettingsDB
danger.app.CategoryDB
public class CategoryDB
Application interface to the CategoryDB class This class is used for managing categories, or folders. The category data is a key value pair. The key is the category name, and the value is an unique id assigned for that category. CategoryDB extends SettingsDB and uses SettingsDB's base implementation to manipulate the data.
| Field Summary | |
|---|---|
static boolean |
SORT_CATEGORIES
|
| Fields inherited from class danger.app.SettingsDB |
|---|
DATA_TYPE_BYTES, DATA_TYPE_INTEGER, DATA_TYPE_STRING, DEBUG_CONFLICT_RESOLVE, DEBUG_CONFLICT_RESOLVE_VERBOSE, DEBUG_SORT, DEFAULT_SETTING, IS_DEBUG, mDataStore |
| Constructor Summary | |
|---|---|
CategoryDB(String dbName)
Create or get a CategoryDB. |
|
CategoryDB(String dbName,
boolean autoSync)
Create or get a CategoryDB. |
|
| Method Summary | |
|---|---|
int |
addCategory(String inCategoryName)
Add the category name to the CategoryDB. |
void |
dumpStats()
Dump the CategoryDB data. |
boolean |
editCategory(int i,
String inName)
Edit the category name for index i Edit the category name for index i |
int |
find(String categoryName)
Find and return the index for a category in the database. |
protected int |
find2(String categoryName)
Find and return the index for a category in the database. |
String |
getCategory(int i)
Gets the category by index. |
String |
getCategoryByID(int id)
Gets the categoryDB name for a given category id. |
int |
getCategoryFlags(int i)
Gets the category flag by index. |
int |
getCategoryID(int i)
Gets the category unique ID for a given index. |
int |
getCategoryIndexByID(int id)
Gets the categoryDB index for a given category id. |
boolean |
getSortCategories()
Checks whether or not the categories are sorted. |
int |
numCategories()
Returns the number of categories. |
boolean |
receiveEvent(Event e)
Receive a CategoryDB related event. |
boolean |
removeCategory(int i)
Remove the category for index i Remove the category for index i |
protected void |
resolveAllRecords()
Resolves each record with every other record in the CategoryDB database. |
protected void |
resolveAutoSyncConflicts()
Resolves potential conflicts caused by auto-syncing the data from Danger service. |
void |
setAutoSyncNotifyee(Listener inNotifyee)
Sets the notifyee when autosync conflict resolution is done. |
void |
setCategoryFlags(int i,
int flag)
Sets the category flag by index. |
void |
setSortCategories(boolean flag)
Sets the option to sort the categories or not. |
protected void |
sort()
Sort by category names Sort by category names only if getSortCategories() return true. |
| Methods inherited from class danger.app.SettingsDB |
|---|
clearAll, dump, findDB, findDB, getBytes, getBytes, getDataType, getIntValue, getIntValue, getKey, getNumEntries, getObject, getStringValue, getStringValue, registerAutoSyncBundleListener, remove, renameKey, renameKey, setBytes, setBytes, setIntValue, setIntValue, setObject, setObject, setStringValue, setStringValue |
| Methods inherited from class danger.app.Listener |
|---|
cancelEvents, childEventPump, childEventPumpDone, eventProblem, isDispatchingThread, receiveEventInternal, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendLowPriorityEvent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final boolean SORT_CATEGORIES
| Constructor Detail |
|---|
public CategoryDB(String dbName,
boolean autoSync)
dbName - A String specifying the name of the CategoryDB database.autoSync - A boolean that is true if the database is to be backed up to the service.public CategoryDB(String dbName)
dbName - A String specifying the name of the CategoryDB database.| Method Detail |
|---|
public boolean receiveEvent(Event e)
receiveEvent in class SettingsDBe - an Event object containing the event type and data.
public void setSortCategories(boolean flag)
flag - a Boolean specifying whether to sort the categories.public boolean getSortCategories()
public int numCategories()
public int find(String categoryName)
find in class SettingsDBcategoryName - the category name.
protected int find2(String categoryName)
find2 in class SettingsDBcategoryName - A String specifying the key for the record.
public String getCategory(int i)
i - the index of the category to be retrieved.
public int getCategoryFlags(int i)
public void setCategoryFlags(int i,
int flag)
i - the index of the category flag to be set.flag - the flag to be set.public int getCategoryID(int i)
i - the index of the category ID to be retrieved.
public int getCategoryIndexByID(int id)
id - the category id of the index to be retrieved.
public String getCategoryByID(int id)
id - the category id of the index to be retrieved.
public int addCategory(String inCategoryName)
inCategoryName - the category to be added.
public boolean editCategory(int i,
String inName)
i - the index of the category to be edited.inName - the category to be added.
public boolean removeCategory(int i)
i - the index of the category to be removed.
protected void sort()
sort in class SettingsDBprotected void resolveAllRecords()
resolveAllRecords in class SettingsDBprotected void resolveAutoSyncConflicts()
resolveAutoSyncConflicts in class SettingsDBpublic void setAutoSyncNotifyee(Listener inNotifyee)
setAutoSyncNotifyee in class SettingsDBinNotifyee - The listener to be notified of the autosync events.public void dumpStats()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||