added support for Connected Records
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@160328 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1e277e8ed0
commit
7427f626f4
|
@ -0,0 +1,83 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* Connected grsf-records bean
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class ConnectedBean {
|
||||
|
||||
@JsonProperty(Constants.CONNECTED_RECORD_SEMANTIC_IDENTIFIER_JSON_KEY)
|
||||
@Size(min=1, message= Constants.CONNECTED_RECORD_SEMANTIC_IDENTIFIER_JSON_KEY + " cannot be empty")
|
||||
private String semanticIdentifier;
|
||||
|
||||
@JsonProperty(Constants.CONNECTED_RECORD_SHORT_NAME_JSON_KEY)
|
||||
private String shortName;
|
||||
|
||||
@JsonProperty(Constants.CONNECTED_RECORD_KNOWLEDGE_BASE_ID_JSON_KEY)
|
||||
@Size(min=1, message= Constants.CONNECTED_RECORD_KNOWLEDGE_BASE_ID_JSON_KEY + " cannot be empty")
|
||||
private String knowledeBaseId;
|
||||
|
||||
public ConnectedBean() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param semanticIdentifier
|
||||
* @param shortName
|
||||
* @param knowledeBaseId
|
||||
*/
|
||||
public ConnectedBean(String semanticIdentifier, String shortName,
|
||||
String knowledeBaseId) {
|
||||
super();
|
||||
this.semanticIdentifier = semanticIdentifier;
|
||||
this.shortName = shortName;
|
||||
this.knowledeBaseId = knowledeBaseId;
|
||||
}
|
||||
|
||||
public String getSemanticIdentifier() {
|
||||
return semanticIdentifier;
|
||||
}
|
||||
|
||||
public void setSemanticIdentifier(String semanticIdentifier) {
|
||||
this.semanticIdentifier = semanticIdentifier;
|
||||
}
|
||||
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
public void setShortName(String shortName) {
|
||||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
public String getKnowledeBaseId() {
|
||||
return knowledeBaseId;
|
||||
}
|
||||
|
||||
public void setKnowledeBaseId(String knowledeBaseId) {
|
||||
this.knowledeBaseId = knowledeBaseId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
JSONObject obj = new JSONObject();
|
||||
|
||||
obj.put(Constants.CONNECTED_RECORD_SHORT_NAME_JSON_KEY, shortName);
|
||||
|
||||
if(semanticIdentifier != null && !semanticIdentifier.isEmpty())
|
||||
obj.put(Constants.CONNECTED_RECORD_SEMANTIC_IDENTIFIER_JSON_KEY, semanticIdentifier);
|
||||
|
||||
obj.put(Constants.CONNECTED_RECORD_KNOWLEDGE_BASE_ID_JSON_KEY, knowledeBaseId);
|
||||
|
||||
return obj.toJSONString();
|
||||
}
|
||||
|
||||
}
|
|
@ -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.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;
|
||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.SimilarRecordBean;
|
||||
|
@ -107,6 +108,10 @@ public class Common extends Base{
|
|||
@CustomField(key=Constants.SPATIAL_GEOJSON_CUSTOM_KEY)
|
||||
private String spatial;
|
||||
|
||||
@JsonProperty(Constants.CONNECTED_JSON_KEY)
|
||||
@CustomField(key=Constants.CONNECTED_CUSTOM_KEY)
|
||||
private List<ConnectedBean> connectedBeans;
|
||||
|
||||
public Common() {
|
||||
super();
|
||||
}
|
||||
|
@ -299,6 +304,14 @@ public class Common extends Base{
|
|||
this.spatial = spatial;
|
||||
}
|
||||
|
||||
public List<ConnectedBean> getConnectedBeans() {
|
||||
return connectedBeans;
|
||||
}
|
||||
|
||||
public void setConnectedBeans(List<ConnectedBean> connectedBeans) {
|
||||
this.connectedBeans = connectedBeans;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean the semantic id
|
||||
* @param id
|
||||
|
@ -327,8 +340,6 @@ public class Common extends Base{
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Common [dataOwner=" + dataOwner + ", databaseSources="
|
||||
|
@ -341,7 +352,8 @@ public class Common extends Base{
|
|||
+ similarGRSFRecords + ", similarSourceRecords="
|
||||
+ similarSourceRecords + ", domain=" + domain + ", uuid="
|
||||
+ uuid + ", managementBodyAuthorities="
|
||||
+ managementBodyAuthorities + "]";
|
||||
+ managementBodyAuthorities + ", spatial=" + spatial
|
||||
+ ", connectedBeans=" + connectedBeans + "]";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue