Fixing issues evidenced in #21995

This commit is contained in:
Luca Frosini 2021-11-04 17:06:38 +01:00
parent 255357bac4
commit ed467d1160
2 changed files with 9 additions and 7 deletions

View File

@ -65,7 +65,7 @@ public class StockRecord extends Common{
@JsonProperty(Constants.BIOMASS_JSON_KEY) @JsonProperty(Constants.BIOMASS_JSON_KEY)
@CustomField(key=Constants.BIOMASS_CUSTOM_KEY) @CustomField(key=Constants.BIOMASS_CUSTOM_KEY)
@TimeSeries @TimeSeries
@Group(groupNameOverValue=Constants.BIOMASS_CUSTOM_KEY, prependSourceToGroupName=false) // @Group(groupNameOverValue=Constants.BIOMASS_CUSTOM_KEY, prependSourceToGroupName=false)
@Valid @Valid
private List<TimeSeriesBean<String, String>> biomass; private List<TimeSeriesBean<String, String>> biomass;
@ -86,7 +86,7 @@ public class StockRecord extends Common{
@JsonProperty(Constants.STATE_AND_TREND_MARINE_RESOURCE_JSON_KEY) @JsonProperty(Constants.STATE_AND_TREND_MARINE_RESOURCE_JSON_KEY)
@CustomField(key=Constants.STATE_AND_TREND_MARINE_RESOURCE_CUSTOM_KEY) @CustomField(key=Constants.STATE_AND_TREND_MARINE_RESOURCE_CUSTOM_KEY)
@TimeSeries @TimeSeries
@Group(groupNameOverValue=Constants.STATE_AND_TREND_MARINE_RESOURCE_CUSTOM_KEY, prependSourceToGroupName=false) @Group(groupNameOverValue="State and Trend of Marine Resource", prependSourceToGroupName=false)
@Valid @Valid
private List<TimeSeriesBean<String, Void>> narrativeState; private List<TimeSeriesBean<String, Void>> narrativeState;
@ -100,7 +100,7 @@ public class StockRecord extends Common{
@JsonProperty(Constants.SCIENTIFIC_ADVICE_JSON_KEY) @JsonProperty(Constants.SCIENTIFIC_ADVICE_JSON_KEY)
@CustomField(key=Constants.SCIENTIFIC_ADVICE_CUSTOM_KEY) @CustomField(key=Constants.SCIENTIFIC_ADVICE_CUSTOM_KEY)
@Group(groupNameOverValue=Constants.SCIENTIFIC_ADVICE_CUSTOM_KEY, prependSourceToGroupName=false) @Group(groupNameOverValue=Constants.SCIENTIFIC_ADVICE_CUSTOM_KEY, prependSourceToGroupName=false)
private List<String> scientificAdvice; private List<TimeSeriesBean<String, Void>> scientificAdvice;
@JsonProperty(Constants.ASSESSOR_JSON_KEY) @JsonProperty(Constants.ASSESSOR_JSON_KEY)
@CustomField(key=Constants.ASSESSOR_CUSTOM_KEY) @CustomField(key=Constants.ASSESSOR_CUSTOM_KEY)
@ -146,7 +146,7 @@ public class StockRecord extends Common{
List<TimeSeriesBean<String, String>> fishingPressure, List<TimeSeriesBean<String, String>> fishingPressure,
List<TimeSeriesBean<String, Void>> narrativeState, List<TimeSeriesBean<String, Void>> narrativeState,
List<TimeSeriesBean<String, Void>> faoState, List<TimeSeriesBean<String, Void>> faoState,
List<String> scientificAdvice, String assessor, Stock_Type type) { List<TimeSeriesBean<String, Void>> scientificAdvice, String assessor, Stock_Type type) {
super(); super();
this.stockName = stockName; this.stockName = stockName;
this.stockId = stockId; this.stockId = stockId;
@ -262,11 +262,11 @@ public class StockRecord extends Common{
this.narrativeState = narrativeState; this.narrativeState = narrativeState;
} }
public List<String> getScientificAdvice() { public List<TimeSeriesBean<String, Void>> getScientificAdvice() {
return scientificAdvice; return scientificAdvice;
} }
public void setScientificAdvice(List<String> scientificAdvice) { public void setScientificAdvice(List<TimeSeriesBean<String, Void>> scientificAdvice) {
this.scientificAdvice = scientificAdvice; this.scientificAdvice = scientificAdvice;
} }

View File

@ -90,7 +90,9 @@ public abstract class HelperMethods {
if(origName == null) if(origName == null)
throw new IllegalArgumentException("origName cannot be null"); throw new IllegalArgumentException("origName cannot be null");
String modified = origName.trim().toLowerCase().replaceAll("[^A-Za-z0-9-]", "-"); String modified = origName.replaceAll("(", "");
modified = origName.replaceAll(")", "");
modified = origName.trim().toLowerCase().replaceAll("[^A-Za-z0-9-]", "-");
if(modified.startsWith("-")) if(modified.startsWith("-"))
modified = modified.substring(1); modified = modified.substring(1);
if(modified.endsWith("-")) if(modified.endsWith("-"))