List of usage examples for org.springframework.util StringUtils collectionToDelimitedString
public static String collectionToDelimitedString(@Nullable Collection<?> coll, String delim)
From source file:org.obiba.rserver.service.RServerService.java
private ProcessBuilder buildRProcess() { List<String> args = getArguments(); log.info("Starting R server: {}", StringUtils.collectionToDelimitedString(args, " ")); ProcessBuilder pb = new ProcessBuilder(args); pb.directory(getWorkingDirectory()); pb.redirectErrorStream(true);/* ww w .j av a 2 s . c o m*/ pb.redirectOutput(ProcessBuilder.Redirect.appendTo(getRserveLogFile())); return pb; }
From source file:net.collegeman.grails.e3db.SqlBuffer.java
public final String getSql() { return StringUtils.collectionToDelimitedString(sql, conjunction); }
From source file:eionet.transfer.controller.UserController.java
private String rolesAsString(List<String> authorisations) { if (authorisations == null) { return "no roles"; } else {/*from w w w . jav a2 s . c o m*/ //return String.join(", ", authorisations); // Only works on Java 8 return "roles " + StringUtils.collectionToDelimitedString(authorisations, ", "); } }
From source file:org.openmrs.module.pcslabinterface.PcsLabInterfaceQueueProcessor.java
/** * process the message and apply rules//from w ww. ja v a2 s .c om * * @param data the message to be processed * @return results of processing the message * @should remove commas from HIV Viral Loads * @should correct values with modifiers from HIV Viral Loads * @should process values with both commas and modifiers from HIV Viral Loads * @should change ST to NM for numeric concepts * @should not process EID messages * @should remove null strings from final results */ protected String preProcessMessage(String data) { // bail if not a PCS message if (data == null || !data.contains("PCSLABPLUS")) { return data; } // TODO '\r' happens to be the character between lines at this time, but // this may not always be the case. we should make this more flexible to // recognize line endings String[] lines = data.split(PcsLabInterfaceConstants.MESSAGE_EOL_SEQUENCE); List<String> results = new ArrayList<String>(); // loop through lines of the HL7 for (String line : lines) { // loop through transform rules for (TransformRule rule : PcsLabInterfaceConstants.TRANSFORM_RULES()) if (rule.matches(line)) // TODO perhaps expect a list back from transform() so we can addAll() results line = rule.transform(line); // append the line to the results results.add(line); } // remove empty strings from list List<String> finished = new ArrayList<String>(); for (String line : results) { if (StringUtils.hasText(line)) finished.add(line); } return StringUtils.collectionToDelimitedString(finished, PcsLabInterfaceConstants.MESSAGE_EOL_SEQUENCE); }
From source file:org.syncope.console.commons.PreferenceManager.java
public void set(final Request request, final Response response, final Map<String, List<String>> prefs) { Cookie prefCookie = ((WebRequest) request).getCookie(Constants.PREFS_COOKIE_NAME); final Map<String, String> current = new HashMap<String, String>(); if (prefCookie == null || !StringUtils.hasText(prefCookie.getValue())) { prefCookie = new Cookie(Constants.PREFS_COOKIE_NAME, null); } else {/*from w w w .j ava 2 s . com*/ current.putAll(getPrefs(new String(Base64.decodeBase64(prefCookie.getValue().getBytes())))); } // after retrieved previous setting in order to overwrite the key ... for (Entry<String, List<String>> entry : prefs.entrySet()) { current.put(entry.getKey(), StringUtils.collectionToDelimitedString(entry.getValue(), ";")); } try { prefCookie.setValue(new String(Base64.encodeBase64(setPrefs(current).getBytes()))); } catch (IOException e) { LOG.error("Could not set preferences " + current, e); } prefCookie.setMaxAge(ONE_YEAR_TIME); ((WebResponse) response).addCookie(prefCookie); }
From source file:fr.openwide.talendalfresco.alfresco.XmlContentImporterResultHandler.java
/** * @param context null if container case * @param nodeRef can't be null/* w w w . jav a 2s . c o m*/ * @param msg */ public void nodeSuccess(ImportNode context, NodeRef nodeRef, String msg) { String typeInfo = null; // node case : take info from context TypeDefinition typeDef = context.getTypeDefinition(); if (typeDef != null) { String nodeAspects = StringUtils.collectionToDelimitedString(context.getNodeAspects(), " "); typeInfo = typeDef.getName() + " " + nodeAspects; } this.nodeSuccess(nodeRef, typeInfo, msg); }
From source file:org.focusns.common.validation.ValidationHelper.java
/** * ??//from ww w . j a v a 2s . c o m * * @param constraintDescriptor * @return */ private static List<String> getConstraintParams(ConstraintDescriptor<?> constraintDescriptor) { Annotation constraintInstance = constraintDescriptor.getAnnotation(); Class<?> constraintClass = constraintDescriptor.getAnnotation().annotationType(); // List<String> params = new ArrayList<String>(); // Method valueMethod = ClassUtils.getMethodIfAvailable(constraintClass, "value", (Class<?>[]) null); if (valueMethod != null) { String value = String.valueOf(ReflectionUtils.invokeMethod(valueMethod, constraintInstance)); params.add("value:" + value); } Map<String, Object> annotationAttrs = AnnotationUtils.getAnnotationAttributes(constraintInstance); for (String key : annotationAttrs.keySet()) { if ("message".equals(key) || "payload".equals(key)) { continue; } // String value = ""; if ("groups".equals(key)) { List<String> groupNames = new ArrayList<String>(); Class[] groupClasses = (Class[]) annotationAttrs.get(key); for (Class groupClass : groupClasses) { groupNames.add(groupClass.getName()); } value = StringUtils.collectionToDelimitedString(groupNames, "|"); } else { value = String.valueOf(annotationAttrs.get(key)); } // if (StringUtils.hasText(value)) { params.add(key + ":" + "'" + value + "'"); } } // return params; }
From source file:org.synyx.hades.dao.query.Parameter.java
@Override public String toString() { StringBuilder builder = new StringBuilder(type.getName()); builder.append(StringUtils.collectionToDelimitedString(annotations, " ")); return builder.toString(); }
From source file:org.springsource.ide.eclipse.commons.internal.configurator.Configurator.java
public void executePendingRequests() { String configureTargets = Activator.getDefault().getPreferenceStore() .getString(Activator.PROPERTY_CONFIGURE_TARGETS); List<String> newConfigureTargets = new ArrayList<String>(); if (StringUtils.hasLength(configureTargets)) { StringTokenizer targets = new StringTokenizer(configureTargets, File.pathSeparator); while (targets.hasMoreTokens()) { String target = targets.nextToken(); Map<String, String> parameters = new HashMap<String, String>(); if (target.startsWith("extension=")) { parameters.put(PARAM_EXTENSION, target.substring("extension=".length())); } else { parameters.put(PARAM_TARGET, target); }/* w w w . ja v a2 s .c o m*/ IStatus status = execute(parameters, true); if (!status.isOK()) { newConfigureTargets.add(target); } } } Activator.getDefault().getPreferenceStore().setValue(Activator.PROPERTY_CONFIGURE_TARGETS, StringUtils.collectionToDelimitedString(newConfigureTargets, File.pathSeparator)); }
From source file:net.sf.appstatus.batch.jdbc.JdbcBatchProgressMonitor.java
private void updateDb(boolean force) { if (force || isLoggable(lastDbSave)) { try {// w ww . j av a2s . c o m lastDbSave = System.currentTimeMillis(); getBatch().getBdBatch().setStatus(readableStatus()); // Current Item. String dbCurrentItem = null; if (currentItem != null) { //Convert to string and ensure max size. String toString = currentItem.toString(); dbCurrentItem = toString.substring(0, Math.min(254, toString.length())); } getBatch().getBdBatch().setCurrentItem(dbCurrentItem); if (!org.apache.commons.lang3.StringUtils.isEmpty(getMainMonitor().getLastMessage()) && getMainMonitor().getLastMessage().length() > 1024) { getBatch().getBdBatch().setLastMessage(getMainMonitor().getLastMessage().substring(0, 1023)); } else { getBatch().getBdBatch().setLastMessage(getMainMonitor().getLastMessage()); } getBatch().getBdBatch().setStartDate(getMainMonitor().getStartDate()); getBatch().getBdBatch().setEndDate(getMainMonitor().getEndDate()); getBatch().getBdBatch().setCurrentTask(taskName); getBatch().getBdBatch().setProgress(getMainMonitor().getProgress() == -1f ? -1 : getMainMonitor().getProgress() * 100f / getMainMonitor().getTotalWork()); getBatch().getBdBatch().setLastUpdate(getMainMonitor().getLastUpdate()); getBatch().getBdBatch().setSuccess(getMainMonitor().isSuccess()); getBatch().getBdBatch().setReject( StringUtils.collectionToDelimitedString(getMainMonitor().getRejectedItems(), "|")); getBatch().getBdBatch().setItemCount(getMainMonitor().getItemCount()); batchDao.update(getBatch().getBdBatch()); } catch (Exception e) { getLogger().error("Error when updating batch table {}", ToStringBuilder.reflectionToString(getBatch().getBdBatch()), e); } } }