Example usage for org.springframework.util StringUtils collectionToCommaDelimitedString

List of usage examples for org.springframework.util StringUtils collectionToCommaDelimitedString

Introduction

In this page you can find the example usage for org.springframework.util StringUtils collectionToCommaDelimitedString.

Prototype

public static String collectionToCommaDelimitedString(@Nullable Collection<?> coll) 

Source Link

Document

Convert a Collection into a delimited String (e.g., CSV).

Usage

From source file:io.pivotal.strepsirrhini.chaosloris.docs.ConstrainedFields.java

FieldDescriptor withPath(String path) {
    String constraints = StringUtils
            .collectionToCommaDelimitedString(this.constraintDescriptions.descriptionsForProperty(path));

    return fieldWithPath(path).attributes(key("constraints").value(constraints));
}

From source file:org.zrgs.spring.statemachine.AbstractStateMachineCommands.java

@SuppressWarnings("unused")
@CliCommand(value = "sm state", help = "Prints current state")
public String state() {
    State<S, E> state = stateMachine.getState();
    if (state != null) {
        return StringUtils.collectionToCommaDelimitedString(state.getIds());
    } else {// w  ww .jav a  2 s. com
        return "No state";
    }
}

From source file:org.excalibur.core.deployment.validation.InvalidDeploymentException.java

@Override
public String getMessage() {
    StringBuilder sb = new StringBuilder("cyclic=").append(context_.isCyclic()).append(";errors:[");
    sb.append(StringUtils.collectionToCommaDelimitedString(context_.getErrors())).append("]");

    return sb.toString();
}

From source file:com.emc.ecs.sync.service.SyncRecord.java

/**
 * passing no fields will insert all fields
 *//*w  ww.  ja  va 2 s. c om*/
public static String insert(String tableName, String... fields) {
    String insert = "insert into " + tableName + " (";
    List<String> insertFields = new ArrayList<>(ALL_FIELDS);
    if (fields != null && fields.length > 0)
        insertFields = Arrays.asList(fields);
    insert += StringUtils.collectionToCommaDelimitedString(insertFields);
    insert += ") values (";
    for (int i = 0; i < insertFields.size(); i++) {
        insert += "?";
        if (i < insertFields.size() - 1)
            insert += ", ";
    }
    insert += ")";
    return insert;
}

From source file:org.cloudfoundry.identity.uaa.scim.job.AdminUsersTasklet.java

@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
    String authorities = StringUtils.collectionToCommaDelimitedString(
            AuthorityUtils.authorityListToSet(authority == UaaAuthority.UAA_USER ? UaaAuthority.USER_AUTHORITIES
                    : UaaAuthority.ADMIN_AUTHORITIES));
    for (String user : admins) {
        int updated = jdbcTemplate.update("update users set authorities=? where userName=?", authorities, user);
        contribution.incrementWriteCount(updated);
    }/*from www . j a v  a  2 s  . c o  m*/
    return RepeatStatus.FINISHED;
}

From source file:io.pivotal.example.order.status.OrderStatusController.java

@RequestMapping(value = "/status/{orderId}")
public String status(@PathVariable String orderId) {
    List<String> status = statusMap.get(orderId);
    return (status == null) ? "unknown\n" : StringUtils.collectionToCommaDelimitedString(status) + "\n";
}

From source file:lodsve.core.condition.OnClassCondition.java

@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {

    StringBuilder matchMessage = new StringBuilder();

    MultiValueMap<String, Object> onClasses = getAttributes(metadata, ConditionalOnClass.class);
    if (onClasses != null) {
        List<String> missing = getMatchingClasses(onClasses, MatchType.MISSING, context);
        if (!missing.isEmpty()) {
            return ConditionOutcome.noMatch("required @ConditionalOnClass classes not found: "
                    + StringUtils.collectionToCommaDelimitedString(missing));
        }/*  w w w .  j a  v  a2s. c  o  m*/
        matchMessage.append("@ConditionalOnClass classes found: ").append(StringUtils
                .collectionToCommaDelimitedString(getMatchingClasses(onClasses, MatchType.PRESENT, context)));
    }

    MultiValueMap<String, Object> onMissingClasses = getAttributes(metadata, ConditionalOnMissingClass.class);
    if (onMissingClasses != null) {
        List<String> present = getMatchingClasses(onMissingClasses, MatchType.PRESENT, context);
        if (!present.isEmpty()) {
            return ConditionOutcome.noMatch("required @ConditionalOnMissing classes found: "
                    + StringUtils.collectionToCommaDelimitedString(present));
        }
        matchMessage.append(matchMessage.length() == 0 ? "" : " ");
        matchMessage.append("@ConditionalOnMissing classes not found: ")
                .append(StringUtils.collectionToCommaDelimitedString(
                        getMatchingClasses(onMissingClasses, MatchType.MISSING, context)));
    }

    return ConditionOutcome.match(matchMessage.toString());
}

From source file:com.emc.ecs.sync.service.SyncRecord.java

public static String selectBySourceId(String tableName) {
    return "select " + StringUtils.collectionToCommaDelimitedString(ALL_FIELDS) + " from " + tableName
            + " where " + SOURCE_ID + " = ?";
}

From source file:com.apporiented.spring.override.MapMergeProcessor.java

@SuppressWarnings({ "rawtypes", "unchecked" })
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

    BeanDefinition bd = beanFactory.getBeanDefinition(ref);
    if (property == null) {
        Assert.state(MapFactoryBean.class.getName().equals(bd.getBeanClassName()),
                "Bean [" + ref + "] must be a MapFactoryBean");

        property = "sourceMap";
    }/*from   w w w.  ja v a  2 s . co m*/

    if (log.isInfoEnabled()) {
        String keys = StringUtils.collectionToCommaDelimitedString(entries.keySet());
        log.debug("Adding [" + keys + "] to " + ref + "." + property);
    }

    PropertyValue pv = bd.getPropertyValues().getPropertyValue(property);
    if (pv == null) {
        // No map set on the target bean, create a new one ...
        ManagedMap map = new ManagedMap();
        map.putAll(entries);
        bd.getPropertyValues().addPropertyValue(property, map);
    } else {
        Object value = pv.getValue();
        if (value instanceof RuntimeBeanReference) {
            RuntimeBeanReference ref = (RuntimeBeanReference) value;
            value = beanFactory.getBean(ref.getBeanName());
        }
        Assert.isInstanceOf(Map.class, value);
        Map map = (Map) value;
        map.putAll(entries);
    }
}

From source file:com.ethlo.kfka.mysql.MysqlKfkaMapStore.java

@Override
public Map<Long, T> loadAll(Collection<Long> keys) {
    logger.debug("Loading data for keys {}", StringUtils.collectionToCommaDelimitedString(keys));
    final List<T> res = tpl.query("SELECT * FROM kfka WHERE id IN (:keys)",
            Collections.singletonMap("keys", keys), mapper);
    final Map<Long, T> retVal = new HashMap<>(keys.size());
    res.forEach(e -> {//from   w ww  . j  a  va  2s. c o m
        retVal.put(e.getId(), e);
    });
    return retVal;
}