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)
*/
@JsonTypeName(value=Context.NAME)
public final class ContextImpl extends EntityElementImpl implements Context {
public class ContextImpl extends EntityElementImpl implements Context {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -5070590328223454087L;
protected UUID uuid;
protected String name;
protected String state;
protected IsParentOf parent;
protected List<IsParentOf> children;
@ -77,19 +78,6 @@ public final class ContextImpl extends EntityElementImpl implements Context {
this.metadata = new MetadataImpl();
}
/**
* @return the uuid
*/
@Override
public UUID getID() {
return uuid;
}
@Override
public void setID(UUID uuid) {
this.uuid = uuid;
}
@Override
public String getName() {
return this.name;
@ -100,6 +88,16 @@ public final class ContextImpl extends EntityElementImpl implements Context {
this.name = name;
}
@Override
public String getState() {
return this.state;
}
@Override
public void setState(String state) {
this.state = state;
}
@Override
public IsParentOf getParent() {
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.model.reference.relations.Relation;
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.reference.Change;
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})
@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)
@Final
public interface Context extends EntityElement, SchemaMixedElement {
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";
/**
* {
* ...
* "availableAt" : [
* "https://i-marine.d4science.org/group/alienandinvasivespecies",
* "https://services.d4science.org/group/alienandinvasivespecies"
* ]
* ...
* }
* For non VRE context this field could be null or could have multiple value
* For VRE it is normally one value only (but some exception could exists
* Indicates the state of Context.
* See #27706
*
* The resource-registry only knows:
* - created
* - active
* - deleted
*
* Other statuses can be set by a Manager.
* 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";
//
/**
* 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";
public static final String STATE = "state";
@ISProperty(name = NAME_PROPERTY, mandatory = true, nullable = false)
public String getName();
public void setName(String name);
@ISProperty(name = STATE)
public String getState();
public void setState(String state);
@JsonGetter
@JsonIgnoreProperties({ Relation.TARGET_PROPERTY })
public IsParentOf getParent();
@ -118,6 +102,7 @@ public interface Context extends EntityElement, SchemaMixedElement {
public void addChild(IsParentOf isParentOf);
@JsonAnyGetter
@JsonSerialize(using = AdditionalPropertiesSerializer.class)
@Override