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