2017-10-25 16:45:34 +02:00
|
|
|
package org.gcube.data_catalogue.grsf_publish_ws.json.input.others;
|
2017-07-14 16:13:10 +02:00
|
|
|
|
2017-11-02 12:32:41 +01:00
|
|
|
import org.gcube.datacatalogue.common.Constants;
|
2017-10-04 17:30:07 +02:00
|
|
|
import org.json.simple.JSONObject;
|
|
|
|
|
2017-07-14 16:13:10 +02:00
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Similar record information.
|
|
|
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
|
|
|
*/
|
|
|
|
public class SimilarRecordBean {
|
|
|
|
|
2017-11-02 12:32:41 +01:00
|
|
|
@JsonProperty(Constants.SIMILAR_RECORDS_BEAN_FIELD_URL)
|
2017-07-14 16:13:10 +02:00
|
|
|
String url;
|
|
|
|
|
2017-11-02 12:32:41 +01:00
|
|
|
@JsonProperty(Constants.SIMILAR_RECORDS_BEAN_FIELD_IDENTIFIER)
|
2017-07-14 16:13:10 +02:00
|
|
|
String id;
|
|
|
|
|
2017-11-02 12:32:41 +01:00
|
|
|
@JsonProperty(Constants.SIMILAR_RECORDS_BEAN_FIELD_DESCRIPTION)
|
2017-07-14 16:13:10 +02:00
|
|
|
String description;
|
|
|
|
|
2017-11-02 12:32:41 +01:00
|
|
|
@JsonProperty(Constants.SIMILAR_RECORDS_BEAN_FIELD_NAME)
|
2017-10-25 16:45:34 +02:00
|
|
|
String name;
|
|
|
|
|
2017-07-14 16:13:10 +02:00
|
|
|
public SimilarRecordBean() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param url
|
|
|
|
* @param id
|
|
|
|
* @param description
|
|
|
|
*/
|
2017-12-13 18:35:23 +01:00
|
|
|
public SimilarRecordBean(String url, String semanticIdentifier, String description, String name) {
|
2017-07-14 16:13:10 +02:00
|
|
|
super();
|
|
|
|
this.url = url;
|
2017-12-13 18:35:23 +01:00
|
|
|
this.id = semanticIdentifier;
|
2017-07-14 16:13:10 +02:00
|
|
|
this.description = description;
|
2017-10-25 16:45:34 +02:00
|
|
|
this.name = name;
|
2017-07-14 16:13:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getUrl() {
|
|
|
|
return url;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setUrl(String url) {
|
|
|
|
this.url = url;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getId() {
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setId(String id) {
|
|
|
|
this.id = id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
return description;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDescription(String description) {
|
|
|
|
this.description = description;
|
|
|
|
}
|
|
|
|
|
2017-10-25 16:45:34 +02:00
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setName(String name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
2017-07-14 16:13:10 +02:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
2017-10-25 16:45:34 +02:00
|
|
|
|
2017-10-04 17:30:07 +02:00
|
|
|
// in json format
|
|
|
|
JSONObject obj = new JSONObject();
|
|
|
|
|
|
|
|
if(url != null && !url.isEmpty())
|
|
|
|
obj.put("url", url);
|
2017-10-25 16:45:34 +02:00
|
|
|
|
2017-10-04 17:30:07 +02:00
|
|
|
if(description != null && !description.isEmpty())
|
|
|
|
obj.put("description", description);
|
2017-10-25 16:45:34 +02:00
|
|
|
|
2017-10-04 17:30:07 +02:00
|
|
|
if(id != null && !id.isEmpty())
|
2018-01-17 10:27:30 +01:00
|
|
|
obj.put("id", id); //Common.cleanSemanticId(id)
|
2017-10-25 16:45:34 +02:00
|
|
|
|
|
|
|
if(name != null && !name.isEmpty())
|
|
|
|
obj.put("name", name);
|
|
|
|
|
2017-10-04 17:30:07 +02:00
|
|
|
return obj.toJSONString();
|
2017-07-14 16:13:10 +02:00
|
|
|
}
|
|
|
|
}
|