use of java.util.Collections in project coffeenet-starter by coffeenet.
the class CoffeeNetNavigationServiceImpl method get.
@Override
public CoffeeNetNavigationInformation get() {
CurrentCoffeeNetUser currentCoffeeNetUser = dataExtractor.extractUser().orElse(null);
CoffeeNetNavigationAppInformation appInformation = dataExtractor.extractAppInformation().orElse(null);
Map<String, List<CoffeeNetApp>> apps = dataExtractor.extractApps().orElseGet(Collections::emptyMap);
String logoutPath = dataExtractor.extractLogoutPath();
List<CoffeeNetApp> profileApps = apps.get("profile");
CoffeeNetApp profileApp = null;
if (profileApps != null && !profileApps.isEmpty()) {
profileApp = profileApps.get(0);
}
List<CoffeeNetApp> coffeeNetApps = apps.get("apps");
return new CoffeeNetNavigationInformation(currentCoffeeNetUser, coffeeNetApps, profileApp, logoutPath, appInformation);
}
use of java.util.Collections in project spring-boot by spring-projects.
the class LoggingApplicationListener method setLogLevels.
/**
* Set logging levels based on relevant {@link Environment} properties.
* @param system the logging system
* @param environment the environment
* @since 2.2.0
*/
protected void setLogLevels(LoggingSystem system, ConfigurableEnvironment environment) {
BiConsumer<String, LogLevel> customizer = getLogLevelConfigurer(system);
Binder binder = Binder.get(environment);
Map<String, LogLevel> levels = binder.bind(LOGGING_LEVEL, STRING_LOGLEVEL_MAP).orElseGet(Collections::emptyMap);
levels.forEach((name, level) -> configureLogLevel(name, level, customizer));
}
use of java.util.Collections in project spring-boot by spring-projects.
the class LayersIndex method writeTo.
/**
* Write the layer index to an output stream.
* @param out the destination stream
* @throws IOException on IO error
*/
public void writeTo(OutputStream out) throws IOException {
MultiValueMap<Layer, String> index = new LinkedMultiValueMap<>();
this.root.buildIndex("", index);
index.values().forEach(Collections::sort);
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8));
for (Layer layer : this.layers) {
List<String> names = index.get(layer);
writer.write("- \"" + layer + "\":\n");
if (names != null) {
for (String name : names) {
writer.write(" - \"" + name + "\"\n");
}
}
}
writer.flush();
}
use of java.util.Collections in project sonarqube by SonarSource.
the class SearchAction method doIndexSearch.
private SearchResponse doIndexSearch(WsRequest wsRequest, DbSession dbSession, @Nullable ComponentDto project) {
var builder = IssueQuery.builder().types(singleton(RuleType.SECURITY_HOTSPOT.name())).sort(IssueQuery.SORT_HOTSPOTS).asc(true).statuses(wsRequest.getStatus().map(Collections::singletonList).orElse(STATUSES));
if (project != null) {
String projectUuid = firstNonNull(project.getMainBranchProjectUuid(), project.uuid());
if (Qualifiers.APP.equals(project.qualifier())) {
builder.viewUuids(singletonList(projectUuid));
if (wsRequest.isSinceLeakPeriod() && wsRequest.getPullRequest().isEmpty()) {
addSinceLeakPeriodFilterByProjects(builder, dbSession, project);
}
} else {
builder.projectUuids(singletonList(projectUuid));
if (wsRequest.isSinceLeakPeriod() && wsRequest.getPullRequest().isEmpty()) {
addSinceLeakPeriodFilter(dbSession, project, builder);
}
}
addMainBranchFilter(project, builder);
}
if (!wsRequest.getHotspotKeys().isEmpty()) {
builder.issueKeys(wsRequest.getHotspotKeys());
}
if (!wsRequest.getFiles().isEmpty()) {
builder.files(wsRequest.getFiles());
}
if (wsRequest.isOnlyMine()) {
userSession.checkLoggedIn();
builder.assigneeUuids(Collections.singletonList(userSession.getUuid()));
}
wsRequest.getStatus().ifPresent(status -> builder.resolved(STATUS_REVIEWED.equals(status)));
wsRequest.getResolution().ifPresent(resolution -> builder.resolutions(singleton(resolution)));
addSecurityStandardFilters(wsRequest, builder);
IssueQuery query = builder.build();
SearchOptions searchOptions = new SearchOptions().setPage(wsRequest.page, wsRequest.index);
return issueIndex.search(query, searchOptions);
}
use of java.util.Collections in project cayenne by apache.
the class FileProjectSaverTest method setUp.
@Before
public void setUp() throws Exception {
Module testModule = binder -> binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
saver = new FileProjectSaver(Collections.<ProjectExtension>emptyList());
Injector injector = DIBootstrap.createInjector(testModule);
injector.injectMembers(saver);
}
Aggregations