本文整理汇总了Java中jetbrains.buildServer.util.StringUtil.emptyIfNull方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.emptyIfNull方法的具体用法?Java StringUtil.emptyIfNull怎么用?Java StringUtil.emptyIfNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jetbrains.buildServer.util.StringUtil
的用法示例。
在下文中一共展示了StringUtil.emptyIfNull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: createBuildProcess
import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
@Override
public BuildProcess createBuildProcess(@NotNull final AgentRunningBuild runningBuild,
@NotNull final BuildRunnerContext context) throws RunBuildException {
final Map<String, String> runnerParameters = context.getRunnerParameters();
final String username = StringUtil.emptyIfNull(runnerParameters.get(DeployerRunnerConstants.PARAM_USERNAME));
final String password = StringUtil.emptyIfNull(runnerParameters.get(DeployerRunnerConstants.PARAM_PASSWORD));
final String target = StringUtil.emptyIfNull(runnerParameters.get(DeployerRunnerConstants.PARAM_TARGET_URL));
final String sourcePaths = runnerParameters.get(DeployerRunnerConstants.PARAM_SOURCE_PATH);
final Collection<ArtifactsPreprocessor> preprocessors = myExtensionHolder.getExtensions(ArtifactsPreprocessor.class);
final ArtifactsBuilder builder = new ArtifactsBuilder();
builder.setPreprocessors(preprocessors);
builder.setBaseDir(runningBuild.getCheckoutDirectory());
builder.setArtifactsPaths(sourcePaths);
final List<ArtifactsCollection> artifactsCollections = builder.build();
return getDeployerProcess(context, username, password, target, artifactsCollections);
}
示例3: VmwareCloudImageDetails
import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
public VmwareCloudImageDetails(@NotNull final CloudImageParameters imageParameters){
myCustomizationSpec = imageParameters.getParameter(VmwareConstants.CUSTOMIZATION_SPEC);
myMaxInstances = StringUtil.parseInt(StringUtil.emptyIfNull(imageParameters.getParameter(VmwareConstants.MAX_INSTANCES)), 0);
mySourceVmName = imageParameters.getParameter(VmwareConstants.SOURCE_VM_NAME);
myFolderId = imageParameters.getParameter(VmwareConstants.FOLDER);
myResourcePoolId = imageParameters.getParameter(VmwareConstants.RESOURCE_POOL);
myCloneBehaviour = CloneBehaviour.valueOf(imageParameters.getParameter(VmwareConstants.BEHAVIOUR));
mySnapshotName = StringUtil.emptyIfNull(imageParameters.getParameter(VmwareConstants.SNAPSHOT));
myNickname = StringUtil.nullIfEmpty(imageParameters.getParameter(VmwareConstants.NICKNAME));
myAgentPoolId = imageParameters.getAgentPoolId();
if (myCloneBehaviour.isUseOriginal()){
mySourceId = mySourceVmName;
} else {
mySourceId = myNickname == null ? mySourceVmName : myNickname;
}
}
示例4: checkAndCreateImage
import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@Override
protected T checkAndCreateImage(@NotNull D imageDetails) {
final String profileId = StringUtil.emptyIfNull(myParameters.getParameter("profileId"));
final String sourceId = imageDetails.getSourceId();
final T cloudImage = createImage(imageDetails);
// Try to find existing images
final T image = (T) myImagesHolder.findImage(profileId, sourceId);
if (image != null) {
for (G instance : image.getInstances()) {
cloudImage.addInstance(instance);
}
} else {
try {
final Map<String, AbstractInstance> realInstances = myApiConnector.fetchInstances(cloudImage);
cloudImage.detectNewInstances(realInstances);
} catch (CheckedCloudException e) {
final String message = String.format("Failed to get instances for image %s: %s", sourceId, e.getMessage());
LOG.warnAndDebugDetails(message, e);
cloudImage.updateErrors(TypedCloudErrorInfo.fromException(e));
}
}
myImagesHolder.addImage(profileId, cloudImage);
return cloudImage;
}
示例5: getPatternsForBuild
import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
private String getPatternsForBuild(@NotNull final BuildCleanupContext cleanupContext, @NotNull final SBuild build) {
if (cleanupContext.getCleanupLevel().isCleanHistoryEntry()) return StringUtil.EMPTY;
final CleanupPolicy policy = cleanupContext.getCleanupPolicyForBuild(build.getBuildId());
return StringUtil.emptyIfNull(policy.getParameters().get(HistoryRetentionPolicy.ARTIFACT_PATTERNS_PARAM));
}
示例6: doHandle
import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@Nullable
@Override
protected ModelAndView doHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response) throws Exception {
String fileFormat = StringUtil.emptyIfNull(request.getParameter("format"));
GraphFormat format = myFormats.get(fileFormat.toLowerCase());
if (format == null) {
return simpleView("Supported formats: " + myFormats.keySet());
}
String result;
String promoId = request.getParameter("promotionId");
if (promoId != null) {
BuildPromotion promotion = myBuildPromotionManager.findPromotionById(Long.parseLong(promoId));
if (promotion == null) return simpleView("Build promotion does not exist: " + promoId);
result = format.export(new PromotionNode(promotion));
} else {
String buildTypeId = request.getParameter("buildTypeId");
if (buildTypeId == null) {
return simpleView("Neither 'promotionId' nor 'buildTypeId' parameters are specified");
}
final SBuildType buildType = myProjectManager.findBuildTypeByExternalId(buildTypeId);
if (buildType == null) {
return simpleView("Build configuration with id '" + buildTypeId + "' is not found");
}
result = format.export(new BuildTypeNode(buildType));
}
response.setContentType("text/plain");
PrintWriter writer = response.getWriter();
writer.print(result);
writer.close();
return null;
}
示例7: createFromUserSettings
import jetbrains.buildServer.util.StringUtil; //导入方法依赖的package包/类
@NotNull
public static VSONotificationUserSettingsBean createFromUserSettings(@NotNull User user) {
final String account = StringUtil.emptyIfNull(VSOUserProperties.getAccount(user));
final String teamRoomName = StringUtil.emptyIfNull(VSOUserProperties.getTeamRoomName(user));
final String username = StringUtil.emptyIfNull(VSOUserProperties.getUsername(user));
final String password = StringUtil.emptyIfNull(VSOUserProperties.getPassword(user));
return new VSONotificationUserSettingsBean(account, teamRoomName, username, password);
}