|
ConfigCategories | getAllCategoryNames () const |
| Return all Fledge categories from storage layer. More...
|
|
ConfigCategory | getCategoryAllItems (const std::string &categoryName) const |
| Return all the items of a specific category from the storage layer. More...
|
|
ConfigCategory | createCategory (const std::string &categoryName, const std::string &categoryDescription, const std::string &categoryItems, bool keepOriginalIterms=false) const |
| Create or update a new category. More...
|
|
std::string | getCategoryItem (const std::string &categoryName, const std::string &itemName) const |
| Get a given item within a given category. More...
|
|
bool | setCategoryItemValue (const std::string &categoryName, const std::string &itemName, const std::string &newValue) const |
| Set the "value" entry of a given item within a given category. More...
|
|
std::string | addChildCategory (const std::string &parentCategoryName, const std::string &childCategories) const |
| Add child categories under a given (parent) category. More...
|
|
ConfigCategories | getChildCategories (const std::string &parentCategoryName) const |
| Get all the child categories of a given category name. More...
|
|
std::string | deleteChildCategory (const std::string &parentCategoryName, const std::string &childCategory) const |
| Remove the link between a child category and its parent. More...
|
|
std::string | deleteCategoryItemValue (const std::string &categoryName, const std::string &itemName) const |
| Unset the category item value. More...
|
|
ConfigCategories | deleteCategory (const std::string &categoryName) const |
| Delete a category from database. More...
|
|
std::string | getCategoryItemValue (const std::string &categoryName, const std::string &itemName) const |
| Get the value of a given item within a given category. More...
|
|
◆ addChildCategory()
string ConfigurationManager::addChildCategory |
( |
const std::string & |
parentCategoryName, |
|
|
const std::string & |
childCategories |
|
) |
| const |
Add child categories under a given (parent) category.
- Parameters
-
parentCategoryName | The parent category name |
childCategories | The child categories list (JSON array) |
- Returns
- The JSON string with all (old and new) child categories of the parent category name
- Exceptions
-
Do the insert: we don't check for failed result as we checked parent/child presence above
◆ createCategory()
ConfigCategory ConfigurationManager::createCategory |
( |
const std::string & |
categoryName, |
|
|
const std::string & |
categoryDescription, |
|
|
const std::string & |
categoryItems, |
|
|
bool |
keepOriginalItems = false |
|
) |
| const |
Create or update a new category.
- Parameters
-
categoryName | The category name |
categoryDescription | The category description |
categoryItems | The category items |
keepOriginalItems | Keep stored iterms or replace them |
- Returns
- The ConfigCategory object with "value" and "default" of the new category added or the merged configuration of the updated confguration.
- Exceptions
-
Merge input data with stored data: stored configuration items are merged or replaced accordingly to keepOriginalItems parameter value.
Items "value" are preserved for items being updated, only "default" values are overwritten.
◆ deleteCategory()
ConfigCategories ConfigurationManager::deleteCategory |
( |
const std::string & |
categoryName | ) |
const |
Delete a category from database.
Also remove the link between a child category and its parent.
- Parameters
-
categoryName | The category being deleted |
- Returns
- The remaining config categories as object
- Exceptions
-
◆ deleteCategoryItemValue()
string ConfigurationManager::deleteCategoryItemValue |
( |
const std::string & |
categoryName, |
|
|
const std::string & |
itemName |
|
) |
| const |
Unset the category item value.
- Parameters
-
categoryName | The category name |
itemName | The item name |
- Returns
- JSON string of category item
- Exceptions
-
◆ deleteChildCategory()
string ConfigurationManager::deleteChildCategory |
( |
const std::string & |
parentCategoryName, |
|
|
const std::string & |
childCategory |
|
) |
| const |
Remove the link between a child category and its parent.
The child becomes a root category when the link is broken. Note the child category still exists after this call is made.
- Parameters
-
parentCategoryName | The parennt category |
childCategory | The child category to remove |
- Returns
- JSON array string with remaining child categories
- Exceptions
-
◆ getAllCategoryNames()
Return all Fledge categories from storage layer.
- Returns
- ConfigCategories class object with key and description for all found categories.
- Exceptions
-
◆ getCategoryAllItems()
ConfigCategory ConfigurationManager::getCategoryAllItems |
( |
const std::string & |
categoryName | ) |
const |
Return all the items of a specific category from the storage layer.
- Parameters
-
categoryName | The specified category name |
- Returns
- ConfigCategory calss object with all category items
- Exceptions
-
◆ getCategoryItem()
string ConfigurationManager::getCategoryItem |
( |
const std::string & |
categoryName, |
|
|
const std::string & |
itemName |
|
) |
| const |
Get a given item within a given category.
- Parameters
-
categoryName | The given category |
itemName | The given item |
- Returns
- JSON string with item details
◆ getCategoryItemValue()
string ConfigurationManager::getCategoryItemValue |
( |
const std::string & |
categoryName, |
|
|
const std::string & |
itemName |
|
) |
| const |
Get the value of a given item within a given category.
- Parameters
-
categoryName | The given category |
itemName | The given item |
- Returns
- string with item value
- Exceptions
-
◆ getChildCategories()
ConfigCategories ConfigurationManager::getChildCategories |
( |
const std::string & |
parentCategoryName | ) |
const |
Get all the child categories of a given category name.
- Parameters
-
parentCategoryName | The given category name |
- Returns
- A ConfigCategories object with child categories (name and description)
- Exceptions
-
For each element fetch then category description and add the entry to ConfigCategories result
◆ getInstance()
ConfigurationManager * ConfigurationManager::getInstance |
( |
const std::string & |
, |
|
|
short unsigned |
int |
|
) |
| |
|
static |
Return the singleton instance of the configuration manager.
- Parameters
-
host | Storage layer TCP address |
port | Storage layer TCP port |
- Returns
- The configuration manager class instance
◆ setCategoryItemValue()
bool ConfigurationManager::setCategoryItemValue |
( |
const std::string & |
categoryName, |
|
|
const std::string & |
itemName, |
|
|
const std::string & |
newValue |
|
) |
| const |
Set the "value" entry of a given item within a given category.
- Parameters
-
categoryName | The given category |
itemName | The given item |
newValue | The "value" entry to set |
- Returns
- True on success. False on DB update error or storage layer exception
- Exceptions
-
Check whether newValue is the same as currentValue NOTE: Does it work if newValue represents JSON object istead of a simple value?
The documentation for this class was generated from the following files: