@Override public boolean hasValue() { return getDelegate().hasValue(); }
@Override public String call() throws Exception { if (testableClassName.hasValue()) { return testableClassName.getValue() + "UnitTest"; } return null; } });
@Override public Boolean call() throws Exception { DirectoryResource targetDirectory = getTargetDirectory(); // Enable Overwrite flag if target exists and it is not empty return named.hasValue() && targetDirectory.exists() && !targetDirectory.listResources().isEmpty(); } });
@Override public void validate(UIValidationContext validator) { if (!command.hasValue() && !arguments.hasValue()) { validator.addValidationError(null, "Command or script file must be provided"); } }
private void addDefaultDeploymentAnnotation(JavaClassSource test, Project project) throws ClassNotFoundException, IOException { test.addImport("org.wildfly.swarm.arquillian.DefaultDeployment"); final AnnotationSource<JavaClassSource> defaultDeploymentAnnotation = test.addAnnotation("DefaultDeployment"); if (asClient.hasValue()) { defaultDeploymentAnnotation.setLiteralValue("testable", "false"); } if (mainClass.hasValue()) { defaultDeploymentAnnotation.setLiteralValue("main", mainClass.getValue() + ".class"); } if (archiveType.hasValue()) { defaultDeploymentAnnotation.setLiteralValue("type", String.format("DefaultDeployment.Type.%s", archiveType.getValue())); } }
@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"); } }
private boolean classExists(JavaSourceFacet javaSourceFacet) { if (!named.hasValue() && !named.hasDefaultValue()) { return false; } String packageName; if (targetPackage.hasValue() || targetPackage.hasDefaultValue()) { packageName = targetPackage.getValue(); } else { packageName = javaSourceFacet.getBasePackage(); } String source = packageName + "." + named.getValue(); boolean classAlreadyExists; try { JavaResource parsedJavaResource = javaSourceFacet.getJavaResource(source); classAlreadyExists = parsedJavaResource != null && parsedJavaResource.exists(); } catch (Exception ex) { classAlreadyExists = false; } return classAlreadyExists; }
if (userPassword.hasValue()) properties.setProperty("password", userPassword.getValue()); try
private void addArquillianResourceEnricher(JavaClassSource test) { if (asClient.hasValue()) { test.addImport("org.jboss.arquillian.test.api.ArquillianResource"); final FieldSource<JavaClassSource> urlField = test.addField(); urlField .setName("url") .setType(URL.class) .setPrivate(); urlField.addAnnotation("ArquillianResource"); } }
@SuppressWarnings("unchecked") private SOURCETYPE buildJavaSource(JavaSourceFacet javaFacet) { if (!named.hasValue() && !named.hasDefaultValue()) { return null; } SOURCETYPE source = (SOURCETYPE) Roaster.create(getSourceType()).setName(named.getValue()); if (targetPackage.hasValue() || targetPackage.hasDefaultValue()) { source.setPackage(targetPackage.getValue()); } else { source.setPackage(javaFacet.getBasePackage()); } if (source instanceof ExtendableSource && extendsType.isEnabled() && extendsType.hasValue()) { ExtendableSource<?> extendableSource = (ExtendableSource<?>) source; extendSuperType(extendableSource, extendsType.getValue(), javaFacet); } if (source instanceof InterfaceCapableSource && implementsType.isEnabled() && implementsType.hasValue()) { InterfaceCapableSource<?> interfaceCapableSource = (InterfaceCapableSource<?>) source; implementInterface(interfaceCapableSource, implementsType.getValue(), javaFacet); } return source; }
@Override public NavigationResult next(UINavigationContext context) throws Exception { applyUIValues(context.getUIContext()); final DatabaseType database = dbType.getValue(); if (!isNotEmbeddedDB(database)) { return Results.navigateTo(FinishJPASetupCommand.class); } else { if (dataSourceName.hasValue()) { // if we specified a datasource, use it return Results.navigateTo(AddJNDIDatasourceCommand.class); } else { // otherwise, we're using the DB URL, so deal with it return Results.navigateTo(AddDBURLCommand.class); } } }
Resource<?> currentResource = (Resource<?>) uiContext.getInitialSelection().get(); final UIOutput output = uiContext.getProvider().getOutput(); if (command.hasValue())
private void cloneTo(GitUtils gitUtils, DirectoryResource projectRoot) throws GitAPIException, IOException { Git git = null; try { git = gitUtils.clone(projectRoot, url.getValue().getFullyQualifiedName()); if (ref.hasValue()) { String refName = ref.getValue(); String currentBranch = git.getRepository().getBranch(); // No need to checkout if the branch name is the same if (!currentBranch.equals(refName)) { git.checkout().setCreateBranch(true).setName(refName).setUpstreamMode(SetupUpstreamMode.TRACK) .setStartPoint("origin/" + refName).call(); } } } finally { gitUtils.close(git); } }
}); overwrite.setEnabled(() -> named.hasValue() && classExists(javaSourceFacet));
if (wrapped.getPath().hasValue()) { final String value = wrapped.getPath().getValue(); properties.put("server.contextPath", (value.startsWith("/") ? value : "/" + value));
if (finalName.hasValue())