@Override public void afterReadOperations(OIdentifiable identifiable) { if (identifiable instanceof ODocument) { ODocument doc = (ODocument) identifiable; OImmutableClass clazz = ODocumentInternal.getImmutableSchemaClass(this, doc); if (clazz != null) { if (clazz.isTriggered()) { OClassTrigger.onRecordAfterRead(doc, this); } } } callbackHooks(ORecordHook.TYPE.AFTER_READ, identifiable); }
@Override public boolean beforeReadOperations(OIdentifiable identifiable) { if (identifiable instanceof ODocument) { ODocument doc = (ODocument) identifiable; OImmutableClass clazz = ODocumentInternal.getImmutableSchemaClass(this, doc); if (clazz != null) { if (clazz.isTriggered()) { ORecordHook.RESULT val = OClassTrigger.onRecordBeforeRead(doc, this); if (val == ORecordHook.RESULT.SKIP) { return true; } } if (clazz.isRestricted()) { if (!ORestrictedAccessHook.isAllowed(this, doc, ORestrictedOperation.ALLOW_READ, false)) { return true; } } } } return callbackHooks(ORecordHook.TYPE.BEFORE_READ, identifiable) == ORecordHook.RESULT.SKIP; }
@Override public void beforeDeleteOperations(OIdentifiable id, String iClusterName) { checkClusterSecurity(ORole.PERMISSION_DELETE, id, iClusterName); if (id instanceof ODocument) { ODocument doc = (ODocument) id; OImmutableClass clazz = ODocumentInternal.getImmutableSchemaClass(this, doc); if (clazz != null) { if (clazz.isTriggered()) { OClassTrigger.onRecordBeforeDelete(doc, this); } if (clazz.isRestricted()) { if (!ORestrictedAccessHook.isAllowed(this, doc, ORestrictedOperation.ALLOW_DELETE, true)) throw new OSecurityException("Cannot delete record " + doc.getIdentity() + ": the resource has restricted access"); } } } callbackHooks(ORecordHook.TYPE.BEFORE_DELETE, id); }
ORecordHook.RESULT res = callbackHooks(ORecordHook.TYPE.BEFORE_CREATE, id); if (changed || res == ORecordHook.RESULT.RECORD_CHANGED || triggerChanged == ORecordHook.RESULT.RECORD_CHANGED) { if (id instanceof ODocument) {
ORecordHook.RESULT res = callbackHooks(ORecordHook.TYPE.BEFORE_UPDATE, id); if (res == ORecordHook.RESULT.RECORD_CHANGED || triggerChanged == ORecordHook.RESULT.RECORD_CHANGED) { if (id instanceof ODocument) {
public void afterUpdateOperations(final OIdentifiable id) { if (id instanceof ODocument) { ODocument doc = (ODocument) id; OImmutableClass clazz = ODocumentInternal.getImmutableSchemaClass(this, doc); if (clazz != null) { OClassIndexManager.checkIndexesAfterUpdate((ODocument) id, this); if (clazz.isFunction()) { this.getSharedContext().getFunctionLibrary().updatedFunction(doc); Orient.instance().getScriptManager().close(this.getName()); } if (clazz.isOuser() || clazz.isOrole()) { getMetadata().getSecurity().incrementVersion(); } if (clazz.isSequence()) { ((OSequenceLibraryProxy) getMetadata().getSequenceLibrary()).getDelegate().onSequenceUpdated(this, doc); } if (clazz.isTriggered()) { OClassTrigger.onRecordAfterUpdate(doc, this); } } OLiveQueryHook.addOp(doc, ORecordOperation.UPDATED, this); OLiveQueryHookV2.addOp(doc, ORecordOperation.UPDATED, this); } callbackHooks(ORecordHook.TYPE.AFTER_UPDATE, id); }
public void afterDeleteOperations(final OIdentifiable id) { if (id instanceof ODocument) { ODocument doc = (ODocument) id; OImmutableClass clazz = ODocumentInternal.getImmutableSchemaClass(this, doc); if (clazz != null) { OClassIndexManager.checkIndexesAfterDelete(doc, this); if (clazz.isFunction()) { this.getSharedContext().getFunctionLibrary().droppedFunction(doc); Orient.instance().getScriptManager().close(this.getName()); } if (clazz.isOuser() || clazz.isOrole()) { getMetadata().getSecurity().incrementVersion(); } if (clazz.isSequence()) { ((OSequenceLibraryProxy) getMetadata().getSequenceLibrary()).getDelegate().onSequenceDropped(this, doc); } if (clazz.isScheduler()) { final String eventName = doc.field(OScheduledEvent.PROP_NAME); getSharedContext().getScheduler().removeEventInternal(eventName); } if (clazz.isTriggered()) { OClassTrigger.onRecordAfterDelete(doc, this); } } OLiveQueryHook.addOp(doc, ORecordOperation.DELETED, this); OLiveQueryHookV2.addOp(doc, ORecordOperation.DELETED, this); } callbackHooks(ORecordHook.TYPE.AFTER_DELETE, id); }
public void afterCreateOperations(final OIdentifiable id) { if (id instanceof ODocument) { ODocument doc = (ODocument) id; OImmutableClass clazz = ODocumentInternal.getImmutableSchemaClass(this, doc); if (clazz != null) { OClassIndexManager.checkIndexesAfterCreate(doc, this); if (clazz.isFunction()) { this.getSharedContext().getFunctionLibrary().createdFunction(doc); Orient.instance().getScriptManager().close(this.getName()); } if (clazz.isOuser() || clazz.isOrole()) { getMetadata().getSecurity().incrementVersion(); } if (clazz.isSequence()) { ((OSequenceLibraryProxy) getMetadata().getSequenceLibrary()).getDelegate().onSequenceCreated(this, doc); } if (clazz.isScheduler()) { getMetadata().getScheduler().scheduleEvent(new OScheduledEvent(doc)); } if (clazz.isTriggered()) { OClassTrigger.onRecordAfterCreate(doc, this); } } OLiveQueryHook.addOp(doc, ORecordOperation.CREATED, this); OLiveQueryHookV2.addOp(doc, ORecordOperation.CREATED, this); } callbackHooks(ORecordHook.TYPE.AFTER_CREATE, id); }