|
@@ -34,8 +34,10 @@ ConstElementPtr findListOrMapSubSpec(ConstElementPtr spec_part) {
|
|
|
(spec_part->contains("list_item_spec") ||
|
|
|
spec_part->contains("map_item_spec"))) {
|
|
|
if (spec_part->contains("list_item_spec")) {
|
|
|
+ std::cout << "[XX] yup, list" << std::endl;
|
|
|
spec_part = spec_part->get("list_item_spec");
|
|
|
} else {
|
|
|
+ std::cout << "[XX] yup, map" << std::endl;
|
|
|
spec_part = spec_part->get("map_item_spec");
|
|
|
}
|
|
|
}
|
|
@@ -54,6 +56,7 @@ ConstElementPtr findItemInSpecList(ConstElementPtr spec_part,
|
|
|
const std::string& id_full)
|
|
|
{
|
|
|
bool found = false;
|
|
|
+ std::cout << "[XX] find item in list: " << spec_part->str() << std::endl;
|
|
|
BOOST_FOREACH(ConstElementPtr list_el, spec_part->listValue()) {
|
|
|
if (list_el->getType() == Element::map &&
|
|
|
list_el->contains("item_name") &&
|
|
@@ -98,6 +101,7 @@ find_spec_part(ConstElementPtr spec, const std::string& identifier) {
|
|
|
size_t sep = id.find('/');
|
|
|
while(sep != std::string::npos) {
|
|
|
std::string part = id.substr(0, sep);
|
|
|
+ std::cout << "[XX] NEXT IS: " << part << std::endl;
|
|
|
|
|
|
if (spec_part->getType() == Element::list) {
|
|
|
spec_part = findItemInSpecList(spec_part, part, identifier);
|
|
@@ -105,6 +109,7 @@ find_spec_part(ConstElementPtr spec, const std::string& identifier) {
|
|
|
isc_throw(DataNotFoundError,
|
|
|
"Not a list of spec items: " + spec_part->str());
|
|
|
}
|
|
|
+ std::cout << "[XX] FOUND: " << part << std::endl;
|
|
|
id = id.substr(sep + 1);
|
|
|
sep = id.find("/");
|
|
|
|
|
@@ -112,9 +117,11 @@ find_spec_part(ConstElementPtr spec, const std::string& identifier) {
|
|
|
// by the identifier, we want to automatically traverse list
|
|
|
// and map specifications
|
|
|
if (id != "" && id != "/") {
|
|
|
+ std::cout << "[XX] try sublist " << id << std::endl;
|
|
|
spec_part = findListOrMapSubSpec(spec_part);
|
|
|
}
|
|
|
}
|
|
|
+ std::cout << "[XX] LAST: " << id << std::endl;
|
|
|
if (id != "" && id != "/") {
|
|
|
if (spec_part->getType() == Element::list) {
|
|
|
spec_part = findItemInSpecList(spec_part, id, identifier);
|
|
@@ -124,9 +131,12 @@ find_spec_part(ConstElementPtr spec, const std::string& identifier) {
|
|
|
spec_part->get("map_item_spec"),
|
|
|
id, identifier);
|
|
|
} else {
|
|
|
- isc_throw(DataNotFoundError, "Element above " + id +
|
|
|
- " in " + identifier +
|
|
|
- " is not a map: " + spec_part->str());
|
|
|
+ if (!spec_part->contains("item_name") ||
|
|
|
+ spec_part->get("item_name")->stringValue() != id) {
|
|
|
+ isc_throw(DataNotFoundError, "Element above " + id +
|
|
|
+ " in " + identifier +
|
|
|
+ " is not a map: " + spec_part->str());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|