Class ImportValidationSettings
java.lang.Object
fr.paris.lutece.plugins.appointment.modules.importer.service.ImportValidationSettings
What the validation of a workbook depends on: the columns, the messages, the email check, the current date and the limits.
fromLutece(Locale) reads them from Lutece; a test builds them with the constructor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringFound in the normalized title or code of a field: "email du CAR", "email_car", "Courriel" -
Constructor Summary
ConstructorsConstructorDescriptionImportValidationSettings(ImportColumns columns, BiFunction<String, Object[], String> messages, Predicate<String> emailChecker, LocalDateTime dtNow, int nMaxRows, int nMaxNameLength, String strPhonePattern, String strEmailFieldPattern) -
Method Summary
Modifier and TypeMethodDescriptionstatic ImportValidationSettingsfromLutece(Locale locale) intintgetNow()booleanisEmailField(String strNormalizedName) booleanisValidEmail(String strEmail) booleanisValidPhoneNumber(String strPhoneNumber)
-
Field Details
-
DEFAULT_EMAIL_FIELD_PATTERN
Found in the normalized title or code of a field: "email du CAR", "email_car", "Courriel"- See Also:
-
-
Constructor Details
-
ImportValidationSettings
public ImportValidationSettings(ImportColumns columns, BiFunction<String, Object[], String> messages, Predicate<String> emailChecker, LocalDateTime dtNow, int nMaxRows, int nMaxNameLength, String strPhonePattern, String strEmailFieldPattern) - Parameters:
columns- the standard columnsmessages- gives the localized message of a key and its argumentsemailChecker- tells whether an email is validdtNow- the current date: an appointment cannot start before itnMaxRows- the maximum number of rows of a workbooknMaxNameLength- the maximum length of a last or first namestrPhonePattern- the pattern a phone number must match once its separators are removedstrEmailFieldPattern- the pattern found in the normalized title or code of the form fields whose value must be an email
-
-
Method Details
-
fromLutece
- Parameters:
locale- the locale of the messages- Returns:
- the settings of the running Lutece
-
getColumns
-
message
- Parameters:
strKey- the i18n keyarguments- the arguments of the message- Returns:
- the localized message
-
isValidEmail
- Parameters:
strEmail- an email- Returns:
- true if it is valid
-
isValidPhoneNumber
- Parameters:
strPhoneNumber- a phone number, separators removed- Returns:
- true if it is valid
-
isEmailField
- Parameters:
strNormalizedName- the normalized title or code of a form field- Returns:
- true if the value of the field must be an email
-
getNow
-
getMaxRows
public int getMaxRows() -
getMaxNameLength
public int getMaxNameLength()
-