Class OClassImpl
java.lang.Object
com.orientechnologies.orient.core.metadata.schema.OClassImpl
- All Implemented Interfaces:
OClass,Comparable<OClass>
- Direct Known Subclasses:
OClassEmbedded,OClassRemote,OViewImpl
Schema Class implementation.
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.metadata.schema.OClass
OClass.ATTRIBUTES, OClass.INDEX_TYPE -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected OClassAllocationImplprotected int[]protected OClusterSelectionStrategyprotected intprotected Stringprotected intprotected Stringprotected static final intprotected floatprotected final OSchemaSharedprotected int[]protected Stringprotected booleanprotected List<OClassImpl>Fields inherited from interface com.orientechnologies.orient.core.metadata.schema.OClass
EDGE_CLASS_NAME, VERTEX_CLASS_NAME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOClassImpl(OSchemaShared iOwner, String iName) Constructor used in unmarshalling.protectedOClassImpl(OSchemaShared iOwner, String iName, int[] iClusterIds) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidaddBaseClass(OClassImpl iBaseClass) Adds a base class to the current one.protected abstract voidaddClusterIdToIndexes(int iId) static OClassaddClusters(OClass cls, int iClusters) protected voidaddPolymorphicClusterIds(OClassImpl iBaseClass) Add different cluster id to the "polymorphic cluster ids" array.protected abstract OPropertyaddProperty(String propertyName, OType type, OType linkedType, OClass linkedClass, boolean unsafe) booleanareIndexed(String... fields) booleanareIndexed(Collection<String> fields) Indicates whether given fields are contained as first key fields in class indexes.protected voidcheckAllLikedObjects(ODatabaseInternal<ORecord> database, String propertyName, OType type, OClass linkedClass) voidprotected voidcheckParametersConflict(OClass baseClass) static voidcheckParametersConflict(List<OClass> classes) voidcheckPersistentPropertyType(ODatabaseInternal<ORecord> database, String propertyName, OType type, OClass linkedClass) intlongcount()Returns the number of the records of this class considering also subclasses (polymorphic).longcount(boolean isPolymorphic) Returns the number of the records of this class and based on polymorphic parameter it consider or not the subclasses.createIndex(String iName, OClass.INDEX_TYPE iType, OProgressListener iProgressListener, String... fields) Creates database index that is based on passed in field names.createIndex(String iName, OClass.INDEX_TYPE iType, String... fields) Creates database index that is based on passed in field names.createIndex(String iName, String iType, OProgressListener iProgressListener, ODocument metadata, String... fields) Creates database index that is based on passed in field names.createIndex(String name, String type, OProgressListener progressListener, ODocument metadata, String algorithm, String... fields) Creates database index that is based on passed in field names.createIndex(String iName, String iType, String... fields) Creates database index that is based on passed in field names.createProperty(String iPropertyName, OType iType) createProperty(String iPropertyName, OType iType, OClass iLinkedClass) createProperty(String iPropertyName, OType iType, OClass iLinkedClass, boolean unsafe) Create a property in the class with the specified options.createProperty(String iPropertyName, OType iType, OType iLinkedType) createProperty(String iPropertyName, OType iType, OType iLinkedType, boolean unsafe) Create a property in the class with the specified options.protected abstract OPropertyImplstatic StringbooleanbooleanexistsProperty(String propertyName) extractFieldTypes(String[] fieldNames) voidfireDatabaseMigration(ODatabaseDocument database, String propertyName, OType type) voidfirePropertyNameMigration(ODatabaseDocument database, String propertyName, String newPropertyName, OType type) voidfromStream(ODocument document) get(OClass.ATTRIBUTES iAttribute) Deprecated.Returns the auto sharding index configured for the class if any.Deprecated.getClassIndex(String name) Returns index instance by database index name.voidgetClassIndexes(Collection<OIndex> indexes) Internal.getClassInvolvedIndexes(String... fields) getClassInvolvedIndexes(Collection<String> fields) Returns list of indexes that contain passed in fields names as their first keys.floatintint[]protected ODatabaseDocumentInternalintprotected StringgetEscapedName(String iName, boolean iStrictSQL) voidgetIndexedProperties(Collection<OProperty> indexedProperties) voidgetIndexes(Collection<OIndex> indexes) Internal.getInvolvedIndexes(String... fields) Returns list of indexes that contain passed in fields names as their first keys.getInvolvedIndexes(Collection<String> fields) Returns list of indexes that contain passed in fields names as their first keys.getName()floatReturns the oversize factor.getOwner()int[]getProperty(String propertyName) longgetSize()Deprecated.booleanhasClusterId(int clusterId) inthashCode()booleanhasPolymorphicClusterId(int clusterId) booleanbooleanbooleanbooleanbooleanisSubClassOf(OClass clazz) Check if the current instance extends specified schema class.booleanisSubClassOf(String iClassName) Check if the current instance extends specified schema class.booleanisSuperClassOf(OClass clazz) Returns true if the passed schema class (iClass) extends the current instance.booleanprotected booleanmatchesType(Object x, OClass linkedClass) protected voidonlyAddPolymorphicClusterId(int clusterId) protected voidonlyRemovePolymorphicClusterId(int clusterId) voidstatic int[]readableClusters(ODatabaseDocument db, int[] iClusterIds, String className) voidvoidvoidreleaseSchemaWriteLock(boolean iSave) voidreleaseSchemaWriteLock(ODatabaseDocumentInternal database, boolean iSave) abstract OClassremoveBaseClassInternal(OClass baseClass) voidremoveCustom(String name) protected voidremovePolymorphicClusterId(int clusterId) protected voidremovePolymorphicClusterIds(OClassImpl iBaseClass) protected voidrenameCluster(String oldName, String newName) voidrenameProperty(String iOldName, String iNewName) set(OClass.ATTRIBUTES attribute, Object iValue) protected OClasssetClusterIds(int[] iClusterIds) setClusterSelection(OClusterSelectionStrategy clusterSelection) voidsetClusterSelectionInternal(OClusterSelectionStrategy iClusterSelection) abstract OClassImplsetEncryption(String iValue) setSuperClass(OClass iSuperClass) Deprecated.setSuperClassesByNames(List<String> classNames) protected abstract voidsetSuperClassesInternal(List<? extends OClass> classes) toStream()toString()voidtruncate()Truncates all the clusters the class uses.protected voidtruncateClusterInternal(String clusterName, ODatabaseDocumentInternal database) protected voidvalidatePropertyName(String propertyName) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.orientechnologies.orient.core.metadata.schema.OClass
addCluster, addClusterId, addSuperClass, clearCustom, dropProperty, removeClusterId, removeSuperClass, setAbstract, setClusterSelection, setCustom, setDefaultClusterId, setDescription, setName, setOverSize, setShortName, setStrictMode, setSuperClasses, truncateCluster
-
Field Details
-
NOT_EXISTENT_CLUSTER_ID
protected static final int NOT_EXISTENT_CLUSTER_ID- See Also:
-
owner
-
properties
-
defaultClusterId
protected int defaultClusterId -
name
-
description
-
clusterIds
protected int[] clusterIds -
superClasses
-
polymorphicClusterIds
protected int[] polymorphicClusterIds -
subclasses
-
overSize
protected float overSize -
shortName
-
strictMode
protected boolean strictMode -
abstractClass
protected boolean abstractClass -
customFields
-
clusterSelection
-
allocation
-
hashCode
protected volatile int hashCode
-
-
Constructor Details
-
Method Details
-
readableClusters
-
getClusterSelection
- Specified by:
getClusterSelectionin interfaceOClass
-
setClusterSelection
- Specified by:
setClusterSelectionin interfaceOClass
-
getCustom
-
getCustomInternal
-
removeCustom
- Specified by:
removeCustomin interfaceOClass
-
getCustomKeys
- Specified by:
getCustomKeysin interfaceOClass
-
hasClusterId
public boolean hasClusterId(int clusterId) - Specified by:
hasClusterIdin interfaceOClass
-
hasPolymorphicClusterId
public boolean hasPolymorphicClusterId(int clusterId) - Specified by:
hasPolymorphicClusterIdin interfaceOClass
-
getSuperClass
Deprecated.- Specified by:
getSuperClassin interfaceOClass
-
setSuperClass
Deprecated.- Specified by:
setSuperClassin interfaceOClass
-
getName
-
getSuperClasses
- Specified by:
getSuperClassesin interfaceOClass
-
hasSuperClasses
public boolean hasSuperClasses()- Specified by:
hasSuperClassesin interfaceOClass
-
getSuperClassesNames
- Specified by:
getSuperClassesNamesin interfaceOClass
-
setSuperClassesByNames
-
setSuperClassesInternal
-
getSize
public long getSize() -
getShortName
- Specified by:
getShortNamein interfaceOClass
-
getDescription
- Specified by:
getDescriptionin interfaceOClass
-
getStreamableName
- Specified by:
getStreamableNamein interfaceOClass
-
declaredProperties
- Specified by:
declaredPropertiesin interfaceOClass
-
propertiesMap
- Specified by:
propertiesMapin interfaceOClass
-
properties
- Specified by:
propertiesin interfaceOClass
-
getIndexedProperties
-
getIndexedProperties
- Specified by:
getIndexedPropertiesin interfaceOClass
-
getProperty
- Specified by:
getPropertyin interfaceOClass
-
createProperty
- Specified by:
createPropertyin interfaceOClass
-
createProperty
- Specified by:
createPropertyin interfaceOClass
-
createProperty
public OProperty createProperty(String iPropertyName, OType iType, OClass iLinkedClass, boolean unsafe) Description copied from interface:OClassCreate a property in the class with the specified options.- Specified by:
createPropertyin interfaceOClass- Parameters:
iPropertyName- the name of the property.iType- the type of the property.iLinkedClass- in case of property of type LINK,LINKLIST,LINKSET,LINKMAP,EMBEDDED,EMBEDDEDLIST,EMBEDDEDSET,EMBEDDEDMAP can be specified a linked class in all the other cases should be nullunsafe- if true avoid to check the persistent data for compatibility, should be used only if all persistent data is compatible with the property- Returns:
- the created property.
-
createProperty
- Specified by:
createPropertyin interfaceOClass
-
createProperty
public OProperty createProperty(String iPropertyName, OType iType, OType iLinkedType, boolean unsafe) Description copied from interface:OClassCreate a property in the class with the specified options.- Specified by:
createPropertyin interfaceOClass- Parameters:
iPropertyName- the name of the property.iType- the type of the property.iLinkedType- in case of property of type EMBEDDEDLIST,EMBEDDEDSET,EMBEDDEDMAP can be specified a linked type in all the other cases should be nullunsafe- if true avoid to check the persistent data for compatibility, should be used only if all persistent data is compatible with the property- Returns:
- the created property.
-
existsProperty
- Specified by:
existsPropertyin interfaceOClass
-
fromStream
-
createPropertyInstance
-
toStream
-
getClusterForNewInstance
- Specified by:
getClusterForNewInstancein interfaceOClass
-
getDefaultClusterId
public int getDefaultClusterId()- Specified by:
getDefaultClusterIdin interfaceOClass
-
getClusterIds
public int[] getClusterIds()- Specified by:
getClusterIdsin interfaceOClass
-
getPolymorphicClusterIds
public int[] getPolymorphicClusterIds()- Specified by:
getPolymorphicClusterIdsin interfaceOClass
-
renameProperty
-
addClusters
-
truncateClusterInternal
-
getSubclasses
- Specified by:
getSubclassesin interfaceOClass- Returns:
- all the subclasses (one level hierarchy only)
-
getAllSubclasses
- Specified by:
getAllSubclassesin interfaceOClass- Returns:
- all the subclass hierarchy
-
getBaseClasses
Deprecated.- Specified by:
getBaseClassesin interfaceOClass
-
getAllBaseClasses
Deprecated.- Specified by:
getAllBaseClassesin interfaceOClass
-
getAllSuperClasses
- Specified by:
getAllSuperClassesin interfaceOClass- Returns:
- all recursively collected super classes
-
removeBaseClassInternal
-
getOverSize
public float getOverSize()Description copied from interface:OClassReturns the oversize factor. Oversize is used to extend the record size by a factor to avoid defragmentation upon updates. 0 or 1.0 means no oversize.- Specified by:
getOverSizein interfaceOClass- Returns:
- Oversize factor
- See Also:
-
getClassOverSize
public float getClassOverSize()- Specified by:
getClassOverSizein interfaceOClass
-
isAbstract
public boolean isAbstract()- Specified by:
isAbstractin interfaceOClass
-
isStrictMode
public boolean isStrictMode()- Specified by:
isStrictModein interfaceOClass
-
toString
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<OClass>
-
count
public long count()Description copied from interface:OClassReturns the number of the records of this class considering also subclasses (polymorphic). -
count
public long count(boolean isPolymorphic) Description copied from interface:OClassReturns the number of the records of this class and based on polymorphic parameter it consider or not the subclasses. -
truncate
public void truncate()Truncates all the clusters the class uses. -
isSubClassOf
Check if the current instance extends specified schema class.- Specified by:
isSubClassOfin interfaceOClass- Parameters:
iClassName- of class that should be checked- Returns:
- Returns true if the current instance extends the passed schema class (iClass)
- See Also:
-
isSubClassOf
Check if the current instance extends specified schema class.- Specified by:
isSubClassOfin interfaceOClass- Parameters:
clazz- to check- Returns:
- true if the current instance extends the passed schema class (iClass)
- See Also:
-
isSuperClassOf
Returns true if the passed schema class (iClass) extends the current instance.- Specified by:
isSuperClassOfin interfaceOClass- Parameters:
clazz- to check- Returns:
- Returns true if the passed schema class extends the current instance
- See Also:
-
get
-
set
-
setEncryption
-
createIndex
Description copied from interface:OClassCreates database index that is based on passed in field names. Given index will be added into class instance and associated with database index.- Specified by:
createIndexin interfaceOClass- Parameters:
iName- Database index nameiType- Index type.fields- Field names from which index will be created.- Returns:
- Class index registered inside of given class ans associated with database index.
-
createIndex
Description copied from interface:OClassCreates database index that is based on passed in field names. Given index will be added into class instance and associated with database index.- Specified by:
createIndexin interfaceOClass- Parameters:
iName- Database index nameiType- Index type.fields- Field names from which index will be created.- Returns:
- Class index registered inside of given class ans associated with database index.
-
createIndex
public OIndex createIndex(String iName, OClass.INDEX_TYPE iType, OProgressListener iProgressListener, String... fields) Description copied from interface:OClassCreates database index that is based on passed in field names. Given index will be added into class instance.- Specified by:
createIndexin interfaceOClass- Parameters:
iName- Database index name.iType- Index type.iProgressListener- Progress listener.fields- Field names from which index will be created.- Returns:
- Class index registered inside of given class ans associated with database index.
-
createIndex
public OIndex createIndex(String iName, String iType, OProgressListener iProgressListener, ODocument metadata, String... fields) Description copied from interface:OClassCreates database index that is based on passed in field names. Given index will be added into class instance.- Specified by:
createIndexin interfaceOClass- Parameters:
iName- Database index name.iType- Index type.iProgressListener- Progress listener.metadata- Additional parameters which will be added in index configuration document as "metadata" field.fields- Field names from which index will be created. @return Class index registered inside of given class ans associated with database index.
-
createIndex
public OIndex createIndex(String name, String type, OProgressListener progressListener, ODocument metadata, String algorithm, String... fields) Description copied from interface:OClassCreates database index that is based on passed in field names. Given index will be added into class instance.- Specified by:
createIndexin interfaceOClass- Parameters:
name- Database index name.type- Index type.progressListener- Progress listener.metadata- Additional parameters which will be added in index configuration document as "metadata" field.algorithm- Algorithm to use for indexing.fields- Field names from which index will be created. @return Class index registered inside of given class ans associated with database index.
-
areIndexed
- Specified by:
areIndexedin interfaceOClass- Parameters:
fields- Field names.- Returns:
trueif given fields are contained as first key fields in class indexes.- See Also:
-
areIndexed
Description copied from interface:OClassIndicates whether given fields are contained as first key fields in class indexes. Order of fields does not matter. If there are indexes for the given set of fields in super class they will be taken into account.- Specified by:
areIndexedin interfaceOClass- Parameters:
fields- Field names.- Returns:
trueif given fields are contained as first key fields in class indexes.
-
getInvolvedIndexes
Description copied from interface:OClassReturns list of indexes that contain passed in fields names as their first keys. Order of fields does not matter.All indexes sorted by their count of parameters in ascending order. If there are indexes for the given set of fields in super class they will be taken into account.
- Specified by:
getInvolvedIndexesin interfaceOClass- Parameters:
fields- Field names.- Returns:
- list of indexes that contain passed in fields names as their first keys.
- See Also:
-
getInvolvedIndexes
Description copied from interface:OClassReturns list of indexes that contain passed in fields names as their first keys. Order of fields does not matter.All indexes sorted by their count of parameters in ascending order. If there are indexes for the given set of fields in super class they will be taken into account.
- Specified by:
getInvolvedIndexesin interfaceOClass- Parameters:
fields- Field names.- Returns:
- list of indexes that contain passed in fields names as their first keys.
- See Also:
-
getClassInvolvedIndexes
Description copied from interface:OClassReturns list of indexes that contain passed in fields names as their first keys. Order of fields does not matter.Indexes that related only to the given class will be returned.
- Specified by:
getClassInvolvedIndexesin interfaceOClass- Parameters:
fields- Field names.- Returns:
- list of indexes that contain passed in fields names as their first keys.
- See Also:
-
getClassInvolvedIndexes
- Specified by:
getClassInvolvedIndexesin interfaceOClass- Parameters:
fields- Field names.- Returns:
- list of indexes that contain passed in fields names as their first keys.
- See Also:
-
getClassIndex
Description copied from interface:OClassReturns index instance by database index name.- Specified by:
getClassIndexin interfaceOClass- Parameters:
name- Database index name.- Returns:
- Index instance.
-
getClassIndexes
- Specified by:
getClassIndexesin interfaceOClass- Returns:
- All indexes for given class, not the inherited ones.
-
getClassIndexes
Description copied from interface:OClassInternal. Copy all the indexes for given class, not the inherited ones, in the collection received as argument.- Specified by:
getClassIndexesin interfaceOClass
-
getAutoShardingIndex
Description copied from interface:OClassReturns the auto sharding index configured for the class if any.- Specified by:
getAutoShardingIndexin interfaceOClass
-
isEdgeType
public boolean isEdgeType()- Specified by:
isEdgeTypein interfaceOClass- Returns:
- true if this class represents a subclass of an edge class (E)
-
isVertexType
public boolean isVertexType()- Specified by:
isVertexTypein interfaceOClass- Returns:
- true if this class represents a subclass of a vertex class (V)
-
onPostIndexManagement
public void onPostIndexManagement() -
getIndexes
Description copied from interface:OClassInternal. All indexes for given class and its super classes.- Specified by:
getIndexesin interfaceOClass
-
getIndexes
- Specified by:
getIndexesin interfaceOClass- Returns:
- All indexes for given class and its super classes.
-
acquireSchemaReadLock
public void acquireSchemaReadLock() -
releaseSchemaReadLock
public void releaseSchemaReadLock() -
acquireSchemaWriteLock
public void acquireSchemaWriteLock() -
acquireSchemaWriteLock
-
releaseSchemaWriteLock
public void releaseSchemaWriteLock() -
releaseSchemaWriteLock
public void releaseSchemaWriteLock(boolean iSave) -
releaseSchemaWriteLock
-
checkEmbedded
public void checkEmbedded() -
setClusterSelectionInternal
-
fireDatabaseMigration
-
firePropertyNameMigration
public void firePropertyNameMigration(ODatabaseDocument database, String propertyName, String newPropertyName, OType type) -
checkPersistentPropertyType
public void checkPersistentPropertyType(ODatabaseInternal<ORecord> database, String propertyName, OType type, OClass linkedClass) -
checkAllLikedObjects
protected void checkAllLikedObjects(ODatabaseInternal<ORecord> database, String propertyName, OType type, OClass linkedClass) -
matchesType
-
getEscapedName
-
getOwner
-
renameCluster
-
onlyAddPolymorphicClusterId
protected void onlyAddPolymorphicClusterId(int clusterId) -
addProperty
-
validatePropertyName
-
addClusterIdToIndexes
protected abstract void addClusterIdToIndexes(int iId) -
addBaseClass
Adds a base class to the current one. It adds also the base class cluster ids to the polymorphic cluster ids array.- Parameters:
iBaseClass- The base class to add.
-
checkParametersConflict
-
checkParametersConflict
-
removePolymorphicClusterIds
-
onlyRemovePolymorphicClusterId
protected void onlyRemovePolymorphicClusterId(int clusterId) -
removePolymorphicClusterId
protected void removePolymorphicClusterId(int clusterId) -
getDatabase
-
addPolymorphicClusterIds
Add different cluster id to the "polymorphic cluster ids" array. -
extractFieldTypes
-
setClusterIds
-
decodeClassName
-
toNetworkStream
-
getAllocation
- Specified by:
getAllocationin interfaceOClass
-