List of usage examples for java.util List forEach
default void forEach(Consumer<? super T> action)
From source file:io.spring.initializr.actuate.metric.ProjectGenerationMetricsListener.java
protected void handleDependencies(ProjectRequest request) { List<Dependency> dependencies = request.getResolvedDependencies(); if (dependencies != null) { dependencies.forEach((it) -> { if (!ProjectRequest.DEFAULT_STARTER.equals(it.getId())) { String id = sanitize(it.getId()); increment(key("dependency." + id)); }/*from w w w . ja va 2 s . c o m*/ }); } }
From source file:com.github.frapontillo.pulse.crowd.lemmatize.morphit.MorphITLemmatizer.java
@Override public Message singleItemProcess(Message message) { List<Token> tokens = message.getTokens(); tokens.forEach(this::lemmatizeToken); return message; }
From source file:com.khartec.waltz.web.endpoints.api.AppCapabilityEndpoint.java
private void logChanges(UpdateAppCapabilitiesAction action, EntityReference appRef, String user) { List<String> additionMessages = map(action.additions(), ref -> format("Added capability [%s]", ref.name().orElse("[unknown]"))); List<String> removalMessages = map(action.removals(), ref -> format("Removed capability [%s]", ref.name().orElse("[unknown]"))); List<String> messages = concat(additionMessages, removalMessages); messages.forEach(message -> changeLogDao.write(ImmutableChangeLog.builder().parentReference(appRef) .userId(user).severity(Severity.INFORMATION).message(message).build())); }
From source file:org.obiba.mica.dataset.search.VariableIndexer.java
private void indexDatasetVariables(String indexName, Iterable<DatasetVariable> variables) { List<DocumentSet> documentSets = variableSetService.getAll(); variables.forEach(variable -> documentSets.forEach(ds -> { if (ds.getIdentifiers().contains(variable.getId())) variable.addSet(ds.getId()); }));/*from www .j a v a 2 s .co m*/ indexer.indexAllIndexables(indexName, variables); }
From source file:com.mec.DAO.Postgre.EstablecimientoPostgreDAO.java
private void init(EstablecimientoPost t) { Hibernate.initialize(t.getCategoria()); Hibernate.initialize(t.getDependencia()); Hibernate.initialize(t.getEstado()); Hibernate.initialize(t.getSector()); List<Localizacion> loc = t.getLocalizacion(); Hibernate.initialize(loc);// ww w. j av a 2 s. c om if (loc != null) { loc.forEach((l) -> { Hibernate.initialize(l.getAmbito()); List<Domicilio> dom = l.getDomicilios(); if (dom != null) { dom.forEach((d) -> { LocalidadTipo localidad = d.getLocalidad(); Hibernate.initialize(localidad); if (localidad != null) { Hibernate.initialize(localidad.getDepartamento()); } }); } List<OfertaLocal> oferta = l.getOfertas(); Hibernate.initialize(oferta); if (oferta != null) { oferta.forEach((o) -> { Hibernate.initialize(o.getJornada()); OfertaTipo ot = o.getOferta(); Hibernate.initialize(ot); if (ot != null) { Hibernate.initialize(ot.getModalidad()); Hibernate.initialize(ot.getBase()); //Hibernate.initialize(ot.getTitulos()); } }); } }); } }
From source file:fr.lepellerin.ecole.web.controller.LoginController.java
/** * reset le mot de passe.//from ww w.j a va 2 s .c om * * @return nom de la vue */ @RequestMapping(value = "/forgottenPassword", method = RequestMethod.POST) public String resetPwdPage(@RequestParam final String email, final Model model) { // find family by email. final List<ForgottenPwdDto> pwds = this.utilisateurService.resetPasswordForFamille(email); pwds.forEach(pwd -> { final Context ctx = new Context(Locale.ROOT); ctx.setVariable("name", pwd.getAccount()); ctx.setVariable("pwd", pwd.getPassword()); try { this.emailService.sendSimpleMail("[Ecole notre dame] - Changement du mot de passe", pwd.getEmails(), "no-reply@ecole-lepellerin.com", "forgottenEmail", ctx); } catch (final MessagingException e) { LOGGER.error("ERROR sending email", e); } model.addAttribute("confirm", "Email avec nouveau mot de passe envoy."); }); return "accueil/forgottenPwd"; }
From source file:org.obiba.mica.micaConfig.rest.CustomTranslationsResource.java
@GET @Timed/* www . j a v a 2 s . c om*/ @Path("/export") @Produces("application/json") public Response exportTranslation() { List<String> locales = micaConfigService.getConfig().getLocalesAsString(); ObjectNode node = objectMapper.createObjectNode(); locales.forEach(l -> node.set(l, getTranslations(l))); return Response.ok(node.toString()).build(); }
From source file:alfio.manager.plugin.PluginManager.java
public void saveAllConfigOptions(int eventId, List<PluginConfigOptionModification> input, String username) { Validate.isTrue(validateOwnership(eventId, username)); input.forEach( m -> pluginConfigurationRepository.update(m.getPluginId(), eventId, m.getName(), m.getValue())); }
From source file:co.mafiagame.engine.command.internalcommand.AnnounceRoleCommand.java
@Override public ResultMessage execute(EmptyContext context) { Game game = context.getGame();/*from w w w.j a v a 2 s. c o m*/ List<Message> messages = new ArrayList<>(); game.getPlayers().forEach(p -> messages .add(new Message(RoleUtil.roleIs(p.getRole())).setReceiverId(p.getAccount().getUserInterfaceId()))); List<Player> mafias = game.mafias(); List<String> mafiaUserNames = mafias.stream().map(Player::getAccount).map(Account::getUsername) .collect(Collectors.toList()); mafias.forEach(m -> messages .add(new Message("mafia.are.players").setReceiverId(m.getAccount().getUserInterfaceId()) .setArgs(ListToString.toString(mafiaUserNames)))); return new ResultMessage(messages, ChannelType.USER_PRIVATE, context.getInterfaceContext()); }
From source file:org.obiba.mica.search.queries.StudyQuery.java
@Override public void processHits(QueryResultDto.Builder builder, Searcher.DocumentResults results, QueryScope scope, CountStatsData counts) throws IOException { StudyResultDto.Builder resBuilder = StudyResultDto.newBuilder(); StudyCountStatsBuilder studyCountStatsBuilder = counts == null ? null : StudyCountStatsBuilder.newBuilder(counts); Consumer<BaseStudy> addDto = getStudyConsumer(scope, resBuilder, studyCountStatsBuilder); List<BaseStudy> publishedStudies = getPublishedDocumentsFromHitsByClassName(results, BaseStudy.class); publishedStudies.forEach(addDto::accept); builder.setExtension(StudyResultDto.result, resBuilder.build()); }