com.openindex.openestate.tool.utils
Class CsvImportTask<CsvType>

java.lang.Object
  extended by javax.swing.SwingWorker<T,V>
      extended by org.jdesktop.application.Task<ResultType,Void>
          extended by com.openindex.openestate.tool.ImmoToolTask<Long>
              extended by com.openindex.openestate.tool.utils.CsvImportTask<CsvType>
Type Parameters:
CsvType - Klasse des CSV-Zielobjektes
All Implemented Interfaces:
Runnable, Future<Long>, RunnableFuture<Long>
Direct Known Subclasses:
ContactsEntryImportCsvTask

public abstract class CsvImportTask<CsvType>
extends ImmoToolTask<Long>

Allgemeiner ImmoToolTask zum Import von CSV-Tabellen.
$Id: CsvImportTask.java 1054 2011-09-08 16:21:07Z andy $

Author:
Andreas Rudolph

Nested Class Summary
 
Nested classes/interfaces inherited from class com.openindex.openestate.tool.ImmoToolTask
ImmoToolTask.Callback, ImmoToolTask.TaskMessageListener
 
Nested classes/interfaces inherited from class org.jdesktop.application.Task
org.jdesktop.application.Task.BlockingScope, org.jdesktop.application.Task.InputBlocker
 
Nested classes/interfaces inherited from class javax.swing.SwingWorker
SwingWorker.StateValue
 
Field Summary
 
Fields inherited from class org.jdesktop.application.Task
PROP_COMPLETED, PROP_DESCRIPTION, PROP_DONE, PROP_INPUTBLOCKER, PROP_MESSAGE, PROP_STARTED, PROP_TASKSERVICE, PROP_TITLE, PROP_USERCANCANCEL
 
Constructor Summary
protected CsvImportTask(File file)
           
 
Method Summary
protected abstract  CsvType createCsvObject()
           
 ComboBoxModel createFieldModel()
           
protected  Long executeImport()
           
protected  Long executeTask()
           
 File getCsvFile()
           
protected abstract  int getDefinedFieldCount()
           
 Map<Integer,List<Integer>> getFieldMapping()
           
protected abstract  String getFieldTitle(int index)
           
 boolean isMultipleSelectionAllowed(int field)
           
protected  String readValue(int field, String[] values)
           
protected abstract  void readValues(String[] src, CsvType dest)
           
protected abstract  boolean saveCsvObject(CsvType container)
           
 void setupReader(org.skife.csv.CSVReader reader)
           
 void setupReader(org.skife.csv.CSVReader reader, Charset charset)
           
 void setupReader(org.skife.csv.CSVReader reader, Charset charset, boolean ignoreFirstLine)
           
 
Methods inherited from class com.openindex.openestate.tool.ImmoToolTask
addMessageListener, cancelled, checkCancelled, createCallback, doInBackground, failed, finished, getTaskDialog, removeMessageListener, setMessage, setTaskDialog, succeeded
 
Methods inherited from class org.jdesktop.application.Task
addTaskListener, done, getApplication, getContext, getDescription, getExecutionDuration, getInputBlocker, getMessage, getMessageDuration, getResourceMap, getTaskListeners, getTaskService, getTitle, getUserCanCancel, interrupted, isPending, isProgressPropertyValid, isStarted, message, process, removeTaskListener, resourceName, setDescription, setInputBlocker, setProgress, setProgress, setProgress, setTitle, setUserCanCancel
 
Methods inherited from class javax.swing.SwingWorker
addPropertyChangeListener, cancel, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, publish, removePropertyChangeListener, run, setProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvImportTask

protected CsvImportTask(File file)
Method Detail

createCsvObject

protected abstract CsvType createCsvObject()

createFieldModel

public ComboBoxModel createFieldModel()

executeImport

protected Long executeImport()
                      throws ImmoToolException,
                             IOException
Throws:
ImmoToolException
IOException

executeTask

protected Long executeTask()
                    throws Exception
Specified by:
executeTask in class ImmoToolTask<Long>
Throws:
Exception

getDefinedFieldCount

protected abstract int getDefinedFieldCount()

getFieldMapping

public Map<Integer,List<Integer>> getFieldMapping()

getCsvFile

public File getCsvFile()

getFieldTitle

protected abstract String getFieldTitle(int index)

isMultipleSelectionAllowed

public boolean isMultipleSelectionAllowed(int field)

readValue

protected String readValue(int field,
                           String[] values)

readValues

protected abstract void readValues(String[] src,
                                   CsvType dest)

saveCsvObject

protected abstract boolean saveCsvObject(CsvType container)

setupReader

public final void setupReader(org.skife.csv.CSVReader reader)

setupReader

public final void setupReader(org.skife.csv.CSVReader reader,
                              Charset charset)

setupReader

public void setupReader(org.skife.csv.CSVReader reader,
                        Charset charset,
                        boolean ignoreFirstLine)


Copyright © 2012 OpenEstate. All Rights Reserved.