当前位置: 首页>>代码示例>>Java>>正文


Java UIValidationContext.addValidationError方法代码示例

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


在下文中一共展示了UIValidationContext.addValidationError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: validate

import org.jboss.forge.addon.ui.context.UIValidationContext; //导入方法依赖的package包/类
@Override
public void validate(UIValidationContext validator)
{
   super.validate(validator);
   if (connectionProfile.getValue().equals(""))
      validator.addValidationError(connectionProfile,
               "Please select a database connection. If there is no connection, "
                        + "please use Forge to create a new connection profile");
}
 
开发者ID:forge,项目名称:db-migration-addon,代码行数:10,代码来源:SetPropertiesCommand.java


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