Merge branch 'maint-rel-1.6' into develop
This commit is contained in:
commit
c7418e32fd
2 changed files with 17 additions and 4 deletions
|
@ -27,6 +27,7 @@ public class DateTimeIntervalValidationVTwo implements N3ValidatorVTwo {
|
||||||
|
|
||||||
private String startFieldName;
|
private String startFieldName;
|
||||||
private String endFieldName;
|
private String endFieldName;
|
||||||
|
private String templateName;
|
||||||
|
|
||||||
private String startValueName;
|
private String startValueName;
|
||||||
private String endValueName;
|
private String endValueName;
|
||||||
|
@ -43,6 +44,16 @@ public class DateTimeIntervalValidationVTwo implements N3ValidatorVTwo {
|
||||||
endPrecisionName = endFieldName + "-precision";
|
endPrecisionName = endFieldName + "-precision";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DateTimeIntervalValidationVTwo(String startFieldName, String endFieldName, String template){
|
||||||
|
this.templateName = template;
|
||||||
|
this.startFieldName = startFieldName;
|
||||||
|
this.endFieldName = endFieldName;
|
||||||
|
startValueName = startFieldName + "-value";
|
||||||
|
endValueName = endFieldName + "-value";
|
||||||
|
startPrecisionName = startFieldName + "-precision";
|
||||||
|
endPrecisionName = endFieldName + "-precision";
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, String> validate(EditConfigurationVTwo editConfig,
|
public Map<String, String> validate(EditConfigurationVTwo editConfig,
|
||||||
MultiValueEditSubmission editSub) {
|
MultiValueEditSubmission editSub) {
|
||||||
Map<String, List<Literal>> existingLiterals = editConfig.getLiteralsInScope();
|
Map<String, List<Literal>> existingLiterals = editConfig.getLiteralsInScope();
|
||||||
|
@ -64,9 +75,11 @@ public class DateTimeIntervalValidationVTwo implements N3ValidatorVTwo {
|
||||||
// return errors;
|
// return errors;
|
||||||
// }
|
// }
|
||||||
// We need to ensure that the user has entered a start year or end year -- tlw72
|
// We need to ensure that the user has entered a start year or end year -- tlw72
|
||||||
if ( literalListIsNull(formStartYear) && literalListIsNull(formStartYear) ) {
|
if ( templateName != null && templateName.equals("dateTimeIntervalForm.ftl")) {
|
||||||
errors.put(startFieldName, "Date/time intervals must begin with a year. Please enter a start year or an end year.");
|
if ( literalListIsNull(formStartYear) && literalListIsNull(formEndYear) ) {
|
||||||
return errors;
|
errors.put(startFieldName, "Date/time intervals must begin with a year. Please enter a start year, an end year or both.");
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//Assuming form start year and form end year are working in conjunction with multiple values
|
//Assuming form start year and form end year are working in conjunction with multiple values
|
||||||
int index;
|
int index;
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class DateTimeIntervalFormGenerator extends
|
||||||
conf.addField(startField);
|
conf.addField(startField);
|
||||||
conf.addField(endField);
|
conf.addField(endField);
|
||||||
//Need to add validators
|
//Need to add validators
|
||||||
conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField"));
|
conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField","dateTimeIntervalForm.ftl"));
|
||||||
//Adding additional data, specifically edit mode
|
//Adding additional data, specifically edit mode
|
||||||
addFormSpecificData(conf, vreq);
|
addFormSpecificData(conf, vreq);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue