List of usage examples for org.springframework.util StringUtils collectionToDelimitedString
public static String collectionToDelimitedString(@Nullable Collection<?> coll, String delim)
From source file:com.sfs.captor.model.AuthUser.java
/** * display user roles as delimited string * // w w w . j a v a2s .com * @return string with delimited roles */ public String getUserRoles() { List<String> roles = new ArrayList<String>(); for (AuthRole authRole : this.authRoles) { roles.add(authRole.getRoleName()); } return StringUtils.collectionToDelimitedString(roles, ","); }
From source file:org.syncope.console.commons.PreferenceManager.java
public void setList(final Request request, final Response response, final String key, final List<String> values) { set(request, response, key, StringUtils.collectionToDelimitedString(values, ";")); }
From source file:org.springsource.ide.eclipse.commons.internal.configurator.ui.ConfiguratorPreferencesPage.java
private void initWidgets() { resetUserLocation();// ww w . j av a2s .c om useDefaultUserLocationButton.setSelection(userLocationText.getText() .equals(getPreferenceStore().getDefaultString(Activator.PROPERTY_USER_INSTALL_PATH))); userLocationText.setEnabled(!useDefaultUserLocationButton.getSelection()); browseButton.setEnabled(!useDefaultUserLocationButton.getSelection()); if (searchLocationsLabel != null) { searchLocationsLabel .setText(StringUtils.collectionToDelimitedString(importer.getSearchLocations(), ", ")); } }
From source file:fr.openwide.talendalfresco.alfresco.NamePathServiceImpl.java
/** * Returns the namePath, starts below the company home ("Alfresco"). * Impl : could use a cache for better perfs, but Alfresco props are already cached (EHCache), * so for now it's ok like this.//from w w w . j av a 2 s . c o m * @param importNodeContext * @return null if null or non existing noderef */ public String getNamePath(NodeRef nodeRef, String pathDelimiter) { if (nodeRef == null || !nodeService.exists(nodeRef)) { return null; } java.util.ArrayList<String> pathNames = new java.util.ArrayList<String>(); for (NodeRef currentParentRef = nodeRef; currentParentRef != null; currentParentRef = nodeService .getPrimaryParent(currentParentRef).getParentRef()) { String parentName = (String) nodeService.getProperty(currentParentRef, ContentModel.PROP_NAME); pathNames.add(0, parentName); } pathNames.remove(0); // remove root node pathNames.remove(0); // remove company node "Alfresco" return pathDelimiter + StringUtils.collectionToDelimitedString(pathNames, pathDelimiter); }
From source file:org.web4thejob.util.CoreUtil.java
public static String describeClass(Class<?> clazz) { List<String> classes = new ArrayList<String>(); classes.add(clazz.getCanonicalName()); for (Class<?> cls : ClassUtils.getAllInterfacesForClassAsSet(clazz)) { classes.add(cls.getCanonicalName()); }//from w ww . j a v a2s .com return StringUtils.collectionToDelimitedString(classes, ", "); }
From source file:org.openmhealth.shim.jawbone.JawboneShim.java
@Override protected String getAuthorizationUrl(UserRedirectRequiredException exception) { final OAuth2ProtectedResourceDetails resource = getResource(); UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(exception.getRedirectUri()) .queryParam("state", exception.getStateKey()).queryParam("client_id", resource.getClientId()) .queryParam("response_type", "code") .queryParam("scope", StringUtils.collectionToDelimitedString(resource.getScope(), " ")) .queryParam("redirect_uri", getCallbackUrl()); return uriBuilder.build().encode().toUriString(); }
From source file:chibi.gemmaanalysis.GeneExpressionWriterCLI.java
@Override protected Exception doWork(String[] args) { StopWatch timer = new StopWatch(); timer.start();//w w w. j av a2 s . c o m String HEADER = "HEADER"; processCommandLine(args); Collection<Gene> genes; try { genes = getQueryGenes(); } catch (IOException e) { return e; } StringBuffer sb = new StringBuffer(); for (Gene gene : genes) { sb.append(gene.toString()); sb.append(", "); } log.info(genes.size() + " genes: " + sb.toString()); sb = new StringBuffer(); for (BioAssaySet bas : this.expressionExperiments) { sb.append(bas.toString()); sb.append(", "); } log.info(this.expressionExperiments.size() + " experiments: " + sb.toString()); Map<Object, StringBuffer> outBuffs = new HashMap<>(); String fileName = outFilePrefix + ".txt"; log.info("Output filename " + fileName); for (BioAssaySet bas : this.expressionExperiments) { ExpressionExperiment ee = (ExpressionExperiment) bas; Collection<ArrayDesign> ads = eeService.getArrayDesignsUsed(ee); Collection<CompositeSequence> css = new HashSet<CompositeSequence>(); for (ArrayDesign ad : ads) { css.addAll(adService.getCompositeSequences(ad)); } log.info("===================================="); log.info("Experiment " + ee + "; Array Design " + ads + "; Composite sequences " + css.size()); Map<Gene, Collection<CompositeSequence>> gene2css = getGene2CsMap(css); // ExpressionDataDoubleMatrix dataMatrix = expressionDataMatrixService.getFilteredMatrix( ee, filterConfig // ); ExpressionDataDoubleMatrix dataMatrix = expressionDataMatrixService .getProcessedExpressionDataMatrix(ee); // store values inside a buffer if (!outBuffs.containsKey(HEADER)) { StringBuffer hb = new StringBuffer(); hb.append("Gene\tProbe\tID"); outBuffs.put(HEADER, hb); } for (BioMaterial bm : dataMatrix.getMatrix().getColNames()) { // bm.getFactorValues() // bm.getCharacteristics() // outBuffs.get( HEADER ) // .append( // "\t" + bm.getName() + "." // + StringUtils.collectionToDelimitedString( bm.getFactorValues(), "," ) ); outBuffs.get(HEADER) .append("\t" + ee.getShortName() + "." + bm.getName() + "." + StringUtils.collectionToDelimitedString(bm.getCharacteristics(), ",") + "." + StringUtils.collectionToDelimitedString(bm.getFactorValues(), ",")); } for (Gene gene : genes) { log.debug(" Getting component sequence for gene " + gene); Collection<CompositeSequence> c = gene2css.get(gene); if (c == null) { log.error("No composite sequences found for gene " + gene); continue; } for (CompositeSequence cs : c) { Double[] row = dataMatrix.getRow(cs); if (row == null) { log.error("Cannot get data from data matrix for " + gene.getOfficialSymbol() + " (" + cs.getName() + ")"); // continue; row = new Double[dataMatrix.getMatrix().columns()]; } if (!outBuffs.containsKey(cs)) { StringBuffer gb = new StringBuffer(); gb.append(gene.getOfficialSymbol() + "\t" + cs.getName() + "\t" + cs.getId()); outBuffs.put(cs, gb); } StringBuffer buf = new StringBuffer(); for (Double d : row) { if (d == null) buf.append("NA"); else buf.append(d); buf.append("\t"); } buf.deleteCharAt(buf.length() - 1); outBuffs.get(cs).append("\t" + buf.toString()); } } } // Output to file try (PrintWriter out = new PrintWriter(new FileWriter(fileName));) { out.println(outBuffs.get(HEADER)); for (Object key : outBuffs.keySet()) { if (key.equals(HEADER)) { continue; } out.println(outBuffs.get(key)); } } catch (IOException e) { return e; } log.info("Done. Wrote " + genes.size() + " genes and " + (outBuffs.keySet().size() - 1) + " composite sequences in " + this.expressionExperiments.size() + " experiments which took " + timer.getTime() + " ms. Output file " + fileName); return null; }
From source file:org.LexGrid.lexevs.metabrowser.helper.ChildPagingJsonConverter.java
private String buildChildrenCuisString(List<String> childrenCuis) { StringBuffer sb = new StringBuffer(); sb.append(StringUtils.collectionToDelimitedString(childrenCuis, "$")); return sb.toString(); }
From source file:org.openmhealth.shim.googlefit.GoogleFitShim.java
@Override protected String getAuthorizationUrl(UserRedirectRequiredException exception) { final OAuth2ProtectedResourceDetails resource = getResource(); UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(exception.getRedirectUri()) .queryParam("state", exception.getStateKey()).queryParam("client_id", resource.getClientId()) .queryParam("response_type", "code").queryParam("access_type", "offline") .queryParam("approval_prompt", "force") .queryParam("scope", StringUtils.collectionToDelimitedString(resource.getScope(), " ")) .queryParam("redirect_uri", getCallbackUrl()); return uriBuilder.build().encode().toUriString(); }