Moved sanityCheck in internalCreate() and internalUpdate() functions
This commit is contained in:
parent
8822d1a40b
commit
f767fc021a
|
@ -340,6 +340,8 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
|
|
||||||
getWorkingContext().addElement(element, oDatabaseDocument);
|
getWorkingContext().addElement(element, oDatabaseDocument);
|
||||||
|
|
||||||
|
sanityCheck();
|
||||||
|
|
||||||
element.save();
|
element.save();
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
|
@ -358,6 +360,9 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
reallyUpdate();
|
reallyUpdate();
|
||||||
|
|
||||||
HeaderUtility.updateModifiedByAndLastUpdate(element);
|
HeaderUtility.updateModifiedByAndLastUpdate(element);
|
||||||
|
|
||||||
|
sanityCheck();
|
||||||
|
|
||||||
element.save();
|
element.save();
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
|
@ -450,8 +455,6 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
|
|
||||||
public abstract void sanityCheck() throws SchemaViolationException, ResourceRegistryException;
|
public abstract void sanityCheck() throws SchemaViolationException, ResourceRegistryException;
|
||||||
|
|
||||||
//public abstract void sanityCheck(Map<UUID, JsonNode> expectedInstances) throws SchemaViolationException, ResourceRegistryException;
|
|
||||||
|
|
||||||
public String all(boolean polymorphic) throws ResourceRegistryException {
|
public String all(boolean polymorphic) throws ResourceRegistryException {
|
||||||
ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal();
|
ODatabaseDocument current = ContextUtility.getCurrentODatabaseDocumentFromThreadLocal();
|
||||||
try {
|
try {
|
||||||
|
@ -507,16 +510,14 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
try {
|
try {
|
||||||
getElement();
|
getElement();
|
||||||
update = true;
|
update = true;
|
||||||
element = internalUpdate();
|
internalUpdate();
|
||||||
} catch(NotFoundException e) {
|
} catch(NotFoundException e) {
|
||||||
String calledMethod = CalledMethodProvider.instance.get();
|
String calledMethod = CalledMethodProvider.instance.get();
|
||||||
calledMethod = calledMethod.replace("update", "create");
|
calledMethod = calledMethod.replace("update", "create");
|
||||||
CalledMethodProvider.instance.set(calledMethod);
|
CalledMethodProvider.instance.set(calledMethod);
|
||||||
element = internalCreate();
|
internalCreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
sanityCheck();
|
|
||||||
|
|
||||||
oDatabaseDocument.commit();
|
oDatabaseDocument.commit();
|
||||||
|
|
||||||
if(update) {
|
if(update) {
|
||||||
|
@ -556,9 +557,7 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
oDatabaseDocument = getWorkingContext().getDatabaseDocument(PermissionMode.WRITER);
|
oDatabaseDocument = getWorkingContext().getDatabaseDocument(PermissionMode.WRITER);
|
||||||
oDatabaseDocument.begin();
|
oDatabaseDocument.begin();
|
||||||
|
|
||||||
element = internalCreate();
|
internalCreate();
|
||||||
|
|
||||||
sanityCheck();
|
|
||||||
|
|
||||||
oDatabaseDocument.commit();
|
oDatabaseDocument.commit();
|
||||||
|
|
||||||
|
@ -621,9 +620,7 @@ public abstract class ElementManagement<El extends OElement> {
|
||||||
oDatabaseDocument = getWorkingContext().getDatabaseDocument(PermissionMode.WRITER);
|
oDatabaseDocument = getWorkingContext().getDatabaseDocument(PermissionMode.WRITER);
|
||||||
oDatabaseDocument.begin();
|
oDatabaseDocument.begin();
|
||||||
|
|
||||||
element = internalUpdate();
|
internalUpdate();
|
||||||
|
|
||||||
sanityCheck();
|
|
||||||
|
|
||||||
oDatabaseDocument.commit();
|
oDatabaseDocument.commit();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue