[New] Added StrolchElementToJsonVisitor.withBagId()
This commit is contained in:
parent
25f6729621
commit
93ff0f0d02
|
@ -51,6 +51,7 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
|||
private boolean withoutElementName;
|
||||
private boolean withoutObjectType;
|
||||
private boolean withLocator;
|
||||
private boolean withBagId;
|
||||
private boolean withoutVersion;
|
||||
private boolean withoutPolicies;
|
||||
private boolean withoutStateVariables;
|
||||
|
@ -106,6 +107,11 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
|||
return this.withListParametersAsArray;
|
||||
}
|
||||
|
||||
public StrolchElementToJsonVisitor withBagId() {
|
||||
this.withBagId = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public StrolchElementToJsonVisitor withLocator() {
|
||||
this.withLocator = true;
|
||||
return this;
|
||||
|
@ -405,6 +411,8 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
|||
if (isFlat() || isBagFlat(bag)) {
|
||||
|
||||
JsonObject bagJ = new JsonObject();
|
||||
if (this.withBagId)
|
||||
bagJ.addProperty(ID, bag.getId());
|
||||
|
||||
Set<String> ignoredParamIds = this.ignoredKeys.getSet(bag.getId());
|
||||
addParameterBagFlat(bagJ, ignoredParamIds, bag);
|
||||
|
@ -678,7 +686,8 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
|||
JsonObject paramsJ = new JsonObject();
|
||||
bagJ.add(PARAMETERS, paramsJ);
|
||||
|
||||
bag.streamOfParameters().sorted(comparing(Parameter::getIndex))
|
||||
bag.streamOfParameters()
|
||||
.sorted(comparing(Parameter::getIndex))
|
||||
.forEach(param -> paramsJ.add(param.getId(), paramToJsonFull(param)));
|
||||
|
||||
if (this.bagHook != null)
|
||||
|
|
|
@ -54,6 +54,11 @@ public class StrolchRootElementToJsonVisitor implements StrolchRootElementVisito
|
|||
return this::visitActivity;
|
||||
}
|
||||
|
||||
public StrolchRootElementToJsonVisitor withBagId() {
|
||||
this.visitor.withBagId();
|
||||
return this;
|
||||
}
|
||||
|
||||
public StrolchRootElementToJsonVisitor withLocator() {
|
||||
this.visitor.withLocator();
|
||||
return this;
|
||||
|
|
Loading…
Reference in New Issue