All Superinterfaces:
Element, Entity, EntityElement, ERElement, IdentifiableElement, ModelElement, Serializable
All Known Implementing Classes:
DummyResource, ResourceImpl

@ResourceSchema(facets=, resources=) @TypeMetadata(name="Resource", description="This is the base type for any Resource", version="1.0.0") @Change(version="1.0.0", description="First Version") public interface Resource extends Entity
Represents a resource, the central entity in the facet-based model.

A resource is composed of one or more Facets, which describe its different aspects. It can also be related to other resources. This interface provides methods for accessing and managing these relationships. For more details, refer to the gCube Facet Based Resource Model Wiki.

Author:
Luca Frosini (ISTI - CNR)
See Also:
  • Field Details

  • Method Details

    • getConsistsOf

      List<ConsistsOf<? extends Resource,? extends Facet>> getConsistsOf()
      Returns all ConsistsOf relations for this resource, linking it to its facets.
      Returns:
      A list of ConsistsOf relations.
    • getConsistsOf

      <C extends ConsistsOf<? extends Resource, ? extends Facet>> List<C> getConsistsOf(Class<C> clz)
      Returns ConsistsOf relations of a specific type.
      Type Parameters:
      C - The specific type of ConsistsOf relation.
      Parameters:
      clz - The class of the relation type.
      Returns:
      A list of matching ConsistsOf relations.
    • getConsistsOf

      <F extends Facet, C extends ConsistsOf<? extends Resource, F>> List<C> getConsistsOf(Class<C> clz, Class<F> target)
      Returns ConsistsOf relations of a specific type, targeting a specific facet type.
      Type Parameters:
      F - The type of the target facet.
      C - The type of the ConsistsOf relation.
      Parameters:
      clz - The class of the relation type.
      target - The class of the target facet type.
      Returns:
      A list of matching ConsistsOf relations.
    • getIsRelatedTo

      List<IsRelatedTo<? extends Resource,? extends Resource>> getIsRelatedTo()
      Returns all IsRelatedTo relations for this resource, linking it to other resources.
      Returns:
      A list of IsRelatedTo relations.
    • getIsRelatedTo

      <I extends IsRelatedTo<? extends Resource, ? extends Resource>> List<I> getIsRelatedTo(Class<I> clz)
      Returns IsRelatedTo relations of a specific type.
      Type Parameters:
      I - The specific type of IsRelatedTo relation.
      Parameters:
      clz - The class of the relation type.
      Returns:
      A list of matching IsRelatedTo relations.
    • getFacets

      List<? extends Facet> getFacets()
      Returns all facets associated with this resource.
      Returns:
      A list of all facets.
    • getFacets

      <F extends Facet> List<F> getFacets(Class<F> clz)
      Returns all facets of a specific type associated with this resource.
      Type Parameters:
      F - The type of the facet.
      Parameters:
      clz - The class of the facet type.
      Returns:
      A list of matching facets.
    • getFacets

      <F extends Facet, C extends ConsistsOf<? extends Resource, F>> List<F> getFacets(Class<C> clz, Class<F> target)
      Returns facets of a specific type, linked by a specific ConsistsOf relation type.
      Type Parameters:
      F - The type of the facet.
      C - The type of the ConsistsOf relation.
      Parameters:
      clz - The class of the relation type.
      target - The class of the facet type.
      Returns:
      A list of matching facets.
    • addFacet

      void addFacet(UUID uuid)
      Adds a facet to the resource by its UUID.
      Parameters:
      uuid - The UUID of the facet to add.
    • addFacet

      <F extends Facet> void addFacet(F facet)
      Adds a facet to the resource.
      Type Parameters:
      F - The type of the facet.
      Parameters:
      facet - The facet instance to add.
    • addFacet

      <C extends ConsistsOf<? extends Resource, ? extends Facet>> void addFacet(C relation)
      Adds a facet to the resource via a ConsistsOf relation.
      Type Parameters:
      C - The type of the ConsistsOf relation.
      Parameters:
      relation - The relation instance to add.
    • attachResource

      <I extends IsRelatedTo<? extends Resource, ? extends Resource>> void attachResource(I relation)
      Attaches another resource to this one via an IsRelatedTo relation.
      Type Parameters:
      I - The type of the IsRelatedTo relation.
      Parameters:
      relation - The relation instance to add.