List of usage examples for org.apache.commons.lang StringUtils join
public static String join(Collection<?> collection, String separator)
Joins the elements of the provided Collection
into a single String containing the provided elements.
From source file:gov.nih.nci.ispy.web.reports.quick.QuickReporterReport.java
public static StringBuffer quickReporterReport(List<String> reporters, String session, String taskId) { StringBuffer html = new StringBuffer(); Document document = DocumentHelper.createDocument(); Element table = document.addElement("table").addAttribute("id", "reportTable").addAttribute("class", "report"); Element tr = null;/*from w w w . j a va 2 s . c om*/ Element td = null; tr = table.addElement("tr").addAttribute("class", "header"); td = tr.addElement("td").addAttribute("class", "header").addText("Reporter"); td = tr.addElement("td").addAttribute("class", "header").addText("Gene Symbol"); td = tr.addElement("td").addAttribute("class", "header").addText("GenBank AccId"); td = tr.addElement("td").addAttribute("class", "header").addText("LocusLink"); if (reporters != null) { try { GeneExprAnnotationService geService = GeneExprAnnotationServiceFactory.getInstance(); List<ReporterAnnotation> reporterAnnotations = geService.getAnnotationsListForReporters(reporters); for (ReporterAnnotation reporterAnnotation : reporterAnnotations) { if (reporterAnnotation != null) { tr = table.addElement("tr").addAttribute("class", "data"); //String reporter = reporterAnnotation.getReporter()!=null ? reporterAnnotation.getReporter().getValue().toString() : "N/A"; td = tr.addElement("td").addText(reporterAnnotation.getReporterId()); //html.append("ReporterID :" +reporterResultset.getReporter().getValue().toString() + "<br/>"); Collection<String> geneSymbols = (Collection<String>) reporterAnnotation.getGeneSymbols(); String genes = ""; if (geneSymbols != null) { genes = StringUtils.join(geneSymbols.toArray(), ","); } if (!genes.equals("")) { td = tr.addElement("td").addText(genes).addAttribute("class", "gene") .addAttribute("name", "gene").addAttribute("id", genes).addElement("input") .addAttribute("type", "checkbox").addAttribute("name", "checkable") .addAttribute("class", "saveElement").addAttribute("value", genes); } else { td = tr.addElement("td").addText(genes).addAttribute("class", "gene") .addAttribute("name", "gene").addAttribute("id", genes); } Collection<String> genBank_AccIDS = (Collection<String>) reporterAnnotation .getGenbankAccessions(); String accs = ""; if (genBank_AccIDS != null) { accs = StringUtils.join(genBank_AccIDS.toArray(), ","); } td = tr.addElement("td").addText(accs); Collection<String> locusLinkIDs = (Collection<String>) reporterAnnotation.getLocusLinkIds(); String ll = ""; if (locusLinkIDs != null) { ll = StringUtils.join(locusLinkIDs.toArray(), ","); } td = tr.addElement("td").addText(ll); } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } //return html; return html.append(document.asXML()); }
From source file:ddf.security.permission.Permissions.java
public static List<String> getPermissionsAsStrings(Map<String, Set<String>> attributes) { if (attributes == null) { return Collections.emptyList(); }//from w w w .ja v a 2s .c o m List<String> stringAttributes = new ArrayList<>(attributes.size()); StringBuilder sb = new StringBuilder(); for (Map.Entry<String, Set<String>> entry : attributes.entrySet()) { sb.append(entry.getKey()); sb.append("="); sb.append(StringUtils.join(entry.getValue(), ",")); stringAttributes.add(sb.toString()); sb.setLength(0); } return stringAttributes; }
From source file:io.viewserver.operators.table.TableKeyDefinition.java
public String getKeyName() { return StringUtils.join(this.keys, SEPARATOR); }
From source file:com.netflix.paas.cassandra.keys.ColumnFamilyKey.java
public String getCanonicalName() { return StringUtils.join(new String[] { keyspaceKey.getCanonicalName(), columnFamilyName }, "."); }
From source file:com.pinterest.secor.parser.DailyOffsetMessageParser.java
@Override public String[] extractPartitions(Message message) throws Exception { long offset = message.getOffset(); long offsetsPerPartition = mConfig.getOffsetsPerPartition(); long partition = (offset / offsetsPerPartition) * offsetsPerPartition; String[] dailyPartition = generatePartitions(new Date().getTime(), mUsingHourly, mUsingMinutely); String dailyPartitionPath = StringUtils.join(dailyPartition, '/'); String[] result = { dailyPartitionPath, offsetPrefix + partition }; return result; }
From source file:com.cognifide.cq.cqsm.api.logger.ProgressEntry.java
public ProgressEntry(ActionDescriptor actionDescriptor, ActionResult actionResult) { this.actionName = actionDescriptor.getAction().getClass().getSimpleName(); this.command = actionDescriptor.getCommand(); this.parameters = StringUtils.join(actionDescriptor.getArgs(), " "); this.authorizable = actionResult.getAuthorizable(); this.messages = new LinkedList<>(actionResult.getMessages()); this.status = actionResult.getStatus(); }
From source file:edu.cwru.jpdg.Javac.java
/** * loads a java file from the resources directory. Give the fully * qualified name of the java file. eg. for: * * source/test/resources/java/test/parse/HelloWorld.java * * give://from w w w. j ava2 s. c om * * test.parse.HelloWorld */ public static String load(String full_name) { ClassLoader loader = Javac.class.getClassLoader(); String[] split = StringUtils.split(full_name, "."); String name = split[split.length - 1]; String slash_name = StringUtils.join(split, pathsep); String resource = Paths.get("java").resolve(slash_name + ".java").toString(); InputStream ci = loader.getResourceAsStream(resource); BufferedReader bi = new BufferedReader(new InputStreamReader(ci)); List<String> lines = new ArrayList<String>(); String line; try { while ((line = bi.readLine()) != null) { lines.add(line); } } catch (IOException e) { throw new RuntimeException(e.getMessage()); } lines.add(line); return StringUtils.join(lines, "\n"); }
From source file:com.mindmutex.draugiem.requests.UserDataRequest.java
public UserDataRequest(Long[] userIds) { if (userIds.length > 100) { throw new DraugiemException("userIds limit is exceeded. only 100 ids allowed"); }// w w w . jav a 2 s . c o m addParam("action", "userdata"); addParam("ids", StringUtils.join(userIds, ",")); }
From source file:edu.northwestern.bioinformatics.studycalendar.dataproviders.commands.BusyBoxCommand.java
private void reportInvalidSubcommand(PrintStream err) { err.println(String.format("Please specify a valid subcommand (%s)", StringUtils.join(subcommands.keySet().iterator(), ", "))); }
From source file:de.tudarmstadt.ukp.experiments.argumentation.convincingness.features.POSNGramFeature.java
public static FrequencyDistribution<String> getSentencePosNGrams(JCas jcas, int minN, int maxN, boolean useCanonical, Paragraph paragraph) { FrequencyDistribution<String> result = new FrequencyDistribution<String>(); List<String> posTagString = new ArrayList<String>(); for (POS p : JCasUtil.selectCovered(jcas, POS.class, paragraph)) { if (useCanonical) { posTagString.add(p.getClass().getSimpleName()); } else {//from w w w . j ava 2 s. com posTagString.add(p.getPosValue()); } } String[] posAsArray = posTagString.toArray(new String[posTagString.size()]); for (List<String> nGram : new NGramStringListIterable(posAsArray, minN, maxN)) { result.inc(StringUtils.join(nGram, "_")); } return result; }