All Implemented Interfaces:
Serializable, Element, EntityElement, IdentifiableElement, Entity, Resource, ERElement, ModelElement
Direct Known Subclasses:
DummyResource

public abstract class ResourceImpl extends EntityImpl implements Resource
The default abstract implementation of the Resource interface.
Author:
Luca Frosini (ISTI - CNR)
See Also:
  • Field Details

  • Constructor Details

    • ResourceImpl

      protected ResourceImpl()
      Default constructor.
  • Method Details

    • addFacet

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

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

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

      public void attachResource(IsRelatedTo relation)
      Attaches another resource to this one via an IsRelatedTo relation.
      Specified by:
      attachResource in interface Resource
      Parameters:
      relation - The relation instance to add.
    • getConsistsOf

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

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

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

      public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> List<I> getIsRelatedTo(Class<I> clz)
      Returns IsRelatedTo relations of a specific type.
      Specified by:
      getIsRelatedTo in interface Resource
      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

      public List<? extends Facet> getFacets()
      Returns all facets associated with this resource.
      Specified by:
      getFacets in interface Resource
      Returns:
      A list of all facets.
    • getFacets

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

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

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