Enhancing model

This commit is contained in:
Luca Frosini 2024-06-13 12:23:34 +02:00
parent 037dcf23fb
commit 82cd5bf24f
2 changed files with 13 additions and 2 deletions

View File

@ -22,7 +22,7 @@ import org.gcube.resourcemanagement.model.reference.properties.utilities.Named;
@JsonDeserialize(as=TemplateFacetImpl.class) @JsonDeserialize(as=TemplateFacetImpl.class)
@TypeMetadata( @TypeMetadata(
name = TemplateFacet.NAME, 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 version = Version.MINIMAL_VERSION_STRING
) )
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION) @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 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 DESCRIPTION_PROPERTY = "description";
public static final String ATTRIBUTES_PROPERTY = "attributes"; public static final String ATTRIBUTES_PROPERTY = "attributes";
@ -47,6 +49,12 @@ public interface TemplateFacet extends Facet, Named {
public void setDescription(String description); 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) @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<AttributeProperty> getAttributes(); public List<AttributeProperty> getAttributes();

View File

@ -4,6 +4,7 @@
package org.gcube.resourcemanagement.model.reference.entities.resources; package org.gcube.resourcemanagement.model.reference.entities.resources;
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize; 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.RelatedResourcesEntry;
import org.gcube.informationsystem.types.annotations.ResourceSchema; import org.gcube.informationsystem.types.annotations.ResourceSchema;
import org.gcube.informationsystem.types.annotations.ResourceSchemaEntry; 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.informationsystem.utils.Version;
import org.gcube.resourcemanagement.model.impl.entities.resources.ConfigurationTemplateImpl; 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.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.consistsof.IsIdentifiedBy;
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.IsConfiguredBy; import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.IsConfiguredBy;
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.IsCustomizedBy; 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) @JsonDeserialize(as=ConfigurationTemplateImpl.class)
@ResourceSchema( @ResourceSchema(
facets={ 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 = { resources = {
@RelatedResourcesEntry(source=Configuration.class, relation=IsDerivationOf.class, target=ConfigurationTemplate.class), @RelatedResourcesEntry(source=Configuration.class, relation=IsDerivationOf.class, target=ConfigurationTemplate.class),