Exemplo 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);
  }
Exemplo n.º 2
0
 protected ValidationStatus devTeamValidation() {
   return devTeamValidator.getValidationStatus();
 }
Exemplo n.º 3
0
 protected ValidationStatus teamMembersValidation() {
   return teamMembersValidator.getValidationStatus();
 }
Exemplo n.º 4
0
 protected ValidationStatus scrumMasterValidation() {
   return scrumMasterValidator.getValidationStatus();
 }
Exemplo n.º 5
0
 protected ValidationStatus productOwnerValidation() {
   return productOwnerValidator.getValidationStatus();
 }
Exemplo n.º 6
0
 protected ValidationStatus descriptionValidation() {
   return descriptionValidator.getValidationStatus();
 }
Exemplo n.º 7
0
 protected ValidationStatus shortNameValidation() {
   return shortNameValidator.getValidationStatus();
 }