Added the possibility to get the AccessType from Type definition
This commit is contained in:
parent
603e8f2cf7
commit
44056157e1
|
@ -3,6 +3,7 @@ package org.gcube.informationsystem.types.impl.entities;
|
|||
import java.io.StringWriter;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
|
@ -98,4 +99,22 @@ public class EntityTypeImpl extends TypeImpl implements EntityType {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessType getAccessType() {
|
||||
|
||||
if(name.compareTo(Context.NAME)==0) {
|
||||
return AccessType.CONTEXT;
|
||||
}
|
||||
|
||||
if(name.compareTo(EntityType.NAME)==0) {
|
||||
return AccessType.ENTITY_TYPE;
|
||||
}
|
||||
|
||||
if(name.compareTo(EntityElement.NAME)==0) {
|
||||
return AccessType.ENTITY_ELEMENT;
|
||||
}
|
||||
|
||||
return AccessType.ENTITY;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.informationsystem.types.impl.properties;
|
|||
import java.util.Set;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.types.impl.TypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
|
@ -39,4 +40,13 @@ public final class PropertyTypeImpl<P extends PropertyElement> extends TypeImpl
|
|||
return properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessType getAccessType() {
|
||||
|
||||
if(name.compareTo(PropertyElement.NAME)==0) {
|
||||
return AccessType.PROPERTY_ELEMENT;
|
||||
}
|
||||
|
||||
return AccessType.PROPERTY;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import java.lang.reflect.ParameterizedType;
|
|||
import java.lang.reflect.Type;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
||||
import org.gcube.informationsystem.base.reference.relations.RelationElement;
|
||||
import org.gcube.informationsystem.context.reference.relations.IsParentOf;
|
||||
|
@ -132,4 +133,21 @@ public class RelationTypeImpl<S extends EntityType, T extends EntityType>
|
|||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessType getAccessType() {
|
||||
|
||||
if(name.compareTo(IsParentOf.NAME)==0) {
|
||||
return AccessType.IS_PARENT_OF;
|
||||
}
|
||||
|
||||
if(name.compareTo(RelationType.NAME)==0) {
|
||||
return AccessType.RELATION_TYPE;
|
||||
}
|
||||
|
||||
if(name.compareTo(RelationElement.NAME)==0) {
|
||||
return AccessType.RELATION_ELEMENT;
|
||||
}
|
||||
|
||||
return AccessType.RELATION;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Set;
|
|||
import org.gcube.com.fasterxml.jackson.annotation.JsonGetter;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
||||
import org.gcube.informationsystem.types.annotations.Abstract;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
|
@ -53,4 +54,9 @@ public interface Type extends IdentifiableElement {
|
|||
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
@JsonIgnore
|
||||
public default AccessType getAccessType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl;
|
||||
|
@ -43,5 +44,9 @@ public interface EntityType extends Type, EntityElement {
|
|||
|
||||
/* {@link Type} is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.ENTITY_ELEMENT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.entities.FacetTypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
|
@ -26,5 +27,9 @@ public interface FacetType extends EntityType {
|
|||
@ISProperty(name = Type.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.FACET;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.informationsystem.types.reference.entities;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.entities.ResourceTypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
|
@ -29,4 +30,9 @@ public interface ResourceType extends EntityType {
|
|||
@ISProperty(name = RESOURCES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
public List<LinkedEntity> getResources();
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.RESOURCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
|
@ -52,5 +53,8 @@ public interface PropertyType<P extends PropertyElement> extends PropertyElement
|
|||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
/* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.PROPERTY_ELEMENT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.informationsystem.types.reference.relations;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.types.impl.relations.ConsistsOfTypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
import org.gcube.informationsystem.types.reference.TypeMetadata;
|
||||
|
@ -18,4 +19,9 @@ public interface ConsistsOfType extends RelationType<ResourceType, FacetType> {
|
|||
|
||||
public static final String NAME = "ConsistsOfType"; // ConsistsOfType.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.CONSISTS_OF;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.informationsystem.types.reference.relations;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.types.impl.relations.IsRelatedToTypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
import org.gcube.informationsystem.types.reference.TypeMetadata;
|
||||
|
@ -17,4 +18,9 @@ public interface IsRelatedToType extends RelationType<ResourceType, ResourceType
|
|||
|
||||
public static final String NAME = "IsRelatedToType"; // IsRelatedToType.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.IS_RELATED_TO;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.relations.RelationElement;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl;
|
||||
|
@ -61,4 +62,9 @@ public interface RelationType<S extends EntityType, T extends EntityType>
|
|||
@JsonGetter(value=TARGET_PROPERTY)
|
||||
public String getTargetType();*/
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.RELATION_ELEMENT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue