connected bean object updated and timeseries to string result updated according to document https://docs.google.com/document/d/1q-WUWsgSZUVb_iMNoZV9udCuHN_qVVxaQ0EizosT7Lg
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@162684 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e02b55d6ab
commit
c3738ffddd
|
@ -24,23 +24,44 @@ public class ConnectedBean {
|
||||||
@Size(min=1, message= Constants.CONNECTED_RECORD_KNOWLEDGE_BASE_ID_JSON_KEY + " cannot be empty")
|
@Size(min=1, message= Constants.CONNECTED_RECORD_KNOWLEDGE_BASE_ID_JSON_KEY + " cannot be empty")
|
||||||
private String knowledeBaseId;
|
private String knowledeBaseId;
|
||||||
|
|
||||||
|
@JsonProperty(Constants.CONNECTED_JSON_KEY)
|
||||||
|
private boolean connected;
|
||||||
|
|
||||||
public ConnectedBean() {
|
public ConnectedBean() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param semanticIdentifier
|
* @param semanticIdentifier
|
||||||
* @param shortName
|
* @param shortName
|
||||||
* @param knowledeBaseId
|
* @param knowledeBaseId
|
||||||
|
* @param connected
|
||||||
*/
|
*/
|
||||||
public ConnectedBean(String semanticIdentifier, String shortName,
|
public ConnectedBean(String semanticIdentifier, String shortName,
|
||||||
String knowledeBaseId) {
|
String knowledeBaseId, boolean connected) {
|
||||||
super();
|
super();
|
||||||
this.semanticIdentifier = semanticIdentifier;
|
this.semanticIdentifier = semanticIdentifier;
|
||||||
this.shortName = shortName;
|
this.shortName = shortName;
|
||||||
this.knowledeBaseId = knowledeBaseId;
|
this.knowledeBaseId = knowledeBaseId;
|
||||||
|
this.connected = connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isConnected() {
|
||||||
|
return connected;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void setConnected(boolean connected) {
|
||||||
|
this.connected = connected;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getSemanticIdentifier() {
|
public String getSemanticIdentifier() {
|
||||||
return semanticIdentifier;
|
return semanticIdentifier;
|
||||||
}
|
}
|
||||||
|
@ -70,14 +91,10 @@ public class ConnectedBean {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
|
|
||||||
obj.put(Constants.CONNECTED_RECORD_SHORT_NAME_JSON_KEY, shortName);
|
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_SEMANTIC_IDENTIFIER_JSON_KEY, semanticIdentifier);
|
||||||
|
|
||||||
obj.put(Constants.CONNECTED_RECORD_KNOWLEDGE_BASE_ID_JSON_KEY, knowledeBaseId);
|
obj.put(Constants.CONNECTED_RECORD_KNOWLEDGE_BASE_ID_JSON_KEY, knowledeBaseId);
|
||||||
|
obj.put(Constants.CONNECTED_JSON_KEY, connected);
|
||||||
return obj.toJSONString();
|
return obj.toJSONString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,14 +135,34 @@ public class TimeSeriesBean<T, T1> implements Comparable<TimeSeriesBean<T, T1>>{
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
||||||
String value = "" + this.value;
|
String value = "" + this.value;
|
||||||
String unit = (this.unit != null ? " " + this.unit : "");
|
String unit = this.unit != null ? "Unit : " + this.unit : "";
|
||||||
String databaseSource = (this.databaseSource != null ? " (" + this.databaseSource + ")" : "");
|
String databaseSource = (this.databaseSource != null ? " - DB Source: " + this.databaseSource : "");
|
||||||
String dataOwner = (this.dataOwner != null ? " " + this.dataOwner : "");
|
String dataOwner = (this.dataOwner != null ? " - Data Owner: " + this.dataOwner : "");
|
||||||
String referenceYear = year >= 0 ? " Ref. Year " + year : "";
|
String referenceYear = year >= 0 ? " - Ref. Year: " + year : "";
|
||||||
String reportingYearOrAssessment = (assessment != null ? " and Rep. Year or Assessment Id " + assessment + "" : "");
|
String reportingYearOrAssessment = (assessment != null ? " - Rep. Year or Assessment Id: " + assessment + "" : "");
|
||||||
|
String partial = value + "[" +
|
||||||
|
unit +
|
||||||
|
reportingYearOrAssessment +
|
||||||
|
referenceYear +
|
||||||
|
dataOwner +
|
||||||
|
databaseSource +
|
||||||
|
"]";
|
||||||
|
|
||||||
return value + unit + databaseSource + dataOwner + referenceYear + reportingYearOrAssessment;
|
return partial.replaceAll("\\b\\[ - \\b", "[");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
//
|
||||||
|
// TimeSeriesBean<String, String> t = new TimeSeriesBean<String, String>();
|
||||||
|
// t.setYear(1021L);
|
||||||
|
// t.setDatabaseSource("tttt");
|
||||||
|
// t.setDataOwner("zzzz");
|
||||||
|
// t.setUnit("uuuu");
|
||||||
|
// t.setValue("vvvv");
|
||||||
|
// t.setAssessment("2015");
|
||||||
|
// System.err.println("Result is \n" + t);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue