public abstract class OClassImpl extends Object implements OClass
OClass.ATTRIBUTES, OClass.INDEX_TYPE
Modifier and Type | Field and Description |
---|---|
protected boolean |
abstractClass |
protected int[] |
clusterIds |
protected OClusterSelectionStrategy |
clusterSelection |
protected Map<String,String> |
customFields |
protected int |
defaultClusterId |
protected String |
description |
protected ODocument |
document |
protected int |
hashCode |
protected String |
name |
protected static int |
NOT_EXISTENT_CLUSTER_ID |
protected float |
overSize |
protected OSchemaShared |
owner |
protected int[] |
polymorphicClusterIds |
protected Map<String,OProperty> |
properties |
protected String |
shortName |
protected boolean |
strictMode |
protected List<OClass> |
subclasses |
protected List<OClassImpl> |
superClasses |
EDGE_CLASS_NAME, VERTEX_CLASS_NAME
Modifier | Constructor and Description |
---|---|
protected |
OClassImpl(OSchemaShared iOwner,
ODocument iDocument,
String iName)
Constructor used in unmarshalling.
|
protected |
OClassImpl(OSchemaShared iOwner,
String iName)
Constructor used in unmarshalling.
|
protected |
OClassImpl(OSchemaShared iOwner,
String iName,
int[] iClusterIds) |
Modifier and Type | Method and Description |
---|---|
void |
acquireSchemaReadLock() |
void |
acquireSchemaWriteLock() |
protected OClass |
addBaseClass(OClassImpl iBaseClass)
Adds a base class to the current one.
|
static OClass |
addClusters(OClass cls,
int iClusters) |
protected void |
addPolymorphicClusterId(int clusterId) |
protected void |
addPolymorphicClusterIds(OClassImpl iBaseClass)
Add different cluster id to the "polymorphic cluster ids" array.
|
protected abstract OProperty |
addProperty(String propertyName,
OType type,
OType linkedType,
OClass linkedClass,
boolean unsafe) |
boolean |
areIndexed(Collection<String> fields)
Indicates whether given fields are contained as first key fields in class indexes.
|
boolean |
areIndexed(String... fields) |
void |
checkEmbedded() |
static void |
checkParametersConflict(List<OClass> classes) |
protected void |
checkParametersConflict(OClass baseClass) |
void |
checkPersistentPropertyType(ODatabaseInternal<ORecord> database,
String propertyName,
OType type) |
int |
compareTo(OClass o) |
long |
count()
Returns the number of the records of this class considering also subclasses (polymorphic).
|
long |
count(boolean isPolymorphic)
Returns the number of the records of this class and based on polymorphic parameter it consider
or not the subclasses.
|
OIndex |
createIndex(String iName,
OClass.INDEX_TYPE iType,
OProgressListener iProgressListener,
String... fields)
Creates database index that is based on passed in field names.
|
OIndex |
createIndex(String iName,
OClass.INDEX_TYPE iType,
String... fields)
Creates database index that is based on passed in field names.
|
OIndex |
createIndex(String iName,
String iType,
OProgressListener iProgressListener,
ODocument metadata,
String... fields)
Creates database index that is based on passed in field names.
|
OIndex |
createIndex(String name,
String type,
OProgressListener progressListener,
ODocument metadata,
String algorithm,
String... fields)
Creates database index that is based on passed in field names.
|
OIndex |
createIndex(String iName,
String iType,
String... fields)
Creates database index that is based on passed in field names.
|
OProperty |
createProperty(String iPropertyName,
OType iType) |
OProperty |
createProperty(String iPropertyName,
OType iType,
OClass iLinkedClass) |
OProperty |
createProperty(String iPropertyName,
OType iType,
OClass iLinkedClass,
boolean unsafe)
Create a property in the class with the specified options.
|
OProperty |
createProperty(String iPropertyName,
OType iType,
OType iLinkedType) |
OProperty |
createProperty(String iPropertyName,
OType iType,
OType iLinkedType,
boolean unsafe)
Create a property in the class with the specified options.
|
protected abstract OPropertyImpl |
createPropertyInstance(ODocument p) |
Collection<OProperty> |
declaredProperties() |
static String |
decodeClassName(String s) |
boolean |
equals(Object obj) |
boolean |
existsProperty(String propertyName) |
List<OType> |
extractFieldTypes(String[] fieldNames) |
void |
fireDatabaseMigration(ODatabaseDocument database,
String propertyName,
OType type) |
void |
firePropertyNameMigration(ODatabaseDocument database,
String propertyName,
String newPropertyName,
OType type) |
void |
fromStream() |
void |
fromStream(ODocument document) |
Object |
get(OClass.ATTRIBUTES iAttribute) |
Collection<OClass> |
getAllBaseClasses()
Deprecated.
|
Collection<OClass> |
getAllSubclasses() |
Collection<OClass> |
getAllSuperClasses() |
OIndex |
getAutoShardingIndex()
Returns the auto sharding index configured for the class if any.
|
Collection<OClass> |
getBaseClasses()
Deprecated.
|
OIndex |
getClassIndex(String name)
Returns index instance by database index name.
|
Set<OIndex> |
getClassIndexes() |
void |
getClassIndexes(Collection<OIndex> indexes)
Internal.
|
Set<OIndex> |
getClassInvolvedIndexes(Collection<String> fields)
Returns list of indexes that contain passed in fields names as their first keys.
|
Set<OIndex> |
getClassInvolvedIndexes(String... fields) |
float |
getClassOverSize() |
int |
getClusterForNewInstance(ODocument doc) |
int[] |
getClusterIds() |
OClusterSelectionStrategy |
getClusterSelection() |
String |
getCustom(String iName) |
Map<String,String> |
getCustomInternal() |
Set<String> |
getCustomKeys() |
protected ODatabaseDocumentInternal |
getDatabase() |
int |
getDefaultClusterId() |
String |
getDescription() |
protected String |
getEscapedName(String iName,
boolean iStrictSQL) |
Collection<OProperty> |
getIndexedProperties() |
void |
getIndexedProperties(Collection<OProperty> indexedProperties) |
Set<OIndex> |
getIndexes() |
void |
getIndexes(Collection<OIndex> indexes)
Internal.
|
Set<OIndex> |
getInvolvedIndexes(Collection<String> fields)
Returns list of indexes that contain passed in fields names as their first keys.
|
Set<OIndex> |
getInvolvedIndexes(String... fields)
Returns list of indexes that contain passed in fields names as their first keys.
|
String |
getName() |
float |
getOverSize()
Returns the oversize factor.
|
OSchemaShared |
getOwner() |
int[] |
getPolymorphicClusterIds() |
OProperty |
getProperty(String propertyName) |
String |
getShortName() |
long |
getSize() |
String |
getStreamableName() |
Collection<OClass> |
getSubclasses() |
OClass |
getSuperClass()
Deprecated.
|
List<OClass> |
getSuperClasses() |
List<String> |
getSuperClassesNames() |
boolean |
hasClusterId(int clusterId) |
int |
hashCode() |
boolean |
hasPolymorphicClusterId(int clusterId) |
boolean |
hasSuperClasses() |
boolean |
isAbstract() |
boolean |
isEdgeType() |
boolean |
isStrictMode() |
boolean |
isSubClassOf(OClass clazz)
Check if the current instance extends specified schema class.
|
boolean |
isSubClassOf(String iClassName)
Check if the current instance extends specified schema class.
|
boolean |
isSuperClassOf(OClass clazz)
Returns true if the passed schema class (iClass) extends the current instance.
|
boolean |
isVertexType() |
void |
onPostIndexManagement() |
Collection<OProperty> |
properties() |
Map<String,OProperty> |
propertiesMap() |
static int[] |
readableClusters(ODatabaseDocument db,
int[] iClusterIds,
String className) |
void |
releaseSchemaReadLock() |
void |
releaseSchemaWriteLock() |
void |
releaseSchemaWriteLock(boolean iSave) |
protected abstract OClass |
removeBaseClassInternal(OClass baseClass) |
void |
removeCustom(String name) |
protected void |
removePolymorphicClusterId(int clusterId) |
protected void |
removePolymorphicClusterIds(OClassImpl iBaseClass) |
protected void |
renameCluster(String oldName,
String newName) |
void |
renameProperty(String iOldName,
String iNewName) |
OClass |
set(OClass.ATTRIBUTES attribute,
Object iValue) |
protected OClass |
setClusterIds(int[] iClusterIds) |
OClass |
setClusterSelection(OClusterSelectionStrategy clusterSelection) |
void |
setClusterSelectionInternal(OClusterSelectionStrategy iClusterSelection) |
abstract OClassImpl |
setEncryption(String iValue) |
protected void |
setEncryptionInternal(ODatabaseDocumentInternal database,
String value) |
OClass |
setSuperClass(OClass iSuperClass)
Deprecated.
|
OClass |
setSuperClassesByNames(List<String> classNames) |
protected abstract void |
setSuperClassesInternal(List<? extends OClass> classes) |
ODocument |
toNetworkStream() |
ODocument |
toStream() |
String |
toString() |
void |
truncate()
Truncates all the clusters the class uses.
|
protected void |
truncateClusterInternal(String clusterName,
ODatabaseDocumentInternal database) |
protected void |
validatePropertyName(String propertyName) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addCluster, addClusterId, addSuperClass, clearCustom, dropProperty, removeClusterId, removeSuperClass, setAbstract, setClusterSelection, setCustom, setDefaultClusterId, setDescription, setName, setOverSize, setShortName, setStrictMode, setSuperClasses, truncateCluster
protected static final int NOT_EXISTENT_CLUSTER_ID
protected final OSchemaShared owner
protected int defaultClusterId
protected String name
protected String description
protected int[] clusterIds
protected List<OClassImpl> superClasses
protected int[] polymorphicClusterIds
protected float overSize
protected String shortName
protected boolean strictMode
protected boolean abstractClass
protected volatile OClusterSelectionStrategy clusterSelection
protected volatile int hashCode
protected ODocument document
protected OClassImpl(OSchemaShared iOwner, String iName)
protected OClassImpl(OSchemaShared iOwner, String iName, int[] iClusterIds)
protected OClassImpl(OSchemaShared iOwner, ODocument iDocument, String iName)
public static int[] readableClusters(ODatabaseDocument db, int[] iClusterIds, String className)
public OClusterSelectionStrategy getClusterSelection()
getClusterSelection
in interface OClass
public OClass setClusterSelection(OClusterSelectionStrategy clusterSelection)
setClusterSelection
in interface OClass
public void removeCustom(String name)
removeCustom
in interface OClass
public Set<String> getCustomKeys()
getCustomKeys
in interface OClass
public boolean hasClusterId(int clusterId)
hasClusterId
in interface OClass
public boolean hasPolymorphicClusterId(int clusterId)
hasPolymorphicClusterId
in interface OClass
@Deprecated public OClass getSuperClass()
getSuperClass
in interface OClass
@Deprecated public OClass setSuperClass(OClass iSuperClass)
setSuperClass
in interface OClass
public List<OClass> getSuperClasses()
getSuperClasses
in interface OClass
public boolean hasSuperClasses()
hasSuperClasses
in interface OClass
public List<String> getSuperClassesNames()
getSuperClassesNames
in interface OClass
protected abstract void setSuperClassesInternal(List<? extends OClass> classes)
public String getShortName()
getShortName
in interface OClass
public String getDescription()
getDescription
in interface OClass
public String getStreamableName()
getStreamableName
in interface OClass
public Collection<OProperty> declaredProperties()
declaredProperties
in interface OClass
public Map<String,OProperty> propertiesMap()
propertiesMap
in interface OClass
public Collection<OProperty> properties()
properties
in interface OClass
public void getIndexedProperties(Collection<OProperty> indexedProperties)
public Collection<OProperty> getIndexedProperties()
getIndexedProperties
in interface OClass
public OProperty getProperty(String propertyName)
getProperty
in interface OClass
public OProperty createProperty(String iPropertyName, OType iType)
createProperty
in interface OClass
public OProperty createProperty(String iPropertyName, OType iType, OClass iLinkedClass)
createProperty
in interface OClass
public OProperty createProperty(String iPropertyName, OType iType, OClass iLinkedClass, boolean unsafe)
OClass
createProperty
in interface OClass
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 propertypublic OProperty createProperty(String iPropertyName, OType iType, OType iLinkedType)
createProperty
in interface OClass
public OProperty createProperty(String iPropertyName, OType iType, OType iLinkedType, boolean unsafe)
OClass
createProperty
in interface OClass
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 propertypublic boolean existsProperty(String propertyName)
existsProperty
in interface OClass
public void fromStream()
protected abstract OPropertyImpl createPropertyInstance(ODocument p)
public ODocument toStream()
public int getClusterForNewInstance(ODocument doc)
getClusterForNewInstance
in interface OClass
public int getDefaultClusterId()
getDefaultClusterId
in interface OClass
public int[] getClusterIds()
getClusterIds
in interface OClass
public int[] getPolymorphicClusterIds()
getPolymorphicClusterIds
in interface OClass
protected void truncateClusterInternal(String clusterName, ODatabaseDocumentInternal database)
public Collection<OClass> getSubclasses()
getSubclasses
in interface OClass
public Collection<OClass> getAllSubclasses()
getAllSubclasses
in interface OClass
@Deprecated public Collection<OClass> getBaseClasses()
getBaseClasses
in interface OClass
@Deprecated public Collection<OClass> getAllBaseClasses()
getAllBaseClasses
in interface OClass
public Collection<OClass> getAllSuperClasses()
getAllSuperClasses
in interface OClass
public float getOverSize()
OClass
getOverSize
in interface OClass
OClass.setOverSize(float)
public float getClassOverSize()
getClassOverSize
in interface OClass
public boolean isAbstract()
isAbstract
in interface OClass
public boolean isStrictMode()
isStrictMode
in interface OClass
public int compareTo(OClass o)
compareTo
in interface Comparable<OClass>
public long count()
OClass
public long count(boolean isPolymorphic)
OClass
public void truncate()
public boolean isSubClassOf(String iClassName)
isSubClassOf
in interface OClass
iClassName
- of class that should be checkedisSuperClassOf(OClass)
public boolean isSubClassOf(OClass clazz)
isSubClassOf
in interface OClass
clazz
- to checkisSuperClassOf(OClass)
public boolean isSuperClassOf(OClass clazz)
isSuperClassOf
in interface OClass
clazz
- to checkisSubClassOf(OClass)
public Object get(OClass.ATTRIBUTES iAttribute)
public OClass set(OClass.ATTRIBUTES attribute, Object iValue)
public abstract OClassImpl setEncryption(String iValue)
protected void setEncryptionInternal(ODatabaseDocumentInternal database, String value)
public OIndex createIndex(String iName, OClass.INDEX_TYPE iType, String... fields)
OClass
createIndex
in interface OClass
iName
- Database index nameiType
- Index type.fields
- Field names from which index will be created.public OIndex createIndex(String iName, String iType, String... fields)
OClass
createIndex
in interface OClass
iName
- Database index nameiType
- Index type.fields
- Field names from which index will be created.public OIndex createIndex(String iName, OClass.INDEX_TYPE iType, OProgressListener iProgressListener, String... fields)
OClass
createIndex
in interface OClass
iName
- Database index name.iType
- Index type.iProgressListener
- Progress listener.fields
- Field names from which index will be created.public OIndex createIndex(String iName, String iType, OProgressListener iProgressListener, ODocument metadata, String... fields)
OClass
createIndex
in interface OClass
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.public OIndex createIndex(String name, String type, OProgressListener progressListener, ODocument metadata, String algorithm, String... fields)
OClass
createIndex
in interface OClass
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.public boolean areIndexed(String... fields)
areIndexed
in interface OClass
fields
- Field names.true
if given fields are contained as first key fields in class indexes.OClass.areIndexed(java.util.Collection)
public boolean areIndexed(Collection<String> fields)
OClass
areIndexed
in interface OClass
fields
- Field names.true
if given fields are contained as first key fields in class indexes.public Set<OIndex> getInvolvedIndexes(String... fields)
OClass
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.
getInvolvedIndexes
in interface OClass
fields
- Field names.OClass.getInvolvedIndexes(java.util.Collection)
public Set<OIndex> getInvolvedIndexes(Collection<String> fields)
OClass
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.
getInvolvedIndexes
in interface OClass
fields
- Field names.OIndexDefinition.getParamCount()
public Set<OIndex> getClassInvolvedIndexes(Collection<String> fields)
OClass
Indexes that related only to the given class will be returned.
getClassInvolvedIndexes
in interface OClass
fields
- Field names.OIndexDefinition.getParamCount()
public Set<OIndex> getClassInvolvedIndexes(String... fields)
getClassInvolvedIndexes
in interface OClass
fields
- Field names.OClass.getClassInvolvedIndexes(java.util.Collection)
public OIndex getClassIndex(String name)
OClass
getClassIndex
in interface OClass
name
- Database index name.public Set<OIndex> getClassIndexes()
getClassIndexes
in interface OClass
public void getClassIndexes(Collection<OIndex> indexes)
OClass
getClassIndexes
in interface OClass
public OIndex getAutoShardingIndex()
OClass
getAutoShardingIndex
in interface OClass
public boolean isEdgeType()
isEdgeType
in interface OClass
public boolean isVertexType()
isVertexType
in interface OClass
public void onPostIndexManagement()
public void getIndexes(Collection<OIndex> indexes)
OClass
getIndexes
in interface OClass
public Set<OIndex> getIndexes()
getIndexes
in interface OClass
public void acquireSchemaReadLock()
public void releaseSchemaReadLock()
public void acquireSchemaWriteLock()
public void releaseSchemaWriteLock()
public void releaseSchemaWriteLock(boolean iSave)
public void checkEmbedded()
public void setClusterSelectionInternal(OClusterSelectionStrategy iClusterSelection)
public void fireDatabaseMigration(ODatabaseDocument database, String propertyName, OType type)
public void firePropertyNameMigration(ODatabaseDocument database, String propertyName, String newPropertyName, OType type)
public void checkPersistentPropertyType(ODatabaseInternal<ORecord> database, String propertyName, OType type)
public OSchemaShared getOwner()
protected void addPolymorphicClusterId(int clusterId)
protected abstract OProperty addProperty(String propertyName, OType type, OType linkedType, OClass linkedClass, boolean unsafe)
protected void validatePropertyName(String propertyName)
protected OClass addBaseClass(OClassImpl iBaseClass)
iBaseClass
- The base class to add.protected void checkParametersConflict(OClass baseClass)
protected void removePolymorphicClusterIds(OClassImpl iBaseClass)
protected void removePolymorphicClusterId(int clusterId)
protected ODatabaseDocumentInternal getDatabase()
protected void addPolymorphicClusterIds(OClassImpl iBaseClass)
protected OClass setClusterIds(int[] iClusterIds)
public void fromStream(ODocument document)
public ODocument toNetworkStream()
Copyright © 2009–2020 OrientDB. All rights reserved.