protected File getJenkinsWorkflowFolder(UIContext context) { File dir = null; Object workflowFolder = context.getAttributeMap().get("jenkinsfilesFolder"); if (workflowFolder instanceof File) { dir = (File) workflowFolder; } return dir; }
private static File getJenkinsWorkflowFolder(UIContext context) { File dir = null; Object workflowFolder = context.getAttributeMap().get("jenkinsfilesFolder"); if (workflowFolder instanceof File) { dir = (File) workflowFolder; } return dir; }
private boolean connectionInfoHasChanged(UIContext context) { Map<Object, Object> attributeMap = context.getAttributeMap(); Properties currentConnectionProperties = (Properties) attributeMap.get(LAST_USED_CONNECTION_PROPERTIES); return !Objects.equals(descriptor.getConnectionProperties(), currentConnectionProperties); }
/** * * @param ctx * @param name * @param value * @return */ @SuppressWarnings("unchecked") public static <C extends UIContextProvider,T> T putAttribute( C ctx, String name, T value ) { return (T)ctx.getUIContext().getAttributeMap().put(name, value); }
/** * * @param ctx * @param name * @return */ @SuppressWarnings("unchecked") public static <C extends UIContextProvider,T> T getAttribute( C ctx, String name ) { return (T)ctx.getUIContext().getAttributeMap().get(name); }
@Override public Result execute(UIExecutionContext context) throws Exception { context.getUIContext().getAttributeMap().put("chatRoom", chatRoom.getValue()); context.getUIContext().getAttributeMap().put("issueProjectName", issueProjectName.getValue()); context.getUIContext().getAttributeMap().put("codeReview", codeReview.getValue()); return null; }
@Override public Result execute(UIExecutionContext context) throws Exception { Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap(); LOG.info("devops tab has attributes:: " + attributeMap); try { return Results.success(""); } catch (IllegalArgumentException e) { return Results.fail(e.getMessage()); } }
@Override public Result execute(UIExecutionContext context) throws Exception { context.getUIContext().getAttributeMap().put("hasJenkinsFile", hasJenkinsFile); // store the pipeline in a special place to avoid weird web console painting context.getUIContext().getAttributeMap().put("selectedPipeline", pipeline.getValue()); // execute and save Project project = getSelectedProject(context); return DevOpsSave.execute(context, project, namespace); }
public static void putComponentValuesInAttributeMap(UIExecutionContext context, List<InputComponent> inputComponents) { if (inputComponents != null) { Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap(); for (InputComponent inputComponent : inputComponents) { String name = inputComponent.getName(); Object value = inputComponent.getValue(); if (value != null) { attributeMap.put(name, value); } } } }
private ScaffoldGenerationContext populateGenerationContext(UIContext context, Collection<Resource<?>> resources) { Map<Object, Object> attributeMap = context.getAttributeMap(); ScaffoldGenerationContext generationContext = (ScaffoldGenerationContext) attributeMap .get(ScaffoldGenerationContext.class); generationContext.setResources(resources); generationContext.setProject(getSelectedProject(context)); return generationContext; }
protected void updateConfiguration(UIExecutionContext context, ProjectConfig config) { Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap(); ProjectConfigs.configureProperties(config, attributeMap); Object pipelineValue = attributeMap.get("selectedPipeline"); if (pipelineValue instanceof PipelineDTO) { PipelineDTO pipeline = (PipelineDTO) pipelineValue; if (pipeline != null) { config.setPipeline(pipeline.getValue()); } } }
private static void updateConfiguration(UIExecutionContext context, ProjectConfig config) { Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap(); ProjectConfigs.configureProperties(config, attributeMap); Object pipelineValue = attributeMap.get("selectedPipeline"); if (pipelineValue instanceof PipelineDTO) { PipelineDTO pipeline = (PipelineDTO) pipelineValue; if (pipeline != null) { config.setPipeline(pipeline.getValue()); } } }
@Override public Result execute(UIExecutionContext context) throws Exception { final UIContext uiContext = context.getUIContext(); JPADataSource dataSource = (JPADataSource) uiContext.getAttributeMap().get(JPADataSource.class); updateDataSource(dataSource); final Properties properties = new Properties(); setProperties(properties, dataSource); final Project project = helper.getProject(uiContext); SpringBootHelper.writeToApplicationProperties(project, properties); return null; }
protected void configureAttributeMaps(UserDetails userDetails, CommandController controller, ExecutionRequest executionRequest) { Map<Object, Object> attributeMap = controller.getContext().getAttributeMap(); if (userDetails != null) { attributeMap.put("gitUser", userDetails.getUser()); attributeMap.put("gitPassword", userDetails.getPassword()); attributeMap.put("gitAuthorEmail", userDetails.getEmail()); attributeMap.put("gitAddress", userDetails.getAddress()); attributeMap.put("gitUrl", userDetails.getAddress()); attributeMap.put("localGitUrl", userDetails.getInternalAddress()); attributeMap.put("gitBranch", userDetails.getBranch()); attributeMap.put("projectName", executionRequest.getProjectName()); attributeMap.put("buildName", executionRequest.getProjectName()); attributeMap.put("namespace", executionRequest.getNamespace()); attributeMap.put("jenkinsfilesFolder", projectFileSystem.getJenkinsfilesLibraryFolder()); projectFileSystem.asyncCloneOrPullJenkinsWorkflows(userDetails); } }
@Override public Result execute(UIExecutionContext context) throws Exception { Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap(); ScaffoldProvider selectedProvider = (ScaffoldProvider) attributeMap.get(ScaffoldProvider.class); ScaffoldSetupContext setupContext = (ScaffoldSetupContext) attributeMap.get(ScaffoldSetupContext.class); Project project = getSelectedProject(context); // FIXME: FORGE-1979: Happens because Facets are not refreshed inside a Project instance setupContext = new ScaffoldSetupContext(setupContext.getTargetDirectory(), project); selectedProvider.setup(setupContext); // No-op. Scaffold setup is done in a separate step. return Results.success("Scaffold was setup successfully."); }
@Override public Result execute(UIExecutionContext context) throws Exception { Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap(); CommandInvocation commandInvocation = (CommandInvocation) attributeMap.get(CommandInvocation.class); CommandResult result = commandLineParser.getCommand().execute(commandInvocation); if (result == CommandResult.FAILURE) { return Results.fail("Failure while executing aesh command"); } else { return Results.success(); } }
@Override public Result execute(UIExecutionContext context) throws Exception { UIContext uiContext = context.getUIContext(); Shell shell = (Shell) uiContext.getProvider(); shell.getConsole().stop(); forge.stop(); uiContext.getAttributeMap().put("org.jboss.forge.exit", Boolean.TRUE); return Results.success(); } }
@Override public Result execute(UIExecutionContext uiExecutionContext) throws Exception { CommandHelpers.putComponentValuesInAttributeMap(uiExecutionContext, inputComponents); UIContext uiContext = uiExecutionContext.getUIContext(); Map<Object, Object> map = uiContext.getAttributeMap(); String search = (String) (map.get("search") != null ? map.get("search") : ""); Project project = getSelectedProject(uiContext); ClassScanner scanner = ClassScanner.newInstance(project); final SortedSet<String> answer = scanner.findClassNames(search, 0); scanner.dispose(); return Results.success(toJson(answer)); } }
@Override public Result execute(UIExecutionContext context) throws Exception { final UIContext uiContext = context.getUIContext(); final Project project = helper.getProject(uiContext); final Map<Object, Object> attributeMap = uiContext.getAttributeMap(); final JPADataSource dataSource = (JPADataSource) attributeMap.get(JPADataSource.class); persistenceOperations.setup(SpringBootJPAFacet.PERSISTENCE_UNIT_NAME, project, dataSource, false); // if we're using H2, Derby or HSQL embedded databases, we need to remove any previously set data // source properties if (!SpringBootPersistenceContainer.isNotEmbeddedDB(dataSource.getDatabase())) { SpringBootHelper.removeSpringDataPropertiesFromApplication(project); } return null; } }
@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; }