Example usage for java.util List forEach

List of usage examples for java.util List forEach

Introduction

In this page you can find the example usage for java.util List forEach.

Prototype

default void forEach(Consumer<? super T> action) 

Source Link

Document

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.

Usage

From source file:InventoryServiceTest.java

@Test
public void getInvoiceByAsset() throws Exception {
    List<Asset> list = inventoryService.list(Asset.class);
    list.forEach(x -> assertNotNull(inventoryService.getLastInvoiceForAsset(x)));
}

From source file:com.tascape.qa.th.android.driver.AdbDevice.java

public List<String> getProp() throws IOException {
    List<String> props = this.adb.shell(Lists.newArrayList("getprop"));
    props.forEach(p -> LOG.debug(p));
    return props;
}

From source file:org.obiba.mica.file.search.FileFilterHelper.java

private void addPathFilter(Collection<String> excludes, Collection<String> includes, String prefix,
        List<String> ids) {
    if (ids.isEmpty()) {
        excludes.add(prefix);//from  w  ww .  j av a  2 s. c  om
    } else {
        ids.forEach(id -> {
            includes.add(prefix + "/" + id);
            includes.add(prefix + "/" + id + "/");
        });
    }
}

From source file:com.oneops.cms.transmitter.CIEventReader.java

private CMSEvent getCiRel(CMSEventRecord record) {
    CMSEvent event = new CMSEvent();
    event.setEventId(record.getEventId());
    event.addHeaders("source", "cm_ci_rel");
    event.addHeaders("action", record.getEventType());
    try (SqlSession session = sqlsf.openSession()) {
        CIMapper ciMapper = session.getMapper(CIMapper.class);
        CmsCIRelation relation = ciMapper.getCIRelation(record.getSourcePk());
        if (relation != null) {
            List<CmsCIRelationAttribute> attrs = ciMapper.getCIRelationAttrs(relation.getCiRelationId());
            attrs.forEach(relation::addAttribute);
            event.addHeaders("clazzName", relation.getRelationName());
        }/* w  w w .  j a  va2 s  . com*/
        event.addHeaders("sourceId", String.valueOf(record.getSourcePk()));
        event.setPayload(relation);
    }
    return event;
}

From source file:org.createnet.raptor.client.model.ActionClient.java

/**
 * List available actions on the object/*from   w  w  w.j  av  a 2s.  c  om*/
 *
 * @param object reference
 * @return return the list of available action for an object
 */
public List<Action> list(ServiceObject object) {

    List<Action> actions = ServiceObject.getMapper().convertValue(
            getClient().get(RaptorComponent.format(RaptorClient.Routes.ACTION_LIST, object.id)),
            new TypeReference<List<Action>>() {
            });

    actions.forEach(action -> {
        action.setServiceObject(object);
    });

    return actions;
}

From source file:org.sahli.asciidoc.confluence.publisher.client.ConfluencePublisher.java

private void startPublishingUnderAncestorId(List<ConfluencePageMetadata> pages, String spaceKey,
        String ancestorId) {/*from w ww . j  a va2  s .  c o  m*/
    deleteConfluencePagesNotPresentUnderAncestor(pages, ancestorId);

    pages.forEach(page -> {
        String content = fileContent(Paths.get(this.contentRoot, page.getContentFilePath()).toString());
        String contentId = addOrUpdatePage(spaceKey, ancestorId, page, content, () -> this.confluenceClient
                .addPageUnderAncestor(spaceKey, ancestorId, page.getTitle(), content));

        deleteConfluenceAttachmentsNotPresentUnderPage(contentId, page.getAttachments());
        addAttachments(contentId, page.getAttachments());
        startPublishingUnderAncestorId(page.getChildren(), spaceKey, contentId);
    });
}

From source file:edu.usu.sdl.openstorefront.service.OrganizationServiceImpl.java

private <T extends BaseEntity> void updateOrganizationOnEntity(T entityExample, String toMergeOrg,
        Organization organizationTarget) {
    if (entityExample instanceof OrganizationModel) {
        log.log(Level.FINE, MessageFormat.format("Updating organizations on {0}",
                entityExample.getClass().getSimpleName()));
        ((OrganizationModel) entityExample).setOrganization(toMergeOrg);

        List<T> entities = entityExample.findByExampleProxy();
        entities.forEach(entity -> {
            ((OrganizationModel) entity).setOrganization(organizationTarget.getName());
            ((StandardEntity) entity).populateBaseUpdateFields();
            persistenceService.persist(entity);
        });/*from  w w w. j  ava  2s. com*/
        log.log(Level.FINE, MessageFormat.format("Updated: ", entities.size()));
    } else {
        throw new OpenStorefrontRuntimeException("Entity does not implement Organization", "Programming error");
    }
}

From source file:fr.lepellerin.ecole.service.internal.CantineServiceImpl.java

@Override
@Transactional(readOnly = true)/*from   w w w  . j av  a  2 s  . c  om*/
public List<DayOfWeek> getJourOuvertCantine(final LocalDate startDate, final Famille famille)
        throws TechnicalException {
    final List<DayOfWeek> jours = new ArrayList<>();
    final Activite activite = getCantineActivite();
    final List<Inscription> icts = this.ictRepository.findByActiviteAndFamille(activite, famille);
    icts.forEach(ict -> {
        final List<Ouverture> ouvertures = this.ouvertureRepository.findByActiviteAndGroupeAndDateDebut(
                activite, ict.getGroupe(),
                Date.from(Instant.from(startDate.atStartOfDay(ZoneId.systemDefault()))));
        ouvertures.forEach(o -> {
            final LocalDate date = LocalDate.from(((java.sql.Date) o.getDate()).toLocalDate());
            if (!jours.contains(date.getDayOfWeek())) {
                jours.add(date.getDayOfWeek());
            }
        });
    });

    return jours;
}

From source file:com.hortonworks.streamline.streams.layout.storm.JDBCBoltFluxComponent.java

private String getColumnList(List<String> columns) {
    String componentId = "ColumnList" + UUID_FOR_COMPONENTS;
    List<Map<String, Object>> configMethods = new ArrayList<>();
    columns.forEach(column -> add(configMethods, column));
    String className = "java.util.ArrayList";
    addToComponents(createComponent(componentId, className, null, null, configMethods));
    return componentId;
}