Revisited serilization
This commit is contained in:
parent
845ddde2c8
commit
74be68d2b6
|
@ -134,7 +134,7 @@ public class ContextManagement extends EntityElementManagement<Context> {
|
||||||
message.append("A context with name (");
|
message.append("A context with name (");
|
||||||
message.append(getName());
|
message.append(getName());
|
||||||
message.append(") has been already created as child of ");
|
message.append(") has been already created as child of ");
|
||||||
message.append(parentContext.serializeSelf().toString());
|
message.append(parentContext.getElement().toString());
|
||||||
|
|
||||||
logger.trace("Checking if {} -> {}", message, select);
|
logger.trace("Checking if {} -> {}", message, select);
|
||||||
|
|
||||||
|
@ -161,9 +161,9 @@ public class ContextManagement extends EntityElementManagement<Context> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
protected JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
||||||
|
|
||||||
JsonNode context = serializeSelf().deepCopy();
|
JsonNode context = serializeSelfAsJsonNode();
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Iterable<OEdge> parents = getElement().getEdges(ODirection.IN);
|
Iterable<OEdge> parents = getElement().getEdges(ODirection.IN);
|
||||||
|
@ -174,7 +174,7 @@ public class ContextManagement extends EntityElementManagement<Context> {
|
||||||
try {
|
try {
|
||||||
IsParentOfManagement isParentOfManagement = new IsParentOfManagement(oDatabaseDocument);
|
IsParentOfManagement isParentOfManagement = new IsParentOfManagement(oDatabaseDocument);
|
||||||
isParentOfManagement.setElement(edge);
|
isParentOfManagement.setElement(edge);
|
||||||
JsonNode isParentOf = isParentOfManagement.serializeAsJson(true, false);
|
JsonNode isParentOf = isParentOfManagement.serializeAsJsonNode();
|
||||||
if(isParentOf!=null) {
|
if(isParentOf!=null) {
|
||||||
((ObjectNode) context).replace(Context.PARENT_PROPERTY, isParentOf);
|
((ObjectNode) context).replace(Context.PARENT_PROPERTY, isParentOf);
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ public class ContextManagement extends EntityElementManagement<Context> {
|
||||||
IsParentOfManagement isParentOfManagement = new IsParentOfManagement(oDatabaseDocument);
|
IsParentOfManagement isParentOfManagement = new IsParentOfManagement(oDatabaseDocument);
|
||||||
isParentOfManagement.setElement(edge);
|
isParentOfManagement.setElement(edge);
|
||||||
try {
|
try {
|
||||||
JsonNode isParentOf = isParentOfManagement.createCompleteJsonNode();
|
JsonNode isParentOf = isParentOfManagement.serializeAsJsonNode();
|
||||||
context = addRelation(context, isParentOf, Context.CHILDREN_PROPERTY);
|
context = addRelation(context, isParentOf, Context.CHILDREN_PROPERTY);
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
logger.error("Unable to correctly serialize {}. {}", edge, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
logger.error("Unable to correctly serialize {}. {}", edge, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||||
|
|
|
@ -55,26 +55,27 @@ public class IsParentOfManagement extends RelationElementManagement<ContextManag
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
protected JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
||||||
return serializeAsJson(false, true);
|
return createCompleteJsonNode(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonNode serializeAsJson(boolean includeSource, boolean includeTarget) throws ResourceRegistryException {
|
@Override
|
||||||
JsonNode relation = serializeSelf();
|
public JsonNode createCompleteJsonNode(boolean includeSource, boolean includeTarget) throws ResourceRegistryException {
|
||||||
|
JsonNode relation = serializeSelfAsJsonNode();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
OVertex source = element.getVertex(ODirection.OUT);
|
OVertex source = element.getVertex(ODirection.OUT);
|
||||||
ContextManagement sourceContextManagement = new ContextManagement(oDatabaseDocument);
|
ContextManagement sourceContextManagement = new ContextManagement(oDatabaseDocument);
|
||||||
sourceContextManagement.setElement(source);
|
sourceContextManagement.setElement(source);
|
||||||
if(includeSource) {
|
if(includeSource) {
|
||||||
((ObjectNode)relation).replace(Relation.SOURCE_PROPERTY, sourceContextManagement.serializeSelf());
|
((ObjectNode)relation).replace(Relation.SOURCE_PROPERTY, sourceContextManagement.serializeSelfAsJsonNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
OVertex target = element.getVertex(ODirection.IN);
|
OVertex target = element.getVertex(ODirection.IN);
|
||||||
ContextManagement targetContextManagement = new ContextManagement(oDatabaseDocument);
|
ContextManagement targetContextManagement = new ContextManagement(oDatabaseDocument);
|
||||||
targetContextManagement.setElement(target);
|
targetContextManagement.setElement(target);
|
||||||
if(includeTarget) {
|
if(includeTarget) {
|
||||||
((ObjectNode)relation).replace(Relation.TARGET_PROPERTY, targetContextManagement.serializeSelf());
|
((ObjectNode)relation).replace(Relation.TARGET_PROPERTY, targetContextManagement.serializeSelfAsJsonNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
|
|
|
@ -262,7 +262,8 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected JsonNode createSelfJsonNode() throws ResourceRegistryException {
|
|
||||||
|
private JsonNode createSelfJsonNode() throws ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
@ -294,20 +295,20 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonNode serializeSelf() throws ResourceRegistryException {
|
public JsonNode serializeSelfAsJsonNode() throws ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
if(self==null) {
|
if(self==null) {
|
||||||
self = createSelfJsonNode();
|
self = createSelfJsonNode();
|
||||||
}
|
}
|
||||||
return self;
|
return self.deepCopy();
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
throw new ResourceRegistryException(e);
|
throw new ResourceRegistryException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract JsonNode createCompleteJsonNode() throws ResourceRegistryException;
|
protected abstract JsonNode createCompleteJsonNode() throws ResourceRegistryException;
|
||||||
|
|
||||||
public JsonNode serializeComplete() throws ResourceRegistryException {
|
public JsonNode serializeAsJsonNode() throws ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
if(complete==null) {
|
if(complete==null) {
|
||||||
complete = createCompleteJsonNode();
|
complete = createCompleteJsonNode();
|
||||||
|
@ -516,7 +517,7 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
|
|
||||||
// TODO Notify to subscriptionNotification
|
// TODO Notify to subscriptionNotification
|
||||||
|
|
||||||
return serializeComplete().toString();
|
return serializeAsJsonNode().toString();
|
||||||
|
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
logger.error("Unable to update {} with UUID {}", accessType.getName(), uuid);
|
logger.error("Unable to update {} with UUID {}", accessType.getName(), uuid);
|
||||||
|
@ -553,7 +554,7 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
|
|
||||||
// TODO Notify to subscriptionNotification
|
// TODO Notify to subscriptionNotification
|
||||||
|
|
||||||
return serializeComplete().toString();
|
return serializeAsJsonNode().toString();
|
||||||
|
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
logger.error("Unable to create {}", accessType.getName());
|
logger.error("Unable to create {}", accessType.getName());
|
||||||
|
@ -586,7 +587,7 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
|
|
||||||
getElement();
|
getElement();
|
||||||
|
|
||||||
return serializeComplete().toString();
|
return serializeAsJsonNode().toString();
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
logger.error("Unable to read {} with UUID {}", accessType.getName(), uuid);
|
logger.error("Unable to read {} with UUID {}", accessType.getName(), uuid);
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -618,7 +619,7 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
|
|
||||||
// TODO Notify to subscriptionNotification
|
// TODO Notify to subscriptionNotification
|
||||||
|
|
||||||
return serializeComplete().toString();
|
return serializeAsJsonNode().toString();
|
||||||
|
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
logger.error("Unable to update {} with UUID {}", accessType.getName(), uuid);
|
logger.error("Unable to update {} with UUID {}", accessType.getName(), uuid);
|
||||||
|
|
|
@ -86,22 +86,22 @@ public abstract class RelationElementManagement<SEM extends EntityElementManagem
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
protected JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
||||||
return serializeAsJson(true, true);
|
return createCompleteJsonNode(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonNode serializeAsJson(boolean includeSource, boolean includeTarget) throws ResourceRegistryException {
|
protected JsonNode createCompleteJsonNode(boolean includeSource, boolean includeTarget) throws ResourceRegistryException {
|
||||||
JsonNode relation = serializeSelf().deepCopy();
|
JsonNode relation = serializeSelfAsJsonNode();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(includeSource) {
|
if(includeSource) {
|
||||||
EntityElementManagement<? extends EntityElement> sourceEntityManagement = getSourceEntityManagement();
|
EntityElementManagement<? extends EntityElement> sourceEntityManagement = getSourceEntityManagement();
|
||||||
((ObjectNode) relation).replace(Relation.SOURCE_PROPERTY, sourceEntityManagement.serializeSelf());
|
((ObjectNode) relation).replace(Relation.SOURCE_PROPERTY, sourceEntityManagement.serializeSelfAsJsonNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(includeTarget) {
|
if(includeTarget) {
|
||||||
EntityElementManagement<? extends EntityElement> targetEntityManagement = getTargetEntityManagement();
|
EntityElementManagement<? extends EntityElement> targetEntityManagement = getTargetEntityManagement();
|
||||||
((ObjectNode) relation).replace(Relation.TARGET_PROPERTY, targetEntityManagement.serializeComplete());
|
((ObjectNode) relation).replace(Relation.TARGET_PROPERTY, targetEntityManagement.serializeAsJsonNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
|
@ -159,12 +159,11 @@ public abstract class RelationElementManagement<SEM extends EntityElementManagem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("Creating {} beetween {} -> {}", elementType, getSourceEntityManagement().serializeSelf().toString(),
|
|
||||||
getTargetEntityManagement().serializeSelf().toString());
|
|
||||||
|
|
||||||
OVertex source = (OVertex) getSourceEntityManagement().getElement();
|
OVertex source = (OVertex) getSourceEntityManagement().getElement();
|
||||||
OVertex target = (OVertex) getTargetEntityManagement().getElement();
|
OVertex target = (OVertex) getTargetEntityManagement().getElement();
|
||||||
|
|
||||||
|
logger.trace("Going to create {} beetween {} -> {}", elementType, source.toString(), target.toString());
|
||||||
|
|
||||||
element = oDatabaseDocument.newEdge(source, target, elementType);
|
element = oDatabaseDocument.newEdge(source, target, elementType);
|
||||||
|
|
||||||
updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||||
|
|
|
@ -327,7 +327,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
|
||||||
HeaderUtility.updateModifiedByAndLastUpdate(element);
|
HeaderUtility.updateModifiedByAndLastUpdate(element);
|
||||||
element.save();
|
element.save();
|
||||||
}
|
}
|
||||||
affectedInstances.put(uuid, serializeSelf());
|
affectedInstances.put(uuid, serializeSelfAsJsonNode());
|
||||||
return affectedInstances;
|
return affectedInstances;
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -384,7 +384,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
|
||||||
HeaderUtility.updateModifiedByAndLastUpdate(element);
|
HeaderUtility.updateModifiedByAndLastUpdate(element);
|
||||||
element.save();
|
element.save();
|
||||||
}
|
}
|
||||||
affectedInstances.put(uuid, serializeSelf());
|
affectedInstances.put(uuid, serializeSelfAsJsonNode());
|
||||||
return affectedInstances;
|
return affectedInstances;
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -473,7 +473,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
|
||||||
EntityManagement<?> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
|
EntityManagement<?> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
|
||||||
oDatabaseDocument, (OVertex) vertex);
|
oDatabaseDocument, (OVertex) vertex);
|
||||||
try {
|
try {
|
||||||
JsonNode jsonNode = entityManagement.serializeComplete();
|
JsonNode jsonNode = entityManagement.serializeAsJsonNode();
|
||||||
arrayNode.add(jsonNode);
|
arrayNode.add(jsonNode);
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
|
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
|
||||||
|
@ -647,9 +647,9 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
RelationManagement relationManagement = ElementManagementUtility.getRelationManagement(getWorkingContext(),
|
RelationManagement relationManagement = ElementManagementUtility.getRelationManagement(getWorkingContext(),
|
||||||
oDatabaseDocument, edge);
|
oDatabaseDocument, edge);
|
||||||
jsonNode = relationManagement.createCompleteJsonNode();
|
jsonNode = relationManagement.serializeAsJsonNode();
|
||||||
}else {
|
}else {
|
||||||
jsonNode = entityManagement.serializeComplete();
|
jsonNode = entityManagement.serializeAsJsonNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayNode.add(jsonNode);
|
arrayNode.add(jsonNode);
|
||||||
|
@ -760,7 +760,7 @@ public abstract class EntityManagement<E extends Entity> extends EntityElementMa
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JsonNode jsonNode = entityManagement.serializeComplete();
|
JsonNode jsonNode = entityManagement.serializeAsJsonNode();
|
||||||
arrayNode.add(jsonNode);
|
arrayNode.add(jsonNode);
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
|
logger.error("Unable to correctly serialize {}. It will be excluded from results. {}",
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class FacetManagement extends EntityManagement<Facet> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
public JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
||||||
return serializeSelf().deepCopy();
|
return serializeSelfAsJsonNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class ResourceManagement extends EntityManagement<Resource> {
|
||||||
@Override
|
@Override
|
||||||
public JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
public JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
||||||
|
|
||||||
JsonNode sourceResource = serializeSelf().deepCopy();
|
JsonNode sourceResource = serializeSelfAsJsonNode();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cannot get ConsistsOf edge only because is not polymorphic for a
|
* Cannot get ConsistsOf edge only because is not polymorphic for a
|
||||||
|
@ -101,7 +101,7 @@ public class ResourceManagement extends EntityManagement<Resource> {
|
||||||
|
|
||||||
if(relationManagement instanceof ConsistsOfManagement) {
|
if(relationManagement instanceof ConsistsOfManagement) {
|
||||||
try {
|
try {
|
||||||
JsonNode consistsOf = relationManagement.serializeAsJson(true, true);
|
JsonNode consistsOf = relationManagement.serializeAsJsonNode();
|
||||||
sourceResource = addConsistsOf(sourceResource, consistsOf);
|
sourceResource = addConsistsOf(sourceResource, consistsOf);
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
logger.error("Unable to correctly serialize {}. {}", edge, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
logger.error("Unable to correctly serialize {}. {}", edge, Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||||
|
|
|
@ -201,22 +201,23 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
protected JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
||||||
return serializeAsJson(true, true);
|
return createCompleteJsonNode(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonNode serializeAsJson(boolean includeSource, boolean includeTarget) throws ResourceRegistryException {
|
@Override
|
||||||
JsonNode relation = serializeSelf();
|
public JsonNode createCompleteJsonNode(boolean includeSource, boolean includeTarget) throws ResourceRegistryException {
|
||||||
|
JsonNode relation = serializeSelfAsJsonNode();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(includeSource) {
|
if(includeSource) {
|
||||||
EntityManagement<? extends Resource> sourceEntityManagement = getSourceEntityManagement();
|
EntityManagement<? extends Resource> sourceEntityManagement = getSourceEntityManagement();
|
||||||
((ObjectNode) relation).replace(Relation.SOURCE_PROPERTY, sourceEntityManagement.serializeSelf());
|
((ObjectNode) relation).replace(Relation.SOURCE_PROPERTY, sourceEntityManagement.serializeSelfAsJsonNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(includeTarget) {
|
if(includeTarget) {
|
||||||
EntityManagement<? extends Entity> targetEntityManagement = getTargetEntityManagement();
|
EntityManagement<? extends Entity> targetEntityManagement = getTargetEntityManagement();
|
||||||
((ObjectNode) relation).replace(Relation.TARGET_PROPERTY, targetEntityManagement.serializeComplete());
|
((ObjectNode) relation).replace(Relation.TARGET_PROPERTY, targetEntityManagement.serializeAsJsonNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
|
@ -246,7 +247,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
||||||
if(this instanceof IsRelatedToManagement) {
|
if(this instanceof IsRelatedToManagement) {
|
||||||
sourceResource = resourceManagement.createCompleteJsonNode();
|
sourceResource = resourceManagement.createCompleteJsonNode();
|
||||||
} else if(this instanceof ConsistsOfManagement) {
|
} else if(this instanceof ConsistsOfManagement) {
|
||||||
sourceResource = resourceManagement.serializeSelf();
|
sourceResource = resourceManagement.serializeSelfAsJsonNode();
|
||||||
} else {
|
} else {
|
||||||
String error = String.format("{%s is not a %s nor a %s. %s", this,
|
String error = String.format("{%s is not a %s nor a %s. %s", this,
|
||||||
IsRelatedToManagement.class.getSimpleName(), ConsistsOfManagement.class.getSimpleName(),
|
IsRelatedToManagement.class.getSimpleName(), ConsistsOfManagement.class.getSimpleName(),
|
||||||
|
@ -256,9 +257,9 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this instanceof IsRelatedToManagement) {
|
if(this instanceof IsRelatedToManagement) {
|
||||||
sourceResource = ResourceManagement.addIsRelatedTo(sourceResource, createCompleteJsonNode());
|
sourceResource = ResourceManagement.addIsRelatedTo(sourceResource, serializeAsJsonNode());
|
||||||
} else if(this instanceof ConsistsOfManagement) {
|
} else if(this instanceof ConsistsOfManagement) {
|
||||||
sourceResource = ResourceManagement.addConsistsOf(sourceResource, createCompleteJsonNode());
|
sourceResource = ResourceManagement.addConsistsOf(sourceResource, serializeAsJsonNode());
|
||||||
} else {
|
} else {
|
||||||
String error = String.format("{%s is not a %s nor a %s. %s", this,
|
String error = String.format("{%s is not a %s nor a %s. %s", this,
|
||||||
IsRelatedToManagement.class.getSimpleName(), ConsistsOfManagement.class.getSimpleName(),
|
IsRelatedToManagement.class.getSimpleName(), ConsistsOfManagement.class.getSimpleName(),
|
||||||
|
@ -443,7 +444,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
||||||
HeaderUtility.updateModifiedByAndLastUpdate(element);
|
HeaderUtility.updateModifiedByAndLastUpdate(element);
|
||||||
element.save();
|
element.save();
|
||||||
}
|
}
|
||||||
affectedInstances.put(uuid, serializeSelf());
|
affectedInstances.put(uuid, serializeSelfAsJsonNode());
|
||||||
}
|
}
|
||||||
return affectedInstances;
|
return affectedInstances;
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
|
@ -475,7 +476,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
||||||
if(!dryRunContextSharing) {
|
if(!dryRunContextSharing) {
|
||||||
targetSecurityContext.addElement(getElement(), oDatabaseDocument);
|
targetSecurityContext.addElement(getElement(), oDatabaseDocument);
|
||||||
}
|
}
|
||||||
affectedInstances.put(uuid, serializeSelf());
|
affectedInstances.put(uuid, serializeSelfAsJsonNode());
|
||||||
|
|
||||||
return affectedInstances;
|
return affectedInstances;
|
||||||
}
|
}
|
||||||
|
@ -545,7 +546,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
||||||
if(!dryRunContextSharing) {
|
if(!dryRunContextSharing) {
|
||||||
targetSecurityContext.removeElement(getElement(), oDatabaseDocument);
|
targetSecurityContext.removeElement(getElement(), oDatabaseDocument);
|
||||||
}
|
}
|
||||||
affectedInstances.put(uuid, serializeSelf());
|
affectedInstances.put(uuid, serializeSelfAsJsonNode());
|
||||||
|
|
||||||
T targetEntityManagement = getTargetEntityManagement();
|
T targetEntityManagement = getTargetEntityManagement();
|
||||||
targetEntityManagement.setDryRunContextSharing(dryRunContextSharing);
|
targetEntityManagement.setDryRunContextSharing(dryRunContextSharing);
|
||||||
|
@ -604,7 +605,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
||||||
HeaderUtility.updateModifiedByAndLastUpdate(element);
|
HeaderUtility.updateModifiedByAndLastUpdate(element);
|
||||||
element.save();
|
element.save();
|
||||||
}
|
}
|
||||||
affectedInstances.put(uuid, serializeSelf());
|
affectedInstances.put(uuid, serializeSelfAsJsonNode());
|
||||||
return affectedInstances;
|
return affectedInstances;
|
||||||
} catch(ResourceRegistryException e) {
|
} catch(ResourceRegistryException e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class QueryImpl implements Query {
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(securityContext, oDatabaseDocument,
|
ElementManagement erManagement = ElementManagementUtility.getERManagement(securityContext, oDatabaseDocument,
|
||||||
element);
|
element);
|
||||||
jsonNode = erManagement.createCompleteJsonNode();
|
jsonNode = erManagement.serializeAsJsonNode();
|
||||||
}
|
}
|
||||||
arrayNode.add(jsonNode);
|
arrayNode.add(jsonNode);
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
protected JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
||||||
return serializeSelf().deepCopy();
|
return serializeSelfAsJsonNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -73,8 +73,8 @@ public class PropertyTypeDefinitionManagement extends ElementManagement<OElement
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
protected JsonNode createCompleteJsonNode() throws ResourceRegistryException {
|
||||||
return serializeSelf().deepCopy();
|
return serializeSelfAsJsonNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -97,12 +97,12 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
|
||||||
targetEntityManagement.setJsonNode(jsonNode.get(Relation.TARGET_PROPERTY));
|
targetEntityManagement.setJsonNode(jsonNode.get(Relation.TARGET_PROPERTY));
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("Creating {} beetween {} -> {}", elementType, getSourceEntityManagement().serializeSelf().toString(),
|
|
||||||
getTargetEntityManagement().serializeSelf().toString());
|
|
||||||
|
|
||||||
OVertex source = (OVertex) getSourceEntityManagement().getElement();
|
OVertex source = (OVertex) getSourceEntityManagement().getElement();
|
||||||
OVertex target = (OVertex) getTargetEntityManagement().getElement();
|
OVertex target = (OVertex) getTargetEntityManagement().getElement();
|
||||||
|
|
||||||
|
logger.trace("Creating {} beetween {} -> {}", elementType, source.toString(),
|
||||||
|
target.toString());
|
||||||
|
|
||||||
element = oDatabaseDocument.newEdge(source, target, elementType);
|
element = oDatabaseDocument.newEdge(source, target, elementType);
|
||||||
|
|
||||||
updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||||
|
|
Loading…
Reference in New Issue