added annotations bean

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@162080 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2018-01-11 09:30:23 +00:00
parent c6b3738191
commit dd2d7d4cb2
2 changed files with 108 additions and 2 deletions

View File

@ -0,0 +1,85 @@
package org.gcube.data_catalogue.grsf_publish_ws.json.input.others;
import javax.validation.constraints.Size;
import org.gcube.datacatalogue.common.Constants;
import org.json.simple.JSONObject;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Stores the annotation message sent by an administrator
* @author Costantino Perciante at ISTI-CNR
* (costantino.perciante@isti.cnr.it)
*/
public class AnnotationBean {
@JsonProperty(Constants.ANNOTATION_ADMIN_JSON_KEY)
@Size(min=1, message= Constants.ANNOTATION_ADMIN_JSON_KEY + " cannot be empty")
private String admin;
@JsonProperty(Constants.ANNOTATION_MESSAGE_JSON_KEY)
private String annotationMessage;
@JsonProperty(Constants.ANNOTATION_TIME_JSON_KEY)
@Size(min=1, message= Constants.ANNOTATION_TIME_JSON_KEY + " cannot be empty")
private String time;
/**
*
*/
public AnnotationBean() {
super();
}
/**
* @param admin
* @param annotationMessage
* @param time
*/
public AnnotationBean(String admin, String annotationMessage, String time) {
super();
this.admin = admin;
this.annotationMessage = annotationMessage;
this.time = time;
}
public String getAdmin() {
return admin;
}
public void setAdmin(String admin) {
this.admin = admin;
}
public String getAnnotationMessage() {
return annotationMessage;
}
public void setAnnotationMessage(String annotationMessage) {
this.annotationMessage = annotationMessage;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
@SuppressWarnings("unchecked")
@Override
public String toString() {
JSONObject obj = new JSONObject();
obj.put(Constants.ANNOTATION_ADMIN_JSON_KEY, admin);
obj.put(Constants.ANNOTATION_MESSAGE_JSON_KEY, annotationMessage);
obj.put(Constants.ANNOTATION_TIME_JSON_KEY, time);
return obj.toJSONString();
}
}

View File

@ -11,6 +11,7 @@ import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CustomField;
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag;
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.TimeSeries;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.AnnotationBean;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.ConnectedBean;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.RefersToBean;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.Resource;
@ -112,6 +113,10 @@ public class Common extends Base{
@CustomField(key=Constants.CONNECTED_CUSTOM_KEY)
private List<ConnectedBean> connectedBeans;
@JsonProperty(Constants.ANNOTATION_PUBLISHER_JSON_KEY)
@CustomField(key=Constants.ANNOTATION_PUBLISHER_CUSTOM_KEY)
private List<AnnotationBean> annotations;
public Common() {
super();
}
@ -134,6 +139,8 @@ public class Common extends Base{
* @param uuid
* @param managementBodyAuthorities
* @param spatial
* @param connectedBeans
* @param annotations
*/
public Common(List<String> dataOwner,
List<Resource<Sources>> databaseSources,
@ -144,7 +151,9 @@ public class Common extends Base{
List<TimeSeriesBean<String, String>> landings,
List<String> species, List<SimilarRecordBean> similarGRSFRecords,
List<SimilarRecordBean> similarSourceRecords, String domain,
String uuid, List<String> managementBodyAuthorities, String spatial) {
String uuid, List<String> managementBodyAuthorities,
String spatial, List<ConnectedBean> connectedBeans,
List<AnnotationBean> annotations) {
super();
this.dataOwner = dataOwner;
this.databaseSources = databaseSources;
@ -163,6 +172,8 @@ public class Common extends Base{
this.uuid = uuid;
this.managementBodyAuthorities = managementBodyAuthorities;
this.spatial = spatial;
this.connectedBeans = connectedBeans;
this.annotations = annotations;
}
public List<String> getManagementBodyAuthorities() {
@ -312,6 +323,15 @@ public class Common extends Base{
this.connectedBeans = connectedBeans;
}
public List<AnnotationBean> getAnnotations() {
return annotations;
}
public void setAnnotations(List<AnnotationBean> annotations) {
this.annotations = annotations;
}
/**
* Clean the semantic id
* @param id
@ -353,7 +373,8 @@ public class Common extends Base{
+ similarSourceRecords + ", domain=" + domain + ", uuid="
+ uuid + ", managementBodyAuthorities="
+ managementBodyAuthorities + ", spatial=" + spatial
+ ", connectedBeans=" + connectedBeans + "]";
+ ", connectedBeans=" + connectedBeans + ", annotations="
+ annotations + "]";
}
}