[Fix] validate type with type, not objectType in FromFlatJsonVisitor
This commit is contained in:
parent
710a989ce5
commit
ec4d7d6146
|
@ -6,7 +6,10 @@ import java.util.Set;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import li.strolch.exception.StrolchModelException;
|
import li.strolch.exception.StrolchModelException;
|
||||||
import li.strolch.model.*;
|
import li.strolch.model.Order;
|
||||||
|
import li.strolch.model.ParameterBag;
|
||||||
|
import li.strolch.model.Resource;
|
||||||
|
import li.strolch.model.StrolchRootElement;
|
||||||
import li.strolch.model.Tags.Json;
|
import li.strolch.model.Tags.Json;
|
||||||
import li.strolch.model.activity.Activity;
|
import li.strolch.model.activity.Activity;
|
||||||
import li.strolch.model.parameter.Parameter;
|
import li.strolch.model.parameter.Parameter;
|
||||||
|
@ -20,8 +23,8 @@ import li.strolch.utils.dbc.DBC;
|
||||||
* iterated and expected to be found as a member on the {@link JsonObject}.
|
* iterated and expected to be found as a member on the {@link JsonObject}.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* To ignore {@link Parameter Parameters} or {@link ParameterBag ParameterBags} use the
|
* To ignore {@link Parameter Parameters} or {@link ParameterBag ParameterBags} use the {@link #ignoreParameter(String,
|
||||||
* {@link #ignoreParameter(String, String)} and {@link #ignoreBag(String)} methods
|
* * String)} and {@link #ignoreBag(String)} methods
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* {@link Parameter} can be made optional by using the {@link #optionalParameter(String, String)} method
|
* {@link Parameter} can be made optional by using the {@link #optionalParameter(String, String)} method
|
||||||
|
@ -111,12 +114,12 @@ public class FromFlatJsonVisitor implements StrolchRootElementVisitor<Void> {
|
||||||
|
|
||||||
// types must be the same, if exists on source element
|
// types must be the same, if exists on source element
|
||||||
if (this.srcObject.has(Json.TYPE))
|
if (this.srcObject.has(Json.TYPE))
|
||||||
DBC.PRE.assertEquals("type must be the same!", dstElement.getObjectType(),
|
DBC.PRE.assertEquals("type must be the same!", dstElement.getType(),
|
||||||
this.srcObject.get(Json.TYPE).getAsString());
|
this.srcObject.get(Json.TYPE).getAsString());
|
||||||
|
|
||||||
// update name if possible
|
// update name if possible
|
||||||
if (this.srcObject.has(Json.NAME))
|
if (this.srcObject.has(Json.NAME))
|
||||||
dstElement.setName(srcObject.get(Json.NAME).getAsString());
|
dstElement.setName(this.srcObject.get(Json.NAME).getAsString());
|
||||||
|
|
||||||
Set<String> bagKeySet = dstElement.getParameterBagKeySet();
|
Set<String> bagKeySet = dstElement.getParameterBagKeySet();
|
||||||
for (String bagId : bagKeySet) {
|
for (String bagId : bagKeySet) {
|
||||||
|
|
Loading…
Reference in New Issue