Skip to content
Snippets Groups Projects
Commit 7239c5e9 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

when returning elements type can be comma separated list

parent 772cf071
No related branches found
No related tags found
1 merge request!58some refactoring giving additional Rest API functionlaity
......@@ -47,6 +47,13 @@ public class ElementsRestImpl extends BaseRestImpl {
ids.add(Integer.valueOf(str));
}
}
Set<String> types = new HashSet<>();
if (!type.isEmpty()) {
for (String str : type.split(",")) {
types.add(str.toLowerCase());
}
}
Set<String> columnsSet = createElementColumnSet(columns);
List<Map<String, Object>> result = new ArrayList<>();
......@@ -56,7 +63,7 @@ public class ElementsRestImpl extends BaseRestImpl {
for (Model model2 : models) {
for (Element element : model2.getElements()) {
if (ids.size() == 0 || ids.contains(element.getId())) {
if (type.isEmpty() || element.getStringType().equalsIgnoreCase(type)) {
if (types.size() == 0 || types.contains(element.getStringType().toLowerCase())) {
result.add(preparedElement(element, columnsSet));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment