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


Java StringUtil.isEmpty方法代码示例

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


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

示例1: parseImageData

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
public static <T extends CloudImageDetails> Collection<T> parseImageData(Class<T> clazz, final CloudClientParameters params) {
    Gson gson = new Gson();
    final String imageData = StringUtil.emptyIfNull(params.getParameter(CloudImageParameters.SOURCE_IMAGES_JSON));
    if (StringUtil.isEmpty(imageData)) {
        return Collections.emptyList();
    }

    final ListParametrizedType listType = new ListParametrizedType(clazz);
    final List<T> images = gson.fromJson(imageData, listType);
    if (CloudImagePasswordDetails.class.isAssignableFrom(clazz)) {
        final String passwordData = params.getParameter("secure:passwords_data");
        final Map<String, String> data = gson.fromJson(passwordData, stringStringMapType);
        if (data != null) {
            for (T image : images) {
                final CloudImagePasswordDetails userImage = (CloudImagePasswordDetails) image;
                if (data.get(image.getSourceId()) != null) {
                    userImage.setPassword(data.get(image.getSourceId()));
                }
            }
        }
    }

    return new ArrayList<>(images);
}
 
开发者ID:JetBrains,项目名称:teamcity-google-agent,代码行数:25,代码来源:GoogleUtils.java

