List of usage examples for org.apache.commons.lang3 StringUtils join
public static String join(final Iterable<?> iterable, final String separator)
Joins the elements of the provided Iterable into a single String containing the provided elements.
No delimiter is added before or after the list.
From source file:com.epam.dlab.configuration.SchedulerConfiguration.java
/** Build the schedule from user' schedule. * @throws ParseException// w w w.ja v a2s. co m */ public void build() throws ParseException { SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); String[] unitArray = schedule.split(","); realSchedule.clear(); for (int i = 0; i < unitArray.length; i++) { Calendar date = Calendar.getInstance(); int[] time = getTime(unitArray[i]); try { df.parse(StringUtils.join(time, ':')); } catch (Exception e) { throw new ParseException("Cannot parse date " + unitArray[i] + ". " + e.getLocalizedMessage(), e); } date.clear(); date.set(1, 1, 1, time[0], time[1], time[2]); realSchedule.put(df.format(date.getTime()), date); } adjustStartTime(); }
From source file:com.thinkbiganalytics.util.ColumnSpec.java
public static String toPrimaryKeyJoinSQL(ColumnSpec[] specs, String leftTableAlias, String rightTableAlias) { final String safeLeftTable = HiveUtils.quoteIdentifier(leftTableAlias); final String safeRightTable = HiveUtils.quoteIdentifier(rightTableAlias); final List<String> keys = Stream.of(specs).filter(ColumnSpec::isPk).map(ColumnSpec::getName) .map(HiveUtils::quoteIdentifier) .map(column -> safeLeftTable + "." + column + " = " + safeRightTable + "." + column) .collect(Collectors.toList()); return StringUtils.join(keys, " AND "); }
From source file:gov.nih.nci.caintegrator.external.ncia.NCIAFacadeImpl.java
/** * {@inheritDoc}//from ww w. j a va 2 s.c o m */ public void validateImagingSourceConnection(ServerConnectionProfile profile, String collectionNameProject) throws ConnectionException, InvalidImagingCollectionException { List<String> validCollectionNames = getAllCollectionNameProjects(profile); if (!validCollectionNames.contains(collectionNameProject)) { throw new InvalidImagingCollectionException( "No collection exists with the name '" + collectionNameProject + "'. The valid names are: " + StringUtils.join(validCollectionNames, " // ")); } }
From source file:ca.umontreal.iro.rxnav.RxNorm.java
/** * Determine if a property exists for a concept and (optionally) matches the specified property * value. Returns the RxCUI if the property name matches. * <p>/*from w w w .ja v a 2 s . com*/ * http://rxnav.nlm.nih.gov/RxNormAPIs.html#uLink=RxNorm_REST_filterByProperty * * @param rxcui the RxNorm concept unique identifier * @param propName the property name. See /propnames for the list of valid property names * @param propValues (optional) the property value. If not specified, the RxCui is returned if * the property exists for the concept. * @return * @throws IOException * @throws JSONException */ public JSONArray filterByProperty(String rxcui, String propName, String... propValues) throws IOException, JSONException { if (propValues.length > 0) return get("rxcui/" + rxcui + "/filter", new BasicNameValuePair("propName", propName), new BasicNameValuePair("propValues", StringUtils.join(propValues, " "))) .getJSONObject("propConceptGroup").getJSONArray("propConcept"); return get("rxcui/" + rxcui + "/filter", new BasicNameValuePair("propName", propName)) .getJSONObject("propConceptGroup").getJSONArray("propConcept"); }
From source file:io.wcm.maven.plugins.nodejs.mojo.Task.java
private void startProcess(ProcessBuilder processBuilder) throws MojoExecutionException { try {/*from ww w .j a va 2 s.c o m*/ final Process process = processBuilder.start(); getLog().info("Running process: " + StringUtils.join(processBuilder.command(), " ")); initLogging(process); int result = process.waitFor(); if (result != 0) { throw new MojoExecutionException("Process: " + StringUtils.join(processBuilder.command(), " ") + " terminated with " + result); } } catch (IOException ex) { throw new MojoExecutionException( "Error executing process: " + StringUtils.join(processBuilder.command(), " "), ex); } catch (InterruptedException ex) { throw new MojoExecutionException( "Error executing process: " + StringUtils.join(processBuilder.command(), " "), ex); } }
From source file:exm.stc.ic.ICUtil.java
/** * print a comma separated list of objects by calling toString() * @param sb/* w ww. j ava 2 s. c o m*/ * @param list */ public static void prettyPrintList(StringBuilder sb, Collection<? extends Object> list) { sb.append(StringUtils.join(list, ", ")); }
From source file:com.emr.utilities.SqliteAddProcess.java
/** * Constructor//from w w w . j a v a 2 s .co m * @param name Name of the process * @param description Description * @param selectQuery The select Query used to fetch data from the emr database * @param destinationTable The destination table in the mpi database * @param truncateFirst Whether to truncate the destination table first * @param destinationColumns List of columns to be copied into * @param jp The progress bar * @param lbl Label to be updated on completion */ public SqliteAddProcess(String name, String description, String selectQuery, String destinationTable, Boolean truncateFirst, String[] destinationColumns, String columnsToBeMappedString, JProgressBar jp, JLabel lbl) { this.name = name; this.description = description; this.selectQuery = selectQuery; this.destinationTable = destinationTable; this.truncateFirst = truncateFirst; this.destinationColumns = destinationColumns; this.columnsToBeMappedString = columnsToBeMappedString; this.jp = jp; this.lbl = lbl; destinationCols = StringUtils.join(destinationColumns, "|"); }
From source file:com.thoughtworks.go.domain.ConfigErrors.java
public String asString() { return StringUtils.join(this.getAll(), ", "); }
From source file:com.blackducksoftware.integration.hub.detect.workflow.codelocation.CodeLocationNameGenerator.java
public String createBomCodeLocationName(final String detectSourcePath, final String sourcePath, final ExternalId externalId, final DetectCodeLocationType detectCodeLocationType, final String prefix, final String suffix) { final String pathPiece = FileNameUtils.relativize(detectSourcePath, sourcePath); final List<String> pieces = Arrays.asList(externalId.getExternalIdPieces()); final String externalIdPiece = StringUtils.join(pieces, "/"); // misc pieces final String codeLocationTypeString = CodeLocationNameType.BOM.toString().toLowerCase(); final String bomToolTypeString = detectCodeLocationType.toString().toLowerCase(); final List<String> bomCodeLocationNamePieces = Arrays.asList(pathPiece, externalIdPiece); final List<String> bomCodeLocationEndPieces = Arrays.asList(bomToolTypeString, codeLocationTypeString); return createCodeLocationName(prefix, bomCodeLocationNamePieces, suffix, bomCodeLocationEndPieces); }
From source file:com.example.data.PetData.java
public List<Map<String, Object>> findPetByStatus(String status) throws SQLException { QueryRunner run = new QueryRunner(H2DB.getDataSource()); String[] statues = status.split(","); String statusInStr = StringUtils.join( Arrays.asList(statues).stream().map(s -> "'" + s.trim() + "'").collect(Collectors.toList()), ","); if (statues.length > 0) { return run .query("select * from pet where status in (" + statusInStr + ")", H2DB.mkResultSetHandler("id", "name", "categoryId", "photoUrls", "tags", "status")) .stream().map(m -> {/*from ww w . j av a 2 s . co m*/ m.put("photoUrls", H2DB.strToList((String) m.get("photoUrls"))); m.put("tags", H2DB.strToList((String) m.get("tags"))); m.put("category", getCategory(run, (Long) m.get("categoryId"))); m.remove("categoryId"); return m; }).collect(Collectors.toList()); } return Collections.EMPTY_LIST; }