List of usage examples for java.util Collection forEach
default void forEach(Consumer<? super T> action)
From source file:org.openmrs.CohortTest.java
@Test public void union_shouldContainVoidedAndExpiredMemberships() throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date startDate = dateFormat.parse("2017-01-01 00:00:00"); Date endDate = dateFormat.parse("2017-02-01 00:00:00"); Cohort cohortOne = new Cohort(3); CohortMembership membershipOne = new CohortMembership(7, startDate); membershipOne.setVoided(true);//from w w w . j av a 2 s.c o m membershipOne.setEndDate(endDate); cohortOne.addMembership(membershipOne); Cohort cohortTwo = new Cohort(4); CohortMembership membershipTwo = new CohortMembership(8, startDate); membershipTwo.setVoided(true); membershipTwo.setEndDate(endDate); cohortTwo.addMembership(membershipTwo); Cohort cohortUnion = Cohort.union(cohortOne, cohortTwo); Collection<CohortMembership> unionOfMemberships = cohortUnion.getMemberships(); unionOfMemberships.forEach(m -> { assertTrue(m.getPatientId().equals(7) || m.getPatientId().equals(8)); assertTrue(m.getVoided() && m.getEndDate() != null); }); }
From source file:com.thoughtworks.gauge.autocomplete.StepCompletionProvider.java
@NotNull private Map<String, Type> getImplementedSteps(Module module) { Map<String, Type> steps = new HashMap<>(); Collection<PsiMethod> methods = StepUtil.getStepMethods(module); methods.forEach(m -> { getGaugeStepAnnotationValues(m).forEach(s -> { steps.put(getStepValueFor(module, m, s, false).getStepText(), new Type(s, STEP)); });// ww w . j ava 2 s .c o m }); return steps; }
From source file:org.openmrs.CohortTest.java
@Test public void subtract_shouldContainVoidedAndExpiredMemberships() throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date startDate = dateFormat.parse("2017-01-01 00:00:00"); Date endDate = dateFormat.parse("2017-02-01 00:00:00"); Cohort cohortOne = new Cohort(3); CohortMembership membershipOne = new CohortMembership(7, startDate); membershipOne.setVoided(true);/*from w w w . ja v a2s .c o m*/ membershipOne.setEndDate(endDate); cohortOne.addMembership(membershipOne); Cohort cohortTwo = new Cohort(4); CohortMembership membershipTwo = new CohortMembership(8, startDate); membershipTwo.setVoided(true); membershipTwo.setEndDate(endDate); cohortTwo.addMembership(membershipTwo); Cohort cohortSubtract = Cohort.subtract(cohortOne, cohortTwo); Collection<CohortMembership> subtractOfMemberships = cohortSubtract.getMemberships(); subtractOfMemberships.forEach(m -> { assertTrue(m.getPatientId().equals(7)); assertTrue(m.getVoided() && m.getEndDate() != null); }); }
From source file:org.trustedanalytics.servicecatalog.service.ApplicationsService.java
/** * Delete application along with services that are not bound to any other application. * @param app unique application identifier *///from www . j av a 2 s. co m public void deleteAppCascade(UUID app) { LOGGER.info("DeleteAppCascade"); final Collection<CcServiceInstance> orphans = getAppServices(app, orphanServices); deleteApp(app); orphans.forEach(service -> ccOperations.deleteServiceInstance(service.getGuid())); }
From source file:org.cbioportal.mutationhotspots.mutationhotspotsdetection.impl.AbstractHotspotDetective.java
protected int getNumberOfAllMutationOnProtein(Collection<Hotspot> hotspotsOnAProtein) { // default behavior for single and linear hotspots Set<Mutation> mutations = new HashSet<>(); hotspotsOnAProtein.forEach((hotspot) -> { mutations.addAll(hotspot.getMutations()); });/*from w ww. ja va 2s.c o m*/ return mutations.size(); }
From source file:com.github.triceo.robozonky.app.CommandLineInterface.java
/** * Parse the command line./* w w w. j a v a 2 s . co m*/ * * @param args Command line arguments as received by {@link App#main(String...)}. * @return Empty if parsing failed, at which point it will write standard help message to sysout. */ public static Optional<CommandLineInterface> parse(final String... args) { // create the mode of operation final OptionGroup operatingModes = new OptionGroup(); operatingModes.setRequired(true); Stream.of(OperatingMode.values()).forEach(mode -> operatingModes.addOption(mode.getSelectingOption())); // find all options from all modes of operation final Collection<Option> ops = Stream.of(OperatingMode.values()).map(OperatingMode::getOtherOptions) .collect(LinkedHashSet::new, LinkedHashSet::addAll, LinkedHashSet::addAll); // include authentication options final OptionGroup authenticationModes = new OptionGroup(); authenticationModes.setRequired(true); authenticationModes.addOption(CommandLineInterface.OPTION_USERNAME); authenticationModes.addOption(CommandLineInterface.OPTION_KEYSTORE); ops.add(CommandLineInterface.OPTION_PASSWORD); ops.add(CommandLineInterface.OPTION_USE_TOKEN); ops.add(CommandLineInterface.OPTION_FAULT_TOLERANT); ops.add(CommandLineInterface.OPTION_CLOSED_SEASON); ops.add(CommandLineInterface.OPTION_ZONK); // join all in a single config final Options options = new Options(); options.addOptionGroup(operatingModes); options.addOptionGroup(authenticationModes); ops.forEach(options::addOption); final CommandLineParser parser = new DefaultParser(); // and parse try { final CommandLine cli = parser.parse(options, args); CommandLineInterface.logOptionValues(cli); return Optional.of(new CommandLineInterface(options, cli)); } catch (final ParseException ex) { CommandLineInterface.printHelp(options, ex.getMessage(), true); return Optional.empty(); } }
From source file:org.ow2.proactive.workflow_catalog.rest.entity.WorkflowRevision.java
public void addVariables(Collection<Variable> variables) { variables.forEach(var -> addVariable(var)); }
From source file:com.linkedin.restli.datagenerator.csharp.CSharpRythmGenerator.java
private int generateResultFiles(CSharpDataTemplateGenerator dataTemplateGenerator, Collection<ClassTemplateSpec> specs, File parentOutputDirectory) throws IOException { specs.forEach(dataTemplateGenerator::generate); int renderedCount = 0; while (true) { final Set<CSharpType> unprocessedTypes = dataTemplateGenerator.getUnprocessedTypes(); if (unprocessedTypes.isEmpty()) { break; }//from w w w .j a v a 2 s .c o m for (CSharpType type : unprocessedTypes) { final ClassTemplateSpec spec = type.getSpec(); if (type instanceof CSharpComplexType && !(type instanceof CSharpUnion)) { final CSharpComplexType templateType = (CSharpComplexType) type; try { final String modelsTemplate = getTemplateName(templateType); final String renderResult = renderToString(modelsTemplate, templateType); if (renderResult.isEmpty()) { throw new IOException("Rythm template does not exist at '" + modelsTemplate + "'"); } else { File outputDirectory = templateType.getOutputDirectory(parentOutputDirectory); outputDirectory.mkdirs(); writeToFile(new File(outputDirectory, templateType.getName() + C_SHARP_FILE_EXTENSION), renderResult); renderedCount++; } } catch (IOException e) { LOG.error("Failed to generate file for " + templateType.getName()); throw e; } } } } return renderedCount; }
From source file:org.uberfire.backend.server.plugins.engine.PluginJarProcessor.java
void loadPlugins() throws IOException { removeAllPlugins();// w w w . j a v a2 s . c o m final File pluginsRoot = new File(pluginsDir); if (pluginsRoot.exists()) { Collection<File> deployedPlugins = FileUtils.listFiles(pluginsRoot, new String[] { "jar" }, false); deployedPlugins.forEach(p -> loadPlugins(Paths.get(p.getAbsolutePath()), false)); } }
From source file:ch.wisv.areafiftylan.extras.consumption.service.ConsumptionServiceImpl.java
private void resetConsumptionEverywhere(Consumption consumption) { Collection<Ticket> allValidTickets = ticketService.getAllTickets().stream().filter(t -> t.isValid()) .collect(Collectors.toList()); allValidTickets.forEach(t -> reset(t.getId(), consumption.getId())); }