Class ValidationRules

java.lang.Object
org.strassburger.subscriptionmanager.util.ValidationRules

public class ValidationRules extends Object
Utility class that provides validation rules for the application.
  • 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.