Refactored due to is-model constant name change
This commit is contained in:
parent
ff68eb6f28
commit
8a23d5898b
|
@ -139,8 +139,8 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
|||
this.accessType = accessType;
|
||||
|
||||
this.ignoreKeys = new HashSet<String>();
|
||||
this.ignoreKeys.add(Element.CLASS_PROPERTY);
|
||||
this.ignoreKeys.add(Element.SUPERCLASSES_PROPERTY);
|
||||
this.ignoreKeys.add(Element.TYPE_PROPERTY);
|
||||
this.ignoreKeys.add(Element.SUPERTYPES_PROPERTY);
|
||||
this.ignoreKeys.add(IdentifiableElement.UUID_PROPERTY);
|
||||
this.ignoreKeys.add(IdentifiableElement.METADATA_PROPERTY);
|
||||
|
||||
|
@ -395,12 +395,12 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
|||
}
|
||||
}
|
||||
|
||||
objectNode.put(Element.CLASS_PROPERTY, getTypeName());
|
||||
objectNode.put(Element.TYPE_PROPERTY, getTypeName());
|
||||
|
||||
Collection<String> superClasses = getCachedType().getSuperTypes();
|
||||
ArrayNode arrayNode = objectMapper.valueToTree(superClasses);
|
||||
|
||||
objectNode.replace(Element.SUPERCLASSES_PROPERTY, arrayNode);
|
||||
objectNode.replace(Element.SUPERTYPES_PROPERTY, arrayNode);
|
||||
|
||||
return objectNode;
|
||||
} catch(ResourceRegistryException e) {
|
||||
|
@ -1152,7 +1152,7 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
|||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
Collection<String> superClasses = metadataType.getSuperTypes();
|
||||
ArrayNode arrayNode = objectMapper.valueToTree(superClasses);
|
||||
((ObjectNode) metadataJson).replace(Element.SUPERCLASSES_PROPERTY, arrayNode);
|
||||
((ObjectNode) metadataJson).replace(Element.SUPERTYPES_PROPERTY, arrayNode);
|
||||
|
||||
return metadataJson;
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ public class PropertyElementManagement {
|
|||
|
||||
JsonNode jsonNode = jsonNodeOrig.deepCopy();
|
||||
|
||||
if(jsonNode.has(Element.SUPERCLASSES_PROPERTY)) {
|
||||
((ObjectNode) jsonNode).remove(Element.SUPERCLASSES_PROPERTY);
|
||||
if(jsonNode.has(Element.SUPERTYPES_PROPERTY)) {
|
||||
((ObjectNode) jsonNode).remove(Element.SUPERTYPES_PROPERTY);
|
||||
}
|
||||
|
||||
String type = TypeUtility.getTypeName(jsonNode);
|
||||
|
@ -161,7 +161,7 @@ public class PropertyElementManagement {
|
|||
|
||||
Collection<String> superClasses = cachedType.getSuperTypes();
|
||||
ArrayNode arrayNode = objectMapper.valueToTree(superClasses);
|
||||
((ObjectNode) jsonNode).replace(Element.SUPERCLASSES_PROPERTY, arrayNode);
|
||||
((ObjectNode) jsonNode).replace(Element.SUPERTYPES_PROPERTY, arrayNode);
|
||||
|
||||
/*
|
||||
* In case it is an Encrypted type the value is encrypted with the DB Key
|
||||
|
|
|
@ -49,8 +49,8 @@ public abstract class JsonQueryERElement {
|
|||
this.entryPoint = false;
|
||||
|
||||
this.fieldNamesToRemove = new HashSet<>();
|
||||
this.fieldNamesToRemove.add(Element.CLASS_PROPERTY);
|
||||
this.fieldNamesToRemove.add(Element.SUPERCLASSES_PROPERTY);
|
||||
this.fieldNamesToRemove.add(Element.TYPE_PROPERTY);
|
||||
this.fieldNamesToRemove.add(Element.SUPERTYPES_PROPERTY);
|
||||
|
||||
validateType(this.type, this.accessType);
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ public class MetadataUtility {
|
|||
return null;
|
||||
}
|
||||
MetadataOrient metadata = new MetadataOrient();
|
||||
metadataNode.set(OrientDBUtility.ORIENTDB_CLASS_PROPERTY, metadataNode.get(Element.CLASS_PROPERTY));
|
||||
metadataNode.remove(Element.CLASS_PROPERTY);
|
||||
metadataNode.set(OrientDBUtility.ORIENTDB_CLASS_PROPERTY, metadataNode.get(Element.TYPE_PROPERTY));
|
||||
metadataNode.remove(Element.TYPE_PROPERTY);
|
||||
metadata.fromJSON(metadataNode.toString());
|
||||
return metadata;
|
||||
}
|
||||
|
|
|
@ -59,14 +59,14 @@ public class OrientDBUtility {
|
|||
}
|
||||
|
||||
public static String replaceType(String s) {
|
||||
s = s.replace("\"" + ORIENTDB_CLASS_PROPERTY + "\"", "\"" + Element.CLASS_PROPERTY + "\"");
|
||||
s = s.replace("\"" + ORIENTDB_CLASS_PROPERTY + "\"", "\"" + Element.TYPE_PROPERTY + "\"");
|
||||
return s;
|
||||
}
|
||||
|
||||
public static String toJsonString(OResult oResult) {
|
||||
String ret = oResult.toJSON();
|
||||
// The above method set the type in @class property
|
||||
// We want to use the property set in Element.CLASS_PROPERTY
|
||||
// We want to use the property set in Element.TYPE_PROPERTY
|
||||
ret = replaceType(ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class OrientDBUtility {
|
|||
public static String toJsonString(ORecord oRecord) {
|
||||
String ret = oRecord.toJSON("class");
|
||||
// The above method set the type in @class property
|
||||
// We want to use the property set in Element.CLASS_PROPERTY
|
||||
// We want to use the property set in Element.TYPE_PROPERTY
|
||||
ret = replaceType(ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -282,9 +282,9 @@ public class ERManagementTest extends ContextTest {
|
|||
}
|
||||
|
||||
Map<String, Object> additionalProperties = new HashMap<>(consistsOf.getAdditionalProperties());
|
||||
additionalProperties.remove(Element.SUPERCLASSES_PROPERTY);
|
||||
additionalProperties.remove(Element.SUPERTYPES_PROPERTY);
|
||||
Map<String, Object> gotAdditionalProperties = new HashMap<>(gotConsistsOf.getAdditionalProperties());
|
||||
gotAdditionalProperties.remove(Element.SUPERCLASSES_PROPERTY);
|
||||
gotAdditionalProperties.remove(Element.SUPERTYPES_PROPERTY);
|
||||
Assert.assertTrue(additionalProperties.size()==gotAdditionalProperties.size());
|
||||
for(String key : additionalProperties.keySet()) {
|
||||
Assert.assertTrue(gotAdditionalProperties.containsKey(key));
|
||||
|
|
|
@ -42,8 +42,8 @@ public class InvalidOperationTest extends ERManagementTest {
|
|||
|
||||
private static Logger logger = LoggerFactory.getLogger(InvalidOperationTest.class);
|
||||
|
||||
public static final String ACTIVATES = "{\"propagationConstraint\":{\"" + Element.CLASS_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"propagate\",\"remove\":\"cascade\",\"delete\":\"cascade\"},\"" + Element.CLASS_PROPERTY + "\":\"Activates\",\"source\":{\"" + Element.CLASS_PROPERTY + "\":\"Configuration\",\"uuid\":\"CONFIGURATION_UUID\"},\"target\":{\"uuid\":\"ESERVICE_UUID\",\"" + Element.CLASS_PROPERTY + "\":\"EService\"}}";
|
||||
public static final String ACTOR = "{\"" + Element.CLASS_PROPERTY + "\":\"Actor\",\"metadata\":null,\"consistsOf\":[{\"" + Element.CLASS_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"propagationConstraint\":{\"" + Element.CLASS_PROPERTY + "\":\"PropagationConstraint\",\"remove\":\"cascade\",\"delete\":\"cascade\",\"add\":\"propagate\"},\"source\":{\"" + Element.CLASS_PROPERTY + "\":\"Actor\",\"metadata\":null},\"target\":{\"" + Element.CLASS_PROPERTY + "\":\"ContactFacet\",\"metadata\":null,\"title\":\"Dr.\",\"name\":\"Frosini\",\"middleName\":null,\"surname\":null,\"eMail\":\"luca.frosini@isti.cnr.it\"}}],\"isRelatedTo\":[]}";
|
||||
public static final String ACTIVATES = "{\"propagationConstraint\":{\"" + Element.TYPE_PROPERTY + "\":\"PropagationConstraint\",\"add\":\"propagate\",\"remove\":\"cascade\",\"delete\":\"cascade\"},\"" + Element.TYPE_PROPERTY + "\":\"Activates\",\"source\":{\"" + Element.TYPE_PROPERTY + "\":\"Configuration\",\"uuid\":\"CONFIGURATION_UUID\"},\"target\":{\"uuid\":\"ESERVICE_UUID\",\"" + Element.TYPE_PROPERTY + "\":\"EService\"}}";
|
||||
public static final String ACTOR = "{\"" + Element.TYPE_PROPERTY + "\":\"Actor\",\"metadata\":null,\"consistsOf\":[{\"" + Element.TYPE_PROPERTY + "\":\"IsIdentifiedBy\",\"metadata\":null,\"propagationConstraint\":{\"" + Element.TYPE_PROPERTY + "\":\"PropagationConstraint\",\"remove\":\"cascade\",\"delete\":\"cascade\",\"add\":\"propagate\"},\"source\":{\"" + Element.TYPE_PROPERTY + "\":\"Actor\",\"metadata\":null},\"target\":{\"" + Element.TYPE_PROPERTY + "\":\"ContactFacet\",\"metadata\":null,\"title\":\"Dr.\",\"name\":\"Frosini\",\"middleName\":null,\"surname\":null,\"eMail\":\"luca.frosini@isti.cnr.it\"}}],\"isRelatedTo\":[]}";
|
||||
|
||||
@Test(expected = SchemaViolationException.class)
|
||||
public void createInvalidIsRealtedTo() throws Exception {
|
||||
|
|
|
@ -106,7 +106,7 @@ public class MultiContextTest extends ERManagementTest {
|
|||
// String expectedType = TypeMapper.getType(element.getClass());
|
||||
//
|
||||
// JsonNode affectedJsonNode = affectedInstances.get(uuid);
|
||||
// String affectedType = affectedJsonNode.get(Element.CLASS_PROPERTY).asText();
|
||||
// String affectedType = affectedJsonNode.get(Element.TYPE_PROPERTY).asText();
|
||||
//
|
||||
// Assert.assertTrue(affectedType.compareTo(expectedType) == 0);
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue