85 lines
2.2 KiB
Java
85 lines
2.2 KiB
Java
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;
|
|
}
|
|
|
|
@SuppressWarnings("unchecked")
|
|
@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();
|
|
}
|
|
|
|
}
|