[New] Added withoutStateVariables to StrolchElementToJsonVisitor

This commit is contained in:
Robert von Burg 2019-06-11 12:21:35 +02:00
parent bd5dbc2e5e
commit 6d216b6f58
2 changed files with 18 additions and 0 deletions

View File

@ -48,6 +48,7 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
private boolean withLocator;
private boolean withoutVersion;
private boolean withoutPolicies;
private boolean withoutStateVariables;
private int activityDepth = Integer.MAX_VALUE;
public StrolchElementToJsonVisitor() {
@ -85,6 +86,10 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
return this.withoutPolicies;
}
public boolean isWithoutStateVariables() {
return this.withoutStateVariables;
}
public StrolchElementToJsonVisitor withLocator() {
this.withLocator = true;
return this;
@ -120,6 +125,11 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
return this;
}
public StrolchElementToJsonVisitor withoutStateVariables() {
this.withoutStateVariables = true;
return this;
}
public StrolchElementToJsonVisitor activityDepth(int depth) {
this.activityDepth = depth;
return this;
@ -611,6 +621,9 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
}
protected void addStates(Resource resource, JsonObject rootJ) {
if (isWithoutStateVariables())
return;
if (isFlat())
addTimedStatesFlat(resource, rootJ);
else

View File

@ -78,6 +78,11 @@ public class StrolchRootElementToJsonVisitor implements StrolchRootElementVisito
return this;
}
public StrolchRootElementToJsonVisitor withoutStateVariables() {
this.visitor.withoutStateVariables();
return this;
}
public StrolchRootElementToJsonVisitor withPolicies() {
this.visitor.withPolicies();
return this;