Class ValidationRules
java.lang.Object
org.strassburger.subscriptionmanager.util.ValidationRules
Utility class that provides validation rules for the application.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.strassburger.tui4j.input.validationrules.ValidationRule<String> Returns a validation rule that checks if a profile with the given name already exists.
Shows an error when a profile with the given name already exists.static org.strassburger.tui4j.input.validationrules.ValidationRule<String> Returns a validation rule that checks if a profile with the given name does not exist.
Shows an error when a profile with the given name does not exist.static org.strassburger.tui4j.input.validationrules.ValidationRule<String> getSubsNameAlreadyExistsValidationRule(DatabaseManager dbManager, int profileId) Returns a validation rule that checks if a subscription with the given name already exists.
Shows an error when a subscription with the given name already exists.static org.strassburger.tui4j.input.validationrules.ValidationRule<String> getSubsNameDoesNotExistValidationRule(DatabaseManager dbManager, int profileId) Returns a validation rule that checks if the subscription with the given name does not exist.
Shows an error when a subscription with the given name does not exist.
-
Method Details
-
getProfileNameAlreadyExistsValidationRule
public static org.strassburger.tui4j.input.validationrules.ValidationRule<String> getProfileNameAlreadyExistsValidationRule(DatabaseManager dbManager) Returns a validation rule that checks if a profile with the given name already exists.
Shows an error when a profile with the given name already exists.- Parameters:
dbManager- DatabaseManager- Returns:
- ValidationRule
-
getProfileNameDoesNotExistValidationRule
public static org.strassburger.tui4j.input.validationrules.ValidationRule<String> getProfileNameDoesNotExistValidationRule(DatabaseManager dbManager) Returns a validation rule that checks if a profile with the given name does not exist.
Shows an error when a profile with the given name does not exist.- Parameters:
dbManager- DatabaseManager- Returns:
- ValidationRule
-
getSubsNameAlreadyExistsValidationRule
public static org.strassburger.tui4j.input.validationrules.ValidationRule<String> getSubsNameAlreadyExistsValidationRule(DatabaseManager dbManager, int profileId) Returns a validation rule that checks if a subscription with the given name already exists.
Shows an error when a subscription with the given name already exists.- Parameters:
dbManager- Database manager used to check if the subscription already exists.- Returns:
- The validation rule.
-
getSubsNameDoesNotExistValidationRule
public static org.strassburger.tui4j.input.validationrules.ValidationRule<String> getSubsNameDoesNotExistValidationRule(DatabaseManager dbManager, int profileId) Returns a validation rule that checks if the subscription with the given name does not exist.
Shows an error when a subscription with the given name does not exist.- Parameters:
dbManager- Database manager used to check if the subscription does not exist.- Returns:
- The validation rule.
-