software-versions-processor.../src/main/java/org/gcube/common/software/model/SoftwareVersion.java

151 lines
3.6 KiB
Java

package org.gcube.common.software.model;
import java.net.URL;
import java.util.Date;
import org.gcube.com.fasterxml.jackson.annotation.JsonFormat;
import org.gcube.com.fasterxml.jackson.annotation.JsonGetter;
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
import org.gcube.com.fasterxml.jackson.annotation.JsonProperty;
import org.gcube.com.fasterxml.jackson.annotation.JsonSetter;
import org.gcube.common.software.utils.Utils;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class SoftwareVersion extends SoftwareConcept {
public static final String VERSION_PROPERTY_NAME = "version";
public static final String DATE_PROPERTY_NAME = "date";
public static final String GCUBE_RELEASE_VERSION_PROPERTY_NAME = "gcube_release_version";
public static final String GCUBE_RELEASE_TICKET_PROPERTY_NAME = "gcube_release_ticket";
public static final String VERISON_DOI_URL_PROPERTY_NAME = "version_doi_url";
@JsonIgnore
protected SoftwareVersion previous;
@JsonIgnore
protected SoftwareVersion next;
@JsonIgnore
protected Boolean newDeposition;
@JsonIgnore
protected Variables variables;
@JsonProperty(VERSION_PROPERTY_NAME)
protected String version;
@JsonProperty(DATE_PROPERTY_NAME)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = Utils.DATETIME_PATTERN)
protected Date date;
@JsonProperty(GCUBE_RELEASE_VERSION_PROPERTY_NAME)
protected String gCubeReleaseVersion;
@JsonProperty(GCUBE_RELEASE_TICKET_PROPERTY_NAME)
protected URL gCubeReleaseTicket;
@JsonProperty(VERISON_DOI_URL_PROPERTY_NAME)
protected URL versionDOIURL;
public SoftwareVersion() {
this.newDeposition = false;
}
@JsonIgnore
public SoftwareVersion getPrevious() {
return previous;
}
@JsonIgnore
public void setPrevious(SoftwareVersion previous) {
this.previous = previous;
}
@JsonIgnore
public SoftwareVersion getNext() {
return next;
}
@JsonIgnore
public void setNext(SoftwareVersion next) {
this.next = next;
}
@JsonIgnore
public Boolean isNewDeposition() {
return newDeposition;
}
@JsonIgnore
public void setNewDeposition(Boolean newVersion) {
this.newDeposition = newVersion;
}
@JsonIgnore
public Variables getVariables() {
return variables;
}
@JsonIgnore
public void setVariables(Variables variables) {
this.variables = variables;
}
@JsonGetter(value = VERSION_PROPERTY_NAME)
public String getVersion() {
return version;
}
@JsonSetter(value = VERSION_PROPERTY_NAME)
public void setVersion(String version) {
if(version==null || version.length()==0) {
throw new RuntimeException("Invalid version");
}
this.version = version;
}
@JsonGetter(value = DATE_PROPERTY_NAME)
public Date getDate() {
return date;
}
@JsonSetter(value = DATE_PROPERTY_NAME)
public void setDate(Date date) {
this.date = date;
}
@JsonGetter(value = GCUBE_RELEASE_VERSION_PROPERTY_NAME)
public String getGCubeReleaseVersion() {
return gCubeReleaseVersion;
}
@JsonSetter(value = GCUBE_RELEASE_VERSION_PROPERTY_NAME)
public void setGCubeReleaseVersion(String gCubeReleaseVersion) {
this.gCubeReleaseVersion = gCubeReleaseVersion;
}
@JsonGetter(value = GCUBE_RELEASE_TICKET_PROPERTY_NAME)
public URL getGCubeReleaseTicket() {
return gCubeReleaseTicket;
}
@JsonSetter(value = GCUBE_RELEASE_TICKET_PROPERTY_NAME)
public void setGCubeReleaseTicket(URL gCubeReleaseTicket) {
this.gCubeReleaseTicket = gCubeReleaseTicket;
}
@JsonGetter(VERISON_DOI_URL_PROPERTY_NAME)
public URL getVersionDOIURL() {
return versionDOIURL;
}
@JsonIgnore
public void setVersionDOIURL(URL versionDOIURL) {
this.versionDOIURL = versionDOIURL;
}
}