Added state and remvoed name of properties non part of IS Model

This commit is contained in:
Luca Frosini 2024-06-26 16:15:18 +02:00
parent 814fe6c395
commit d119db0294
2 changed files with 42 additions and 59 deletions

View File

@ -29,16 +29,17 @@ import org.gcube.informationsystem.utils.UUIDManager;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@JsonTypeName(value=Context.NAME) @JsonTypeName(value=Context.NAME)
public final class ContextImpl extends EntityElementImpl implements Context { public class ContextImpl extends EntityElementImpl implements Context {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
*/ */
private static final long serialVersionUID = -5070590328223454087L; private static final long serialVersionUID = -5070590328223454087L;
protected UUID uuid;
protected String name; protected String name;
protected String state;
protected IsParentOf parent; protected IsParentOf parent;
protected List<IsParentOf> children; protected List<IsParentOf> children;
@ -77,19 +78,6 @@ public final class ContextImpl extends EntityElementImpl implements Context {
this.metadata = new MetadataImpl(); this.metadata = new MetadataImpl();
} }
/**
* @return the uuid
*/
@Override
public UUID getID() {
return uuid;
}
@Override
public void setID(UUID uuid) {
this.uuid = uuid;
}
@Override @Override
public String getName() { public String getName() {
return this.name; return this.name;
@ -100,6 +88,16 @@ public final class ContextImpl extends EntityElementImpl implements Context {
this.name = name; this.name = name;
} }
@Override
public String getState() {
return this.state;
}
@Override
public void setState(String state) {
this.state = state;
}
@Override @Override
public IsParentOf getParent() { public IsParentOf getParent() {
return parent; return parent;

View File

@ -23,6 +23,7 @@ import org.gcube.informationsystem.contexts.impl.entities.ContextImpl;
import org.gcube.informationsystem.contexts.reference.relations.IsParentOf; import org.gcube.informationsystem.contexts.reference.relations.IsParentOf;
import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.serialization.AdditionalPropertiesSerializer; import org.gcube.informationsystem.serialization.AdditionalPropertiesSerializer;
import org.gcube.informationsystem.types.annotations.Final;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
@ -37,6 +38,7 @@ import org.gcube.informationsystem.utils.Version;
@JsonPropertyOrder({ Element.TYPE_PROPERTY, IdentifiableElement.ID_PROPERTY, IdentifiableElement.METADATA_PROPERTY}) @JsonPropertyOrder({ Element.TYPE_PROPERTY, IdentifiableElement.ID_PROPERTY, IdentifiableElement.METADATA_PROPERTY})
@TypeMetadata(name = Context.NAME, description = "This type is the used to define a Context", version = Version.MINIMAL_VERSION_STRING) @TypeMetadata(name = Context.NAME, description = "This type is the used to define a Context", 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)
@Final
public interface Context extends EntityElement, SchemaMixedElement { public interface Context extends EntityElement, SchemaMixedElement {
public static final String NAME = "Context"; // Context.class.getSimpleName(); public static final String NAME = "Context"; // Context.class.getSimpleName();
@ -46,55 +48,37 @@ public interface Context extends EntityElement, SchemaMixedElement {
public static final String CHILDREN_PROPERTY = "children"; public static final String CHILDREN_PROPERTY = "children";
/** /**
* { * Indicates the state of Context.
* ... * See #27706
* "availableAt" : [ *
* "https://i-marine.d4science.org/group/alienandinvasivespecies", * The resource-registry only knows:
* "https://services.d4science.org/group/alienandinvasivespecies" * - created
* ] * - active
* ... * - deleted
* } *
* For non VRE context this field could be null or could have multiple value * Other statuses can be set by a Manager.
* For VRE it is normally one value only (but some exception could exists * The resource-registry will allow the management of instances
* from non-managers if and only if the state is active.
*
* The resource-registry sets the states according to the following:
*
* A newly created Context is set as created. Only a manager can use the instances collection;
* The active state can be set only by a Manager;
* When a context is deleted, the state is set to deleted, and the security space is removed,
* but the Vertex representing the Context will be maintained see #19428.
*/ */
public static final String AVAILABLE_AT_PROPERTY = "availableAt"; public static final String STATE = "state";
//
/**
* This information is provided to allowed user only (by role)
* {
* ...
* "fullpaths" : [
* {
* "fullpath": "/gcube/devsec/myTest",
* "time": "2023-12-11 15:35:41.289 +0000", // Same of creationTime in metadata
* },
* {
* "fullpath": "/gcube/devsec/myTestVRE",
* "time": "2023-12-13 16:13:12.336 +0000",
* }
* {
* "fullpath": "/gcube/devsec/myVRE",
* "time": "2023-12-18 12:37:48.172 +0000", // Same of lastUpdateTime in metadata
* }
* ]
* ...
* }
*/
public static final String CONTEXT_FULLPATH_CHANGES_LOG_PROPERTY = "fullpathChangelog";
/**
* This information is provided to allowed user only (by role)
* The symmetric key for the context
*/
public static final String CONTEXT_KEY_PROPERTY = "key";
@ISProperty(name = NAME_PROPERTY, mandatory = true, nullable = false) @ISProperty(name = NAME_PROPERTY, mandatory = true, nullable = false)
public String getName(); public String getName();
public void setName(String name); public void setName(String name);
@ISProperty(name = STATE)
public String getState();
public void setState(String state);
@JsonGetter @JsonGetter
@JsonIgnoreProperties({ Relation.TARGET_PROPERTY }) @JsonIgnoreProperties({ Relation.TARGET_PROPERTY })
public IsParentOf getParent(); public IsParentOf getParent();
@ -118,6 +102,7 @@ public interface Context extends EntityElement, SchemaMixedElement {
public void addChild(IsParentOf isParentOf); public void addChild(IsParentOf isParentOf);
@JsonAnyGetter @JsonAnyGetter
@JsonSerialize(using = AdditionalPropertiesSerializer.class) @JsonSerialize(using = AdditionalPropertiesSerializer.class)
@Override @Override