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>
|
||||
<artifactId>grsf-publisher-ws</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<version>1.11.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<name>grsf-publisher-ws</name>
|
||||
<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)
|
||||
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)
|
||||
@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
|
||||
|
@ -165,7 +160,7 @@ public abstract class Common extends Base{
|
|||
List<Resource<Sources>> databaseSources,
|
||||
List<Resource<String>> sourceOfInformation,
|
||||
List<RefersToBean> refersTo, String shortName,
|
||||
Boolean traceabilityFlag, Status status, String systemType,
|
||||
Status status, String systemType,
|
||||
List<TimeSeriesBean<String, String>> catches,
|
||||
List<TimeSeriesBean<String, String>> landings,
|
||||
List<String> species, List<SimilarRecordBean> similarGRSFRecords,
|
||||
|
@ -179,7 +174,6 @@ public abstract class Common extends Base{
|
|||
this.sourceOfInformation = sourceOfInformation;
|
||||
this.refersTo = refersTo;
|
||||
this.shortName = shortName;
|
||||
this.traceabilityFlag = traceabilityFlag;
|
||||
this.status = status;
|
||||
this.systemType = systemType;
|
||||
this.catches = catches;
|
||||
|
@ -227,10 +221,6 @@ public abstract class Common extends Base{
|
|||
this.systemType = systemType;
|
||||
}
|
||||
|
||||
public Boolean getTraceabilityFlag() {
|
||||
return traceabilityFlag;
|
||||
}
|
||||
|
||||
public List<RefersToBean> getRefersTo() {
|
||||
return refersTo;
|
||||
}
|
||||
|
@ -262,14 +252,6 @@ public abstract class Common extends Base{
|
|||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
public Boolean isTraceabilityFlag() {
|
||||
return traceabilityFlag;
|
||||
}
|
||||
|
||||
public void setTraceabilityFlag(Boolean traceabilityFlag) {
|
||||
this.traceabilityFlag = traceabilityFlag;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
@ -388,8 +370,7 @@ public abstract class Common extends Base{
|
|||
return "Common [dataOwner=" + dataOwner + ", databaseSources="
|
||||
+ databaseSources + ", sourceOfInformation="
|
||||
+ sourceOfInformation + ", refersTo=" + refersTo
|
||||
+ ", shortName=" + shortName + ", traceabilityFlag="
|
||||
+ traceabilityFlag + ", sdgFlag=" + sdgFlag + ", status="
|
||||
+ ", shortName=" + shortName + ", sdgFlag=" + sdgFlag + ", status="
|
||||
+ status + ", systemType=" + systemType + ", catches="
|
||||
+ catches + ", landings=" + landings + ", species=" + species
|
||||
+ ", similarGRSFRecords=" + similarGRSFRecords
|
||||
|
|
|
@ -21,6 +21,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
*/
|
||||
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)
|
||||
@NotNull(message="fishery_name cannot be null")
|
||||
|
@ -81,12 +85,13 @@ public class FisheryRecord extends Common {
|
|||
* @param fishingGear
|
||||
* @param type
|
||||
*/
|
||||
public FisheryRecord(String fisheryName, String fisheryId,
|
||||
public FisheryRecord(Boolean traceabilityFlag, String fisheryName, String fisheryId,
|
||||
List<String> fishingArea, List<String> resourcesExploited,
|
||||
List<String> jurisdictionArea,
|
||||
List<Production_System_Type> productionSystemType,
|
||||
List<String> flagState, List<String> fishingGear, Fishery_Type type) {
|
||||
super();
|
||||
this.traceabilityFlag = traceabilityFlag;
|
||||
this.fisheryName = fisheryName;
|
||||
this.fisheryId = fisheryId;
|
||||
this.fishingArea = fishingArea;
|
||||
|
@ -97,6 +102,20 @@ public class FisheryRecord extends Common {
|
|||
this.fishingGear = fishingGear;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/*
|
||||
public Boolean getTraceabilityFlag() {
|
||||
return traceabilityFlag;
|
||||
}
|
||||
*/
|
||||
|
||||
public Boolean isTraceabilityFlag() {
|
||||
return traceabilityFlag;
|
||||
}
|
||||
|
||||
public void setTraceabilityFlag(Boolean traceabilityFlag) {
|
||||
this.traceabilityFlag = traceabilityFlag;
|
||||
}
|
||||
|
||||
public String getFisheryName() {
|
||||
return fisheryName;
|
||||
|
@ -175,6 +194,7 @@ public class FisheryRecord extends Common {
|
|||
public String toString() {
|
||||
return super.toString() + " - FisheryRecord [fisheryName=" + fisheryName + ", fisheryId="
|
||||
+ fisheryId + ", fishingArea=" + fishingArea
|
||||
+ ", traceabilityFlag=" + traceabilityFlag
|
||||
+ ", resourcesExploited=" + resourcesExploited
|
||||
+ ", jurisdictionArea=" + jurisdictionArea
|
||||
+ ", productionSystemType=" + productionSystemType
|
||||
|
|
|
@ -81,9 +81,11 @@ public class CommonServiceUtils {
|
|||
if(refersToList == null || refersToList.isEmpty())
|
||||
throw new Exception("refers_to cannot be null/empty");
|
||||
|
||||
Boolean traceabilityFlag = record.isTraceabilityFlag();
|
||||
if(traceabilityFlag == null)
|
||||
throw new Exception("traceability_flag cannot be null");
|
||||
if(record.getClass().equals(FisheryRecord.class)) {
|
||||
Boolean traceabilityFlag = ((FisheryRecord) record).isTraceabilityFlag();
|
||||
if(traceabilityFlag == null)
|
||||
throw new Exception("traceability_flag cannot be null");
|
||||
}
|
||||
|
||||
Status status = record.getStatus();
|
||||
if(status == null)
|
||||
|
|
Loading…
Reference in New Issue