Package com.salesforce.dataloader.exception

Examples of com.salesforce.dataloader.exception.ExtractException


                startWriteExtraction(size);
                writeExtraction();
                flushResults();
            }
        } catch (final ApiFault e) {
            throw new ExtractException(e.getExceptionMessage(), e);
        } catch (final ConnectionException e) {
            throw new ExtractException(e.getMessage(), e);
        } catch (final AsyncApiException e) {
            throw new ExtractException(e.getExceptionMessage(), e);
        }
    }
View Full Code Here


                getRateCalculator(), false);
        jobUtil.createJob(getConfig());
        try {
            jobUtil.createBatch(new ByteArrayInputStream(soql.getBytes(Config.BULK_API_ENCODING)));
        } catch (final UnsupportedEncodingException e) {
            throw new ExtractException(e);
        }
        jobUtil.closeJob();
        final BatchInfo b = jobUtil.getBatches().getBatchInfo()[0];
        if (b.getState() == BatchStateEnum.Failed) throw new ExtractException("Batch failed: " + b.getStateMessage());
        this.batch = b;
        return b.getNumberRecordsProcessed();
    }
View Full Code Here

    }

    @Override
    protected void writeExtraction() throws AsyncApiException, ExtractException, DataAccessObjectException {
        if (this.batch.getState() == BatchStateEnum.Failed)
            throw new ExtractException("Batch failed: " + this.batch.getStateMessage());
        final QueryResultList results = getController().getBulkClient().getClient()
                .getQueryResultList(this.batch.getJobId(), this.batch.getId());

        for (final String resultId : results.getResult()) {
            if (getProgressMonitor().isCanceled()) return;
            try {
                final InputStream resultStream = getController().getBulkClient().getClient()
                        .getQueryResultStream(this.batch.getJobId(), this.batch.getId(), resultId);
                try {
                    final CSVReader rdr = new CSVReader(resultStream, Config.BULK_API_ENCODING);
                    rdr.setMaxCharsInFile(Integer.MAX_VALUE);
                    rdr.setMaxRowsInFile(Integer.MAX_VALUE);
                    List<String> headers;
                    headers = rdr.nextRecord();
                    List<String> csvRow;
                    while ((csvRow = rdr.nextRecord()) != null) {
                        final StringBuilder id = new StringBuilder();
                        final Row daoRow = getDaoRow(headers, csvRow, id);
                        addResultRow(daoRow, id.toString());
                    }
                } finally {
                    resultStream.close();
                }
            } catch (final IOException e) {
                throw new ExtractException(e);
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.salesforce.dataloader.exception.ExtractException

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.