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.Group;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Tag;
|
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.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.RefersToBean;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.Resource;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.Resource;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.SimilarRecordBean;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.others.SimilarRecordBean;
|
||||||
|
@ -88,17 +89,17 @@ public class Common extends Base{
|
||||||
@JsonProperty(Constants.SIMILAR_SOURCE_RECORDS_JSON_KEY)
|
@JsonProperty(Constants.SIMILAR_SOURCE_RECORDS_JSON_KEY)
|
||||||
@CustomField(key=Constants.SIMILAR_SOURCE_RECORDS_CUSTOM_KEY)
|
@CustomField(key=Constants.SIMILAR_SOURCE_RECORDS_CUSTOM_KEY)
|
||||||
private List<SimilarRecordBean> similarSourceRecords;
|
private List<SimilarRecordBean> similarSourceRecords;
|
||||||
|
|
||||||
// automatically set
|
// automatically set
|
||||||
@CustomField(key=Constants.DOMAIN_CUSTOM_KEY)
|
@CustomField(key=Constants.DOMAIN_CUSTOM_KEY)
|
||||||
private String domain;
|
private String domain;
|
||||||
|
|
||||||
@JsonProperty(Constants.UUID_KB_JSON_KEY)
|
@JsonProperty(Constants.UUID_KB_JSON_KEY)
|
||||||
@CustomField(key=Constants.UUID_KB_CUSTOM_KEY)
|
@CustomField(key=Constants.UUID_KB_CUSTOM_KEY)
|
||||||
@NotNull(message="grsf_uuid cannot be null")
|
@NotNull(message="grsf_uuid cannot be null")
|
||||||
@Size(min=1, message="grsf_uuid cannot be empty")
|
@Size(min=1, message="grsf_uuid cannot be empty")
|
||||||
private String uuid;
|
private String uuid;
|
||||||
|
|
||||||
@JsonProperty(Constants.MANAGEMENT_ENTITIES_JSON_KEY)
|
@JsonProperty(Constants.MANAGEMENT_ENTITIES_JSON_KEY)
|
||||||
@CustomField(key=Constants.MANAGEMENT_ENTITIES_CUSTOM_KEY)
|
@CustomField(key=Constants.MANAGEMENT_ENTITIES_CUSTOM_KEY)
|
||||||
private List<String> managementBodyAuthorities;
|
private List<String> managementBodyAuthorities;
|
||||||
|
@ -106,7 +107,11 @@ public class Common extends Base{
|
||||||
@JsonProperty(Constants.SPATIAL_GEOJSON_JSON_KEY)
|
@JsonProperty(Constants.SPATIAL_GEOJSON_JSON_KEY)
|
||||||
@CustomField(key=Constants.SPATIAL_GEOJSON_CUSTOM_KEY)
|
@CustomField(key=Constants.SPATIAL_GEOJSON_CUSTOM_KEY)
|
||||||
private String spatial;
|
private String spatial;
|
||||||
|
|
||||||
|
@JsonProperty(Constants.CONNECTED_JSON_KEY)
|
||||||
|
@CustomField(key=Constants.CONNECTED_CUSTOM_KEY)
|
||||||
|
private List<ConnectedBean> connectedBeans;
|
||||||
|
|
||||||
public Common() {
|
public Common() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -299,6 +304,14 @@ public class Common extends Base{
|
||||||
this.spatial = spatial;
|
this.spatial = spatial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ConnectedBean> getConnectedBeans() {
|
||||||
|
return connectedBeans;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConnectedBeans(List<ConnectedBean> connectedBeans) {
|
||||||
|
this.connectedBeans = connectedBeans;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean the semantic id
|
* Clean the semantic id
|
||||||
* @param id
|
* @param id
|
||||||
|
@ -327,8 +340,6 @@ public class Common extends Base{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Common [dataOwner=" + dataOwner + ", databaseSources="
|
return "Common [dataOwner=" + dataOwner + ", databaseSources="
|
||||||
|
@ -341,7 +352,8 @@ public class Common extends Base{
|
||||||
+ similarGRSFRecords + ", similarSourceRecords="
|
+ similarGRSFRecords + ", similarSourceRecords="
|
||||||
+ similarSourceRecords + ", domain=" + domain + ", uuid="
|
+ similarSourceRecords + ", domain=" + domain + ", uuid="
|
||||||
+ uuid + ", managementBodyAuthorities="
|
+ uuid + ", managementBodyAuthorities="
|
||||||
+ managementBodyAuthorities + "]";
|
+ managementBodyAuthorities + ", spatial=" + spatial
|
||||||
|
+ ", connectedBeans=" + connectedBeans + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue