protected void checkRecordClass(final OClass recordClass, final String iClusterName, final ORecordId rid) { final OClass clusterIdClass = metadata.getImmutableSchemaSnapshot().getClassByClusterId(rid.getClusterId()); if (recordClass == null && clusterIdClass != null || clusterIdClass == null && recordClass != null || (recordClass != null && !recordClass.equals(clusterIdClass))) throw new IllegalArgumentException( "Record saved into cluster '" + iClusterName + "' should be saved with class '" + clusterIdClass + "' but has been created with class '" + recordClass + "'"); }
@Override public boolean isClusterEdge(int cluster) { OClass clazz = getMetadata().getImmutableSchemaSnapshot().getClassByClusterId(cluster); if (clazz != null && clazz.isEdgeType()) return true; return false; }
@Override public boolean isClusterVertex(int cluster) { OClass clazz = getMetadata().getImmutableSchemaSnapshot().getClassByClusterId(cluster); if (clazz != null && clazz.isVertexType()) return true; return false; } }
/** * {@inheritDoc} */ public ORecordIteratorClass<ODocument> browseClass(final String iClassName, final boolean iPolymorphic) { if (getMetadata().getImmutableSchemaSnapshot().getClass(iClassName) == null) throw new IllegalArgumentException("Class '" + iClassName + "' not found in current database"); checkSecurity(ORule.ResourceGeneric.CLASS, ORole.PERMISSION_READ, iClassName); return new ORecordIteratorClass<ODocument>(this, iClassName, iPolymorphic, false); }
public void checkForClusterPermissions(final String iClusterName) { // CHECK FOR ORESTRICTED final Set<OClass> classes = getMetadata().getImmutableSchemaSnapshot().getClassesRelyOnCluster(iClusterName); for (OClass c : classes) { if (c.isSubClassOf(OSecurityShared.RESTRICTED_CLASSNAME)) throw new OSecurityException( "Class '" + c.getName() + "' cannot be truncated because has record level security enabled (extends '" + OSecurityShared.RESTRICTED_CLASSNAME + "')"); } }
protected boolean filter(final ORecord iRecord, final OCommandContext iContext) { if (iRecord instanceof ODocument) { // CHECK THE TARGET CLASS final ODocument recordSchemaAware = (ODocument) iRecord; Map<String, String> targetClasses = parsedTarget.getTargetClasses(); // check only classes that specified in query will go to result set if ((targetClasses != null) && (!targetClasses.isEmpty())) { for (String targetClass : targetClasses.keySet()) { if (!((OMetadataDefault) getDatabase().getMetadata()).getImmutableSchemaSnapshot().getClass(targetClass) .isSuperClassOf(ODocumentInternal.getImmutableSchemaClass(recordSchemaAware))) return false; } iContext.updateMetric("documentAnalyzedCompatibleClass", +1); } } return evaluateRecord(iRecord, iContext); }
final OClass cls = getMetadata().getImmutableSchemaSnapshot().getClass(iClassName);
return getDefaultClusterId(); case TYPE: return getMetadata().getImmutableSchemaSnapshot().existsClass("V") ? "graph" : "document"; case DATEFORMAT: return storage.getConfiguration().getDateFormat();