Example usage for org.apache.commons.lang3 StringUtils join

List of usage examples for org.apache.commons.lang3 StringUtils join

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils join.

Prototype

public static String join(final Iterable<?> iterable, final String separator) 

Source Link

Document

Joins the elements of the provided Iterable into a single String containing the provided elements.

No delimiter is added before or after the list.

Usage

From source file:com.adobe.acs.commons.reports.models.StringReportCellCSVExporter.java

@Override
public String getValue(Object result) {
    Resource resource = (Resource) result;
    ReportCellValue val = new ReportCellValue(resource, property);
    List<String> values = new ArrayList<String>();
    if (val.getValue() != null) {
        if (val.isArray()) {
            for (String value : val.getMultipleValues()) {
                values.add(value);/*from  w ww. j a  va 2s .c  o  m*/
            }
        } else {
            values.add(val.getSingleValue());
        }
    }
    if (StringUtils.isNotBlank(format)) {
        for (int i = 0; i < values.size(); i++) {
            values.set(i, String.format(format, values.get(i)));
        }
    }
    return StringUtils.join(values, ";");
}

From source file:info.pancancer.arch3.worker.CollectingLogOutputStream.java

/**
 * Get all the lines concatenated into a single string, with \n between each line.
 * //from  w w  w.ja v  a 2  s . c  o m
 * @return
 */
public String getAllLinesAsString() {
    Lock lock = new ReentrantLock();
    lock.lock();
    // TODO: Add functionality to allow other join characters besides \n ? (not urgent)
    String allTheLines = StringUtils.join(this.lines, "\n");
    lock.unlock();
    return allTheLines;
}

From source file:com.njmd.framework.utils.memcached.SpyMemcachedClient.java

/**
 * ??KeyskeyPrefix//w ww.j  a v  a  2 s.  c  o  m
 * 
 * @param <T>
 * @param keys
 * @param keyPrefix
 * @return
 */
public <T> Map<String, T> getBulk(String[] keyArray, String keyPrefix) {
    try {
        List<String> keyList = new ArrayList<String>();
        for (String key : keyArray) {
            keyList.add(keyPrefix + key);
        }
        return (Map<String, T>) memcachedClient.getBulk(keyList);
    } catch (RuntimeException e) {
        handleException(e, StringUtils.join(keyArray, ","));
        return null;
    }
}

From source file:ca.uhn.fhir.rest.method.HttpGetClientInvocation.java

public HttpGetClientInvocation(FhirContext theContext, Map<String, List<String>> theParameters,
        List<String> theUrlFragments) {
    super(theContext);
    myParameters = theParameters;//from  w  ww  .  j  av a2 s. c o m
    myUrlPath = StringUtils.join(theUrlFragments, '/');
}

From source file:com.flowpowered.cerealization.config.migration.NewJoinedKey.java

@Override
public String[] convertKey(String[] key) {
    String oldKey = StringUtils.join(key, config.getPathSeparator());
    return config.getPathSeparatorPattern().split(newKeyPattern.replace("%", oldKey));
}

From source file:edu.emory.cci.aiw.i2b2etl.dest.table.BlobBuilder.java

final String build() {
    String[] fields = getFields();
    StringUtil.escapeDelimitedColumnsInPlace(fields, REPLACE, this.delimiter);
    return StringUtils.join(fields, this.delimiter);
}

From source file:annis.sqlgen.AbstractUnionSqlGenerator.java

@Override
public String toSql(QueryData queryData, String indent) {
    Assert.notEmpty(queryData.getAlternatives(), "BUG: no alternatives");

    StringBuffer sb = new StringBuffer();

    sb.append(indent);/*from  w w  w  . j av  a  2s  .  co  m*/
    List<String> alternatives = new ArrayList<String>();
    for (List<QueryNode> alternative : queryData.getAlternatives()) {
        alternatives.add(createSqlForAlternative(queryData, alternative, indent));
    }
    sb.append(StringUtils.join(alternatives, "\n" + indent + "UNION "));

    // ORDER BY and LIMIT/OFFSET clauses cannot depend on alternative?
    appendOrderByClause(sb, queryData, null, indent);
    appendLimitOffsetClause(sb, queryData, null, indent);

    return sb.toString();
}

From source file:de.helmholtz_muenchen.ibis.ngs.vcfmerger.VCFMerger.java

/**
 * Executes vcf-merge /*from  www.j ava2s. c  o m*/
 * @param Files2Merge
 * @param Outfolder
 * @param exec
 * @param logger
 */
private static String merge_vcfs(String GATK, String RefGenome, LinkedList<String> Files2Merge,
        String Outfolder, String GenotypeMergeOption, ExecutionContext exec, NodeLogger logger,
        String OUTFILETAG) {
    ArrayList<String> command = new ArrayList<String>();

    String OUTFILE = Outfolder + "/AllSamples_vcfmerger" + OUTFILETAG + ".vcf";
    String ERRFILE = Outfolder + "/AllSamples_vcfmerger" + OUTFILETAG + ".vcf.err";

    command.add("java");
    command.add("-jar " + GATK);
    command.add("-T CombineVariants");
    command.add("-R " + RefGenome);
    command.addAll(Files2Merge);
    command.add("--genotypemergeoption " + GenotypeMergeOption);
    command.add("-o " + OUTFILE);

    try {
        Executor.executeCommand(new String[] { StringUtils.join(command, " ") }, exec, new String[] {}, logger,
                OUTFILE, ERRFILE);

    } catch (CanceledExecutionException | InterruptedException | ExecutionException
            | UnsuccessfulExecutionException e) {
        e.printStackTrace();
    }
    return OUTFILE;
}

From source file:com.act.lcms.db.model.PlateWell.java

protected String makeGetByPlateIDQuery() {
    return StringUtils.join(new String[] { "SELECT", StringUtils.join(this.getAllFields(), ','), "from",
            this.getTableName(), "where plate_id = ?", "order by plate_row asc, plate_column asc" }, " ");
}

From source file:dev.maisentito.suca.commands.ToCommandHandler.java

@Override
public void handleCommand(MessageEvent event, String[] args) throws Throwable {
    String userHost = formatUserHost(event.getUser());

    if (!messages.containsKey(args[0].toLowerCase())) {
        messages.put(args[0].toLowerCase(), new HashMap<String, String>());
    }/*  w  w w  .j  ava 2 s.  co m*/

    messages.get(args[0].toLowerCase()).put(userHost,
            StringUtils.join(Arrays.copyOfRange(args, 1, args.length), ' '));

    event.respond("message added to queue");
}