Traceability flag must be assigned only to Fishery records refs #18293
This commit is contained in:
parent
f2fc4a75f5
commit
ff62f341bc
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.data-catalogue</groupId>
|
<groupId>org.gcube.data-catalogue</groupId>
|
||||||
<artifactId>grsf-publisher-ws</artifactId>
|
<artifactId>grsf-publisher-ws</artifactId>
|
||||||
<version>1.10.0</version>
|
<version>1.11.0-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>grsf-publisher-ws</name>
|
<name>grsf-publisher-ws</name>
|
||||||
<description>Utility library to publish GRSF products on GRSF catalogue.</description>
|
<description>Utility library to publish GRSF products on GRSF catalogue.</description>
|
||||||
|
|
|
@ -52,11 +52,6 @@ public abstract class Common extends Base{
|
||||||
@CustomField(key=Constants.SHORT_NAME_CUSTOM_KEY)
|
@CustomField(key=Constants.SHORT_NAME_CUSTOM_KEY)
|
||||||
private String shortName;
|
private String shortName;
|
||||||
|
|
||||||
@JsonProperty(Constants.TRACEABILITY_FLAG_JSON_KEY)
|
|
||||||
@CustomField(key=Constants.TRACEABILITY_FLAG_CUSTOM_KEY)
|
|
||||||
@Group(condition="true", groupNameOverValue=Constants.TRACEABILITY_FLAG_GROUP_NAME) // record is added to group grsf-traceability-flag if Traceability Flag is true
|
|
||||||
private Boolean traceabilityFlag;
|
|
||||||
|
|
||||||
@JsonProperty(Constants.SDG_FLAG_JSON_KEY)
|
@JsonProperty(Constants.SDG_FLAG_JSON_KEY)
|
||||||
@CustomField(key=Constants.SDG_FLAG_CUSTOM_KEY)
|
@CustomField(key=Constants.SDG_FLAG_CUSTOM_KEY)
|
||||||
@Group(condition="true", groupNameOverValue=Constants.SDG_FLAG_GROUP_NAME) // record is added to group grsf-sdg-flag if sdg Flag is true
|
@Group(condition="true", groupNameOverValue=Constants.SDG_FLAG_GROUP_NAME) // record is added to group grsf-sdg-flag if sdg Flag is true
|
||||||
|
@ -165,7 +160,7 @@ public abstract class Common extends Base{
|
||||||
List<Resource<Sources>> databaseSources,
|
List<Resource<Sources>> databaseSources,
|
||||||
List<Resource<String>> sourceOfInformation,
|
List<Resource<String>> sourceOfInformation,
|
||||||
List<RefersToBean> refersTo, String shortName,
|
List<RefersToBean> refersTo, String shortName,
|
||||||
Boolean traceabilityFlag, Status status, String systemType,
|
Status status, String systemType,
|
||||||
List<TimeSeriesBean<String, String>> catches,
|
List<TimeSeriesBean<String, String>> catches,
|
||||||
List<TimeSeriesBean<String, String>> landings,
|
List<TimeSeriesBean<String, String>> landings,
|
||||||
List<String> species, List<SimilarRecordBean> similarGRSFRecords,
|
List<String> species, List<SimilarRecordBean> similarGRSFRecords,
|
||||||
|
@ -179,7 +174,6 @@ public abstract class Common extends Base{
|
||||||
this.sourceOfInformation = sourceOfInformation;
|
this.sourceOfInformation = sourceOfInformation;
|
||||||
this.refersTo = refersTo;
|
this.refersTo = refersTo;
|
||||||
this.shortName = shortName;
|
this.shortName = shortName;
|
||||||
this.traceabilityFlag = traceabilityFlag;
|
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.systemType = systemType;
|
this.systemType = systemType;
|
||||||
this.catches = catches;
|
this.catches = catches;
|
||||||
|
@ -227,10 +221,6 @@ public abstract class Common extends Base{
|
||||||
this.systemType = systemType;
|
this.systemType = systemType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getTraceabilityFlag() {
|
|
||||||
return traceabilityFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<RefersToBean> getRefersTo() {
|
public List<RefersToBean> getRefersTo() {
|
||||||
return refersTo;
|
return refersTo;
|
||||||
}
|
}
|
||||||
|
@ -262,14 +252,6 @@ public abstract class Common extends Base{
|
||||||
this.shortName = shortName;
|
this.shortName = shortName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isTraceabilityFlag() {
|
|
||||||
return traceabilityFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTraceabilityFlag(Boolean traceabilityFlag) {
|
|
||||||
this.traceabilityFlag = traceabilityFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Status getStatus() {
|
public Status getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -388,8 +370,7 @@ public abstract class Common extends Base{
|
||||||
return "Common [dataOwner=" + dataOwner + ", databaseSources="
|
return "Common [dataOwner=" + dataOwner + ", databaseSources="
|
||||||
+ databaseSources + ", sourceOfInformation="
|
+ databaseSources + ", sourceOfInformation="
|
||||||
+ sourceOfInformation + ", refersTo=" + refersTo
|
+ sourceOfInformation + ", refersTo=" + refersTo
|
||||||
+ ", shortName=" + shortName + ", traceabilityFlag="
|
+ ", shortName=" + shortName + ", sdgFlag=" + sdgFlag + ", status="
|
||||||
+ traceabilityFlag + ", sdgFlag=" + sdgFlag + ", status="
|
|
||||||
+ status + ", systemType=" + systemType + ", catches="
|
+ status + ", systemType=" + systemType + ", catches="
|
||||||
+ catches + ", landings=" + landings + ", species=" + species
|
+ catches + ", landings=" + landings + ", species=" + species
|
||||||
+ ", similarGRSFRecords=" + similarGRSFRecords
|
+ ", similarGRSFRecords=" + similarGRSFRecords
|
||||||
|
|
|
@ -21,6 +21,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
*/
|
*/
|
||||||
public class FisheryRecord extends Common {
|
public class FisheryRecord extends Common {
|
||||||
|
|
||||||
|
@JsonProperty(Constants.TRACEABILITY_FLAG_JSON_KEY)
|
||||||
|
@CustomField(key=Constants.TRACEABILITY_FLAG_CUSTOM_KEY)
|
||||||
|
@Group(condition="true", groupNameOverValue=Constants.TRACEABILITY_FLAG_GROUP_NAME) // record is added to group grsf-traceability-flag if Traceability Flag is true
|
||||||
|
private Boolean traceabilityFlag;
|
||||||
|
|
||||||
@JsonProperty(Constants.FISHERY_NAME_JSON_KEY)
|
@JsonProperty(Constants.FISHERY_NAME_JSON_KEY)
|
||||||
@NotNull(message="fishery_name cannot be null")
|
@NotNull(message="fishery_name cannot be null")
|
||||||
|
@ -81,12 +85,13 @@ public class FisheryRecord extends Common {
|
||||||
* @param fishingGear
|
* @param fishingGear
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
public FisheryRecord(String fisheryName, String fisheryId,
|
public FisheryRecord(Boolean traceabilityFlag, String fisheryName, String fisheryId,
|
||||||
List<String> fishingArea, List<String> resourcesExploited,
|
List<String> fishingArea, List<String> resourcesExploited,
|
||||||
List<String> jurisdictionArea,
|
List<String> jurisdictionArea,
|
||||||
List<Production_System_Type> productionSystemType,
|
List<Production_System_Type> productionSystemType,
|
||||||
List<String> flagState, List<String> fishingGear, Fishery_Type type) {
|
List<String> flagState, List<String> fishingGear, Fishery_Type type) {
|
||||||
super();
|
super();
|
||||||
|
this.traceabilityFlag = traceabilityFlag;
|
||||||
this.fisheryName = fisheryName;
|
this.fisheryName = fisheryName;
|
||||||
this.fisheryId = fisheryId;
|
this.fisheryId = fisheryId;
|
||||||
this.fishingArea = fishingArea;
|
this.fishingArea = fishingArea;
|
||||||
|
@ -97,6 +102,20 @@ public class FisheryRecord extends Common {
|
||||||
this.fishingGear = fishingGear;
|
this.fishingGear = fishingGear;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public Boolean getTraceabilityFlag() {
|
||||||
|
return traceabilityFlag;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Boolean isTraceabilityFlag() {
|
||||||
|
return traceabilityFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTraceabilityFlag(Boolean traceabilityFlag) {
|
||||||
|
this.traceabilityFlag = traceabilityFlag;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFisheryName() {
|
public String getFisheryName() {
|
||||||
return fisheryName;
|
return fisheryName;
|
||||||
|
@ -175,6 +194,7 @@ public class FisheryRecord extends Common {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + " - FisheryRecord [fisheryName=" + fisheryName + ", fisheryId="
|
return super.toString() + " - FisheryRecord [fisheryName=" + fisheryName + ", fisheryId="
|
||||||
+ fisheryId + ", fishingArea=" + fishingArea
|
+ fisheryId + ", fishingArea=" + fishingArea
|
||||||
|
+ ", traceabilityFlag=" + traceabilityFlag
|
||||||
+ ", resourcesExploited=" + resourcesExploited
|
+ ", resourcesExploited=" + resourcesExploited
|
||||||
+ ", jurisdictionArea=" + jurisdictionArea
|
+ ", jurisdictionArea=" + jurisdictionArea
|
||||||
+ ", productionSystemType=" + productionSystemType
|
+ ", productionSystemType=" + productionSystemType
|
||||||
|
|
|
@ -81,9 +81,11 @@ public class CommonServiceUtils {
|
||||||
if(refersToList == null || refersToList.isEmpty())
|
if(refersToList == null || refersToList.isEmpty())
|
||||||
throw new Exception("refers_to cannot be null/empty");
|
throw new Exception("refers_to cannot be null/empty");
|
||||||
|
|
||||||
Boolean traceabilityFlag = record.isTraceabilityFlag();
|
if(record.getClass().equals(FisheryRecord.class)) {
|
||||||
if(traceabilityFlag == null)
|
Boolean traceabilityFlag = ((FisheryRecord) record).isTraceabilityFlag();
|
||||||
throw new Exception("traceability_flag cannot be null");
|
if(traceabilityFlag == null)
|
||||||
|
throw new Exception("traceability_flag cannot be null");
|
||||||
|
}
|
||||||
|
|
||||||
Status status = record.getStatus();
|
Status status = record.getStatus();
|
||||||
if(status == null)
|
if(status == null)
|
||||||
|
|
Loading…
Reference in New Issue