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

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

Introduction

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

Prototype

public static String join(Collection<?> collection, String separator) 

Source Link

Document

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

Usage

From source file:com.mmj.app.lucene.solr.utils.BaseSolrQueryConvert.java

protected static SolrQuery createSearchQuery(List<String> params, List<String> fiters, SearchQuery searchQuery,
        String... searchHandler) {
    SolrQuery solrQuery = new SolrQuery();
    String query = null;/*from ww w .ja  va2  s  .  co m*/
    if (Argument.isEmpty(params)) {
        query = ("*:*");
    } else {
        query = StringUtils.join(params, " AND ");
        if (!StringUtils.join(params.toArray()).contains("*")) {
            if (Argument.isNotEmptyArray(searchHandler)) {
                solrQuery.setRequestHandler(
                        StringUtils.isEmpty(searchHandler[0]) ? "/select" : searchHandler[0]);
            }

        }
    }
    if (Argument.isNotEmpty(fiters)) {
        solrQuery.setFilterQueries(StringUtils.join(fiters, " AND "));
    }
    solrQuery.setQuery(query);
    solrQuery.setStart(searchQuery.getStart());
    solrQuery.setRows(searchQuery.getRows());
    if (StringUtils.isNotBlank(searchQuery.getSortFiled())) {
        solrQuery.addSort(searchQuery.getSortFiled(), searchQuery.getOrderBy());
    }
    return solrQuery;
}

From source file:com.mobiquitynetworks.statsutilspig.CreateCombinations.java

@Override
public String exec(Tuple tuple) throws IOException {

    String[] fields = tuple.get(0).toString().split(",");
    Integer fieldsCardinality = fields.length;
    //LOG.warn("--------------------------->>>>>>>>>>>>>>>>>>>>> THE AMOUNT OF FIELDS IS: "+ fieldsCardinality + " <<<<<<<<<<<<<<<<<<<<<<<<<<---------------------------");
    int[] combinationValues = getCombinationValues(fieldsCardinality);
    Map<Integer, Object> vectors = getVectors(fieldsCardinality);
    String symbol = "*";
    List<String[]> combStrings = computeCombinations(fields, combinationValues, vectors, symbol);
    //int combStrings = computeCombinations(fields, combinationValues, vectors, symbol);
    String returnCombination = "";
    for (int i = 0; i < combStrings.size(); i++) {
        String joined = StringUtils.join(combStrings.get(i), "|");
        if (i == combStrings.size() - 1) {
            returnCombination += joined;
        } else {//  w  w w. j ava 2s  .c  o  m
            returnCombination += joined + ",";
        }
    }

    return returnCombination;

}

From source file:com.github.hexocraft.random.items.command.RiCommandAddCommand.java

public RiCommandAddCommand(RandomItemsPlugin plugin) {
    super("addc", plugin);
    this.setAliases(Lists.newArrayList("ac", "addcommand"));
    this.setDescription(StringUtils.join(plugin.messages.cAddc, "\n"));
    this.setPermission(Permissions.CREATE.toString());

    this.addArgument(new CommandArgument<String>("name", ArgTypeRandomPool.get(), true, true,
            plugin.messages.cAddcArgName));
    this.addArgument(new CommandArgument<String>("command", ArgTypeString.get(), true, true,
            plugin.messages.cAddcArgCmd));
    this.addArgument(new CommandArgument<Integer>("weight", ArgTypeInteger.get(), true, true,
            plugin.messages.cAddcArgWeight));
    this.addArgument(new CommandArgument<String>("Description", ArgTypeString.get(), false, false,
            plugin.messages.cAddcArgDesc));
}

From source file:net.jetrix.commands.IgnoreCommand.java

public void execute(CommandMessage message) {
    // get the user sending this command
    Client client = (Client) message.getSource();
    User user = client.getUser();//from w w w . j  a  va  2  s.  c  o m

    // prepare the response
    PlineMessage response = new PlineMessage();

    if (message.getParameterCount() == 0) {
        // display the ignore list
        Set ignoredUsers = user.getIgnoredUsers();

        if (ignoredUsers.isEmpty()) {
            response.setKey("command.ignore.empty");
        } else {
            response.setKey("command.ignore.list", StringUtils.join(ignoredUsers.iterator(), ", "));
        }
    } else {
        // get the name of the (un)ignored player
        Client target = message.getClientParameter(0);
        String name = target != null ? target.getUser().getName() : message.getParameter(0);

        // add or remove the name from the ignore list
        if (user.ignores(name)) {
            user.unignore(name);
            response.setKey("command.ignore.removed", name);
        } else {
            user.ignore(name);
            response.setKey("command.ignore.added", name);
        }
    }

    // send the response
    client.send(response);
}

From source file:edu.uiowa.icts.bluebutton.json.view.FindLoincCodeList.java

public String getLoincCodeCsvList() {
    Set<String> loincCodeSet = new LinkedHashSet<String>();
    for (Vitals v : this.vitalsList) {
        for (VitalsResult vr : v.getResults()) {
            if (vr.getLoincCodeName() != null) {
                loincCodeSet.add(vr.getLoincCodeName());
            }//from   w w  w . j  ava2 s  .co  m
        }
    }
    for (Lab lab : this.labList) {
        for (LabResult labResult : lab.getResults()) {
            if (labResult.getLoincCodeName() != null) {
                loincCodeSet.add(labResult.getLoincCodeName());
            }
        }
    }
    return StringUtils.join(loincCodeSet, ",");
}

From source file:com.jslsolucoes.tagria.lib.grid.exporter.impl.CsvExporter.java

private void header(StringBuilder csv) {

    List<String> headers = new ArrayList<>();
    for (Header header : table.getHeaders()) {
        headers.add(header.getContent());
    }/*from ww w. ja v a 2  s .c  o m*/
    csv.append(StringUtils.join(headers.toArray(), ",").concat(System.lineSeparator()));
}

From source file:io.kodokojo.endpoint.BasicAuthenticator.java

@Override
public void handle(Request request, Response response) throws Exception {
    String authorization = request.headers("Authorization");
    if (StringUtils.isNotBlank(authorization) && authorization.startsWith("Basic ")) {
        String encoded = authorization.substring("Basic ".length());
        String decoded = new String(Base64.getDecoder().decode(encoded));
        String[] split = decoded.split(":");
        username = split[0];/*from   w w  w. j  a  va  2  s . c o  m*/
        password = split[1];
    } else if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Basic Authorization header not found.");
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("List of Header of current request {}", StringUtils.join(request.headers(), ","));
            LOGGER.trace("List of attribute : {}", StringUtils.join(request.attributes(), ","));
            LOGGER.trace("List of params : {}", StringUtils.join(request.queryParams(), ","));
        }
    }
}

From source file:com.microsoft.azure.shortcuts.services.samples.RegionsSample.java

private static void printRegion(Region region) throws Exception {
    System.out.println(String.format(
            "Region: %s\n" + "\tDisplay name: %s\n" + "\tAvailable VM sizes: %s\n"
                    + "\tAvailable web/worker role sizes: %s\n" + "\tAvailable services: %s\n"
                    + "\tAvailable storage account types: %s\n",
            region.id(), region.displayName(), StringUtils.join(region.availableVirtualMachineSizes(), ", "),
            StringUtils.join(region.availableWebWorkerRoleSizes(), ", "),
            StringUtils.join(region.availableServices(), ", "),
            StringUtils.join(region.availableStorageAccountTypes(), ", ")));
}

From source file:com.github.stagirs.lingvo.model.Form.java

@Override
public String toString() {
    return StringUtils.join(attrs, ",");
}

From source file:com.netscape.certsrv.key.KeyGenerationRequest.java

public void setUsages(List<String> usages) {
    attributes.put(KEY_USAGE, StringUtils.join(usages, ","));
}