public static String normalizeArtifactPath(final String path, final File file) { if (StringUtil.isEmpty(path)) { return file.getName(); } else { return FileUtil.normalizeRelativePath(String.format("%s/%s", path, file.getName())); } }
@NotNull public static String writeS3ObjectKeys(@NotNull Collection<String> s3ObjectKeys) throws IOException { Element rootElement = new Element(S3_OBJECT_KEYS); for (String s3ObjectKey : s3ObjectKeys){ if(StringUtil.isEmpty(s3ObjectKey)) continue; Element xmlElement = new Element(S3_OBJECT_KEY); xmlElement.addContent(s3ObjectKey); rootElement.addContent(xmlElement); } return JDOMUtil.writeDocument(new Document(rootElement), System.getProperty("line.separator")); } }
final Map<String, String> settings = build.getArtifactStorageSettings(); final String bucketName = S3Util.getBucketName(settings); if (StringUtil.isEmpty(bucketName)) { throw new IllegalArgumentException("S3 bucket name must not be empty");
public ProjectWebhook findWebHookById(String projectExternalId, String webHookLocator, final @NotNull Fields fields, @NotNull final BeanContext beanContext) { if (StringUtil.isEmpty(webHookLocator)) { throw new BadRequestException("Empty webhook locator is not supported."); } final Locator locator = new Locator(webHookLocator, "id", Locator.LOCATOR_SINGLE_VALUE_UNUSED_NAME); if (locator.isSingleValue()) { // no dimensions found, assume it's a name or internal id or // external id @NotNull final String singleValue = locator.getSingleValue(); return getWebHookConfigById(projectExternalId, fields, beanContext, singleValue); } else if (locator.getSingleDimensionValue("id") != null){ @NotNull final String webHookId = locator.getSingleDimensionValue("id"); return getWebHookConfigById(projectExternalId, fields, beanContext, webHookId); } throw new BadRequestException("Sorry: Searching for multiple template is not supported."); }
public WebHookTemplateItemConfigWrapper findTemplateByIdAndTemplateContentById(String templateLocator, String templateContentLocator) { WebHookTemplateConfigWrapper templateConfigWrapper = findTemplateById(templateLocator); if (StringUtil.isEmpty(templateLocator)) { throw new BadRequestException("Empty template locator is not supported."); } final Locator locator = new Locator(templateContentLocator, "id", "name", Locator.LOCATOR_SINGLE_VALUE_UNUSED_NAME); if (locator.isSingleValue()) { // no dimensions found, assume it's a name or id without "id:" @NotNull final String templateId = locator.getSingleValue(); return buildWebHookTemplateItemConfigWrapper(templateConfigWrapper, templateId); } else if (locator.getSingleDimensionValue("id") != null){ @NotNull final String templateId = locator.getSingleDimensionValue("id"); return buildWebHookTemplateItemConfigWrapper(templateConfigWrapper, templateId); } else { throw new BadRequestException("Sorry: Searching for multiple templates is not supported."); } }
public WebHookTemplateConfigWrapper findTemplateById(String templateLocator) { if (StringUtil.isEmpty(templateLocator)) { throw new BadRequestException("Empty template locator is not supported.");
public void getFromConfig(SlackNotification slackNotification, SlackNotificationConfig slackNotificationConfig){ slackNotification.setChannel(StringUtil.isEmpty(slackNotificationConfig.getChannel()) ? myMainSettings.getDefaultChannel() : slackNotificationConfig.getChannel()); slackNotification.setTeamName(myMainSettings.getTeamName()); slackNotification.setToken(StringUtil.isEmpty(slackNotificationConfig.getToken()) ? myMainSettings.getToken() : slackNotificationConfig.getToken()); slackNotification.setIconUrl(myMainSettings.getIconUrl()); slackNotification.setBotName(myMainSettings.getBotName());