better check of version value provided
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@133173 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e32ccbac4d
commit
7b347dd923
|
@ -213,6 +213,8 @@ public class GrsfPublisherFisheryService {
|
||||||
license = record.getLicense();
|
license = record.getLicense();
|
||||||
else throw new Exception("Please check the license id!");
|
else throw new Exception("Please check the license id!");
|
||||||
|
|
||||||
|
long version = record.getVersion() == null ? 1 : record.getVersion();
|
||||||
|
|
||||||
// create the product
|
// create the product
|
||||||
id = catalogue.createCKanDataset(
|
id = catalogue.createCKanDataset(
|
||||||
catalogue.getApiKeyFromUsername(username),
|
catalogue.getApiKeyFromUsername(username),
|
||||||
|
@ -222,7 +224,7 @@ public class GrsfPublisherFisheryService {
|
||||||
authorMail,
|
authorMail,
|
||||||
record.getMaintainer(),
|
record.getMaintainer(),
|
||||||
record.getMaintainerContact(),
|
record.getMaintainerContact(),
|
||||||
record.getVersion(),
|
version,
|
||||||
record.getDescription(),
|
record.getDescription(),
|
||||||
license,
|
license,
|
||||||
tags,
|
tags,
|
||||||
|
|
|
@ -204,6 +204,8 @@ public class GrsfPublisherStockService {
|
||||||
license = record.getLicense();
|
license = record.getLicense();
|
||||||
else throw new Exception("Please check the license id!");
|
else throw new Exception("Please check the license id!");
|
||||||
|
|
||||||
|
long version = record.getVersion() == null ? 1 : record.getVersion();
|
||||||
|
|
||||||
// create the product
|
// create the product
|
||||||
id = catalogue.createCKanDataset(
|
id = catalogue.createCKanDataset(
|
||||||
catalogue.getApiKeyFromUsername(username),
|
catalogue.getApiKeyFromUsername(username),
|
||||||
|
@ -213,7 +215,7 @@ public class GrsfPublisherStockService {
|
||||||
authorMail,
|
authorMail,
|
||||||
record.getMaintainer(),
|
record.getMaintainer(),
|
||||||
record.getMaintainerContact(),
|
record.getMaintainerContact(),
|
||||||
record.getVersion(),
|
version,
|
||||||
record.getDescription(),
|
record.getDescription(),
|
||||||
license,
|
license,
|
||||||
tags,
|
tags,
|
||||||
|
|
|
@ -17,11 +17,12 @@ 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.json.input.DatabaseSource;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.DatabaseSource;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.json.input.FisheryRecord;
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.FisheryRecord;
|
||||||
|
import org.gcube.data_catalogue.grsf_publish_ws.json.input.StockRecord;
|
||||||
|
import org.gcube.data_catalogue.grsf_publish_ws.json.output.ResponseCreationBean;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.HelperMethods;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Abundance_Level;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Abundance_Level;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status;
|
||||||
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Type;
|
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Type;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
@ -113,10 +114,10 @@ public class JTests {
|
||||||
System.out.println(res.name());
|
System.out.println(res.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
//@Test
|
||||||
public void testJSONMapping() throws IOException{
|
public void testJSONMapping() throws IOException{
|
||||||
|
|
||||||
FisheryRecord record = new FisheryRecord();
|
StockRecord record = new StockRecord();
|
||||||
// record.setType(Type.Assessment_Unit);
|
// record.setType(Type.Assessment_Unit);
|
||||||
// record.setFisheryId("sajhdskajda");
|
// record.setFisheryId("sajhdskajda");
|
||||||
// record.setScientificName("assadsadada");
|
// record.setScientificName("assadsadada");
|
||||||
|
@ -184,8 +185,10 @@ public class JTests {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
//Object to JSON in String
|
//Object to JSON in String
|
||||||
String jsonInString = mapper.writeValueAsString(record);
|
String jsonInString = mapper.writeValueAsString(new ResponseCreationBean());
|
||||||
System.out.println(jsonInString);
|
System.out.println(jsonInString);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// // JSON back to object
|
// // JSON back to object
|
||||||
// StockRecord converted = mapper.readValue(jsonInString, recordStock.getClass());
|
// StockRecord converted = mapper.readValue(jsonInString, recordStock.getClass());
|
||||||
|
|
Loading…
Reference in New Issue