Fixed AccessType

This commit is contained in:
Luca Frosini 2021-02-12 12:08:30 +01:00
parent 8bb0e6aa5d
commit 16d9735851
2 changed files with 10 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.types.impl.TypeImpl; import org.gcube.informationsystem.types.impl.TypeImpl;
import org.gcube.informationsystem.types.reference.properties.Changelog;
import org.gcube.informationsystem.types.reference.properties.LinkedEntity; import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyType; import org.gcube.informationsystem.types.reference.properties.PropertyType;
@ -53,7 +54,8 @@ public final class PropertyTypeImpl<P extends PropertyElement> extends TypeImpl
} }
if(name.compareTo(PropertyElement.NAME)==0 || if(name.compareTo(PropertyElement.NAME)==0 ||
name.compareTo(LinkedEntity.NAME)==0) { name.compareTo(LinkedEntity.NAME)==0 ||
name.compareTo(Changelog.NAME)==0) {
return AccessType.PROPERTY_ELEMENT; return AccessType.PROPERTY_ELEMENT;
} }

View File

@ -18,6 +18,7 @@ import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.entities.FacetType; import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.entities.ResourceType; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.properties.Changelog;
import org.gcube.informationsystem.types.reference.properties.LinkedEntity; import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyType; import org.gcube.informationsystem.types.reference.properties.PropertyType;
@ -97,6 +98,12 @@ public class SerializationTest {
PropertyType<Encrypted> encrypted = (PropertyType<Encrypted>) TypeMapper.createTypeDefinition(Encrypted.class); PropertyType<Encrypted> encrypted = (PropertyType<Encrypted>) TypeMapper.createTypeDefinition(Encrypted.class);
Assert.assertTrue(encrypted.getAccessType()==AccessType.PROPERTY); Assert.assertTrue(encrypted.getAccessType()==AccessType.PROPERTY);
logger.info(ElementMapper.marshal(encrypted)); logger.info(ElementMapper.marshal(encrypted));
@SuppressWarnings("unchecked")
PropertyType<Changelog> changelog = (PropertyType<Changelog>) TypeMapper.createTypeDefinition(Changelog.class);
Assert.assertTrue(changelog.getAccessType()==AccessType.PROPERTY_ELEMENT);
logger.info(ElementMapper.marshal(changelog));
} }
@Test @Test