Class CachedType<T extends org.gcube.informationsystem.types.reference.Type>

java.lang.Object
org.gcube.informationsystem.resourceregistry.persistence.orientdb.types.CachedType<T>
Type Parameters:
T - the specific Type subclass

public class CachedType<T extends org.gcube.informationsystem.types.reference.Type> extends Object
Represents a cached representation of a metadata schema type, providing high-performance schema lookup and type hierarchy traversal.
Author:
Luca Frosini (ISTI - CNR)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.gcube.informationsystem.base.reference.AccessType
    The access type category of the schema type.
    protected com.orientechnologies.orient.core.metadata.schema.OClass
    The cached OrientDB schema class.
    protected List<String>
    The cached list of subtype names.
    protected List<String>
    The cached list of supertype names.
    protected T
    The cached strongly-typed schema model instance.
    protected final String
    The unique name of the schema type.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CachedType(String typeName)
    Creates a new CachedType instance for the specified type name.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    org.gcube.informationsystem.base.reference.AccessType
    Returns the access type category of this type, retrieving it if not cached.
    Set<org.gcube.informationsystem.types.reference.properties.PropertyDefinition>
    Returns the property definitions of this type, including those inherited from all of its supertypes.
    protected List<String>
    Recursively retrieves the list of all subclasses for this schema class.
    com.orientechnologies.orient.core.metadata.schema.OClass
    Returns the OrientDB schema class of this type, retrieving it if not cached.
    Returns the list of subtype names of this type, retrieving them if not cached.
    Returns the list of supertype names of this type, retrieving them if not cached.
    Returns the strongly-typed schema model instance of this type, retrieving it if not cached.
    int
     
    void
    setOClass(com.orientechnologies.orient.core.metadata.schema.OClass oClass)
    Manually sets the OrientDB schema class of this type, caching it if not already set.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • typeName

      protected final String typeName
      The unique name of the schema type.
    • oClass

      protected com.orientechnologies.orient.core.metadata.schema.OClass oClass
      The cached OrientDB schema class.
    • accessType

      protected org.gcube.informationsystem.base.reference.AccessType accessType
      The access type category of the schema type.
    • type

      protected T extends org.gcube.informationsystem.types.reference.Type type
      The cached strongly-typed schema model instance.
    • superTypes

      protected List<String> superTypes
      The cached list of supertype names.
    • subTypes

      protected List<String> subTypes
      The cached list of subtype names.
  • Constructor Details

    • CachedType

      public CachedType(String typeName)
      Creates a new CachedType instance for the specified type name.
      Parameters:
      typeName - the unique name of the schema type
  • Method Details

    • setOClass

      public void setOClass(com.orientechnologies.orient.core.metadata.schema.OClass oClass) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Manually sets the OrientDB schema class of this type, caching it if not already set.
      Parameters:
      oClass - the OrientDB schema class to cache
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException - if the type is not registered
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException - if the schema definition is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database error
    • getAllSubclasses

      protected List<String> getAllSubclasses() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Recursively retrieves the list of all subclasses for this schema class.
      Returns:
      the list of all subclasses
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException - if the schema definition is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database error
    • getOClass

      public com.orientechnologies.orient.core.metadata.schema.OClass getOClass() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the OrientDB schema class of this type, retrieving it if not cached.
      Returns:
      the OrientDB schema class
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException - if the type is not registered
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException - if the schema definition is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database error
    • getType

      public T getType() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the strongly-typed schema model instance of this type, retrieving it if not cached.
      Returns:
      the strongly-typed schema model
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException - if the type is not registered
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException - if the schema definition is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database error
    • getAccessType

      public org.gcube.informationsystem.base.reference.AccessType getAccessType() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the access type category of this type, retrieving it if not cached.
      Returns:
      the access type category
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaNotFoundException - if the type is not registered
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException - if the schema definition is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database error
    • getSuperTypes

      public List<String> getSuperTypes() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the list of supertype names of this type, retrieving them if not cached.
      Returns:
      the list of supertype names
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException - if the schema definition is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database error
    • getSubTypes

      public List<String> getSubTypes() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the list of subtype names of this type, retrieving them if not cached.
      Returns:
      the list of subtype names
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException - if the schema definition is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database error
    • getAllProperties

      public Set<org.gcube.informationsystem.types.reference.properties.PropertyDefinition> getAllProperties() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Returns the property definitions of this type, including those inherited from all of its supertypes.
      Returns:
      the property definitions
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException - if the schema definition is invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database error
    • hashCode

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

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