Fixing code

This commit is contained in:
Luca Frosini 2023-05-17 14:03:59 +02:00
parent 76438c6a90
commit dab30f5670
2 changed files with 4 additions and 3 deletions

View File

@ -721,13 +721,14 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
oDatabaseDocument = getWorkingContext().getDatabaseDocument(PermissionMode.WRITER); oDatabaseDocument = getWorkingContext().getDatabaseDocument(PermissionMode.WRITER);
oDatabaseDocument.begin(); oDatabaseDocument.begin();
boolean update = false; boolean update = false;
setAsEntryPoint();
try { try {
setAsEntryPoint();
getElement(); getElement();
setOperation(Operation.UPDATE);
update = true; update = true;
internalUpdate(); internalUpdate();
} catch(NotFoundException e) { } catch(NotFoundException e) {
setAsEntryPoint(); setOperation(Operation.CREATE);
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);

View File

@ -187,7 +187,7 @@ public class FacetManagement extends EntityManagement<Facet, FacetType> {
} }
public OVertex internalCreate() throws AlreadyPresentException, ResourceRegistryException { public OVertex internalCreate() throws AlreadyPresentException, ResourceRegistryException {
if(entryPoint && operation == Operation.CREATE) { if(entryPoint) {
throw new SchemaViolationException("You cannot create a stand alone Facet"); throw new SchemaViolationException("You cannot create a stand alone Facet");
} }
return super.internalCreate(); return super.internalCreate();