Examples of EasyBatchReport


Examples of org.easybatch.core.api.EasyBatchReport

                .registerRecordValidator(new BeanValidationRecordValidator<Product>())
                .registerRecordProcessor(new ProductProcessor())
                .build();

        // Run easy batch engine
        EasyBatchReport easyBatchReport = easyBatchEngine.call();
        System.out.println(easyBatchReport);

        /*
         * Dump product table to checks inserted data
         */
 
View Full Code Here

Examples of org.easybatch.core.api.EasyBatchReport

        EasyBatchEngine easyBatchEngine = new EasyBatchEngineBuilder()
                .registerRecordReader(new FlatFileRecordReader(new File(args[0]))) //read data from secret-messages.txt
                .registerRecordProcessor(new MessageEncrypter())
                .build();

        EasyBatchReport easyBatchReport = easyBatchEngine.call();
        System.out.println(easyBatchReport);

        long singleInstanceEndTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - singleInstanceStartTime);

        System.out.println(COMMENT_SEPARATOR);
View Full Code Here

Examples of org.easybatch.core.api.EasyBatchReport

                .registerRecordMapper(productMapper)
                .registerRecordProcessor(new ProductProcessor())
                .build();

        // Run easy batch engine and get execution report
        EasyBatchReport easyBatchReport = easyBatchEngine.call();

        // Print Easy Batch report
        System.out.println(easyBatchReport);

        // Get the batch computation result
        Double maxProductPrice = (Double) easyBatchReport.getEasyBatchResult();

        // Print the maximum price
        System.out.println("The maximum product price for national published products is : " + maxProductPrice);

    }
View Full Code Here

Examples of org.easybatch.core.api.EasyBatchReport

        List<Object> results = new ArrayList<Object>();

        List<String> datasources = new ArrayList<String>();

        //calculate aggregate results
        EasyBatchReport easyBatchFinalReport = new EasyBatchReport();
        for (EasyBatchReport easyBatchReport : easyBatchReports) {
            startTimes.add(easyBatchReport.getStartTime());
            endTimes.add(easyBatchReport.getEndTime());
            totalRecords += easyBatchReport.getTotalRecords();
            filteredRecords.addAll(easyBatchReport.getFilteredRecords());
            ignoredRecords.addAll(easyBatchReport.getIgnoredRecords());
            rejectedRecords.addAll(easyBatchReport.getRejectedRecords());
            errorRecords.addAll(easyBatchReport.getErrorRecords());
            successRecords.addAll(easyBatchReport.getSuccessRecords());
            results.add(easyBatchReport.getEasyBatchResult());
            datasources.add(easyBatchReport.getDataSource());
        }

        //merge results
        easyBatchFinalReport.setStartTime(Collections.min(startTimes));
        easyBatchFinalReport.setEndTime(Collections.max(endTimes));
        easyBatchFinalReport.setTotalRecords(totalRecords);
        for (Integer filteredRecord : filteredRecords) {
            easyBatchFinalReport.addFilteredRecord(filteredRecord);
        }
        for (Integer ignoredRecord : ignoredRecords) {
            easyBatchFinalReport.addIgnoredRecord(ignoredRecord);
        }
        for (Integer rejectedRecord : rejectedRecords) {
            easyBatchFinalReport.addRejectedRecord(rejectedRecord);
        }
        for (Integer errorRecord : errorRecords) {
            easyBatchFinalReport.addErrorRecord(errorRecord);
        }
        for (Integer successRecord : successRecords) {
            easyBatchFinalReport.addSuccessRecord(successRecord);
        }
        easyBatchFinalReport.setEasyBatchResult(results);

        //data sources
        StringBuilder stringBuilder = new StringBuilder();
        for (String dataSource : datasources) {
            stringBuilder.append(dataSource).append("\n");

        }
        easyBatchFinalReport.setDataSource(stringBuilder.toString());

        //return merged report
        return easyBatchFinalReport;
    }
View Full Code Here

Examples of org.easybatch.core.api.EasyBatchReport

                .registerRecordMapper(new XmlRecordMapper<Greeting>(Greeting.class, new File(args[1])))
                .registerRecordProcessor(new GreetingProcessor())
                .build();

        // Run easy batch engine
        EasyBatchReport easyBatchReport = easyBatchEngine.call();

        // Print the batch execution report
        System.out.println(easyBatchReport);

    }
View Full Code Here

Examples of org.easybatch.core.api.EasyBatchReport

        Future<EasyBatchReport> batchReportFuture1 = executorService.submit(easyBatchEngine1);
        Future<EasyBatchReport> batchReportFuture2 = executorService.submit(easyBatchEngine2);

        //wait for easy batch instances termination and get partial reports
        EasyBatchReport easyBatchReport1 = batchReportFuture1.get();
        EasyBatchReport easyBatchReport2 = batchReportFuture2.get();

        //aggregate partial reports into a global one
        EasyBatchReportsAggregator reportsAggregator = new DefaultEasyBatchReportsAggregator();
        EasyBatchReport finalReport = reportsAggregator.aggregateReports(easyBatchReport1, easyBatchReport2);
        System.out.println(finalReport);

        //shutdown executor service
        executorService.shutdown();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.