@DefaultCommand public void rm( @Option(name = "recursive", shortName = "r", help = "recursively delete resources", flagOnly = true) final boolean recursive, @Option(name = "force", shortName = "f", help = "do not prompt to confirm operations", flagOnly = true) final boolean force, @Option(description = "path", required = true) final Resource<?>[] paths) { for (Resource<?> resource : paths) { deleteResource(recursive, force, resource); } }
@DefaultCommand public void rename( @Option(description = "source", required = true) final Resource<?> source, @Option(description = "target", required = true) final String target, @Option(name = "force", shortName = "f", description = "force operation", flagOnly = true) final boolean force, final PipeOut out) { Resource<?> directory = this.directory; rename(source, directory, target, force, out); }
@DefaultCommand(help = "Add many custom field to an existing @Entity class") public void newExpressionField( @Option(required = true, description = "The field descriptor") final String... fields) { System.out.println(Arrays.asList(fields)); }
@Command(value = "NotNull", help = "Adds @NotNull constraint on the specified property") public void addNotNullConstraint( @Option(name = "onProperty", completer = PropertyCompleter.class, required = true) String property, @Option(name = "onAccessor", flagOnly = true) boolean onAccessor, @Option(name = "message") String message, @Option(name = "groups", type = JAVA_CLASS) String[] groups) throws FileNotFoundException { final Annotation<JavaClass> constraintAnnotation = addConstraintOnProperty(property, onAccessor, NotNull.class); setConstraintMessage(constraintAnnotation, message); javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin()); outputConstraintAdded(property, NotNull.class); }
@Command(value = "AssertTrue", help = "Adds @AssertTrue constraint on the specified property") public void addAssertTrueConstraint( @Option(name = "onProperty", completer = PropertyCompleter.class, required = true) String property, @Option(name = "onAccessor", flagOnly = true) boolean onAccessor, @Option(name = "message") String message, @Option(name = "groups", type = JAVA_CLASS) String[] groups) throws FileNotFoundException { final Annotation<JavaClass> constraintAnnotation = addConstraintOnProperty(property, onAccessor, AssertTrue.class); setConstraintMessage(constraintAnnotation, message); javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin()); outputConstraintAdded(property, AssertTrue.class); }
@Command(value = "Past", help = "Adds @Past constraint on the specified property") public void addPastConstraint( @Option(name = "onProperty", completer = PropertyCompleter.class, required = true) String property, @Option(name = "onAccessor", flagOnly = true) boolean onAccessor, @Option(name = "message") String message, @Option(name = "groups", type = JAVA_CLASS) String[] groups) throws FileNotFoundException { final Annotation<JavaClass> constraintAnnotation = addConstraintOnProperty(property, onAccessor, Past.class); setConstraintMessage(constraintAnnotation, message); javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin()); outputConstraintAdded(property, Past.class); }
@Command(value = "Future", help = "Adds @Future constraint on the specified property") public void addFutureConstraint( @Option(name = "onProperty", completer = PropertyCompleter.class, required = true) String property, @Option(name = "onAccessor", flagOnly = true) boolean onAccessor, @Option(name = "message") String message, @Option(name = "groups", type = JAVA_CLASS) String[] groups) throws FileNotFoundException { final Annotation<JavaClass> constraintAnnotation = addConstraintOnProperty(property, onAccessor, Future.class); setConstraintMessage(constraintAnnotation, message); javaSourceFacet.saveJavaSource(constraintAnnotation.getOrigin()); outputConstraintAdded(property, Future.class); }
@Command(value = "Null", help = "Adds @Null constraint on the specified property") public void addNullConstraint( @Option(name = "onProperty", completer = PropertyCompleter.class, required = true) String property, @Option(name = "onAccessor", flagOnly = true) boolean onAccessor, @Option(name = "message") String message, @Option(name = "groups", type = JAVA_CLASS) String[] groups) throws FileNotFoundException { final Annotation<JavaClass> constraint = addConstraintOnProperty(property, onAccessor, Null.class); setConstraintMessage(constraint, message); javaSourceFacet.saveJavaSource(constraint.getOrigin()); outputConstraintAdded(property, Null.class); }
@DefaultCommand public void run( @Option(description = "The starting resource to be listed", defaultValue = ".") final Resource<?> r, PipeOut out) throws IOException { listResources(out, r); }
@DefaultCommand public void set(final PipeOut out, @Option(help = "The alias name to remove: E.g: 'mycommand'") final String[] aliases) { if ((aliases != null) && (aliases.length > 0)) { for (String alias : aliases) { registry.removeAlias(alias); } } } }
@Command(value = "Valid", help = "Adds @Valid constraint on the specified property") public void addValidConstraint( @Option(name = "onProperty", completer = PropertyCompleter.class, required = true) String property, @Option(name = "onAccessor", flagOnly = true) boolean onAccessor) throws FileNotFoundException { final Annotation<JavaClass> constraint = addConstraintOnProperty(property, onAccessor, Valid.class); javaSourceFacet.saveJavaSource(constraint.getOrigin()); outputConstraintAdded(property, Valid.class); }
@DefaultCommand public void setEnabled(@Option(name = "enabled", required = true) Boolean enabled) { configuration.setProperty(ANALYTICS_ENABLED, enabled); getAnalyticsTracker().setEnabled(enabled); }
@DefaultCommand public void run( @Option(help = "The text to be echoed") final String[] tokens, final PipeOut out) { if (tokens == null || tokens.length == 0) { return; } out.println(echo(shell, promptExpressionParser(shell, tokensToString(tokens)))); }
@Command("add-plugin") public void addPlugin( @Option(description = "dependency identifier of plugin, ex: \"org.jboss.forge:forge-maven-plugin:1.0.0.Final\"", required = true) final Dependency gav, final PipeOut out) { MavenPluginBuilder plugin = MavenPluginBuilder.create().setDependency(gav); if (!mavenPluginInstaller.isInstalled(project, plugin)) { mavenPluginInstaller.install(project, plugin); } }
@Command(value = "add-locale", help = "Adds another locale in this resource bundle") public void addLocale(@Option(name = "locale", required = true) String locale) { String baseName = "messages"; if (propertiesFileResource != null) { baseName = getBaseBundleName(propertiesFileResource.getName()); } final String baseBundleName = (baseName + "_" + locale + ".properties"); PropertiesFileResource newFileResource = getOrCreate(baseBundleName); shell.setCurrentResource(newFileResource); }
@DefaultCommand public void list(@Option(required = false) String filter) { ServletFacet web = project.getFacet(ServletFacet.class); List<Resource<?>> resources = web.getResources(); for (Resource<?> file : resources) { shell.println(file.getFullyQualifiedName()); } } }
@Command("set-artifactid") public void setArtifactId(final PipeOut out, @Option(description = "the new artifactId; for example: \"forge-shell\"") final String artifactId) { Assert.notNull(artifactId, "GroupId must not be empty"); MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class); Model pom = mvn.getPOM(); pom.setArtifactId(artifactId); mvn.setPOM(pom); out.println("Set artifactId [ " + artifactId + " ]"); }
@Command("set-name") public void setName(final PipeOut out, @Option(description = "the new name; for example: \"UI-Layer\"") final String name) { Assert.notNull(name, "Name must not be empty"); MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class); Model pom = mvn.getPOM(); pom.setName(name); mvn.setPOM(pom); out.println("Set name [ " + name + " ]"); }
@Command("set-groupid") public void setGroupId(final PipeOut out, @Option(description = "the new groupId; for example: \"org.jboss.forge\"") final String groupId) { Assert.notNull(groupId, "GroupId must not be empty"); MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class); Model pom = mvn.getPOM(); pom.setGroupId(groupId); mvn.setPOM(pom); out.println("Set groupId [ " + groupId + " ]"); }
@Command("set-version") public void setVersion(final PipeOut out, @Option(description = "the new version; for example: \"1.0.0.Final\"") final String version) { Assert.notNull(version, "GroupId must not be empty"); MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class); Model pom = mvn.getPOM(); pom.setVersion(version); mvn.setPOM(pom); out.println("Set version [ " + version + " ]"); }