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:com.amediamanager.util.CommaDelimitedTagEditor.java
@SuppressWarnings("unchecked") public String getAsText() { String concatenated = new String(); if (null != getValue()) { concatenated = StringUtils.join((Set<Tag>) getValue(), ", "); }//from ww w .j av a 2 s. co m return concatenated; }
From source file:com.hp.alm.ali.idea.filter.MultipleItemsFactory.java
@Override public String multipleValues(List<String> values) { LinkedList<String> list = new LinkedList<String>(); for (String value : values) { if (value.isEmpty()) { list.add(MultipleItemsTranslatedResolver.NO_VALUE); } else {//from w w w.j av a2s . co m list.add(value); } } return StringUtils.join(list, ";"); }
From source file:com.collective.celos.ci.testing.fixtures.convert.FixTableToTSVFileConverter.java
@Override public FixFile convert(TestRun tr, FixTable table) throws Exception { List<String> lines = new ArrayList<>(); for (FixTable.FixRow row : table.getRows()) { lines.add(StringUtils.join(row.getOrderedColumns(table.getColumnNames()), "\t")); }//from w ww . ja v a 2 s. c o m return new FixFile(IOUtils.toInputStream(StringUtils.join(lines, "\n") + "\n")); }
From source file:de.tudarmstadt.lt.n2n.utilities.PatternGenerator.java
public String[] get_patterns(String str) { String[] words = str.split("\\s+"); List<String> patterns = new ArrayList<String>(); for (int i = 1; i < words.length; i++) { for (String[] pattern : get_merged_patterns(words, i)) patterns.add(StringUtils.join(pattern, " ")); }//from ww w . j a v a 2 s.c o m return patterns.toArray(new String[0]); }
From source file:jp.primecloud.auto.sdk.client.component.StopComponent.java
public void execute(Long componentNo, List<Long> instanceNos, Boolean isStopInstance) { Map<String, String> parameters = new LinkedHashMap<String, String>(); parameters.put("ComponentNo", componentNo.toString()); parameters.put("InstanceNos", StringUtils.join(instanceNos, ",")); if (isStopInstance != null) { parameters.put("IsStopInstance", isStopInstance.toString()); }/* w w w .j a va2 s.c om*/ requester.execute("/StopComponent", parameters); }
From source file:edu.berkeley.compbio.ncbitaxonomy.service.NcbiTaxonomyServicesContextFactory.java
public static ApplicationContext makeNcbiTaxonomyServicesContext() throws IOException { File propsFile = PropertiesUtils.findPropertiesFile("NCBI_TAXONOMY_SERVICE_PROPERTIES", ".ncbitaxonomy", "service.properties"); logger.debug("Using properties file: " + propsFile); Properties p = new Properties(); FileInputStream is = null;/*from w ww.j ava 2 s .c o m*/ try { is = new FileInputStream(propsFile); p.load(is); } finally { is.close(); } String dbName = (String) p.get("default"); Map<String, Properties> databases = PropertiesUtils.splitPeriodDelimitedProperties(p); GenericApplicationContext ctx = new GenericApplicationContext(); XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx); xmlReader.loadBeanDefinitions(new ClassPathResource("ncbitaxonomyclient.xml")); PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer(); Properties properties = databases.get(dbName); if (properties == null) { logger.error("Service definition not found: " + dbName); logger.error("Valid names: " + StringUtils.join(databases.keySet().iterator(), ", ")); throw new NcbiTaxonomyRuntimeException("Database definition not found: " + dbName); } cfg.setProperties(properties); ctx.addBeanFactoryPostProcessor(cfg); ctx.refresh(); // add a shutdown hook for the above context... ctx.registerShutdownHook(); return ctx; }
From source file:net.sourceforge.fenixedu.dataTransferObject.externalServices.TeacherPublicationsInformation.java
public static Map<Teacher, List<String>> getTeacherPublicationsInformations(Set<Teacher> teachers) { Map<Teacher, List<String>> teacherPublicationsInformationMap = new HashMap<Teacher, List<String>>(); Client client = ClientBuilder.newClient(); WebTarget resource = client.target(BASE_URL); List<String> teacherIds = new ArrayList<String>(); for (Teacher teacher : teachers) { teacherIds.add(teacher.getTeacherId()); }/* w ww .java2s . com*/ resource = resource.path(CURRICULUM_PATH).queryParam("istids", StringUtils.join(teacherIds, ",")); try { String allPublications = resource.request().get(String.class); JSONParser parser = new JSONParser(); for (Object teacherPublications : (JSONArray) parser.parse(allPublications)) { JSONObject teacherPublicationsInfo = (JSONObject) teacherPublications; final String username = (String) teacherPublicationsInfo.get("istID"); final Teacher teacher = Teacher.readByIstId(username); JSONArray preferredPublications = (JSONArray) teacherPublicationsInfo.get("preferred"); List<String> teacherPublicationsList = new ArrayList<String>(); for (Object publication : preferredPublications) { teacherPublicationsList.add(publication.toString()); } teacherPublicationsInformationMap.put(teacher, teacherPublicationsList); } } catch (ParseException e) { logger.error(e.getMessage(), e); } finally { client.close(); } return teacherPublicationsInformationMap; }
From source file:bazaar4idea.action.BzrCommandResultNotifier.java
public void process(BzrStandardResult result) { List<String> out = result.getStdOutAsLines(); List<String> err = result.getStdErrAsLines(); if (!out.isEmpty()) { VcsUtil.showStatusMessage(project, out.get(out.size() - 1)); }// www.j a va 2 s .c o m if (!err.isEmpty()) { VcsImplUtil.showErrorMessage(project, "<html>" + StringUtils.join(err, "<br>") + "</html>", "Error"); } }
From source file:de.tudarmstadt.ukp.dkpro.core.ngrams.util.NGramStringListIterableTest.java
@Test public void ngramTest() { String[] tokens = "This is a simple example sentence .".split(" "); int i = 0;/* www . j av a 2s .com*/ for (List<String> ngram : new NGramStringListIterable(tokens, 2, 2)) { if (i == 0) { assertEquals(2, ngram.size()); assertEquals("This is", StringUtils.join(ngram, " ")); } System.out.println(ngram); i++; } assertEquals(6, i); }
From source file:edu.scripps.fl.hibernate.DoubleListStringType.java
public String getStringFromList(List<Double> ids) { if (null == ids) return null; return StringUtils.join(ids, "\n"); }