[Minor] added function for ignoring paramBags by type

This commit is contained in:
Reto Breitenmoser 2018-01-21 18:18:34 +01:00
parent 00e41fdc4a
commit ab0930eec8
1 changed files with 9 additions and 0 deletions

View File

@ -45,6 +45,7 @@ public class StrolchElementToJsonVisitor
private MapOfSets<String, String> ignoredKeys;
private Set<String> ignoredStates;
private Set<String> ignoredBagTypes;
private BiConsumer<Resource, JsonObject> resourceHook;
private BiConsumer<Order, JsonObject> orderHook;
@ -60,6 +61,7 @@ public class StrolchElementToJsonVisitor
public StrolchElementToJsonVisitor() {
this.ignoredKeys = new MapOfSets<>();
this.ignoredStates = new HashSet<>();
this.ignoredBagTypes = new HashSet<>();
}
public boolean isFlat() {
@ -112,6 +114,11 @@ public class StrolchElementToJsonVisitor
this.ignoredKeys.addElement(bagId, paramId);
return this;
}
public StrolchElementToJsonVisitor ignoreBagParameterTyp(String type) {
this.ignoredBagTypes.add(type);
return this;
}
public StrolchElementToJsonVisitor resourceHook(BiConsumer<Resource, JsonObject> hook) {
this.resourceHook = hook;
@ -335,6 +342,8 @@ public class StrolchElementToJsonVisitor
continue;
ParameterBag parameterBag = element.getParameterBag(bagId);
if(ignoredBagTypes.contains(parameterBag.getType()))
continue;
Set<String> parameterKeySet = parameterBag.getParameterKeySet();
for (String paramId : parameterKeySet) {