Add version information on IS type

This commit is contained in:
Luca Frosini 2020-12-11 09:47:14 +01:00
parent 7763dd4abb
commit c593c383a6
4 changed files with 16 additions and 1 deletions

View File

@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for Information System Model
## [v4.2.0]
- Added version information on Type
## [v4.1.0]

View File

@ -10,7 +10,7 @@
<groupId>org.gcube.information-system</groupId>
<artifactId>information-system-model</artifactId>
<version>4.1.0</version>
<version>4.2.0-SNAPSHOT</version>
<name>Information System Model</name>
<description>Information System Model is the reference model of the gCube Information System</description>
<packaging>jar</packaging>

View File

@ -36,11 +36,13 @@ public class TypeImpl implements Type {
private static final long serialVersionUID = -4333954207969059451L;
public final static String DESCRIPTION = "DESCRIPTION";
public final static String VERSION = "VERSION";
protected Header header;
protected String name;
protected String description;
protected String version;
@JsonProperty(value="abstract")
protected boolean abstractType;
protected Set<String> superClasses;
@ -133,6 +135,7 @@ public class TypeImpl implements Type {
protected TypeImpl(Class<? extends Element> clz) {
this.name = TypeMapper.getType(clz);
this.description = TypeMapper.getStaticStringFieldByName(clz, DESCRIPTION, "");
this.version = TypeMapper.getStaticStringFieldByName(clz, VERSION, "1.0.0");
this.abstractType = false;
if(clz.isAnnotationPresent(Abstract.class)){
@ -162,6 +165,11 @@ public class TypeImpl implements Type {
return description;
}
@Override
public String getVersion() {
return version;
}
@Override
public boolean isAbstract() {
return abstractType;
@ -176,4 +184,5 @@ public class TypeImpl implements Type {
public Set<PropertyDefinition> getProperties() {
return properties;
}
}

View File

@ -16,6 +16,7 @@ public interface Type extends IdentifiableElement {
public static final String NAME_PROPERTY = "name";
public static final String DESCRIPTION_PROPERTY = "description";
public static final String VERSION_PROPERTY = "version";
public static final String ABSTRACT_PROPERTY = "abstract";
public static final String TYPE_SUPERCLASSES_PROPERTY = "superClasses";
public static final String PROPERTIES_PROPERTY = "properties";
@ -24,6 +25,8 @@ public interface Type extends IdentifiableElement {
public String getDescription();
public String getVersion();
public boolean isAbstract();
public Set<String> getSuperClasses();