Class DerivatedRelatedResourceGroup<I extends Instance>
java.lang.Object
org.gcube.resourcemanagement.resource.DerivatedRelatedResourceGroup<I>
- Type Parameters:
I- the type of instances contained in the resource group, which extends the Instance class.
- All Implemented Interfaces:
Comparable<DerivatedRelatedResourceGroup<I>>
public class DerivatedRelatedResourceGroup<I extends Instance>
extends Object
implements Comparable<DerivatedRelatedResourceGroup<I>>
- Author:
- Luca Frosini (ISTI - CNR) Represents a group of related resources that are derived from a common ancestor. This class implements the Comparable interface to allow comparison based on the name of the resource group.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.gcube.informationsystem.model.reference.entities.ResourceThe ancestor resource from which this group is derived.protected StringThe description of the resource group.The class type of the instances contained in the resource group.The list of instances contained in the resource group.protected final org.gcube.com.fasterxml.jackson.databind.ObjectMapperThe ObjectMapper used for JSON serialization and deserialization.protected IntegerThe maximum number of instances in the resource group.protected intThe minimum number of instances in the resource group.protected StringThe name of the resource group.protected List<org.gcube.informationsystem.model.reference.entities.Resource>The list of related resources associated with this resource group. -
Constructor Summary
ConstructorsConstructorDescriptionDerivatedRelatedResourceGroup(Class<I> instanceClass) Constructs a new DerivatedRelatedResourceGroup with the specified instance class type. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInstance(I instance) voidaddInstances(Collection<I> instances) intCompare two DerivatedRelatedResourceGroup by namebooleanorg.gcube.informationsystem.model.reference.entities.ResourceReturns the ancestor resource from which this group is derived.Returns the description of the resource group.Returns the class type of the instances contained in the resource group.Returns the list of instances contained in the resource group.getMax()Returns the maximum number of instances in the resource group.intgetMin()Returns the minimum number of instances in the resource group.getName()Returns the name of the resource group.List<org.gcube.informationsystem.model.reference.entities.Resource>Returns the list of related resources associated with this resource group.inthashCode()Returns the hash code of the DerivatedRelatedResourceGroup based on the name.voidsetAncestor(org.gcube.informationsystem.model.reference.entities.Resource ancestor) Sets the ancestor resource from which this group is derived.voidsetDescription(String description) Sets the description of the resource group.voidsetInstances(Set<I> instances) voidSets the maximum number of instances in the resource group.voidsetMin(int min) Sets the minimum number of instances in the resource group.voidSets the name of the resource group.voidsetRelatedResources(List<org.gcube.informationsystem.model.reference.entities.Resource> relatedResources) Sets the list of related resources associated with this resource group.toString()Returns a JSON representation of the DerivatedRelatedResourceGroup.
-
Field Details
-
ancestor
protected org.gcube.informationsystem.model.reference.entities.Resource ancestorThe ancestor resource from which this group is derived. -
mapper
protected final org.gcube.com.fasterxml.jackson.databind.ObjectMapper mapperThe ObjectMapper used for JSON serialization and deserialization. -
instanceClass
The class type of the instances contained in the resource group. -
name
The name of the resource group. -
description
The description of the resource group. -
min
protected int minThe minimum number of instances in the resource group. -
max
The maximum number of instances in the resource group. -
instances
The list of instances contained in the resource group.
-
-
Constructor Details
-
DerivatedRelatedResourceGroup
Constructs a new DerivatedRelatedResourceGroup with the specified instance class type.- Parameters:
instanceClass- the class type of the instances contained in the resource group
-
-
Method Details
-
getInstanceClass
Returns the class type of the instances contained in the resource group.- Returns:
- the class type of the instances
-
getAncestor
public org.gcube.informationsystem.model.reference.entities.Resource getAncestor()Returns the ancestor resource from which this group is derived.- Returns:
- the ancestor resource
-
setAncestor
public void setAncestor(org.gcube.informationsystem.model.reference.entities.Resource ancestor) Sets the ancestor resource from which this group is derived.- Parameters:
ancestor- the ancestor resource
-
getName
Returns the name of the resource group.- Returns:
- the name of the resource group
-
setName
Sets the name of the resource group.- Parameters:
name- the name of the resource group
-
getDescription
Returns the description of the resource group.- Returns:
- the description of the resource group
-
setDescription
Sets the description of the resource group.- Parameters:
description- the description of the resource group
-
getMin
public int getMin()Returns the minimum number of instances in the resource group.- Returns:
- the minimum number of instances
-
setMin
public void setMin(int min) Sets the minimum number of instances in the resource group.- Parameters:
min- the minimum number of instances
-
getMax
Returns the maximum number of instances in the resource group.- Returns:
- the maximum number of instances
-
setMax
Sets the maximum number of instances in the resource group.- Parameters:
max- the maximum number of instances
-
getRelatedResources
Returns the list of related resources associated with this resource group.- Returns:
- the list of related resources
-
setRelatedResources
public void setRelatedResources(List<org.gcube.informationsystem.model.reference.entities.Resource> relatedResources) Sets the list of related resources associated with this resource group.- Parameters:
relatedResources- the list of related resources
-
getInstances
public Set<I> getInstances() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionReturns the list of instances contained in the resource group. If the instances are not already initialized, they are derived from the related resources. Please note that Instance is a format to represent the summary of a resource, so the instances are just a minimal representation of the related resources. In other words, the instances and related resources are two sides of the same coin.- Returns:
- the list of instances
- Throws:
jakarta.ws.rs.WebApplicationException- if there is an error during the web application processorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if there is an error with the resource registry
-
setInstances
-
addInstance
-
addInstances
-
toString
Returns a JSON representation of the DerivatedRelatedResourceGroup. -
compareTo
Compare two DerivatedRelatedResourceGroup by name- Specified by:
compareToin interfaceComparable<I extends Instance>- Parameters:
o-- Returns:
- the comparison result
-
hashCode
public int hashCode()Returns the hash code of the DerivatedRelatedResourceGroup based on the name. -
equals
-