diff --git a/src/main/java/org/gcube/resourcemanagement/model/reference/entities/facets/TemplateFacet.java b/src/main/java/org/gcube/resourcemanagement/model/reference/entities/facets/TemplateFacet.java index 297deed..4c9b9af 100644 --- a/src/main/java/org/gcube/resourcemanagement/model/reference/entities/facets/TemplateFacet.java +++ b/src/main/java/org/gcube/resourcemanagement/model/reference/entities/facets/TemplateFacet.java @@ -22,7 +22,7 @@ import org.gcube.resourcemanagement.model.reference.properties.utilities.Named; @JsonDeserialize(as=TemplateFacetImpl.class) @TypeMetadata( name = TemplateFacet.NAME, - description = "This facet define a template to instantiate using the list of attributes specified", + description = "This facet define a template for a Facet to instantiate using the list of attributes specified. The type of the instatianted facet is specified in 'targetFacetType' attribute", version = Version.MINIMAL_VERSION_STRING ) @Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) @@ -30,6 +30,8 @@ public interface TemplateFacet extends Facet, Named { public static final String NAME = "TemplateFacet"; // TemplateFacet.class.getSimpleName(); + public static final String TARGET_FACET_TYPE_PROPERTY = "targetFacetType"; + public static final String DESCRIPTION_PROPERTY = "description"; public static final String ATTRIBUTES_PROPERTY = "attributes"; @@ -47,6 +49,12 @@ public interface TemplateFacet extends Facet, Named { public void setDescription(String description); + @ISProperty(name = TARGET_FACET_TYPE_PROPERTY, description = "The type of Facet to instantiate with the attributes valued", readonly = false, mandatory = true, nullable = false) + public String getTargetFacetType(); + + public void setTargetFacetType(String targetFacetType); + + @ISProperty(name = ATTRIBUTES_PROPERTY, description = "The attributes of the template to be created when instantiated", readonly = false, mandatory = true, nullable = false, min=1) public List getAttributes(); diff --git a/src/main/java/org/gcube/resourcemanagement/model/reference/entities/resources/ConfigurationTemplate.java b/src/main/java/org/gcube/resourcemanagement/model/reference/entities/resources/ConfigurationTemplate.java index 051c6eb..6bd5e20 100644 --- a/src/main/java/org/gcube/resourcemanagement/model/reference/entities/resources/ConfigurationTemplate.java +++ b/src/main/java/org/gcube/resourcemanagement/model/reference/entities/resources/ConfigurationTemplate.java @@ -4,6 +4,7 @@ package org.gcube.resourcemanagement.model.reference.entities.resources; import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.types.annotations.RelatedResourcesEntry; import org.gcube.informationsystem.types.annotations.ResourceSchema; import org.gcube.informationsystem.types.annotations.ResourceSchemaEntry; @@ -12,6 +13,7 @@ import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.utils.Version; import org.gcube.resourcemanagement.model.impl.entities.resources.ConfigurationTemplateImpl; import org.gcube.resourcemanagement.model.reference.entities.facets.IdentifierFacet; +import org.gcube.resourcemanagement.model.reference.entities.facets.TemplateFacet; import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy; import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.IsConfiguredBy; import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.IsCustomizedBy; @@ -29,7 +31,8 @@ import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.IsDeri @JsonDeserialize(as=ConfigurationTemplateImpl.class) @ResourceSchema( facets={ - @ResourceSchemaEntry(relation=IsIdentifiedBy.class, facet=IdentifierFacet.class, min=1, max=1) + @ResourceSchemaEntry(relation=IsIdentifiedBy.class, facet=IdentifierFacet.class, min=1, max=1), + @ResourceSchemaEntry(relation=ConsistsOf.class, facet=TemplateFacet.class) }, resources = { @RelatedResourcesEntry(source=Configuration.class, relation=IsDerivationOf.class, target=ConfigurationTemplate.class),