Esempio n. 1
0
  private void createValidators() {
    shortNameValidator = new ObservableRuleBasedValidator();
    BooleanBinding uniqueName =
        Bindings.createBooleanBinding(
            () -> {
              if (organisationProperty().get() != null) {
                return Utilities.shortnameIsUnique(
                    shortNameProperty().get(),
                    modelWrapper.get(),
                    organisationProperty().get().getTeams());
              } else {
                return true; // no project means this isn't for real yet.
              }
            },
            shortNameProperty(),
            organisationProperty());
    shortNameValidator.addRule(
        shortNameProperty().isNotNull(), ValidationMessage.error("Name must not be empty"));
    shortNameValidator.addRule(
        shortNameProperty().length().greaterThan(0),
        ValidationMessage.error("Name must not be empty"));
    shortNameValidator.addRule(
        shortNameProperty().length().lessThan(Utilities.SHORT_NAME_MAX_LENGTH),
        ValidationMessage.error(
            "Name must be less than " + Utilities.SHORT_NAME_MAX_LENGTH + " characters"));
    shortNameValidator.addRule(
        uniqueName, ValidationMessage.error("Name must be unique within organisation"));

    descriptionValidator = new ObservableRuleBasedValidator(); // always true

    // the other validators are input-constrained so need not be validated
    productOwnerValidator = new ObservableRuleBasedValidator(); // always true
    scrumMasterValidator = new ObservableRuleBasedValidator(); // always true
    teamMembersValidator = new ObservableRuleBasedValidator(); // always true
    devTeamValidator = new ObservableRuleBasedValidator(); // always true

    allValidator =
        new CompositeValidator(
            shortNameValidator,
            descriptionValidator,
            productOwnerValidator,
            scrumMasterValidator,
            teamMembersValidator,
            devTeamValidator);
  }
Esempio n. 2
0
 protected ValidationStatus devTeamValidation() {
   return devTeamValidator.getValidationStatus();
 }
Esempio n. 3
0
 protected ValidationStatus teamMembersValidation() {
   return teamMembersValidator.getValidationStatus();
 }
Esempio n. 4
0
 protected ValidationStatus scrumMasterValidation() {
   return scrumMasterValidator.getValidationStatus();
 }
Esempio n. 5
0
 protected ValidationStatus productOwnerValidation() {
   return productOwnerValidator.getValidationStatus();
 }
Esempio n. 6
0
 protected ValidationStatus descriptionValidation() {
   return descriptionValidator.getValidationStatus();
 }
Esempio n. 7
0
 protected ValidationStatus shortNameValidation() {
   return shortNameValidator.getValidationStatus();
 }