boost::algorithm::to_lower(attr);
if (query->Contains(attr)) {
- String name = query->Get(attr);
+ String name = HttpUtility::GetLastParameter(query, attr);
DynamicObject::Ptr obj = GetObjectByTypeAndName(type->GetName(), name);
if (!obj)
BOOST_THROW_EXCEPTION(std::invalid_argument("Object does not exist."));
if (query->Contains(attr)) {
Array::Ptr names = query->Get(attr);
- ObjectLock olock(names);
- BOOST_FOREACH(const String& name, names) {
- DynamicObject::Ptr obj = GetObjectByTypeAndName(type->GetName(), name);
- if (!obj)
- BOOST_THROW_EXCEPTION(std::invalid_argument("Object does not exist."));
- result.push_back(obj);
+ if (names) {
+ ObjectLock olock(names);
+ BOOST_FOREACH(const String& name, names) {
+ DynamicObject::Ptr obj = GetObjectByTypeAndName(type->GetName(), name);
+ if (!obj)
+ BOOST_THROW_EXCEPTION(std::invalid_argument("Object does not exist."));
+ result.push_back(obj);
+ }
}
}
}
- if (query->Contains("filter")) {
+ if (query->Contains("filter") || result.empty()) {
if (!query->Contains("type"))
BOOST_THROW_EXCEPTION(std::invalid_argument("Type must be specified when using a filter."));
- String filter = HttpUtility::GetLastParameter(query, "filter");
+ String filter;
+ if (!query->Contains("filter"))
+ filter = "true";
+ else
+ filter = HttpUtility::GetLastParameter(query, "filter");
+
String type = HttpUtility::GetLastParameter(query, "type");
Log(LogInformation, "FilterUtility", filter);
String attr = type->GetName();
boost::algorithm::to_lower(attr);
params->Set(attr, request.RequestUrl->GetPath()[2]);
- } else if (!params->Contains("filter")) {
- params->Set("filter", "true");
}
std::vector<DynamicObject::Ptr> objs = FilterUtility::GetFilterTargets(qd, params);
Dictionary::Ptr result1 = new Dictionary();
for (int fid = 0; fid < type->GetFieldCount(); fid++) {
Field field = type->GetFieldInfo(fid);
-
- if ((field.Attributes & (FAConfig|FAState)) == 0)
- continue;
-
String aname = prefix + "." + field.Name;
if (!attrs.empty() && attrs.find(aname) == attrs.end())
continue;