Class OImmutableClass

java.lang.Object
com.orientechnologies.orient.core.metadata.schema.OImmutableClass
All Implemented Interfaces:
OClass, Comparable<OClass>
Direct Known Subclasses:
OImmutableView

public class OImmutableClass extends Object implements OClass
Since:
10/21/14
Author:
Andrey Lomakin (a.lomakin-at-orientdb.com)
  • Field Details

  • Constructor Details

  • Method Details

    • init

      public void init()
    • isSecurityPolicy

      public boolean isSecurityPolicy()
    • isAbstract

      public boolean isAbstract()
      Specified by:
      isAbstract in interface OClass
    • setAbstract

      public OClass setAbstract(boolean iAbstract)
      Specified by:
      setAbstract in interface OClass
    • isStrictMode

      public boolean isStrictMode()
      Specified by:
      isStrictMode in interface OClass
    • setStrictMode

      public OClass setStrictMode(boolean iMode)
      Specified by:
      setStrictMode in interface OClass
    • getSuperClass

      @Deprecated public OClass getSuperClass()
      Deprecated.
      Specified by:
      getSuperClass in interface OClass
    • setSuperClass

      @Deprecated public OClass setSuperClass(OClass iSuperClass)
      Deprecated.
      Specified by:
      setSuperClass in interface OClass
    • getSuperClasses

      public List<OClass> getSuperClasses()
      Specified by:
      getSuperClasses in interface OClass
    • hasSuperClasses

      public boolean hasSuperClasses()
      Specified by:
      hasSuperClasses in interface OClass
    • getSuperClassesNames

      public List<String> getSuperClassesNames()
      Specified by:
      getSuperClassesNames in interface OClass
    • setSuperClasses

      public OClass setSuperClasses(List<? extends OClass> classes)
      Specified by:
      setSuperClasses in interface OClass
    • addSuperClass

      public OClass addSuperClass(OClass superClass)
      Specified by:
      addSuperClass in interface OClass
    • removeSuperClass

      public OClass removeSuperClass(OClass superClass)
      Specified by:
      removeSuperClass in interface OClass
    • getName

      public String getName()
      Specified by:
      getName in interface OClass
    • setName

      public OClass setName(String iName)
      Specified by:
      setName in interface OClass
    • getStreamableName

      public String getStreamableName()
      Specified by:
      getStreamableName in interface OClass
    • declaredProperties

      public Collection<OProperty> declaredProperties()
      Specified by:
      declaredProperties in interface OClass
    • properties

      public Collection<OProperty> properties()
      Specified by:
      properties in interface OClass
    • propertiesMap

      public Map<String,OProperty> propertiesMap()
      Specified by:
      propertiesMap in interface OClass
    • getIndexedProperties

      public void getIndexedProperties(Collection<OProperty> indexedProperties)
    • getIndexedProperties

      public Collection<OProperty> getIndexedProperties()
      Specified by:
      getIndexedProperties in interface OClass
    • getProperty

      public OProperty getProperty(String propertyName)
      Specified by:
      getProperty in interface OClass
    • createProperty

      public OProperty createProperty(String iPropertyName, OType iType)
      Specified by:
      createProperty in interface OClass
    • createProperty

      public OProperty createProperty(String iPropertyName, OType iType, OClass iLinkedClass)
      Specified by:
      createProperty in interface OClass
    • createProperty

      public OProperty createProperty(String iPropertyName, OType iType, OClass iLinkedClass, boolean unsafe)
      Description copied from interface: OClass
      Create a property in the class with the specified options.
      Specified by:
      createProperty in interface OClass
      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 null
      unsafe - 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

      public OProperty createProperty(String iPropertyName, OType iType, OType iLinkedType)
      Specified by:
      createProperty in interface OClass
    • createProperty

      public OProperty createProperty(String iPropertyName, OType iType, OType iLinkedType, boolean unsafe)
      Description copied from interface: OClass
      Create a property in the class with the specified options.
      Specified by:
      createProperty in interface OClass
      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 null
      unsafe - 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

      public void dropProperty(String iPropertyName)
      Specified by:
      dropProperty in interface OClass
    • existsProperty

      public boolean existsProperty(String propertyName)
      Specified by:
      existsProperty in interface OClass
    • getClusterForNewInstance

      public int getClusterForNewInstance(ODocument doc)
      Specified by:
      getClusterForNewInstance in interface OClass
    • getDefaultClusterId

      public int getDefaultClusterId()
      Specified by:
      getDefaultClusterId in interface OClass
    • setDefaultClusterId

      public void setDefaultClusterId(int iDefaultClusterId)
      Specified by:
      setDefaultClusterId in interface OClass
    • getClusterIds

      public int[] getClusterIds()
      Specified by:
      getClusterIds in interface OClass
    • addClusterId

      public OClass addClusterId(int iId)
      Specified by:
      addClusterId in interface OClass
    • getClusterSelection

      public OClusterSelectionStrategy getClusterSelection()
      Specified by:
      getClusterSelection in interface OClass
    • setClusterSelection

      public OClass setClusterSelection(OClusterSelectionStrategy clusterSelection)
      Specified by:
      setClusterSelection in interface OClass
    • setClusterSelection

      public OClass setClusterSelection(String iStrategyName)
      Specified by:
      setClusterSelection in interface OClass
    • addCluster

      public OClass addCluster(String iClusterName)
      Specified by:
      addCluster in interface OClass
    • truncateCluster

      public OClass truncateCluster(String clusterName)
      Description copied from interface: OClass
      Removes all data in the cluster with given name. As result indexes for this class will be rebuilt.
      Specified by:
      truncateCluster in interface OClass
      Parameters:
      clusterName - Name of cluster to be truncated.
      Returns:
      Instance of current object.
    • removeClusterId

      public OClass removeClusterId(int iId)
      Specified by:
      removeClusterId in interface OClass
    • getPolymorphicClusterIds

      public int[] getPolymorphicClusterIds()
      Specified by:
      getPolymorphicClusterIds in interface OClass
    • getSchema

      public OImmutableSchema getSchema()
    • getSubclasses

      public Collection<OClass> getSubclasses()
      Specified by:
      getSubclasses in interface OClass
      Returns:
      all the subclasses (one level hierarchy only)
    • getAllSubclasses

      public Collection<OClass> getAllSubclasses()
      Specified by:
      getAllSubclasses in interface OClass
      Returns:
      all the subclass hierarchy
    • getBaseClasses

      @Deprecated public Collection<OClass> getBaseClasses()
      Deprecated.
      Specified by:
      getBaseClasses in interface OClass
    • getAllBaseClasses

      @Deprecated public Collection<OClass> getAllBaseClasses()
      Deprecated.
      Specified by:
      getAllBaseClasses in interface OClass
    • getAllSuperClasses

      public Collection<OClass> getAllSuperClasses()
      Specified by:
      getAllSuperClasses in interface OClass
      Returns:
      all recursively collected super classes
    • getSize

      public long getSize()
      Specified by:
      getSize in interface OClass
    • getOverSize

      public float getOverSize()
      Description copied from interface: OClass
      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.
      Specified by:
      getOverSize in interface OClass
      Returns:
      Oversize factor
      See Also:
    • getClassOverSize

      public float getClassOverSize()
      Specified by:
      getClassOverSize in interface OClass
    • setOverSize

      public OClass setOverSize(float overSize)
      Description copied from interface: OClass
      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.
      Specified by:
      setOverSize in interface OClass
      Returns:
      Oversize factor
      See Also:
    • count

      public long count()
      Description copied from interface: OClass
      Returns the number of the records of this class considering also subclasses (polymorphic).
      Specified by:
      count in interface OClass
    • count

      public long count(boolean isPolymorphic)
      Description copied from interface: OClass
      Returns the number of the records of this class and based on polymorphic parameter it consider or not the subclasses.
      Specified by:
      count in interface OClass
    • countImpl

      public long countImpl(boolean isPolymorphic)
    • truncate

      public void truncate() throws IOException
      Description copied from interface: OClass
      Truncates all the clusters the class uses.
      Specified by:
      truncate in interface OClass
      Throws:
      IOException
    • isSubClassOf

      public boolean isSubClassOf(String iClassName)
      Description copied from interface: OClass
      Tells if the current instance extends the passed schema class (iClass).
      Specified by:
      isSubClassOf in interface OClass
      Returns:
      true if the current instance extends the passed schema class (iClass).
      See Also:
    • isSubClassOf

      public boolean isSubClassOf(OClass clazz)
      Description copied from interface: OClass
      Returns true if the current instance extends the passed schema class (iClass).
      Specified by:
      isSubClassOf in interface OClass
      Returns:
      true if the current instance extends the passed schema class (iClass).
      See Also:
    • isSuperClassOf

      public boolean isSuperClassOf(OClass clazz)
      Description copied from interface: OClass
      Returns true if the passed schema class (iClass) extends the current instance.
      Specified by:
      isSuperClassOf in interface OClass
      Returns:
      Returns true if the passed schema class extends the current instance.
      See Also:
    • getShortName

      public String getShortName()
      Specified by:
      getShortName in interface OClass
    • setShortName

      public OClass setShortName(String shortName)
      Specified by:
      setShortName in interface OClass
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface OClass
    • setDescription

      public OClass setDescription(String iDescription)
      Specified by:
      setDescription in interface OClass
    • get

      public Object get(OClass.ATTRIBUTES iAttribute)
      Specified by:
      get in interface OClass
    • set

      public OClass set(OClass.ATTRIBUTES attribute, Object iValue)
      Specified by:
      set in interface OClass
    • createIndex

      public OIndex createIndex(String iName, OClass.INDEX_TYPE iType, String... fields)
      Description copied from interface: OClass
      Creates 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:
      createIndex in interface OClass
      Parameters:
      iName - Database index name
      iType - 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, String iType, String... fields)
      Description copied from interface: OClass
      Creates 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:
      createIndex in interface OClass
      Parameters:
      iName - Database index name
      iType - 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: OClass
      Creates database index that is based on passed in field names. Given index will be added into class instance.
      Specified by:
      createIndex in interface OClass
      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 algorithm, String... fields)
      Description copied from interface: OClass
      Creates database index that is based on passed in field names. Given index will be added into class instance.
      Specified by:
      createIndex in interface OClass
      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

      public OIndex createIndex(String iName, String iType, OProgressListener iProgressListener, ODocument metadata, String... fields)
      Description copied from interface: OClass
      Creates database index that is based on passed in field names. Given index will be added into class instance.
      Specified by:
      createIndex in interface OClass
      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

      public Set<OIndex> getInvolvedIndexes(Collection<String> fields)
      Description copied from interface: OClass
      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.

      Specified by:
      getInvolvedIndexes in interface OClass
      Parameters:
      fields - Field names.
      Returns:
      list of indexes that contain passed in fields names as their first keys.
      See Also:
    • getInvolvedIndexes

      public Set<OIndex> getInvolvedIndexes(String... fields)
      Description copied from interface: OClass
      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.

      Specified by:
      getInvolvedIndexes in interface OClass
      Parameters:
      fields - Field names.
      Returns:
      list of indexes that contain passed in fields names as their first keys.
      See Also:
    • getClassInvolvedIndexes

      public Set<OIndex> getClassInvolvedIndexes(Collection<String> fields)
      Description copied from interface: OClass
      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.

      Specified by:
      getClassInvolvedIndexes in interface OClass
      Parameters:
      fields - Field names.
      Returns:
      list of indexes that contain passed in fields names as their first keys.
      See Also:
    • getClassInvolvedIndexes

      public Set<OIndex> getClassInvolvedIndexes(String... fields)
      Specified by:
      getClassInvolvedIndexes in interface OClass
      Parameters:
      fields - Field names.
      Returns:
      list of indexes that contain passed in fields names as their first keys.
      See Also:
    • areIndexed

      public boolean areIndexed(Collection<String> fields)
      Description copied from interface: OClass
      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.
      Specified by:
      areIndexed in interface OClass
      Parameters:
      fields - Field names.
      Returns:
      true if given fields are contained as first key fields in class indexes.
    • areIndexed

      public boolean areIndexed(String... fields)
      Specified by:
      areIndexed in interface OClass
      Parameters:
      fields - Field names.
      Returns:
      true if given fields are contained as first key fields in class indexes.
      See Also:
    • getClassIndex

      public OIndex getClassIndex(String iName)
      Description copied from interface: OClass
      Returns index instance by database index name.
      Specified by:
      getClassIndex in interface OClass
      Parameters:
      iName - Database index name.
      Returns:
      Index instance.
    • getClassIndexes

      public Set<OIndex> getClassIndexes()
      Specified by:
      getClassIndexes in interface OClass
      Returns:
      All indexes for given class, not the inherited ones.
    • getClassIndexes

      public void getClassIndexes(Collection<OIndex> indexes)
      Description copied from interface: OClass
      Internal. Copy all the indexes for given class, not the inherited ones, in the collection received as argument.
      Specified by:
      getClassIndexes in interface OClass
    • getRawClassIndexes

      public void getRawClassIndexes(Collection<OIndex> indexes)
    • getIndexes

      public void getIndexes(Collection<OIndex> indexes)
      Description copied from interface: OClass
      Internal. All indexes for given class and its super classes.
      Specified by:
      getIndexes in interface OClass
    • getRawIndexes

      public void getRawIndexes(Collection<OIndex> indexes)
    • getIndexes

      public Set<OIndex> getIndexes()
      Specified by:
      getIndexes in interface OClass
      Returns:
      All indexes for given class and its super classes.
    • getRawIndexes

      public Set<OIndex> getRawIndexes()
    • getAutoShardingIndex

      public OIndex getAutoShardingIndex()
      Description copied from interface: OClass
      Returns the auto sharding index configured for the class if any.
      Specified by:
      getAutoShardingIndex in interface OClass
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getCustom

      public String getCustom(String iName)
      Specified by:
      getCustom in interface OClass
    • setCustom

      public OClass setCustom(String iName, String iValue)
      Specified by:
      setCustom in interface OClass
    • removeCustom

      public void removeCustom(String iName)
      Specified by:
      removeCustom in interface OClass
    • clearCustom

      public void clearCustom()
      Specified by:
      clearCustom in interface OClass
    • getCustomKeys

      public Set<String> getCustomKeys()
      Specified by:
      getCustomKeys in interface OClass
    • hasClusterId

      public boolean hasClusterId(int clusterId)
      Specified by:
      hasClusterId in interface OClass
    • hasPolymorphicClusterId

      public boolean hasPolymorphicClusterId(int clusterId)
      Specified by:
      hasPolymorphicClusterId in interface OClass
    • compareTo

      public int compareTo(OClass other)
      Specified by:
      compareTo in interface Comparable<OClass>
    • getDatabase

      protected ODatabaseDocumentInternal getDatabase()
    • isRestricted

      public boolean isRestricted()
    • isEdgeType

      public boolean isEdgeType()
      Specified by:
      isEdgeType in interface OClass
      Returns:
      true if this class represents a subclass of an edge class (E)
    • isVertexType

      public boolean isVertexType()
      Specified by:
      isVertexType in interface OClass
      Returns:
      true if this class represents a subclass of a vertex class (V)
    • isTriggered

      public boolean isTriggered()
    • isFunction

      public boolean isFunction()
    • isScheduler

      public boolean isScheduler()
    • isOuser

      public boolean isOuser()
    • isOrole

      public boolean isOrole()
    • isSequence

      public boolean isSequence()
    • getAllocation

      public OClassAllocation getAllocation()
      Specified by:
      getAllocation in interface OClass