Ignore:
Timestamp:
Feb 18, 2010, 8:10:35 AM (11 years ago)
Author:
tabma
Message:
  • rewrote to HashMap? based columns (columns are always unique, storing in array tricky/redundancy)
  • entities can be chosen in the preview
  • properties page shows columns grouped per entity
  • properties page allows mapping of column to property (TODO: get all fields per entity)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/services/dbnp/importer/ImporterService.groovy

    r169 r203  
    1919import org.apache.poi.poifs.filesystem.POIFSFileSystem
    2020import org.apache.poi.ss.usermodel.DataFormatter
    21 
     21import dbnp.importer.Column
    2222
    2323class ImporterService {
     
    4343        def sheet = wb.getSheetAt(sheetindex)
    4444        def datamatrix_start = sheet.getFirstRowNum() + 1
    45         def header = []       
     45        //def header = []
     46        def header = [:]
    4647        def df = new DataFormatter()
     48
    4749
    4850        for (HSSFCell c: sheet.getRow(sheet.getFirstRowNum())) {
     
    5456            switch (c.getCellType()) {
    5557                    case HSSFCell.CELL_TYPE_STRING:                     
    56                         header.add (columnindex:c.getColumnIndex(), value:df.formatCellValue(c), celltype:datamatrix_celltype);
     58                        header[c.getColumnIndex()] = new dbnp.importer.Column(value:df.formatCellValue(c), type:datamatrix_celltype);
    5759                        break
    5860                    case HSSFCell.CELL_TYPE_NUMERIC:
    59                         header.add (columnindex:c.getColumnIndex(), value:df.formatCellValue(c), celltype:datamatrix_celltype);
     61                        header[c.getColumnIndex()] = new dbnp.importer.Column(value:df.formatCellValue(c), type:datamatrix_celltype);
    6062                        break
    6163                    case HSSFCell.CELL_TYPE_BLANK:
    62                         header.add (columnindex:c.getColumnIndex(), value:"-", celltype:datamatrix_celltype);
     64                        header[c.getColumnIndex()] = new dbnp.importer.Column(value:df.formatCellValue(c), type:datamatrix_celltype);
    6365                        break
    6466                    default:
    65                         header.add (columnindex:c.getColumnIndex(), value:df.formatCellValue(c), celltype:datamatrix_celltype);
     67                        header[c.getColumnIndex()] = new dbnp.importer.Column(value:df.formatCellValue(c), type:datamatrix_celltype);
    6668                        break
    6769            }
Note: See TracChangeset for help on using the changeset viewer.