/** * Create a new instance of a NavigationResultBuilder * * @return A NavigationResultBuilder instance */ public static NavigationResultBuilder create() { return new NavigationResultBuilder(); }
/** * Create a {@link NavigationResult} using the given {@link UICommand} type as the target. */ public static final NavigationResult navigateTo(Class<? extends UICommand> next) { if (next == null) { return null; } NavigationResultBuilder builder = navigationBuilder(); builder.add(next); return builder.build(); }
public static NavigationResultBuilder navigationBuilder() { NavigationResultBuilder builder = NavigationResultBuilder.create(); return builder; }
/** * Create a {@link NavigationResult} using the given {@link UICommand} types as the targets. */ @SuppressWarnings("unchecked") public static final NavigationResult navigateTo(Class<? extends UICommand> next, Class<? extends UICommand>... additional) { if (next == null) return null; NavigationResultBuilder builder = navigationBuilder(); builder.add(next); for (Class<? extends UICommand> type : additional) { builder.add(type); } return builder.build(); }
/** * Create a {@link NavigationResult} using the given {@link UICommand} array as the target. */ public static final NavigationResult navigateTo(Class<? extends UICommand>[] next) { if (next == null) { return null; } NavigationResultBuilder builder = navigationBuilder(); for (Class<? extends UICommand> type : next) { builder.add(type); } return builder.build(); }
/** * Create a new instance of a NavigationResultBuilder using the provided NavigationResult instance as a base. * * @param result A NavigationResult whose entries are used as the basis to eventually construct a new * NavigationResult through this NavigationResultBuilder. * @return A NavigationResultBuilder instance */ public static NavigationResultBuilder create(NavigationResult result) { NavigationResultBuilder builder = new NavigationResultBuilder(); if (result != null && result.getNext() != null) { builder.entries.addAll(Arrays.asList(result.getNext())); } return builder; }
@Override public NavigationResult next(UINavigationContext context) throws Exception { NavigationResultBuilder builder = NavigationResultBuilder.create(); if (needFabric8Setup) { builder.add(Fabric8SetupStep.class); } if (needOptionalStep) { builder.add(DevOpsEditOptionalStep.class); } builder.add(DevOpsEditStep.class); return builder.build(); }
@Override public NavigationResult next(UINavigationContext context) throws Exception { NavigationResultBuilder builder = NavigationResultBuilder.create(); builder.add(Metadata.forCommand(SetupCommand.class).name("WildFly Swarm: Setup") .description("Setup WildFly Swarm in your web application"), Arrays.asList(SetupCommand.class, AddFractionCommand.class)); builder.add(SetupFractionsStep.class); return builder.build(); }
@Override public NavigationResult next(UINavigationContext context) { NavigationResultBuilder builder = NavigationResultBuilder.create(); builder.add( Metadata.forCommand(SetupVertxCommand.class).name("Vert.x: Setup").description("Setup Vert.x") .category(Categories.create("vert.x")), Arrays.asList(SetupVertxCommand.class, AddDependencyCommand.class)); return builder.build(); }
@Override public NavigationResult next(UINavigationContext context) throws Exception { UIContext uiContext = context.getUIContext(); Map<Object, Object> attributeMap = uiContext.getAttributeMap(); ScaffoldProvider selectedProvider = provider.getValue(); ScaffoldSetupContext setupContext = createSetupContext(uiContext); attributeMap.put(ScaffoldProvider.class, selectedProvider); attributeMap.put(ScaffoldSetupContext.class, setupContext); // Get the navigation result entries from the selected scaffold provider NavigationResult setupFlow = selectedProvider.getSetupFlow(setupContext); // Add the execution logic step in the end so that the scaffold setup step is executed last after all other steps NavigationResultBuilder builder = NavigationResultBuilder.create(setupFlow); NavigationResult navigationResult = builder.add(ScaffoldExecuteSetupStep.class).build(); return navigationResult; }
@Override public NavigationResult next(UINavigationContext context) throws Exception { ScaffoldProvider selectedProvider = provider.getValue(); UIContext uiContext = context.getUIContext(); Map<Object, Object> attributeMap = uiContext.getAttributeMap(); attributeMap.put(ScaffoldProvider.class, selectedProvider); ScaffoldGenerationContext generationContext = populateGenerationContext(uiContext); attributeMap.put(ScaffoldGenerationContext.class, generationContext); NavigationResult setupFlow = null; // Verify if the selected provider is installed // If not, add the setup flow and inform the generation step to setup the scaffold. ScaffoldSetupContext setupContext = populateSetupContext(uiContext); if (!selectedProvider.isSetup(setupContext)) { setupFlow = selectedProvider.getSetupFlow(setupContext); attributeMap.put(REQUIRES_SCAFFOLD_SETUP, true); attributeMap.put(ScaffoldSetupContext.class, setupContext); } // Get the step sequence from the selected scaffold provider NavigationResult generationFlow = selectedProvider.getGenerationFlow(generationContext); // Add the execution logic step in the end so that the scaffold generation step is executed last after all other // steps NavigationResultBuilder builder = NavigationResultBuilder.create(setupFlow); NavigationResult navigationResult = builder.add(generationFlow).add(ScaffoldExecuteGenerationStep.class).build(); return navigationResult; }
NavigationResultBuilder builder = NavigationResultBuilder.create(); List<Class<? extends UICommand>> setupCommands = new ArrayList<>(); if (!project.hasFacet(JPAFacet.class)) builder.add(JPASetupWizard.class); .name("Setup Facets") .description("Setup all dependent facets for the Faces scaffold."); builder.add(compositeSetupMetadata, setupCommands); return builder.build();
@Override public NavigationResult next(UINavigationContext context) { descriptor.setTargetPackage(targetPackage.getValue()); descriptor.setConnectionProfileName(connectionProfile.getValue()); NavigationResultBuilder navigationResultBuilder = NavigationResultBuilder.create(); if (Strings.isNullOrEmpty(descriptor.getConnectionProfileName())) { descriptor.setDriverClass(null); descriptor.setUrls(null); descriptor.setConnectionProperties(null); navigationResultBuilder.add(connectionProfileDetailsStep); } else { ConnectionProfile profile = profiles.get(descriptor.getConnectionProfileName()); if (profile.getPath() != null) { descriptor.setUrls(HibernateToolsHelper.getDriverUrls(createResource(profile.getPath()))); } descriptor.setDriverClass(profile.getDriver()); descriptor.setConnectionProperties(createConnectionProperties(profile)); } navigationResultBuilder.add(dbTableSelectionStep); return navigationResultBuilder.build(); }