stock_name and fishery_name cannot be null

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@135198 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-12-01 21:41:24 +00:00
parent 6a91d90023
commit 291b542d61
4 changed files with 19 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CustomField;
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
@ -23,7 +24,7 @@ public class FisheryRecord extends Common{
@JsonProperty("fishery_name")
@NotNull(message="fishery_name cannot be null")
// @Size(min=1, message="fishery_name cannot be empty")
@Size(min=1, message="fishery_name cannot be empty")
@CustomField(key="Fishery Name")
private String fisheryName;

View File

@ -3,6 +3,8 @@ package org.gcube.data_catalogue.grsf_publish_ws.json.input;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.CustomField;
import org.gcube.data_catalogue.grsf_publish_ws.custom_annotations.Group;
@ -22,8 +24,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class StockRecord extends Common{
@JsonProperty("stock_name")
// @NotNull(message="stock_name cannot be null")
// @Size(min=2, message="stock_name cannot be empty")
@NotNull(message="stock_name cannot be null")
@Size(min=2, message="stock_name cannot be empty")
@CustomField(key="Stock Name")
private String stockName;

View File

@ -185,12 +185,18 @@ public class GrsfPublisherFisheryService {
record.setProductType(Record_Type.FISHERY.getOrigName());
// evaluate the tags of the product
Set<String> tags = new HashSet<String>();
Set<String> tags = new HashSet<String>();
CommonUtils.getTags(tags, record);
// evaluate the groups
Set<String> groups = new HashSet<String>();
CommonUtils.getGroups(groups, record);
// add the tag and group for the other sources
if(!sourceInPath.equals(Sources.GRSF)){
tags.add(sourceInPath.getOrigName());
groups.add(sourceInPath.getOrigName());
}
// evaluate the custom fields
Map<String, List<String>> customFields = record.getExtrasFields();

View File

@ -181,6 +181,12 @@ public class GrsfPublisherStockService {
// evaluate the groups
Set<String> groups = new HashSet<String>();
CommonUtils.getGroups(groups, record);
// add the tag and group for the other sources
if(!sourceInPath.equals(Sources.GRSF)){
tags.add(sourceInPath.getOrigName());
groups.add(sourceInPath.getOrigName());
}
// evaluate the custom fields
Map<String, List<String>> customFields = record.getExtrasFields();