Interface Resource
-
- 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:
Entity,Facet,ConsistsOf,IsRelatedTo
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONSISTS_OF_PROPERTYThe property name for the 'consistsOf' relations.static StringIS_RELATED_TO_PROPERTYThe property name for the 'isRelatedTo' relations.static StringNAMEThe name of the resource type.-
Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, TYPE_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.model.reference.ERElement
CONTEXTS_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.model.reference.ModelElement
EXPECTED_TYPE_PROPERTY, SUPERTYPES_PROPERTY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <C extends ConsistsOf<? extends Resource,? extends Facet>>
voidaddFacet(C relation)Adds a facet to the resource via aConsistsOfrelation.<F extends Facet>
voidaddFacet(F facet)Adds a facet to the resource.voidaddFacet(UUID uuid)Adds a facet to the resource by its UUID.<I extends IsRelatedTo<? extends Resource,? extends Resource>>
voidattachResource(I relation)Attaches another resource to this one via anIsRelatedTorelation.List<ConsistsOf<? extends Resource,? extends Facet>>getConsistsOf()Returns allConsistsOfrelations for this resource, linking it to its facets.<C extends ConsistsOf<? extends Resource,? extends Facet>>
List<C>getConsistsOf(Class<C> clz)ReturnsConsistsOfrelations of a specific type.<F extends Facet,C extends ConsistsOf<? extends Resource,F>>
List<C>getConsistsOf(Class<C> clz, Class<F> target)ReturnsConsistsOfrelations of a specific type, targeting a specific facet type.List<? extends Facet>getFacets()Returns all facets associated with this resource.<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 specificConsistsOfrelation type.<F extends Facet>
List<F>getFacets(Class<F> clz)Returns all facets of a specific type associated with this resource.List<IsRelatedTo<? extends Resource,? extends Resource>>getIsRelatedTo()Returns allIsRelatedTorelations for this resource, linking it to other resources.<I extends IsRelatedTo<? extends Resource,? extends Resource>>
List<I>getIsRelatedTo(Class<I> clz)ReturnsIsRelatedTorelations of a specific type.-
Methods inherited from interface org.gcube.informationsystem.base.reference.Element
getTypeName
-
Methods inherited from interface org.gcube.informationsystem.base.reference.entities.EntityElement
getID, getMetadata, setID, setMetadata
-
Methods inherited from interface org.gcube.informationsystem.model.reference.ERElement
getContexts
-
Methods inherited from interface org.gcube.informationsystem.model.reference.ModelElement
getExpectedtype, getSupertypes
-
-
-
-
Field Detail
-
NAME
static final String NAME
The name of the resource type.- See Also:
- Constant Field Values
-
CONSISTS_OF_PROPERTY
static final String CONSISTS_OF_PROPERTY
The property name for the 'consistsOf' relations.- See Also:
- Constant Field Values
-
IS_RELATED_TO_PROPERTY
static final String IS_RELATED_TO_PROPERTY
The property name for the 'isRelatedTo' relations.- See Also:
- Constant Field Values
-
-
Method Detail
-
getConsistsOf
List<ConsistsOf<? extends Resource,? extends Facet>> getConsistsOf()
Returns allConsistsOfrelations for this resource, linking it to its facets.- Returns:
- A list of
ConsistsOfrelations.
-
getConsistsOf
<C extends ConsistsOf<? extends Resource,? extends Facet>> List<C> getConsistsOf(Class<C> clz)
ReturnsConsistsOfrelations of a specific type.- Type Parameters:
C- The specific type ofConsistsOfrelation.- Parameters:
clz- The class of the relation type.- Returns:
- A list of matching
ConsistsOfrelations.
-
getConsistsOf
<F extends Facet,C extends ConsistsOf<? extends Resource,F>> List<C> getConsistsOf(Class<C> clz, Class<F> target)
ReturnsConsistsOfrelations of a specific type, targeting a specific facet type.- Type Parameters:
F- The type of the target facet.C- The type of theConsistsOfrelation.- Parameters:
clz- The class of the relation type.target- The class of the target facet type.- Returns:
- A list of matching
ConsistsOfrelations.
-
getIsRelatedTo
List<IsRelatedTo<? extends Resource,? extends Resource>> getIsRelatedTo()
Returns allIsRelatedTorelations for this resource, linking it to other resources.- Returns:
- A list of
IsRelatedTorelations.
-
getIsRelatedTo
<I extends IsRelatedTo<? extends Resource,? extends Resource>> List<I> getIsRelatedTo(Class<I> clz)
ReturnsIsRelatedTorelations of a specific type.- Type Parameters:
I- The specific type ofIsRelatedTorelation.- Parameters:
clz- The class of the relation type.- Returns:
- A list of matching
IsRelatedTorelations.
-
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 specificConsistsOfrelation type.- Type Parameters:
F- The type of the facet.C- The type of theConsistsOfrelation.- 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 aConsistsOfrelation.- Type Parameters:
C- The type of theConsistsOfrelation.- 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 anIsRelatedTorelation.- Type Parameters:
I- The type of theIsRelatedTorelation.- Parameters:
relation- The relation instance to add.
-
-