All Superinterfaces:
Comparable<OClass>
All Known Subinterfaces:
OView
All Known Implementing Classes:
OClassAbstractDelegate, OClassDistributed, OClassEmbedded, OClassImpl, OClassRemote, OImmutableClass, OImmutableView, OViewEmbedded, OViewImpl, OViewRemote

public interface OClass extends Comparable<OClass>
Schema class
Author:
Luca Garulli (l.garulli--(at)--orientdb.com)
  • Field Details

  • Method Details

    • isAbstract

      boolean isAbstract()
    • setAbstract

      OClass setAbstract(boolean iAbstract)
    • isStrictMode

      boolean isStrictMode()
    • setStrictMode

      OClass setStrictMode(boolean iMode)
    • getSuperClass

      @Deprecated OClass getSuperClass()
      Deprecated.
    • setSuperClass

      @Deprecated OClass setSuperClass(OClass iSuperClass)
      Deprecated.
    • hasSuperClasses

      boolean hasSuperClasses()
    • getSuperClassesNames

      List<String> getSuperClassesNames()
    • getSuperClasses

      List<OClass> getSuperClasses()
    • setSuperClasses

      OClass setSuperClasses(List<? extends OClass> classes)
    • addSuperClass

      OClass addSuperClass(OClass superClass)
    • removeSuperClass

      OClass removeSuperClass(OClass superClass)
    • getName

      String getName()
    • setName

      OClass setName(String iName)
    • getDescription

      String getDescription()
    • setDescription

      OClass setDescription(String iDescription)
    • getStreamableName

      String getStreamableName()
    • declaredProperties

      Collection<OProperty> declaredProperties()
    • properties

      Collection<OProperty> properties()
    • propertiesMap

      Map<String,OProperty> propertiesMap()
    • getIndexedProperties

      Collection<OProperty> getIndexedProperties()
    • getProperty

      OProperty getProperty(String iPropertyName)
    • createProperty

      OProperty createProperty(String iPropertyName, OType iType)
    • createProperty

      OProperty createProperty(String iPropertyName, OType iType, OClass iLinkedClass)
    • createProperty

      OProperty createProperty(String iPropertyName, OType iType, OClass iLinkedClass, boolean iUnsafe)
      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 null
      iUnsafe - 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

      OProperty createProperty(String iPropertyName, OType iType, OType iLinkedType)
    • createProperty

      OProperty createProperty(String iPropertyName, OType iType, OType iLinkedType, boolean iUnsafe)
      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 null
      iUnsafe - 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

      void dropProperty(String iPropertyName)
    • existsProperty

      boolean existsProperty(String iPropertyName)
    • getClusterForNewInstance

      int getClusterForNewInstance(ODocument doc)
    • getDefaultClusterId

      int getDefaultClusterId()
    • setDefaultClusterId

      void setDefaultClusterId(int iDefaultClusterId)
    • getClusterIds

      int[] getClusterIds()
    • addClusterId

      OClass addClusterId(int iId)
    • getClusterSelection

      OClusterSelectionStrategy getClusterSelection()
    • setClusterSelection

      OClass setClusterSelection(OClusterSelectionStrategy clusterSelection)
    • setClusterSelection

      OClass setClusterSelection(String iStrategyName)
    • addCluster

      OClass addCluster(String iClusterName)
    • truncateCluster

      OClass truncateCluster(String clusterName)
      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

      OClass removeClusterId(int iId)
    • getPolymorphicClusterIds

      int[] getPolymorphicClusterIds()
    • getBaseClasses

      @Deprecated Collection<OClass> getBaseClasses()
      Deprecated.
    • getAllBaseClasses

      @Deprecated Collection<OClass> 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

      OClass setOverSize(float overSize)
      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

      void truncate() throws IOException
      Truncates all the clusters the class uses.
      Throws:
      IOException
    • isSubClassOf

      boolean isSubClassOf(String iClassName)
      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

      boolean isSubClassOf(OClass iClass)
      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

      boolean isSuperClassOf(OClass iClass)
      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

      OClass setShortName(String shortName)
    • get

      Object get(OClass.ATTRIBUTES iAttribute)
    • set

      OClass set(OClass.ATTRIBUTES attribute, Object iValue)
    • createIndex

      OIndex createIndex(String iName, OClass.INDEX_TYPE iType, String... fields)
      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 name
      iType - Index type.
      Returns:
      Class index registered inside of given class ans associated with database index.
    • createIndex

      OIndex createIndex(String iName, String iType, String... fields)
      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 name
      iType - 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

      Set<OIndex> getInvolvedIndexes(Collection<String> fields)
      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

      Set<OIndex> getInvolvedIndexes(String... fields)
      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

      Set<OIndex> getClassInvolvedIndexes(Collection<String> fields)
      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

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

      boolean areIndexed(Collection<String> fields)
      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:
      true if given fields are contained as first key fields in class indexes.
    • areIndexed

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

      OIndex getClassIndex(String iName)
      Returns index instance by database index name.
      Parameters:
      iName - Database index name.
      Returns:
      Index instance.
    • getClassIndexes

      Set<OIndex> getClassIndexes()
      Returns:
      All indexes for given class, not the inherited ones.
    • getClassIndexes

      void getClassIndexes(Collection<OIndex> indexes)
      Internal. Copy all the indexes for given class, not the inherited ones, in the collection received as argument.
    • getIndexes

      void getIndexes(Collection<OIndex> indexes)
      Internal. All indexes for given class and its super classes.
    • getIndexes

      Set<OIndex> 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

      String getCustom(String iName)
    • setCustom

      OClass setCustom(String iName, String iValue)
    • removeCustom

      void removeCustom(String iName)
    • clearCustom

      void clearCustom()
    • getCustomKeys

      Set<String> getCustomKeys()
    • hasClusterId

      boolean hasClusterId(int clusterId)
    • hasPolymorphicClusterId

      boolean hasPolymorphicClusterId(int clusterId)
    • getAllocation

      OClassAllocation getAllocation()