示例2: doHandle

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@Nullable
@Override
protected ModelAndView doHandle(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception {
    String projectId = httpServletRequest.getParameter("projectId");
    String profileId = httpServletRequest.getParameter("profileId");
    String imageId = httpServletRequest.getParameter("imageId");
    if(StringUtil.isEmpty(imageId)) return null;

    final CloudClientEx client = myCloudManager.getClientIfExistsByProjectExtId(projectId, profileId);
    CloudImage image = client.findImageById(imageId);

    if(isGet(httpServletRequest)){
        ModelAndView modelAndView = new ModelAndView(myPluginDescriptor.getPluginResourcesPath("deleteImageDialog.jsp"));
        modelAndView.getModelMap().put("instances", image == null ? Collections.emptyList() : image.getInstances());
        return modelAndView;
    } else if(isPost(httpServletRequest) && image != null){
        for (CloudInstance instance : image.getInstances()){
            client.terminateInstance(instance);
        }
    }
    return null;
}
 
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:23,代码来源:KubeDeleteImageDialogController.java

示例3: getRunnerPropertiesProcessor

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@Nullable
@Override
public PropertiesProcessor getRunnerPropertiesProcessor() {
  return new PropertiesProcessor() {
    @Override
    public Collection<InvalidProperty> process(final Map<String, String> properties) {
      final ArrayList<InvalidProperty> result = new ArrayList<InvalidProperty>();

      final String user = properties.get(RunAsBean.Shared.getRunAsUserKey());
      final String password = properties.get(RunAsBean.Shared.getRunAsPasswordKey());

      if(!(StringUtil.isEmpty(user) && StringUtil.isEmpty(password))) {
        if (StringUtil.isEmptyOrSpaces(user)) {
          result.add(new InvalidProperty(RunAsBean.Shared.getRunAsUserKey(), "The user must be specified."));
        }

        if (StringUtil.isEmpty(password)) {
          result.add(new InvalidProperty(RunAsBean.Shared.getRunAsPasswordKey(), "The password must be specified."));
        }
      }

      return result;
    }
  };
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:26,代码来源:RunAsRunTypeExtension.java

示例4: tryGetParameter

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@Nullable
@Override
public String tryGetParameter(@NotNull final String paramName) {
  final String isRunAsUiEnabledStr = myRunnerParametersService.tryGetConfigParameter(Constants.RUN_AS_UI_ENABLED);
  final boolean isRunAsUiEnabled = StringUtil.isEmpty(isRunAsUiEnabledStr) || !Boolean.toString(false).equalsIgnoreCase(isRunAsUiEnabledStr);
  if(isRunAsUiEnabled) {
    String paramValue = myRunnerParametersService.tryGetRunnerParameter(paramName);
    if (!StringUtil.isEmptyOrSpaces(paramValue)) {
      return paramValue;
    }

    paramValue = myBuildFeatureParametersService.tryGetBuildFeatureParameter(Constants.BUILD_FEATURE_TYPE, paramName);
    if (!StringUtil.isEmptyOrSpaces(paramValue)) {
      return paramValue;
    }
  }

  return tryGetConfigParameter(paramName);
}
 
开发者ID:JetBrains,项目名称:teamcity-runas-plugin,代码行数:20,代码来源:ParametersServiceImpl.java

示例5: tagBuild

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
/**
 * Tag the finishing build (if requested in the config) as either
 * 1) triggered by SinCity
 * 2) not triggered by SinCity
 */
void tagBuild() {
    // tag the finished build
    SettingNames settingNames = new SettingNames();

    // if this is a SinCity-triggered build, we know for sure that the getSincityRangeTopBuildId() parameter is set;
    // if, on the other hand, it is a non-SinCity-triggered run, it may still be set (and hopefully empty) if the
    // user has set the parameter up in their build configuration; therefore, don't just test for null and accept
    // empty as a sign of a non-SinCity-triggered build
    final String sincityRangeTopBuildId = build.getParametersProvider().get(new ParameterNames().getSincityRangeTopBuildId());
    String tagParameterName = StringUtil.isEmpty(sincityRangeTopBuildId)
            ? settingNames.getTagNameForBuildsNotTriggeredBySinCity()
            : settingNames.getTagNameForBuildsTriggeredBySinCity();

    String unresolvedTagName = sinCityParameters.get(tagParameterName);
    if (StringUtil.isEmpty(unresolvedTagName))
        return;

    ValueResolver resolver = build.getValueResolver();
    final String resolvedTagName = resolver.resolve(unresolvedTagName).getResult();

    Loggers.SERVER.debug("[SinCity] tagging build with '" + resolvedTagName + "'");
    final List<String> resultingTags = new ArrayList<String>(build.getTags());
    resultingTags.add(resolvedTagName);
    build.setTags(resultingTags);
}
 
开发者ID:sferencik,项目名称:SinCity,代码行数:31,代码来源:BuildTagger.java

示例6: writeParameterToFileIfSet

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
private void writeParameterToFileIfSet(String parameterName, String filePath) {
    final Map<String, String> configParameters = build.getSharedConfigParameters();
    if (!configParameters.containsKey(parameterName)) {
        Loggers.AGENT.debug("[SinCity] the " + parameterName + " parameter is not set");
        return;
    }

    String parameterValue = configParameters.get(parameterName);

    if (StringUtil.isEmpty(parameterValue)) {
        Loggers.AGENT.debug("[SinCity] the " + parameterName + " is empty");
        return;
    }

    writeStringToFile(parameterValue, filePath);
}
 
开发者ID:sferencik,项目名称:SinCity,代码行数:17,代码来源:ParamsToFiles.java

示例7: getFullPath

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
private String getFullPath(@NotNull final String entityName,
                           @NotNull final ManagedObjectReference mor,
                           @Nullable final ManagedObjectReference firstParent,
                           @Nullable final Datacenter dc){
  final String uniqueName = String.format("%s (%s)", entityName, mor.getVal());
  if (firstParent == null) {
    return uniqueName;
  }
  try {
    final String morPath = getFullMORPath(createExactManagedEntity(firstParent), dc);
    if (StringUtil.isEmpty(morPath)) {
      return uniqueName;
    } else if (("Resources".equals(entityName) || "vm".equals(entityName)) && !mor.getType().equals(firstParent.getType())) {
      LOG.debug("The pool is a special pool. Skipping it...");
      return morPath;
    } else {
      return morPath + "/" + entityName;
    }
  } catch (Exception ex){
    LOG.warnAndDebugDetails("Can't calculate full path for " + uniqueName, ex);
    return uniqueName;
  }
}
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:24,代码来源:VMWareApiConnectorImpl.java

示例8: getFriendlyErrorMessage

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@Override
public String getFriendlyErrorMessage(String message, String defaultMessage) {
    if (StringUtil.isEmpty(message)) {
        return "No details available";
    }

    return defaultMessage;
}
 
开发者ID:JetBrains,项目名称:teamcity-google-agent,代码行数:9,代码来源:DefaultErrorMessageUpdater.java

示例9: doHandle

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@Nullable
@Override
protected ModelAndView doHandle(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception {
    BasePropertiesBean propsBean = new BasePropertiesBean(null);
    PluginPropertiesUtil.bindPropertiesFromRequest(httpServletRequest, propsBean, true);
    Map<String, String> props = propsBean.getProperties();

    KubeApiConnection apiConnection = new KubeApiConnection() {
        @NotNull
        @Override
        public String getApiServerUrl() {
            return props.get(API_SERVER_URL);
        }

        @NotNull
        @Override
        public String getNamespace() {
            String explicitNameSpace = props.get(KUBERNETES_NAMESPACE);
            return StringUtil.isEmpty(explicitNameSpace) ? DEFAULT_NAMESPACE : explicitNameSpace;
        }

        @Nullable
        @Override
        public String getCustomParameter(@NotNull String parameterName) {
            return props.get(parameterName);
        }
    };
    String authStrategy = props.get(AUTH_STRATEGY);

    ModelAndView modelAndView = new ModelAndView(myPluginDescriptor.getPluginResourcesPath("kubeDeployments.jsp"));
    try {
        KubeApiConnectorImpl apiConnector = KubeApiConnectorImpl.create(apiConnection, myAuthStrategyProvider.get(authStrategy));
        modelAndView.getModelMap().put("deployments", apiConnector.listDeployments());
        modelAndView.getModelMap().put("error","");
    } catch (Exception ex){
        modelAndView.getModelMap().put("deployments", Collections.emptyList());
        modelAndView.getModelMap().put("error", ex.getLocalizedMessage());
    }
    return modelAndView;
}
 
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:41,代码来源:KubeDeploymentChooserController.java

示例10: doHandle

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@Nullable
@Override
protected ModelAndView doHandle(@NotNull HttpServletRequest httpServletRequest, @NotNull HttpServletResponse httpServletResponse) throws Exception {
    BasePropertiesBean propsBean = new BasePropertiesBean(null);
    PluginPropertiesUtil.bindPropertiesFromRequest(httpServletRequest, propsBean, true);
    Map<String, String> props = propsBean.getProperties();

    KubeApiConnection apiConnection = new KubeApiConnection() {
        @NotNull
        @Override
        public String getApiServerUrl() {
            return props.get(API_SERVER_URL);
        }

        @NotNull
        @Override
        public String getNamespace() {
            String explicitNameSpace = props.get(KUBERNETES_NAMESPACE);
            return StringUtil.isEmpty(explicitNameSpace) ? DEFAULT_NAMESPACE : explicitNameSpace;
        }

        @Nullable
        @Override
        public String getCustomParameter(@NotNull String parameterName) {
            return props.get(parameterName);
        }
    };
    String authStrategy = props.get(AUTH_STRATEGY);

    ModelAndView modelAndView = new ModelAndView(myPluginDescriptor.getPluginResourcesPath("kubeNamespaces.jsp"));
    try {
        KubeApiConnectorImpl apiConnector = KubeApiConnectorImpl.create(apiConnection, myAuthStrategyProvider.get(authStrategy));
        modelAndView.getModelMap().put("namespaces", apiConnector.listNamespaces());
        modelAndView.getModelMap().put("error","");
    } catch (Exception ex){
        modelAndView.getModelMap().put("namespaces", Collections.emptyList());
        modelAndView.getModelMap().put("error", ex.getLocalizedMessage());
    }
    return modelAndView;
}
 
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:41,代码来源:KubeNamespaceChooserController.java

示例11: getStartedTime

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public Date getStartedTime() {
    final PodStatus podStatus = myApiConnector.getPodStatus(myPod.getMetadata().getName());
    if(podStatus == null) return myCreationTime;
    try {
        final List<PodCondition> podConditions = podStatus.getConditions();
        if (podConditions != null && !podConditions.isEmpty()) {
            for (PodCondition podCondition : podConditions) {
                if (PodConditionType.valueOf(podCondition.getType()) == PodConditionType.Ready)
                    return myPodTransitionTimeFormat.parse(podCondition.getLastTransitionTime());
            }
        }
        String startTime = podStatus.getStartTime();
        return !StringUtil.isEmpty(startTime) ? myPodStartTimeFormat.parse(startTime) : myCreationTime;
    } catch (ParseException e) {
        throw new KubeCloudException("Failed to get instance start date", e);
    }
}
 
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:20,代码来源:KubeCloudInstanceImpl.java

示例12: apply

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public ConfigBuilder apply(@NotNull ConfigBuilder clientConfig, @NotNull KubeApiConnection connection) {
    String token = connection.getCustomParameter(AUTH_TOKEN);
    if(StringUtil.isEmpty(token)) {
        throw new KubeCloudException("Auth token is empty for connection " + connection);
    }
    return clientConfig.withOauthToken(token);
}
 
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:10,代码来源:TokenAuthStrategy.java

示例13: apply

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public ConfigBuilder apply(@NotNull ConfigBuilder clientConfig, @NotNull KubeApiConnection connection) {
    String defaultServiceAccountAuthToken = getDefaultServiceAccountAuthToken();
    if(StringUtil.isEmpty(defaultServiceAccountAuthToken)) throw new KubeCloudException("Can't locate default Kubernetes service account token.");
    return clientConfig.withOauthToken(defaultServiceAccountAuthToken);
}
 
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:8,代码来源:DefaultServiceAccountAuthStrategy.java

示例14: apply

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public ConfigBuilder apply(@NotNull ConfigBuilder clientConfig, @NotNull KubeApiConnection connection) {
    String clientCertData = connection.getCustomParameter(CLIENT_CERTIFICATE_DATA);
    if(StringUtil.isEmpty(clientCertData)) {
        throw new KubeCloudException("Client certificate data is empty for connection " + connection);
    }
    return clientConfig.withClientCertData(Base64.encodeBase64String(clientCertData.getBytes()));
}
 
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:10,代码来源:ClientCertificateAuthStrategy.java

示例15: appendKubeSpecificConfiguration

import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
private void appendKubeSpecificConfiguration() {
    Map<String, String> env = System.getenv();

    String providedAgentName = env.get(KubeContainerEnvironment.AGENT_NAME);
    if(!StringUtil.isEmpty(providedAgentName)) myAgentConfigurationEx.setName(providedAgentName);
    String providedServerUrl = env.get(KubeContainerEnvironment.SERVER_URL);
    if(!StringUtil.isEmpty(providedServerUrl)) myAgentConfigurationEx.setServerUrl(providedServerUrl);
}
 
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:9,代码来源:KubeAgentConfigurationProvider.java


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