Interface OClass
- All Superinterfaces:
Comparable<OClass>
- All Known Subinterfaces:
OView
- All Known Implementing Classes:
OClassAbstractDelegate,OClassDistributed,OClassEmbedded,OClassImpl,OClassRemote,OImmutableClass,OImmutableView,OViewEmbedded,OViewImpl,OViewRemote
Schema class
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionaddCluster(String iClusterName) addClusterId(int iId) addSuperClass(OClass superClass) booleanareIndexed(String... fields) booleanareIndexed(Collection<String> fields) Indicates whether given fields are contained as first key fields in class indexes.voidlongcount()Returns the number of the records of this class considering also subclasses (polymorphic).longcount(boolean iPolymorphic) 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 iName, String iType, OProgressListener iProgressListener, 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 iUnsafe) 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 iUnsafe) Create a property in the class with the specified options.voiddropProperty(String iPropertyName) booleanexistsProperty(String iPropertyName) get(OClass.ATTRIBUTES iAttribute) Deprecated.Returns the auto sharding index configured for the class if any.Deprecated.getClassIndex(String iName) 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[]intvoidgetIndexes(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.int[]getProperty(String iPropertyName) longgetSize()Deprecated.booleanhasClusterId(int clusterId) booleanhasPolymorphicClusterId(int clusterId) booleanbooleanbooleanbooleanbooleanisSubClassOf(OClass iClass) Returns true if the current instance extends the passed schema class (iClass).booleanisSubClassOf(String iClassName) Tells if the current instance extends the passed schema class (iClass).booleanisSuperClassOf(OClass iClass) Returns true if the passed schema class (iClass) extends the current instance.booleanremoveClusterId(int iId) voidremoveCustom(String iName) removeSuperClass(OClass superClass) set(OClass.ATTRIBUTES attribute, Object iValue) setAbstract(boolean iAbstract) setClusterSelection(OClusterSelectionStrategy clusterSelection) setClusterSelection(String iStrategyName) voidsetDefaultClusterId(int iDefaultClusterId) setDescription(String iDescription) setOverSize(float overSize) Sets the oversize factor.setShortName(String shortName) setStrictMode(boolean iMode) setSuperClass(OClass iSuperClass) Deprecated.setSuperClasses(List<? extends OClass> classes) voidtruncate()Truncates all the clusters the class uses.truncateCluster(String clusterName) Removes all data in the cluster with given name.Methods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
EDGE_CLASS_NAME
- See Also:
-
VERTEX_CLASS_NAME
- See Also:
-
-
Method Details
-
isAbstract
boolean isAbstract() -
setAbstract
-
isStrictMode
boolean isStrictMode() -
setStrictMode
-
getSuperClass
Deprecated. -
setSuperClass
Deprecated. -
hasSuperClasses
boolean hasSuperClasses() -
getSuperClassesNames
-
getSuperClasses
-
setSuperClasses
-
addSuperClass
-
removeSuperClass
-
getName
String getName() -
setName
-
getDescription
String getDescription() -
setDescription
-
getStreamableName
String getStreamableName() -
declaredProperties
Collection<OProperty> declaredProperties() -
properties
Collection<OProperty> properties() -
propertiesMap
-
getIndexedProperties
Collection<OProperty> getIndexedProperties() -
getProperty
-
createProperty
-
createProperty
-
createProperty
Create a property in the class with the specified options.- 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 nulliUnsafe- 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
-
createProperty
Create a property in the class with the specified options.- 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 nulliUnsafe- 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.
-
dropProperty
-
existsProperty
-
getClusterForNewInstance
-
getDefaultClusterId
int getDefaultClusterId() -
setDefaultClusterId
void setDefaultClusterId(int iDefaultClusterId) -
getClusterIds
int[] getClusterIds() -
addClusterId
-
getClusterSelection
OClusterSelectionStrategy getClusterSelection() -
setClusterSelection
-
setClusterSelection
-
addCluster
-
truncateCluster
Removes all data in the cluster with given name. As result indexes for this class will be rebuilt.- Parameters:
clusterName- Name of cluster to be truncated.- Returns:
- Instance of current object.
-
removeClusterId
-
getPolymorphicClusterIds
int[] getPolymorphicClusterIds() -
getBaseClasses
Deprecated. -
getAllBaseClasses
Deprecated. -
getSubclasses
Collection<OClass> getSubclasses()- Returns:
- all the subclasses (one level hierarchy only)
-
getAllSubclasses
Collection<OClass> getAllSubclasses()- Returns:
- all the subclass hierarchy
-
getAllSuperClasses
Collection<OClass> getAllSuperClasses()- Returns:
- all recursively collected super classes
-
getSize
long getSize() -
getClassOverSize
float getClassOverSize() -
getOverSize
float getOverSize()Returns 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.- Returns:
- Oversize factor
- See Also:
-
setOverSize
Sets 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. Default is 0.- Returns:
- Oversize factor
- See Also:
-
count
long count()Returns the number of the records of this class considering also subclasses (polymorphic). -
count
long count(boolean iPolymorphic) Returns the number of the records of this class and based on polymorphic parameter it consider or not the subclasses. -
truncate
Truncates all the clusters the class uses.- Throws:
IOException
-
isSubClassOf
Tells if the current instance extends the passed schema class (iClass).- Parameters:
iClassName-- Returns:
- true if the current instance extends the passed schema class (iClass).
- See Also:
-
isSubClassOf
Returns true if the current instance extends the passed schema class (iClass).- Parameters:
iClass-- 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.- Parameters:
iClass-- Returns:
- Returns true if the passed schema class extends the current instance.
- See Also:
-
getShortName
String getShortName() -
setShortName
-
get
-
set
-
createIndex
Creates database index that is based on passed in field names. Given index will be added into class instance and associated with database index.- Parameters:
fields- Field names from which index will be created.iName- Database index nameiType- Index type.- Returns:
- Class index registered inside of given class ans associated with database index.
-
createIndex
Creates database index that is based on passed in field names. Given index will be added into class instance and associated with database index.- Parameters:
fields- Field names from which index will be created.iName- Database index nameiType- Index type.- Returns:
- Class index registered inside of given class ans associated with database index.
-
createIndex
OIndex createIndex(String iName, OClass.INDEX_TYPE iType, OProgressListener iProgressListener, String... fields) Creates database index that is based on passed in field names. Given index will be added into class instance.- Parameters:
fields- Field names from which index will be created.iName- Database index name.iType- Index type.iProgressListener- Progress listener.- Returns:
- Class index registered inside of given class ans associated with database index.
-
createIndex
OIndex createIndex(String iName, String iType, OProgressListener iProgressListener, ODocument metadata, String algorithm, String... fields) Creates database index that is based on passed in field names. Given index will be added into class instance.- 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.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.
-
createIndex
OIndex createIndex(String iName, String iType, OProgressListener iProgressListener, ODocument metadata, String... fields) Creates database index that is based on passed in field names. Given index will be added into class instance.- 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.
-
getInvolvedIndexes
Returns 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.
- Parameters:
fields- Field names.- Returns:
- list of indexes that contain passed in fields names as their first keys.
- See Also:
-
getInvolvedIndexes
Returns 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.
- Parameters:
fields- Field names.- Returns:
- list of indexes that contain passed in fields names as their first keys.
- See Also:
-
getClassInvolvedIndexes
Returns 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.
- Parameters:
fields- Field names.- Returns:
- list of indexes that contain passed in fields names as their first keys.
- See Also:
-
getClassInvolvedIndexes
- Parameters:
fields- Field names.- Returns:
- list of indexes that contain passed in fields names as their first keys.
- See Also:
-
areIndexed
Indicates 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.- Parameters:
fields- Field names.- Returns:
trueif given fields are contained as first key fields in class indexes.
-
areIndexed
- Parameters:
fields- Field names.- Returns:
trueif given fields are contained as first key fields in class indexes.- See Also:
-
getClassIndex
Returns index instance by database index name.- Parameters:
iName- Database index name.- Returns:
- Index instance.
-
getClassIndexes
- Returns:
- All indexes for given class, not the inherited ones.
-
getClassIndexes
Internal. Copy all the indexes for given class, not the inherited ones, in the collection received as argument. -
getIndexes
Internal. All indexes for given class and its super classes. -
getIndexes
- Returns:
- All indexes for given class and its super classes.
-
getAutoShardingIndex
OIndex getAutoShardingIndex()Returns the auto sharding index configured for the class if any. -
isEdgeType
boolean isEdgeType()- Returns:
- true if this class represents a subclass of an edge class (E)
-
isVertexType
boolean isVertexType()- Returns:
- true if this class represents a subclass of a vertex class (V)
-
getCustom
-
setCustom
-
removeCustom
-
clearCustom
void clearCustom() -
getCustomKeys
-
hasClusterId
boolean hasClusterId(int clusterId) -
hasPolymorphicClusterId
boolean hasPolymorphicClusterId(int clusterId) -
getAllocation
OClassAllocation getAllocation()
-