List of usage examples for java.util.stream Collectors joining
public static Collector<CharSequence, ?, String> joining(CharSequence delimiter)
From source file:enmasse.controller.flavor.FlavorManager.java
public void flavorsUpdated(Map<String, Flavor> flavorMap) { this.flavorMap = flavorMap; if (log.isInfoEnabled()) { String flavors = flavorMap.values().stream().map(Flavor::toString).collect(Collectors.joining(",")); log.info(String.format("Got new set of flavors: [%s]", flavors)); }/* ww w .j a va 2 s . c o m*/ }
From source file:com.thinkbiganalytics.metadata.rest.model.data.DatasourceDefinition.java
public String getIdentityString() { if (StringUtils.isBlank(identityString)) { identityString = getDatasourcePropertyKeys().stream().map(key -> "${" + key + "}") .collect(Collectors.joining(",")); }//from ww w . j av a 2 s. co m return identityString; }
From source file:org.cloudfoundry.identity.uaa.util.UaaHttpRequestUtils.java
public static String paramsToQueryString(Map<String, String[]> parameterMap) { return parameterMap.entrySet().stream().flatMap( param -> stream(param.getValue()).map(value -> param.getKey() + "=" + encodeParameter(value))) .collect(Collectors.joining("&")); }
From source file:com.sinet.gage.delta.DomainUpdatesImporter.java
/** * Performs the delta imports for District & School Domain * //from ww w . j a v a 2s. c om * @param domainIdsToProcessInsert */ public void processInsertsForDomains(Set<Integer> domainIdsToProcessInsert) { Set<Integer> domainIdsForInsert; List<DomainResponse> domainResponseList; List<Domain> domainList = new ArrayList<>(); for (Integer domainId : domainIdsToProcessInsert) { domainIdsForInsert = signalManager.getDomainIdsForDeltaImportsForADomain(domainId, serverSettings.getEntityCreatedSignalTypeCode()); if (!CollectionUtils.isEmpty(domainIdsForInsert)) { log.debug("Domain Ids to be inserted: " + domainIdsForInsert); String idsString = domainIdsForInsert.stream().map(Object::toString) .collect(Collectors.joining(", ")); domainResponseList = getDomainsWithData(domainId, idsString); for (DomainResponse domainResponse : domainResponseList) { DomainResponse parentDomainResponse = dlapDomainClient.getDomain(null, Long.parseLong(domainId.toString())); Domain domain = mapToDomain(domainResponse); if (domainResponse.getData() != null && domainResponse.getData().getCustomization() != null && domainResponse.getData().getCustomization().getEdivatelearn() != null) { if ("DISTRICT".equalsIgnoreCase( domainResponse.getData().getCustomization().getEdivatelearn().getDomaintype())) { domain.setStateDomainId(Long.parseLong(parentDomainResponse.getId())); domain.setStateDomainName(parentDomainResponse.getName()); domain.setParentDomainName(parentDomainResponse.getName()); } else if ("SCHOOL".equalsIgnoreCase( domainResponse.getData().getCustomization().getEdivatelearn().getDomaintype())) { DomainResponse stateDomainResponse = dlapDomainClient.getDomain(null, Long.parseLong(parentDomainResponse.getParentid())); domain.setStateDomainId(Long.parseLong(stateDomainResponse.getId())); domain.setStateDomainName(stateDomainResponse.getName()); domain.setParentDomainName(parentDomainResponse.getName()); } } else { domain.setStateDomainId(Long.parseLong(parentDomainResponse.getId())); domain.setStateDomainName(parentDomainResponse.getName()); domain.setParentDomainName(parentDomainResponse.getName()); } domainList.add(domain); } log.debug("Inserting domain ids: " + domainId); if (!CollectionUtils.isEmpty(domainList)) { domainsRepository.insertDomains(domainList); } } } }
From source file:com.adobe.acs.commons.mcp.impl.processes.asset.NameUtil.java
static String createValidDamPath(String path) { if (StringUtils.isNotEmpty(path)) { path = Arrays.asList(StringUtils.split(path, PATH_SEPARATOR)).stream() .map(name -> name.matches(VALID_NAME_REGEXP) ? name : NameUtil.createValidDamName(name)) .collect(Collectors.joining(PATH_SEPARATOR)); if (!path.startsWith(PATH_SEPARATOR)) { path = PATH_SEPARATOR + path; }//w w w .j a v a 2 s .c o m } return path; }
From source file:dk.dma.msiproxy.model.MessageFilter.java
/** * Returns a key that uniquely defines the filter * @return a key that uniquely defines the filter *//* w ww . j a v a2 s .com*/ public String getKey() { // Need to make sure that the types are enlisted in a deterministic order List<SeriesIdType> mainTypes = new ArrayList<>(this.mainTypes); Collections.sort(mainTypes); List<Type> types = new ArrayList<>(this.types); Collections.sort(types); return String.format("%s_%b_%s_%s_%s_%s", StringUtils.defaultString(lang), detailed, mainTypes.stream().map(Enum::toString).collect(Collectors.joining("-")), types.stream().map(Enum::toString).collect(Collectors.joining("-")), areaId == null ? "" : areaId.toString(), categoryId == null ? "" : categoryId.toString()); }
From source file:de.rkl.tools.tzconv.configuration.PreferencesProvider.java
private void dumpSelectedZoneIdsIntoPreferences() { applicationPreferences.put(PREFERENCES_KEY_SELECTED_ZONE_IDS, applicationModel.selectedZoneIds.stream() .map(ZoneId::toString).collect(Collectors.joining(PREFERENCES_SELECTED_ZONE_IDS_DELIMITER))); }
From source file:de._692b8c32.cdlauncher.tasks.GithubReleasesDownloadTask.java
@Override public void doWork() { setProgress(-1);//from ww w . j a v a 2 s. c om try { String realUrl = null; HttpClient client = HttpClients.createDefault(); if (version.getValue() == null) { Pattern pattern = Pattern .compile("<ul class=\"release-downloads\"> <li> <a href=\"([^\"]*)\" rel=\"nofollow\">"); try (BufferedReader reader = new BufferedReader(new InputStreamReader( client.execute(new HttpGet(baseUrl + "latest")).getEntity().getContent()))) { Matcher matcher = pattern .matcher(reader.lines().collect(Collectors.joining(" ")).replace(" ", "")); if (matcher.find()) { realUrl = baseUrl.substring(0, baseUrl.indexOf('/', baseUrl.indexOf('/', baseUrl.indexOf('/') + 1) + 1)) + matcher.group(1); } } } else { realUrl = baseUrl + "download/" + version.getValue() + "/OpenRA-" + version.getValue() + ".zip"; } if (realUrl == null) { throw new RuntimeException("Failed to find real url"); } else { try (InputStream stream = client.execute(new HttpGet(realUrl)).getEntity().getContent()) { Files.copy(stream, cacheFile.toPath(), StandardCopyOption.REPLACE_EXISTING); } } } catch (IOException ex) { throw new RuntimeException("Could not download data", ex); } }
From source file:de.hs.mannheim.modUro.reader.BoxAndWhiskersPlotDiagram.java
/** * Create a Tikz snippet that will render a Box and Whisker diagram * in Tikz.//from w w w . j a v a 2 s . com * @return */ public String exportToTikz() { Map<String, StatisticValues> stats = bwpModel.getStatisticValues(); List<String> sortedModels = new ArrayList<>(stats.keySet()); //sortedModels.sort(String::compareTo); sortedModels.sort((s1, s2) -> s2.compareTo(s1)); String ytickslabels = "yticklabels={" + sortedModels.stream().map(Object::toString).collect(Collectors.joining(", ")) + "}"; List<String> yticksl = new ArrayList<>(); for (int i = 2; i <= sortedModels.size() + 1; i++) { yticksl.add(i + ""); } String ytick = "ytick={" + yticksl.stream().map(Object::toString).collect(Collectors.joining(", ")) + "}"; String enn = "enn"; // ok.map(m = > m._1.toString + " = " + m._2.toString).mkString(", ") String s = "% " + enn + "\n"; s = s + "\\begin{tikzpicture}\n" + " \\begin{axis}[\n" + " " + ytick + ",\n" + " " + ytickslabels + ",\n " + " height=.5*\\textheight,\n" + " xmin=0, xmax=1.0, width=.9*\\textwidth,\n" + " xtick={0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1},\n" + " xticklabels={0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1}\n" + " ]\n"; int pos = 2; for (String m : sortedModels) { s = s + " \\addplot+[boxplot prepared={draw position=" + pos + ",\n" + " lower whisker=" + stats.get(m).getMin() + ", lower quartile=" + stats.get(m).getFirstPercentile() + ",\n" + " median=" + stats.get(m).getSecondPercentile() + ", upper quartile=" + stats.get(m).getLastPercentile() + ",\n" + " upper whisker=" + stats.get(m).getMax() + ",\n" + " every box/.style={draw=black},\n" + " every whisker/.style={black},\n" + " every median/.style={black}}]\n" + " coordinates {};\n"; pos++; } s = s + " \\end{axis}\n" + "\\end{tikzpicture}\n"; return s; }
From source file:com.epam.dlab.backendapi.service.impl.GitCredentialServiceImpl.java
@Override public void updateGitCredentials(UserInfo userInfo, ExploratoryGitCredsDTO formDTO) { log.debug("Updating GIT creds for user {} to {}", userInfo.getName(), formDTO); try {//from www .j a va 2s .c o m gitCredsDAO.updateGitCreds(userInfo.getName(), formDTO); final String failedNotebooks = exploratoryDAO.fetchRunningExploratoryFields(userInfo.getName()).stream() .filter(ui -> !updateNotebookGitCredentials(userInfo, formDTO, ui)) .map(UserInstanceDTO::getExploratoryName).collect(Collectors.joining(",")); if (StringUtils.isNotEmpty(failedNotebooks)) { throw new DlabException("Requests for notebooks failed: " + failedNotebooks); } } catch (Exception t) { log.error("Cannot update the GIT creds for user {}", userInfo.getName(), t); throw new DlabException("Cannot update the GIT credentials: " + t.getLocalizedMessage(), t); } }