コード例 #1
0
  @Override
  public DataSet getData() throws DataSetException {
    /*
     * Create a new data set instance in case no data set is available yet or configuration has
     * changed
     */
    boolean configurationChanged =
        dataSetConfiguration != null
            && !dataSetConfiguration.getParameters().equals(getConfiguration().getParameters());
    if (dataSet == null || configurationChanged) {

      // close old preview set in case a new one is created
      if (dataSet != null) {
        dataSet.close();
        dataSet = null;
      }

      try {
        this.dataSet = createDataSet(XlsxReadMode.OPERATOR);
        this.dataSetConfiguration = getConfiguration();
      } catch (OperatorException e) {
        throw new DataSetException(e.getMessage(), e.getCause());
      }
    }
    return dataSet;
  }
コード例 #2
0
  @Override
  public DataSet getPreview(int maxPreviewSize) throws DataSetException {
    /*
     * Create a new preview data set instance in case no preview is available yet or
     * configuration has changed
     */
    boolean configChange =
        previewConfiguration != null
            && !previewConfiguration.getParameters().equals(getConfiguration().getParameters());
    if (previewDataSet == null || configChange) {

      // close old preview set in case a new one is created
      if (previewDataSet != null) {
        previewDataSet.close();
        previewDataSet = null;
      }

      try {
        this.previewDataSet = createDataSet(XlsxReadMode.WIZARD_PREVIEW, maxPreviewSize);
        this.previewConfiguration = getConfiguration();
      } catch (OperatorException e) {
        throw new DataSetException(e.getMessage(), e.getCause());
      }
    }
    return previewDataSet;
  }