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:
Costantino Perciante 2016-10-13 13:34:47 +00:00
parent e32ccbac4d
commit 7b347dd923
3 changed files with 13 additions and 6 deletions

View File

@ -212,6 +212,8 @@ public class GrsfPublisherFisheryService {
if(HelperMethods.existsLicenseId(record.getLicense()))
license = record.getLicense();
else throw new Exception("Please check the license id!");
long version = record.getVersion() == null ? 1 : record.getVersion();
// create the product
id = catalogue.createCKanDataset(
@ -222,7 +224,7 @@ public class GrsfPublisherFisheryService {
authorMail,
record.getMaintainer(),
record.getMaintainerContact(),
record.getVersion(),
version,
record.getDescription(),
license,
tags,

View File

@ -203,6 +203,8 @@ public class GrsfPublisherStockService {
if(HelperMethods.existsLicenseId(record.getLicense()))
license = record.getLicense();
else throw new Exception("Please check the license id!");
long version = record.getVersion() == null ? 1 : record.getVersion();
// create the product
id = catalogue.createCKanDataset(
@ -213,7 +215,7 @@ public class GrsfPublisherStockService {
authorMail,
record.getMaintainer(),
record.getMaintainerContact(),
record.getVersion(),
version,
record.getDescription(),
license,
tags,

View File

@ -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.json.input.DatabaseSource;
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.groups.Abundance_Level;
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Status;
import org.gcube.data_catalogue.grsf_publish_ws.utils.groups.Type;
import org.junit.Test;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -113,10 +114,10 @@ public class JTests {
System.out.println(res.name());
}
@Test
//@Test
public void testJSONMapping() throws IOException{
FisheryRecord record = new FisheryRecord();
StockRecord record = new StockRecord();
// record.setType(Type.Assessment_Unit);
// record.setFisheryId("sajhdskajda");
// record.setScientificName("assadsadada");
@ -184,8 +185,10 @@ public class JTests {
ObjectMapper mapper = new ObjectMapper();
//Object to JSON in String
String jsonInString = mapper.writeValueAsString(record);
String jsonInString = mapper.writeValueAsString(new ResponseCreationBean());
System.out.println(jsonInString);
//
// // JSON back to object
// StockRecord converted = mapper.readValue(jsonInString, recordStock.getClass());