List of usage examples for org.apache.commons.lang StringUtils upperCase
public static String upperCase(String str)
Converts a String to upper case as per String#toUpperCase() .
From source file:org.rundeck.api.RundeckClient.java
/** * Export the definitions of the jobs that belongs to the given project, and matches the given criteria (jobFilter, * groupPath and jobIds)/* ww w . j ava2s. c o m*/ * * @param format of the export. See {@link FileType} - mandatory * @param project name of the project - mandatory * @param jobFilter a filter for the job Name - optional * @param groupPath a group or partial group path to include all jobs within that group path - optional * @param jobIds a list of Job IDs to include - optional * @return an {@link InputStream} instance, not linked to any network resources - won't be null * @throws RundeckApiException in case of error when calling the API (non-existent project with this name) * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) * @throws IllegalArgumentException if the format or project is blank (null, empty or whitespace), or the format is * invalid * @see #exportJobs(FileType, String, String, String, String...) * @see #exportJobsToFile(String, String, String, String, String, String...) */ public InputStream exportJobs(String format, String project, String jobFilter, String groupPath, String... jobIds) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { AssertUtil.notBlank(format, "format is mandatory to export jobs !"); return exportJobs(FileType.valueOf(StringUtils.upperCase(format)), project, jobFilter, groupPath, jobIds); }
From source file:org.rundeck.api.RundeckClient.java
/** * Export the definition of a single job (identified by the given ID) * * @param filename path of the file where the content should be saved - mandatory * @param format of the export. See {@link FileType} - mandatory * @param jobId identifier of the job - mandatory * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) * @throws IllegalArgumentException if the filename, format or jobId is blank (null, empty or whitespace), or the * format is invalid/* www . j a v a 2s . c om*/ * @throws IOException if we failed to write to the file * @see #exportJobToFile(String, FileType, String) * @see #exportJob(String, String) * @see #getJob(String) */ public void exportJobToFile(String filename, String format, String jobId) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException, IOException { AssertUtil.notBlank(format, "format is mandatory to export a job !"); exportJobToFile(filename, FileType.valueOf(StringUtils.upperCase(format)), jobId); }
From source file:org.rundeck.api.RundeckClient.java
/** * Export the definition of a single job, identified by the given ID * * @param format of the export. See {@link FileType} - mandatory * @param jobId identifier of the job - mandatory * @return an {@link InputStream} instance, not linked to any network resources - won't be null * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) * @throws IllegalArgumentException if the format or jobId is blank (null, empty or whitespace), or the format is * invalid//w ww. j a va 2 s . c om * @see #exportJobToFile(String, String, String) * @see #getJob(String) */ public InputStream exportJob(String format, String jobId) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { AssertUtil.notBlank(format, "format is mandatory to export a job !"); return exportJob(FileType.valueOf(StringUtils.upperCase(format)), jobId); }
From source file:org.rundeck.api.RundeckClient.java
/** * Get the executions of the given job/*from w w w. j av a2s . c om*/ * * @param jobId identifier of the job - mandatory * @param status of the executions, see {@link ExecutionStatus} - optional (null for all) * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the executionStatus is * invalid * @see #getJobExecutions(String, String, Long, Long) */ public List<RundeckExecution> getJobExecutions(String jobId, String status) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { return getJobExecutions(jobId, StringUtils.isBlank(status) ? null : ExecutionStatus.valueOf(StringUtils.upperCase(status))); }
From source file:org.rundeck.api.RundeckClient.java
/** * Get the executions of the given job// ww w. ja va 2 s. c o m * * @param jobId identifier of the job - mandatory * @param status of the executions, see {@link ExecutionStatus} - optional (null for all) * @param max number of results to return - optional (null for all) * @param offset the 0-indexed offset for the first result to return - optional * @return a {@link List} of {@link RundeckExecution} : might be empty, but won't be null * @throws RundeckApiException in case of error when calling the API (non-existent job with this ID) * @throws RundeckApiLoginException if the login fails (in case of login-based authentication) * @throws RundeckApiTokenException if the token is invalid (in case of token-based authentication) * @throws IllegalArgumentException if the jobId is blank (null, empty or whitespace), or the executionStatus is * invalid * @see #getJobExecutions(String, RundeckExecution.ExecutionStatus, Long, Long) */ public List<RundeckExecution> getJobExecutions(String jobId, String status, Long max, Long offset) throws RundeckApiException, RundeckApiLoginException, RundeckApiTokenException, IllegalArgumentException { return getJobExecutions(jobId, StringUtils.isBlank(status) ? null : ExecutionStatus.valueOf(StringUtils.upperCase(status)), max, offset); }
From source file:org.sonar.api.qualitymodel.Characteristic.java
public Characteristic setName(String s, boolean asKey) { this.name = StringUtils.trimToNull(s); if (asKey) {/*from w w w. j a v a 2 s . c om*/ this.key = StringUtils.upperCase(this.name); this.key = StringUtils.replaceChars(this.key, ' ', '_'); } return this; }
From source file:org.sonar.api.technicaldebt.batch.internal.DefaultCharacteristic.java
public DefaultCharacteristic setName(String s, boolean asKey) { this.name = StringUtils.trimToNull(s); if (asKey) {//from www . j a v a 2 s. c o m this.key = StringUtils.upperCase(this.name); this.key = StringUtils.replaceChars(this.key, ' ', '_'); } return this; }
From source file:org.sonar.application.config.JdbcSettings.java
Provider resolveProviderAndEnforceNonnullJdbcUrl(Props props) { String url = props.value(JDBC_URL); Integer embeddedDatabasePort = props.valueAsInt(JDBC_EMBEDDED_PORT); if (embeddedDatabasePort != null) { String correctUrl = buildH2JdbcUrl(embeddedDatabasePort); warnIfUrlIsSet(embeddedDatabasePort, url, correctUrl); props.set(JDBC_URL, correctUrl); return Provider.H2; }/* w w w.j a v a2 s .c o m*/ if (isEmpty(url)) { props.set(JDBC_URL, buildH2JdbcUrl(JDBC_EMBEDDED_PORT_DEFAULT_VALUE)); props.set(JDBC_EMBEDDED_PORT, String.valueOf(JDBC_EMBEDDED_PORT_DEFAULT_VALUE)); return Provider.H2; } Pattern pattern = Pattern.compile("jdbc:(\\w+):.+"); Matcher matcher = pattern.matcher(url); if (!matcher.find()) { throw new MessageException(format("Bad format of JDBC URL: %s", url)); } String key = matcher.group(1); try { return Provider.valueOf(StringUtils.upperCase(key)); } catch (IllegalArgumentException e) { throw new MessageException(format("Unsupported JDBC driver provider: %s", key)); } }
From source file:org.sonar.application.JdbcSettings.java
Provider resolveProviderAndEnforceNonnullJdbcUrl(Props props) { String url = props.value(JDBC_URL); String embeddedDatabasePort = props.value(PROP_EMBEDDED_PORT); if (isNotEmpty(embeddedDatabasePort)) { String correctUrl = buildH2JdbcUrl(embeddedDatabasePort); warnIfUrlIsSet(embeddedDatabasePort, url, correctUrl); props.set(PROP_URL, correctUrl); return Provider.H2; }//from www. ja v a 2 s . com if (isEmpty(url)) { props.set(PROP_URL, buildH2JdbcUrl(PROP_EMBEDDED_PORT_DEFAULT_VALUE)); props.set(PROP_EMBEDDED_PORT, PROP_EMBEDDED_PORT_DEFAULT_VALUE); return Provider.H2; } Pattern pattern = Pattern.compile("jdbc:(\\w+):.+"); Matcher matcher = pattern.matcher(url); if (!matcher.find()) { throw new MessageException(String.format("Bad format of JDBC URL: %s", url)); } String key = matcher.group(1); try { return Provider.valueOf(StringUtils.upperCase(key)); } catch (IllegalArgumentException e) { throw new MessageException(String.format("Unsupported JDBC driver provider: %s", key)); } }
From source file:org.sonar.core.measure.MeasureFilterSql.java
private void appendResourceKeyCondition(StringBuilder sb) { if (StringUtils.isNotBlank(filter.getResourceKeyRegexp())) { sb.append(" AND UPPER(p.kee) LIKE '"); // limitation : special characters _ and % are not escaped String regexp = StringEscapeUtils.escapeSql(filter.getResourceKeyRegexp()); regexp = StringUtils.replaceChars(regexp, '*', '%'); regexp = StringUtils.replaceChars(regexp, '?', '_'); sb.append(StringUtils.upperCase(regexp)).append("'"); }//w ww .j a v a2 s. com }