remove semantic identifier clean code

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@162236 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2018-01-17 09:27:30 +00:00
parent 61aee0d483
commit 5d5789d12f
4 changed files with 34 additions and 31 deletions

View File

@ -1,6 +1,5 @@
package org.gcube.data_catalogue.grsf_publish_ws.json.input.others;
import org.gcube.data_catalogue.grsf_publish_ws.json.input.record.Common;
import org.gcube.datacatalogue.common.Constants;
import org.json.simple.JSONObject;
@ -88,7 +87,7 @@ public class SimilarRecordBean {
obj.put("description", description);
if(id != null && !id.isEmpty())
obj.put("id", Common.cleanSemanticId(id));
obj.put("id", id); //Common.cleanSemanticId(id)
if(name != null && !name.isEmpty())
obj.put("name", name);

View File

@ -332,33 +332,37 @@ public class Common extends Base{
this.annotations = annotations;
}
/**
* Clean the semantic id
* @param id
* @return
*/
public static String cleanSemanticId(String id){
if(id == null)
return null;
else{
String idmodified = "";
if(id != null){
String[] splitCodesValues = id.split("\\+");
for (int i = 0; i < splitCodesValues.length; i++) {
String prefixAndCode = splitCodesValues[i];
String prefix = prefixAndCode.split(":")[0];
String code = prefixAndCode.split(":")[1];
idmodified += prefix.toLowerCase() + ":" + code.toUpperCase();
if(splitCodesValues.length > 1 && i < (splitCodesValues.length - 1))
idmodified += "+";
}
}
return idmodified;
}
}
// /**
// * Clean the semantic id
// * @param id
// * @return
// */
// public static String cleanSemanticId(String id){
//
// if(id == null)
// return null;
// else{
// String idmodified = "";
// if(id != null){
//
// String[] splitCodesValues = id.split("\\+");
// for (int i = 0; i < splitCodesValues.length; i++) {
// String prefixAndCode = splitCodesValues[i];
// if(prefixAndCode.length() == 0)
// idmodified += "+";
// else{
// String prefix = prefixAndCode.split(":")[0];
// String code = prefixAndCode.split(":")[1];
// idmodified += prefix.toLowerCase() + ":" + code.toUpperCase();
// if(splitCodesValues.length > 1 && i < (splitCodesValues.length - 1))
// idmodified += "+";
// }
// }
// }
// return idmodified;
// }
//
// }
@Override
public String toString() {

View File

@ -108,7 +108,7 @@ public class FisheryRecord extends Common{
}
public void setFisheryId(String fisheryId) {
this.fisheryId = super.cleanSemanticId(fisheryId);
this.fisheryId = fisheryId;//super.cleanSemanticId(fisheryId);
}
public List<String> getFishingArea() {

View File

@ -173,7 +173,7 @@ public class StockRecord extends Common{
}
public void setStockId(String stockId) {
this.stockId = super.cleanSemanticId(stockId);
this.stockId = stockId;//super.cleanSemanticId(stockId);
}
public List<String> getArea() {