Java Code Examples for org.apache.commons.lang3.StringUtils#join()

The following examples show how to use org.apache.commons.lang3.StringUtils#join() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
    Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
    List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
    for (CodegenOperation op : operationList) {
        String path = op.path;
        String[] items = path.split("/", -1);
        String opsPath = "";
        int pathParamIndex = 0;

        for (int i = 0; i < items.length; ++i) {
            if (items[i].matches("^\\{(.*)\\}$")) { // wrap in {}
                // camelize path variable
                items[i] = "{" + camelize(items[i].substring(1, items[i].length() - 1), true) + "}";
            }
        }

        op.path = StringUtils.join(items, "/");
    }

    return objs;
}
 
Example 2
@Override
public String getPermissionIds(final String[] codes) {
    if (ArrayUtils.isEmpty(codes)) {
        return StringUtils.EMPTY;
    }

    final List<String> permIds = new ArrayList<>(codes.length);
    for (final String code : codes) {
        final String key = code.trim().toLowerCase();
        if (cache.containsKey(key)) {
            permIds.add(String.valueOf(cache.get(key).getId()));
        }
    }

    return StringUtils.join(permIds, ',');
}
 
Example 3
@Override
protected Pattern getTargetedUrlPattern() {
    String availableTargetIds = StringUtils.join(targetIdManager.getAvailableTargetIds(), '|');
    String targetedUrlByFilePattern = String.format(TARGETED_URL_REGEX_FORMAT, availableTargetIds);

    return Pattern.compile(targetedUrlByFilePattern);
}
 
Example 4
@Override
public void run(String[] args) {
	String line = StringUtils.join(args, " ");
	try {
		writeStdin(line);
	} catch (Throwable e) {
		err.println(getStackTrace(e));
		shutdown();
	}
}
 
Example 5
Source Project: disconf   File: ZkDeployMgrImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 获取ZK的详细部署信息
 */
@Override
public String getDeployInfo(String app, String env, String version) {

    // 路径获取
    String url = ZooPathMgr.getZooBaseUrl(zooConfig.getZookeeperUrlPrefix(), app, env, version);

    List<String> hostInfoList = zooKeeperDriver.getConf(url);

    return StringUtils.join(hostInfoList, '\n');
}
 
Example 6
/**
 * Remove characters that is not good to be included in method name from the input and camelize it
 *
 * @param name string to be camelize
 * @param nonNameElementPattern a regex pattern of the characters that is not good to be included in name
 * @return camelized string
 */
protected String removeNonNameElementToCamelCase(final String name, final String nonNameElementPattern) {
    String result = StringUtils.join(Lists.transform(Lists.newArrayList(name.split(nonNameElementPattern)), new Function<String, String>() {
        @Nullable
        @Override
        public String apply(String input) {
            return StringUtils.capitalize(input);
        }
    }), "");
    if (result.length() > 0) {
        result = result.substring(0, 1).toLowerCase() + result.substring(1);
    }
    return result;
}
 
Example 7
/** Helper method to detect a race condition between fetching the shards via paginated DescribeStream calls
 * and a reshard operation.
 * @param inconsistentShardIds
 * @throws KinesisClientLibIOException
 */
private static void assertAllParentShardsAreClosed(final Set<String> inconsistentShardIds)
    throws KinesisClientLibIOException {
    if (!CollectionUtils.isNullOrEmpty(inconsistentShardIds)) {
        final String ids = StringUtils.join(inconsistentShardIds, ' ');
        throw new KinesisClientLibIOException(String.format(
                "%d open child shards (%s) are inconsistent. This can happen due to a race condition between describeStream and a reshard operation.",
                inconsistentShardIds.size(), ids));
    }
}
 
Example 8
private String toCommaSeparatedRoleList(com.liferay.portal.model.User liferayUser)throws SystemException {
  List<String> roleNames = new ArrayList<>();
  for (Role role : liferayUser.getRoles()) {
    roleNames.add(role.getName());
  }
  return StringUtils.join(roleNames, ",");
}
 
Example 9
Source Project: nifi   File: StandardNiFiUser.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    final String formattedGroups;
    if (groups == null) {
        formattedGroups = "none";
    } else {
        formattedGroups = StringUtils.join(groups, ", ");
    }

    return String.format("identity[%s], groups[%s]", getIdentity(), formattedGroups);
}
 
Example 10
Source Project: RestServices   File: ChangeLogManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Determines on which settings this index was build. If changed, a new index should be generated
 * @param def
 * @return
 */
private String calculateServiceConfigurationHash(DataServiceDefinition def) {
	IMetaObject returnType = Core.getMetaObject(Core.getReturnType(def.getOnPublishMicroflow()).getObjectType());
	JSONObject exporttype = JSONSchemaBuilder.build(returnType);
	
	return StringUtils.join(new String[] {
		def.getSourceEntity(), 
		def.getSourceKeyAttribute(), 
		def.getSourceConstraint(),
		exporttype.toString()
	},";");
}
 
Example 11
Source Project: fess   File: StopwordsItem.java    License: Apache License 2.0 5 votes vote down vote up
public String toLineString() {
    if (isUpdated()) {
        return StringUtils.join(newInput);
    } else {
        return StringUtils.join(input);
    }
}
 
Example 12
Source Project: jkube   File: AwsSigner4Request.java    License: Eclipse Public License 2.0 5 votes vote down vote up
AwsSigner4Request(String region, String service, HttpRequest request, Date signingTime) {
    this.region = region;
    this.service = service;
    this.request = request;

    signingDateTime = getSigningDateTime(request, signingTime);
    signingDate = signingDateTime.substring(0, 8);
    scope = signingDate + '/' + region + '/' + service + "/aws4_request";
    method = request.getRequestLine().getMethod();
    uri = getUri(request);

    Map<String, String> headers = getOrderedHeadersToSign(request.getAllHeaders());
    signedHeaders = StringUtils.join(headers.keySet(), ';');
    canonicalHeaders = canonicalHeaders(headers);
}
 
Example 13
@Override
public String convertToDatabaseColumn(List<String> attribute) {
    if (attribute == null || attribute.isEmpty()) {
        return "";
    }
    return StringUtils.join(attribute, ",");
}
 
Example 14
/**
 * Returns the array of with double quotes around any argument with spaces
 * in it so it can be run from the command line.
 */
static public String getArgsForCopyAndPaste(String[] args) {
	String[] result = new String[args.length];

	for (int i = 0; i < args.length; ++i) {
		String arg = args[i];
		result[i] = arg.contains(" ") ? "\"" + arg + "\"" : arg;
	}

	return StringUtils.join(result, " ");
}
 
Example 15
Source Project: gocd   File: ConsoleResult.java    License: Apache License 2.0 4 votes vote down vote up
public String errorForDisplayAsString() {
    return StringUtils.join(forDisplay(error), "\n");
}
 
Example 16
Source Project: apollo   File: ApolloClient.java    License: Apache License 2.0 4 votes vote down vote up
private <T> String createCsvFromList(List<T> list) {
    return StringUtils.join(list, ",");
}
 
Example 17
Source Project: jackcess   File: QueryTest.java    License: Apache License 2.0 4 votes vote down vote up
private static String multiline(String... strs)
{
  return StringUtils.join(strs, System.lineSeparator());
}
 
Example 18
public static String toListString(String[] list) {
	return "(" + StringUtils.join(list) + ")";
}
 
Example 19
Source Project: stratio-cassandra   File: Directories.java    License: Apache License 2.0 4 votes vote down vote up
private static String join(String... s)
{
    return StringUtils.join(s, File.separator);
}
 
Example 20
public void drawReaction(MongoDB db, Long reactionId, String dirPath, boolean includeCofactors) throws IOException {

    RxnMolecule renderedReactionMolecule = getRxnMolecule(db, reactionId, includeCofactors);

    String fileName = StringUtils.join(new String[] {reactionId.toString(), ".", format});
    drawRxnMolecule(renderedReactionMolecule, new File(dirPath, fileName));
  }