[Fix] Fix version loading from PostgreSql with Json
This commit is contained in:
parent
0bcdbe1f5d
commit
20eec25137
|
@ -41,7 +41,7 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
||||||
|
|
||||||
private boolean flat;
|
private boolean flat;
|
||||||
private boolean withoutElementName;
|
private boolean withoutElementName;
|
||||||
private boolean withVersion;
|
private boolean withoutVersion;
|
||||||
private boolean withoutPolicies;
|
private boolean withoutPolicies;
|
||||||
private int activityDepth = Integer.MAX_VALUE;
|
private int activityDepth = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
@ -56,7 +56,11 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWithVersion() {
|
public boolean isWithVersion() {
|
||||||
return this.withVersion;
|
return !this.withoutVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWithoutVersion() {
|
||||||
|
return this.withoutVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWithoutElementName() {
|
public boolean isWithoutElementName() {
|
||||||
|
@ -68,7 +72,12 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
||||||
}
|
}
|
||||||
|
|
||||||
public StrolchElementToJsonVisitor withVersion() {
|
public StrolchElementToJsonVisitor withVersion() {
|
||||||
this.withVersion = true;
|
this.withoutVersion = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StrolchElementToJsonVisitor withoutVersion() {
|
||||||
|
this.withoutVersion = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,7 +654,7 @@ public class StrolchElementToJsonVisitor implements StrolchElementVisitor<JsonEl
|
||||||
protected void addVersion(StrolchRootElement element, JsonObject rootJ) {
|
protected void addVersion(StrolchRootElement element, JsonObject rootJ) {
|
||||||
if (!element.hasVersion())
|
if (!element.hasVersion())
|
||||||
return;
|
return;
|
||||||
if (!isWithVersion())
|
if (isWithoutVersion())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Version version = element.getVersion();
|
Version version = element.getVersion();
|
||||||
|
|
|
@ -53,6 +53,11 @@ public class StrolchRootElementToJsonVisitor implements StrolchRootElementVisito
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StrolchRootElementToJsonVisitor withoutVersion() {
|
||||||
|
this.visitor.withoutVersion();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public StrolchRootElementToJsonVisitor withoutElementName() {
|
public StrolchRootElementToJsonVisitor withoutElementName() {
|
||||||
this.visitor.withoutElementName();
|
this.visitor.withoutElementName();
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class ModelToJsonTest extends ModelMarshallingTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Order formatAndParseOrder(Order order) {
|
protected Order formatAndParseOrder(Order order) {
|
||||||
StrolchRootElementToJsonVisitor jsonVisitor = new StrolchRootElementToJsonVisitor().withVersion();
|
StrolchRootElementToJsonVisitor jsonVisitor = new StrolchRootElementToJsonVisitor();
|
||||||
JsonObject jsonObject = order.accept(jsonVisitor).getAsJsonObject();
|
JsonObject jsonObject = order.accept(jsonVisitor).getAsJsonObject();
|
||||||
|
|
||||||
Order parsedOrder = new OrderFromJsonVisitor().visit(jsonObject);
|
Order parsedOrder = new OrderFromJsonVisitor().visit(jsonObject);
|
||||||
|
@ -47,7 +47,7 @@ public class ModelToJsonTest extends ModelMarshallingTest {
|
||||||
@Override
|
@Override
|
||||||
protected Resource formatAndParseResource(Resource resource) {
|
protected Resource formatAndParseResource(Resource resource) {
|
||||||
|
|
||||||
StrolchRootElementToJsonVisitor jsonVisitor = new StrolchRootElementToJsonVisitor().withVersion();
|
StrolchRootElementToJsonVisitor jsonVisitor = new StrolchRootElementToJsonVisitor();
|
||||||
JsonObject jsonObject = resource.accept(jsonVisitor).getAsJsonObject();
|
JsonObject jsonObject = resource.accept(jsonVisitor).getAsJsonObject();
|
||||||
|
|
||||||
Resource parsedResource = new ResourceFromJsonVisitor().visit(jsonObject);
|
Resource parsedResource = new ResourceFromJsonVisitor().visit(jsonObject);
|
||||||
|
@ -62,7 +62,7 @@ public class ModelToJsonTest extends ModelMarshallingTest {
|
||||||
@Override
|
@Override
|
||||||
protected Activity formatAndParseActivity(Activity activity) {
|
protected Activity formatAndParseActivity(Activity activity) {
|
||||||
|
|
||||||
StrolchRootElementToJsonVisitor jsonVisitor = new StrolchRootElementToJsonVisitor().withVersion();
|
StrolchRootElementToJsonVisitor jsonVisitor = new StrolchRootElementToJsonVisitor();
|
||||||
JsonObject jsonObject = activity.accept(jsonVisitor).getAsJsonObject();
|
JsonObject jsonObject = activity.accept(jsonVisitor).getAsJsonObject();
|
||||||
|
|
||||||
Activity parsedActivity = new ActivityFromJsonVisitor().visit(jsonObject);
|
Activity parsedActivity = new ActivityFromJsonVisitor().visit(jsonObject);
|
||||||
|
|
|
@ -415,7 +415,7 @@ public class Inspector {
|
||||||
// build JSON response
|
// build JSON response
|
||||||
ResourceVisitor<JsonObject> visitor;
|
ResourceVisitor<JsonObject> visitor;
|
||||||
if (overview == null || !overview) {
|
if (overview == null || !overview) {
|
||||||
visitor = new StrolchRootElementToJsonVisitor().withVersion().asResourceVisitor();
|
visitor = new StrolchRootElementToJsonVisitor().asResourceVisitor();
|
||||||
} else {
|
} else {
|
||||||
visitor = e -> {
|
visitor = e -> {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
@ -459,7 +459,7 @@ public class Inspector {
|
||||||
// build JSON response
|
// build JSON response
|
||||||
OrderVisitor<JsonObject> visitor;
|
OrderVisitor<JsonObject> visitor;
|
||||||
if (overview == null || !overview) {
|
if (overview == null || !overview) {
|
||||||
visitor = new StrolchRootElementToJsonVisitor().withVersion().asOrderVisitor();
|
visitor = new StrolchRootElementToJsonVisitor().asOrderVisitor();
|
||||||
} else {
|
} else {
|
||||||
visitor = e -> {
|
visitor = e -> {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
@ -505,7 +505,7 @@ public class Inspector {
|
||||||
// build JSON response
|
// build JSON response
|
||||||
ActivityVisitor<JsonObject> visitor;
|
ActivityVisitor<JsonObject> visitor;
|
||||||
if (overview == null || !overview) {
|
if (overview == null || !overview) {
|
||||||
visitor = new StrolchRootElementToJsonVisitor().withVersion().asActivityVisitor();
|
visitor = new StrolchRootElementToJsonVisitor().asActivityVisitor();
|
||||||
} else {
|
} else {
|
||||||
visitor = e -> {
|
visitor = e -> {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
|
Loading…
Reference in New Issue