• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UIValidationContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jboss.forge.addon.ui.context.UIValidationContext的典型用法代码示例。如果您正苦于以下问题:Java UIValidationContext类的具体用法?Java UIValidationContext怎么用?Java UIValidationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UIValidationContext类属于org.jboss.forge.addon.ui.context包,在下文中一共展示了UIValidationContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
@Override
public void validate(UIValidationContext context) {
    UIContext uiContext = context.getUIContext();
    Map<Object, Object> attributeMap = uiContext.getAttributeMap();
    if ("next".equals(attributeMap.get("action"))) {
        // Do not validate again if next() was called
        return;
    }
    List<String> step = (List<String>) attributeMap.get(RETRY_STEP);
    DeploymentType deploymentType = (DeploymentType) attributeMap.get(DeploymentType.class);
    if (deploymentType == DeploymentType.CD && (step == null || "0".equals(step.get(0)))) {
        String openShiftCluster = (String) attributeMap.get("OPENSHIFT_CLUSTER");
        if (missionControlValidator.validateOpenShiftTokenExists(context, openShiftCluster)) {
            missionControlValidator.validateOpenShiftProjectExists(context, named.getValue(), openShiftCluster);
        }
        if (missionControlValidator.validateGitHubTokenExists(context)) {
            String repository = getGithubRepositoryNameValue();
            missionControlValidator.validateGitHubRepositoryExists(context, repository);
        }
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:22,代码来源:ProjectInfoStep.java


示例2: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
@Override
public void validate(UIValidationContext context) {
    // lets ignore the mission validation as its not suitable for fabric8
    // super.validate(context);

    if (github == null || !github.isDetailsValid()) {
        // invoked too early before the github account is setup - lets return silently
        return;
    }
    String orgName = getOrganisationName(gitOrganisation.getValue());
    String repoName = getGithubRepositoryNameValue();

    if (Strings.isNotBlank(orgName)) {
        if (Strings.isNotBlank(repoName)) {
            github.validateRepositoryName(getNamed(), context, orgName, repoName);
        }
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:19,代码来源:Fabric8ProjectInfoStep.java


示例3: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
@Override
public void validate(UIValidationContext context) {
	Project selectedProject = getSelectedProject(context);
	JavaSourceFacet javaFacet = selectedProject.getFacet(JavaSourceFacet.class);
	try {
		if (null == context.getCurrentInputComponent().getValue())
			return;
		JavaResource javaResource = javaFacet.getJavaResource((String)context.getCurrentInputComponent().getValue());
		if (javaResource.exists()) {
			if (!javaResource.getJavaType().hasAnnotation(Named.class)) {
				context.addValidationError(context.getCurrentInputComponent(), javaResource.getFullyQualifiedName() + " must be annotated with @Named");
			}
		}
	} catch (FileNotFoundException e) {
		context.addValidationError(context.getCurrentInputComponent(), e.getMessage());
	}				
}
 
开发者ID:javaee-samples,项目名称:forge-addons,代码行数:18,代码来源:BatchNewJobXmlCommand.java


示例4: configureInputs

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
private void configureInputs(UIBuilder builder) {
    Project project = getSelectedProject(builder);
    final Resource<?> projectRoot = project.getRoot();
    dateOfCreated.setValue(new Date().toString());
    targetDirectory.addValidator(new UIValidator() {
        @Override
        public void validate(UIValidationContext context) {
            try {
                projectRoot.resolveChildren(targetDirectory.getValue());
            } catch (RuntimeException re) {
                context.addValidationError(targetDirectory, "Target Directory is not a child of the project root "
                        + projectRoot);
            }
        }
    });
    if (builder.getUIContext().getProvider().isGUI()) {
        postStatus
                .setItemLabelConverter(new Converter<PublishType, String>() {
                    @Override
                    public String convert(PublishType source) {
                        return source != null ? source.name() : null;
                    }
                });
    }

}
 
开发者ID:jbake-org,项目名称:jbake-forge-addon,代码行数:27,代码来源:NewPostWizard.java


示例5: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
@Override
public void validate(UIValidationContext context) {
    if (deploymentType.getValue() == DeploymentType.CD) {
        if (!openShiftCluster.getValueChoices().iterator().hasNext()) {
            context.addValidationError(null, "No OpenShift token assigned");
        }
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:9,代码来源:ChooseDeploymentTypeStep.java


示例6: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
@Override
public void validate(UIValidationContext context) {
    UIContext uiContext = context.getUIContext();
    Mission mission = (Mission) uiContext.getAttributeMap().get(Mission.class);
    String[] filterLabels = catalogServiceFactory.getFilterLabels(uiContext);

    Optional<Booster> booster = catalogServiceFactory.getCatalog(uiContext).getBooster(mission,
                                                                                       runtime.getValue(), filterLabels);
    if (!booster.isPresent()) {
        context.addValidationError(runtime,
                                   "No booster found for mission '" + mission + "' and runtime '" + runtime.getValue() + "'");
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:14,代码来源:ChooseRuntimeStep.java


示例7: validateGitHubTokenExists

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
public boolean validateGitHubTokenExists(UIValidationContext context) {
    Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
    String validationMessage = (String) attributeMap.computeIfAbsent("token_github_exists", key -> {
        List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
        String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
        return missionControlFacade.validateGitHubTokenExists(authHeader);
    });
    if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage)) {
        context.addValidationError(context.getCurrentInputComponent(), validationMessage);
        return false;
    }
    return true;
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:14,代码来源:MissionControlValidator.java


示例8: validateOpenShiftTokenExists

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
public boolean validateOpenShiftTokenExists(UIValidationContext context, String cluster) {
    Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
    String validationMessage = (String) attributeMap.computeIfAbsent("token_openshift_exists", key -> {
        List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
        String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
        return missionControlFacade.validateOpenShiftTokenExists(authHeader, cluster);
    });
    if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage)) {
        context.addValidationError(context.getCurrentInputComponent(), validationMessage);
        return false;
    }
    return true;
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:14,代码来源:MissionControlValidator.java


示例9: validateGitHubRepositoryExists

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
public void validateGitHubRepositoryExists(UIValidationContext context, String repository) {
    Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
    String validationMessage = (String) attributeMap.computeIfAbsent("validate_repo_" + repository, key -> {
        List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
        String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
        return missionControlFacade.validateGitHubRepositoryExists(authHeader, repository);
    });
    if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage)) {
        context.addValidationError(context.getCurrentInputComponent(), validationMessage);
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:12,代码来源:MissionControlValidator.java


示例10: validateOpenShiftProjectExists

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
public void validateOpenShiftProjectExists(UIValidationContext context, String project, String cluster) {
    Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
    String validationMessage = (String) attributeMap.computeIfAbsent("validate_project_" + project, key -> {
        List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
        String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
        return missionControlFacade.validateOpenShiftProjectExists(authHeader, project, cluster);
    });
    if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage)) {
        context.addValidationWarning(context.getCurrentInputComponent(), validationMessage);
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:12,代码来源:MissionControlValidator.java


示例11: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
@Override
public void validate(UIValidationContext context) {
    if (github == null || !github.isDetailsValid()) {
        // invoked too early before the github account is setup - lets return silently
        return;
    }
    Iterable<GitRepositoryDTO> value = gitRepositoryPattern.getValue();
    if (!value.iterator().hasNext()) {
        context.addValidationError(gitRepositoryPattern, "You must select a repository to import");
    }
    // Check for repos with already existing bc
    Controller controller = new Controller(kubernetesClientHelper.getKubernetesClient());
    OpenShiftClient openShiftClient = controller.getOpenShiftClientOrNull();
    if (openShiftClient == null) {
        context.addValidationError(gitRepositoryPattern, "Could not create OpenShiftClient. Maybe the Kubernetes server version is older than 1.7?");
    }
    Iterator<GitRepositoryDTO> it = value.iterator();
    String userNameSpace = Tenants.findDefaultUserNamespace(namespaces);
    if (userNameSpace == null) {
        // Tenant not yet initialised properly!
        return;
    }
    while (it.hasNext()) {
        GitRepositoryDTO repo = it.next();
        if (repo != null && repo.getName() != null) {
            BuildConfig oldBC = openShiftClient.buildConfigs().inNamespace(userNameSpace).withName(repo.getName().toLowerCase()).get();
            if (oldBC != null && Strings.isNotBlank(KubernetesHelper.getName(oldBC))) {
                context.addValidationError(gitRepositoryPattern, "The repository " + repo.getName() + " has already a build config, please select another repo.");
                break;
            }
        }
    }


}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:36,代码来源:GitHubImportPickRepositoriesStep.java


示例12: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
@Override
public void validate(UIValidationContext context) {
    if (github == null || !github.isDetailsValid()) {
        // invoked too early before the github account is setup - lets return silently
        return;
    }
    String orgName = getOrganisationName(gitOrganisation.getValue());

    if (Strings.isNullOrBlank(orgName)) {
        context.addValidationError(gitOrganisation, "Please select a github organization");
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:13,代码来源:GitHubImportPickOrganisationStep.java


示例13: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
@Override
public void validate(UIValidationContext context) {
    if (github == null || !github.isDetailsValid()) {
        // invoked too early before the github account is setup - lets return silently
        return;
    }
    String orgName = getOrganisationName(gitOrganisation.getValue());
    String repoName = gitRepository.getValue();

    if (Strings.isNotBlank(orgName) && Strings.isNotBlank(repoName)) {
        github.validateRepositoryName(gitRepository, context, orgName, repoName);
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:14,代码来源:GitHubRepoStep.java


示例14: validateFileDoesNotExist

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
/**
 * Validates that the given selected directory and fileName are valid and that the file doesn't already exist
 */
public void validateFileDoesNotExist(UIInput<String> directory, UIInput<String> fileName, UIValidationContext validator) {
    String resourcePath = CamelXmlHelper.createFileName(directory, fileName);
    if (files.contains(resourcePath)) {
        validator.addValidationError(fileName, "A file with that name already exists!");
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:10,代码来源:SpringBootConfigurationFileCompleter.java


示例15: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
@Override
public void validate(UIValidationContext context)
{
   if (deploymentType.getValue() == DeploymentType.CD)
   {
      if (!openShiftCluster.getValueChoices().iterator().hasNext())
      {
         context.addValidationError(null, "No OpenShift token assigned");
      }
   }
}
 
开发者ID:fabric8-launcher,项目名称:launchpad-addon,代码行数:12,代码来源:ChooseDeploymentTypeStep.java


示例16: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
@Override
public void validate(UIValidationContext context)
{
   UIContext uiContext = context.getUIContext();
   Map<Object, Object> attributeMap = uiContext.getAttributeMap();
   if ("next".equals(attributeMap.get("action")))
   {
      // Do not validate again if next() was called
      return;
   }

   List<String> step = (List<String>) attributeMap.get(RETRY_STEP);
   DeploymentType deploymentType = (DeploymentType) attributeMap.get(DeploymentType.class);
   if (deploymentType == DeploymentType.CD && (step == null || "0".equals(step.get(0))))
   {
      String openShiftCluster = (String) attributeMap.get("OPENSHIFT_CLUSTER");
      if (missionControlValidator.validateOpenShiftTokenExists(context, openShiftCluster))
      {
         missionControlValidator.validateOpenShiftProjectExists(context, named.getValue(), openShiftCluster);
      }
      if (missionControlValidator.validateGitHubTokenExists(context))
      {
         String repository = getGithubRepositoryNameValue();
         missionControlValidator.validateGitHubRepositoryExists(context, repository);
      }
   }
}
 
开发者ID:fabric8-launcher,项目名称:launchpad-addon,代码行数:28,代码来源:ProjectInfoStep.java


示例17: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
@Override
public void validate(UIValidationContext context)
{
   UIContext uiContext = context.getUIContext();
   Mission mission = (Mission) uiContext.getAttributeMap().get(Mission.class);
   String[] filterLabels = catalogServiceFactory.getFilterLabels(uiContext);

   Optional<Booster> booster = catalogServiceFactory.getCatalog(uiContext).getBooster(mission,
            runtime.getValue(), filterLabels);
   if (!booster.isPresent())
   {
      context.addValidationError(runtime,
               "No booster found for mission '" + mission + "' and runtime '" + runtime.getValue() + "'");
   }
}
 
开发者ID:fabric8-launcher,项目名称:launchpad-addon,代码行数:16,代码来源:ChooseRuntimeStep.java


示例18: validateGitHubTokenExists

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
public boolean validateGitHubTokenExists(UIValidationContext context)
{
   Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
   String validationMessage = (String) attributeMap.computeIfAbsent("token_github_exists", key -> {
      List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
      String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
      return missionControlFacade.validateGitHubTokenExists(authHeader);
   });
   if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage))
   {
      context.addValidationError(context.getCurrentInputComponent(), validationMessage);
      return false;
   }
   return true;
}
 
开发者ID:fabric8-launcher,项目名称:launchpad-addon,代码行数:16,代码来源:MissionControlValidator.java


示例19: validateOpenShiftTokenExists

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
public boolean validateOpenShiftTokenExists(UIValidationContext context, String cluster)
{
   Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
   String validationMessage = (String) attributeMap.computeIfAbsent("token_openshift_exists", key -> {
      List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
      String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
      return missionControlFacade.validateOpenShiftTokenExists(authHeader, cluster);
   });
   if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage))
   {
      context.addValidationError(context.getCurrentInputComponent(), validationMessage);
      return false;
   }
   return true;
}
 
开发者ID:fabric8-launcher,项目名称:launchpad-addon,代码行数:16,代码来源:MissionControlValidator.java


示例20: validateGitHubRepositoryExists

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入依赖的package包/类
public void validateGitHubRepositoryExists(UIValidationContext context, String repository)
{
   Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
   String validationMessage = (String) attributeMap.computeIfAbsent("validate_repo_" + repository, key -> {
      List<String> authList = (List<String>) attributeMap.get(HttpHeaders.AUTHORIZATION);
      String authHeader = (authList == null || authList.isEmpty()) ? null : authList.get(0);
      return missionControlFacade.validateGitHubRepositoryExists(authHeader, repository);
   });
   if (validationMessage != null && !MissionControl.VALIDATION_MESSAGE_OK.equals(validationMessage))
   {
      context.addValidationError(context.getCurrentInputComponent(), validationMessage);
   }
}
 
开发者ID:fabric8-launcher,项目名称:launchpad-addon,代码行数:14,代码来源:MissionControlValidator.java



注:本文中的org.jboss.forge.addon.ui.context.UIValidationContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java KeyValueSortReducer类代码示例发布时间:2022-05-22
下一篇:
Java TextDocumentService类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap