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:ch.ivyteam.ivy.maven.ShareEngineCoreClasspathMojo.java

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    List<File> ivyEngineClassPathFiles = EngineClassLoaderFactory
            .getIvyEngineClassPathFiles(identifyAndGetEngineDirectory());
    String propertyValue = StringUtils.join(ivyEngineClassPathFiles, ",");

    MavenProperties properties = new MavenProperties(project, getLog());
    properties.setMavenProperty(IVY_ENGINE_CORE_CLASSPATH_PROPERTY, propertyValue);
}

From source file:gov.uscis.vis.api.config.SwaggerPropertiesLoader.java

private Properties createSwaggerProperties(ConfigurableEnvironment env) {
    Properties properties = new Properties();
    properties.setProperty("swagger.title", "Jira Metrics API");
    properties.setProperty("swagger.description", "Jira Metrics API Documentation");
    properties.setProperty("swagger.version", env.getProperty("info.build.version"));
    properties.setProperty("swagger.base-path", "/jira-metrics-api");
    properties.setProperty("swagger.pretty-print", "true");
    properties.setProperty("swagger.scan", "true");
    properties.setProperty("swagger.contact", "");
    properties.setProperty("swagger.license", "");
    properties.setProperty("swagger.licenseUrl", "");

    // Packages that should be added as resources visible in swagger
    List<String> packagesToAdd = new ArrayList<>();
    packagesToAdd.add("gov.uscis.vis.api");
    //        packagesToAdd.add("gov.uscis.visapi.common.batch.resource");
    // Add scan packages
    properties.setProperty("swagger.resourcePackage", StringUtils.join(packagesToAdd, ","));

    return properties;
}

From source file:net.ontopia.persistence.rdbms.CSVExport.java

public void exportCSV(Writer writer, String table, String[] columns) throws SQLException, IOException {
    Statement stm = conn.createStatement();
    ResultSet rs = stm.executeQuery("select " + StringUtils.join(columns, ", ") + " from " + table);
    try {//from   w ww .j ava  2s.  c  om
        while (rs.next()) {
            for (int i = 1; i <= columns.length; i++) {
                if (i > 1)
                    writer.write(separator);
                writer.write('"');
                String value = rs.getString(i);
                if (value != null) {
                    writer.write(StringUtils.replace(value, "\"", "\\\""));
                }
                writer.write('"');
            }
            writer.write('\n');
        }
    } finally {
        rs.close();
        stm.close();
    }
    writer.flush();
}

From source file:cn.com.axiom.utils.Collections3.java

/**
 * ????(Getter), ??.//from   w ww .j  a  v  a2  s . c o m
 * 
 * @param collection ???.
 * @param propertyName ??????.
 * @param separator .
 */
@SuppressWarnings("rawtypes")
public static String extractToString(final Collection collection, final String propertyName,
        final String separator) {
    List list = extractToList(collection, propertyName);
    return StringUtils.join(list, separator);
}

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

@Override
protected void setParameters(PreparedStatement ps, ObservationFact record) throws SQLException {
    super.setParameters(ps, record);
    String[] rejectionReasons = record.getRejectionReasons();
    if (rejectionReasons.length > 0) {
        ps.setString(25, StringUtils.join(rejectionReasons, ", "));
    } else {/*from ww w  .  j a va2 s.  c  o m*/
        ps.setString(25, null);
    }
}

From source file:eu.delving.x3ml.TestCoinA.java

@Test
public void testSimpleCoinExample() {
    X3MLEngine engine = engine("/coin_a/01-coin-simple.x3ml");
    X3MLEngine.Output output = engine.execute(document("/coin_a/00-coin-input.xml"), VALUE_POLICY);
    String[] mappingResult = output.toStringArray();
    String[] expectedResult = xmlToNTriples("/coin_a/01-coin-simple-rdf.xml");
    //        System.out.println(StringUtils.join(expectedResult, "\n"));
    List<String> diff = compareNTriples(expectedResult, mappingResult);
    assertTrue("\n" + StringUtils.join(diff, "\n") + "\n", errorFree(diff));
}

From source file:com.github.tddts.jet.rest.client.esi.impl.RouteClientImpl.java

@Override
@Retry/*www  .java2s  .c o m*/
public RestResponse<List<Integer>> getRoute(int origin, int destination, int[] avoid, int[] connections,
        RouteOption routeOption) {
    UriComponentsBuilder builder = client.apiUriBuilder(addressRoutes);

    if (connections.length > 0)
        builder = builder.queryParam("avoid", StringUtils.join(avoid, ','));
    if (avoid.length > 0)
        builder = builder.queryParam("connections", StringUtils.join(connections, ','));

    String url = builder.queryParam("flag", routeOption.getValue()).build().toString();

    Map<String, ?> uriVariables = ImmutableMap.of("origin", origin, "destination", destination);

    return RestResponse
            .fromArrayResponse(client.restOperations().getForEntity(url, Integer[].class, uriVariables));
}

From source file:com.connio.sdk.request.deviceprofile.DeviceProfileReadRequest.java

@Override
protected Request request() {
    final Map<String, String> filter = new HashMap<>();

    if (StringUtils.isNotBlank(base))
        filter.put("base", base);
    if (tags != null && tags.size() > 0)
        filter.put("tags", StringUtils.join(tags, ","));

    filter.putAll(getPaginationParameters());

    return Request.get("deviceprofiles", filter);
}

From source file:com.lexicalintelligence.admin.add.AddRequest.java

public AddResponse execute() {
    List<BasicNameValuePair> params = Collections
            .singletonList(new BasicNameValuePair(getName(), StringUtils.join(items, ",")));
    AddResponse addResponse;//from   ww w. j  av  a 2 s  . c o m
    Reader reader = null;
    try {
        HttpResponse response = client.getHttpClient().execute(new HttpGet(client.getUrl() + PATH + getPath()
                + "?" + URLEncodedUtils.format(params, StandardCharsets.UTF_8)));
        reader = new InputStreamReader(response.getEntity().getContent(), StandardCharsets.UTF_8);
        addResponse = new AddResponse(Boolean.valueOf(IOUtils.toString(reader)));
    } catch (Exception e) {
        addResponse = new AddResponse(false);
        log.error(e);
    } finally {
        try {
            reader.close();
        } catch (Exception e) {
            log.error(e);
        }
    }
    return addResponse;
}

From source file:eu.delving.x3ml.TestCoinB.java

@Test
public void test10Join() {
    X3MLEngine engine = engine("/coin_b/10-join.x3ml");
    Generator policy = X3MLGeneratorPolicy.load(resource("/coin_a/00-generator-policy.xml"),
            X3MLGeneratorPolicy.createUUIDSource(2));
    X3MLEngine.Output output = engine.execute(document("/coin_b/01-coin-input-simplified.xml"), policy);
    String[] mappingResult = output.toStringArray();
    //        output.writeXML(System.out);
    String[] expectedResult = xmlToNTriples("/coin_b/10-join-rdf.xml");
    List<String> diff = compareNTriples(expectedResult, mappingResult);
    assertTrue("\nLINES:" + diff.size() + "\n" + StringUtils.join(diff, "\n") + "\n", errorFree(diff));
}