Package com.salesforce.dataloader.dao

Examples of com.salesforce.dataloader.dao.DataReader


        // assert that it's a CSV...if not fail
        final Set<String> unexpectedIds = new HashSet<String>();
        final Set<String> expectedIds = new HashSet<String>(Arrays.asList(ids));
        String fileName = control.getConfig().getString(Config.OUTPUT_SUCCESS);
        final DataReader resultReader = new CSVFileReader(fileName, getController());
        try {
            resultReader.open();

            // go through item by item and assert that it's there
            Row row;
            while ((row = resultReader.readRow()) != null) {
                final String resultId = (String)row.get(Config.ID_COLUMN_NAME);
                assertValidId(resultId);
                if (!expectedIds.remove(resultId)) {
                    unexpectedIds.add(resultId);
                }
            }
        } finally {
            resultReader.close();
        }

        if (!expectedIds.isEmpty()) {
            Assert.fail("These ids were not found in the result file: " + expectedIds);
        }
View Full Code Here


                        ok.setEnabled(true);
                        label.setText(Labels.getString("DataSelectionDialog.errorRead")); //$NON-NLS-1$
                        shell.setText(Labels.getString("DataSelectionDialog.titleError"));
                        return;
                    }
                    DataReader dataReader = (DataReader)controller.getDao();

                    List header = null;
                    int totalRows = 0;
                    try {
                        dataReader.checkConnection();
                        dataReader.open();

                        String warning = DAORowUtil.validateColumns(dataReader);
                        if(warning != null && warning.length() != 0) {
                            int response = UIUtils.warningConfMessageBox(shell, warning + "\n" + Labels.getString("DataSelectionDialog.warningConf"));
                            // in case user doesn't want to continue, treat this as an error
                            if(response != SWT.YES) {
                                success = false;
                                ok.setEnabled(true);
                                label.setText(Labels.getString("DataSelectionDialog.errorCSVFormat")); //$NON-NLS-1$
                                shell.setText(Labels.getString("DataSelectionDialog.titleError"));
                                return;
                            }
                        }

                        totalRows = dataReader.getTotalRows();

                        if ((header = dataReader.getColumnNames())== null || header.size() == 0) {
                            success = false;
                            ok.setEnabled(true);
                            label.setText(Labels.getString("DataSelectionDialog.errorCSVFormat")); //$NON-NLS-1$
                            shell.setText(Labels.getString("DataSelectionDialog.titleError"));
                            return;
                        }

                    } catch (DataAccessObjectException e) {
                        success = false;
                        ok.setEnabled(true);
                        label.setText(Labels.getString("DataSelectionDialog.errorCSVFormat") + "  " + e.getMessage()); //$NON-NLS-1$
                        Point size = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
                        label.setSize(shell.getClientArea().width, size.y);
                        shell.setText(Labels.getString("DataSelectionDialog.titleError"));
                        shell.pack();
                        shell.redraw();
                        return;
                    } finally {
                        dataReader.close();
                    }
                    success = true;
                    ok.setEnabled(true);
                    label.setText(Labels.getFormattedString(
                            "DataSelectionDialog.initSuccess", String.valueOf(totalRows))); //$NON-NLS-1$
View Full Code Here

    private void getResults() throws AsyncApiException, OperationException, DataAccessObjectException {

        getProgressMonitor().setSubTask(Messages.getMessage(getClass(), "retrievingResults"));

        final DataReader dataReader = resetDAO();

        // create a map of batch infos by batch id. Each batchinfo has the final processing state of the batch
        final Map<String, BatchInfo> batchInfoMap = createBatchInfoMap();

        // go through all the batches we sent to sfdc in the same order and process the batch results for
View Full Code Here

        }
        return batchInfoMap;
    }

    private DataReader resetDAO() throws DataAccessObjectInitializationException, LoadException {
        final DataReader dataReader = (DataReader)getController().getDao();
        dataReader.close();
        // TODO: doing this causes sql to be executed twice, for sql we should cache results in a local file
        dataReader.open();
        // when re-opening the dao we need to start at the same row in the input
        DAORowUtil.get().skipRowToStartOffset(getConfig(), dataReader, getProgressMonitor(), true);
        return dataReader;
    }
View Full Code Here

TOP

Related Classes of com.salesforce.dataloader.dao.DataReader

Copyright © 2018 www.massapicom. 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.