context.addValidationError(outputPath, "Output file cannot be the same as the input file."); context.addValidationError(outputPath, "Output path must not be a parent of input path."); inputParent = inputParent.getParentFile(); context.addValidationError(inputPathsUI, "Input path must not be a parent of output path."); outputParent = outputParent.getParentFile();
@Override public void validate(UIValidationContext context) { InputComponent<?, ?> currentInputComponent = context.getCurrentInputComponent(); Object value = InputComponents.getValueFor(currentInputComponent); if (value != null) { ValidationResult result = validate(value.toString()); switch (result.getType()) { case ERROR: context.addValidationError(currentInputComponent, result.getMessage()); break; case WARNING: context.addValidationWarning(currentInputComponent, result.getMessage()); break; default: break; } } }
@Override public void validate(UIValidationContext context) UIContext uiContext = context.getUIContext(); updateValueChoices(uiContext, null); if (exception != null) context.addValidationError(databaseTables, "Unknown host: " + exception.getMessage()); exception.getClass().getName()); context.addValidationError(databaseTables, message); if (list == null || list.isEmpty()) context.addValidationError(databaseTables, "At least one database table must be specified");
@Override public void validate(UIValidationContext context) { String coordinate = (String) context.getCurrentInputComponent().getValue(); try { Set<Addon> addons = furnace.getAddonRegistry().getAddons(); boolean match = false; for (Addon addon : addons) { if (addon.getId().getName().equals(coordinate)) { match = true; break; } } if (!match) { context.addValidationError(context.getCurrentInputComponent(), "\"" + coordinate + "\" does not refer to any installed Addon coordinate."); } } catch (IllegalArgumentException e) { context.addValidationError(context.getCurrentInputComponent(), "\"" + coordinate + "\" is not a valid Addon coordinate"); } } });
@Override public void validate(UIValidationContext context) Boolean value = (Boolean) context.getCurrentInputComponent().getValue(); if (value != null && value && connectionStale) + "]."); context.addValidationInformation(verifyConnection, "Connection successful."); context.addValidationError(context.getCurrentInputComponent(), "Unknown host: " + exception.getMessage()); context.addValidationError(context.getCurrentInputComponent(), "Could not connect to database: " + exception.getMessage());
@Override public void validate(UIValidationContext context) { for (Entry<ConfigurationOption, InputComponent<?, ?>> entry : this.inputOptions.entrySet()) { final InputComponent<?, ?> inputComponent = entry.getValue(); ConfigurationOption option = entry.getKey(); Object inputValue = getValueForInput(option, inputComponent); if (inputValue == null && !option.isRequired()) return; ValidationResult result = option.validate(inputValue); switch (result.getLevel()) { case ERROR: context.addValidationError(inputComponent, result.getMessage()); break; case WARNING: context.addValidationWarning(inputComponent, result.getMessage()); break; case PROMPT_TO_CONTINUE: this.promptMessages.add(result); break; } } }
@Override public void validate(UIValidationContext context) { UIContext uiContext = context.getUIContext(); if (uiContext.getProvider().isGUI()) { boolean useTemplate = useCustomTemplate.getValue(); if (useTemplate) { validateTemplate(context); } } else { validateTemplate(context); } }
@Override public void validate(UIValidationContext validator) { Iterable<String> value = arguments.getValue(); if (value != null) { if (Lists.toList(value).size() != 2) { validator.addValidationError(arguments, "Only two arguments are accepted"); } } }
Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap(); Project project = (Project) attributeMap.get(Project.class); WebResourcesFacet web = project.getFacet(WebResourcesFacet.class); context.addValidationError(pageTemplate, "Not a valid template resource. " + "The template should be located under a web root directory for the project."); context.addValidationError(pageTemplate, "The template [" + template.getName() + "] does not exist. You must select a template that exists.");
@Override public void validate(UIValidationContext validator) { Iterable<String> value = arguments.getValue(); if (value != null) { if (Lists.toList(value).size() != 2) { validator.addValidationError(arguments, "Only two arguments are accepted"); } } }
@Override public void validate(UIValidationContext context) { if (named.getValue() != null && named.getValue().matches(".*[^-_.a-zA-Z0-9].*")) context.addValidationError(named, "Project name must not contain spaces or special characters."); } });
@Override public void validate(UIValidationContext context) { String packg = topLevelPackage.getValue(); if (packg != null && !VALID_PACKAGE_PATTERN.matcher(packg).matches()) { context.addValidationError(topLevelPackage, "Top level package must be a valid package name."); } if (overwrite.isEnabled() && !overwrite.getValue()) { String errorMessage = String.format("Project location '%s' is not empty.", getTargetDirectory()); context.addValidationError(targetLocation, errorMessage); } }
@Override public void validate(UIValidationContext validator) { if (!command.hasValue() && !arguments.hasValue()) { validator.addValidationError(null, "Command or script file must be provided"); } }
@Override public void validate(UIValidationContext context) { FileResource<?> checkoutDir = templateRepoDir.getValue(); if (checkoutDir.exists()) { if (!checkoutDir.isDirectory()) { context.addValidationError(templateRepoDir, "File " + checkoutDir + " is not a directory."); } if (!checkoutDir.listResources().isEmpty()) { context.addValidationError(templateRepoDir, "Directory " + checkoutDir + " is not empty"); } } }
@Override public void validate(UIValidationContext validator) { DirectoryResource folder = targetDirectory.getValue(); if (folder == null || (folder.exists() && (!folder.isDirectory() || !folder.listResources().isEmpty()))) { validator.addValidationError(targetDirectory, "The specified target directory should not exist or should be empty directory"); } }
@Override public void validate(UIValidationContext validator) { String repository = getArchetypeRepository(); if (!Strings.isNullOrEmpty(repository) && !Strings.isURL(repository)) { validator.addValidationError(archetypeRepository, "Archetype repository must be a valid URL"); } }
@Override public void validate(UIValidationContext context) { FileResource<?> resource = driverLocation.getValue(); if (resource != null && !resource.exists()) { context.addValidationError(driverLocation, "The location '" + resource.getFullyQualifiedName() + "' does not exist"); } } });
@Override public void validate(UIValidationContext validator) { final DatabaseType database = dbType.getValue(); final DatabaseDriver driver = DatabaseDriver.fromProductName(database.name()); if (driver.equals(DatabaseDriver.UNKNOWN)) { // Spring Boot doesn't know about this DB validator.addValidationError(dbType, "Spring Boot doesn't know about DB '" + dbType.getName() + "'"); } if (isNotEmbeddedDB(database) && !databaseURL.hasValue() && !dataSourceName.hasValue()) { validator.addValidationError(dataSourceName, "Either DataSource name or database URL is required"); validator.addValidationError(databaseURL, "Either DataSource name or database URL is required"); } }
@Override public void validate(UIValidationContext validator) { Project project = getSelectedProject(validator); final JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class); if (classExists(javaSourceFacet) && overwrite.isEnabled() && overwrite.getValue() == false) { validator.addValidationError(named, getType() + " " + targetPackage.getValue() + "." + named.getValue() + " already exists. Use the --overwrite flag to allow the overwrite."); } }
context.addValidationError(named, "Invalid java type name."); });