Class ResourceImpl
- java.lang.Object
-
- org.gcube.informationsystem.base.impl.ElementImpl
-
- org.gcube.informationsystem.base.impl.entities.EntityElementImpl
-
- org.gcube.informationsystem.model.impl.entities.EntityImpl
-
- org.gcube.informationsystem.model.impl.entities.ResourceImpl
-
- 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 theResourceinterface.- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<ConsistsOf<? extends Resource,? extends Facet>>consistsOfListThe list ofConsistsOfrelations.protected List<IsRelatedTo<? extends Resource,? extends Resource>>isRelatedToListThe list ofIsRelatedTorelations.-
Fields inherited from class org.gcube.informationsystem.model.impl.entities.EntityImpl
contexts, expectedtype, supertypes
-
Fields inherited from class org.gcube.informationsystem.base.impl.entities.EntityElementImpl
metadata, uuid
-
Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, NAME, TYPE_PROPERTY
-
Fields inherited from interface org.gcube.informationsystem.base.reference.entities.EntityElement
NAME
-
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
-
Fields inherited from interface org.gcube.informationsystem.model.reference.entities.Resource
CONSISTS_OF_PROPERTY, IS_RELATED_TO_PROPERTY, NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedResourceImpl()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete 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.voidattachResource(IsRelatedTo 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> facetClz)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> facetClz)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 class org.gcube.informationsystem.model.impl.entities.EntityImpl
getContexts, getExpectedtype, getSupertypes, setContexts
-
Methods inherited from class org.gcube.informationsystem.base.impl.entities.EntityElementImpl
getID, getMetadata, setID, setMetadata
-
Methods inherited from class org.gcube.informationsystem.base.impl.ElementImpl
getTypeName, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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
-
consistsOfList
protected List<ConsistsOf<? extends Resource,? extends Facet>> consistsOfList
The list ofConsistsOfrelations.
-
isRelatedToList
protected List<IsRelatedTo<? extends Resource,? extends Resource>> isRelatedToList
The list ofIsRelatedTorelations.
-
-
Method Detail
-
addFacet
public void addFacet(UUID uuid)
Adds a facet to the resource by its UUID.
-
addFacet
public <F extends Facet> void addFacet(F facet)
Adds a facet to the resource.
-
addFacet
public <C extends ConsistsOf<? extends Resource,? extends Facet>> void addFacet(C relation)
Adds a facet to the resource via aConsistsOfrelation.
-
attachResource
public void attachResource(IsRelatedTo relation)
Attaches another resource to this one via anIsRelatedTorelation.- Specified by:
attachResourcein interfaceResource- Parameters:
relation- The relation instance to add.
-
getConsistsOf
public List<ConsistsOf<? extends Resource,? extends Facet>> getConsistsOf()
Returns allConsistsOfrelations for this resource, linking it to its facets.- Specified by:
getConsistsOfin interfaceResource- Returns:
- A list of
ConsistsOfrelations.
-
getConsistsOf
public <C extends ConsistsOf<? extends Resource,? extends Facet>> List<C> getConsistsOf(Class<C> clz)
ReturnsConsistsOfrelations of a specific type.- Specified by:
getConsistsOfin interfaceResource- Type Parameters:
C- The specific type ofConsistsOfrelation.- Parameters:
clz- The class of the relation type.- Returns:
- A list of matching
ConsistsOfrelations.
-
getIsRelatedTo
public List<IsRelatedTo<? extends Resource,? extends Resource>> getIsRelatedTo()
Returns allIsRelatedTorelations for this resource, linking it to other resources.- Specified by:
getIsRelatedToin interfaceResource- Returns:
- A list of
IsRelatedTorelations.
-
getIsRelatedTo
public <I extends IsRelatedTo<? extends Resource,? extends Resource>> List<I> getIsRelatedTo(Class<I> clz)
ReturnsIsRelatedTorelations of a specific type.- Specified by:
getIsRelatedToin interfaceResource- Type Parameters:
I- The specific type ofIsRelatedTorelation.- Parameters:
clz- The class of the relation type.- Returns:
- A list of matching
IsRelatedTorelations.
-
getFacets
public List<? extends Facet> getFacets()
Returns all facets associated with this resource.
-
getFacets
public <F extends Facet> List<F> getFacets(Class<F> clz)
Returns all facets of a specific type associated with this resource.
-
getConsistsOf
public <F extends Facet,C extends ConsistsOf<? extends Resource,F>> List<C> getConsistsOf(Class<C> clz, Class<F> facetClz)
ReturnsConsistsOfrelations of a specific type, targeting a specific facet type.- Specified by:
getConsistsOfin interfaceResource- Type Parameters:
F- The type of the target facet.C- The type of theConsistsOfrelation.- Parameters:
clz- The class of the relation type.facetClz- The class of the target facet type.- Returns:
- A list of matching
ConsistsOfrelations.
-
-