Example usage for org.apache.poi.ss.usermodel Cell getColumnIndex

List of usage examples for org.apache.poi.ss.usermodel Cell getColumnIndex

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel Cell getColumnIndex.

Prototype

int getColumnIndex();

Source Link

Document

Returns column index of this cell

Usage

From source file:fr.unice.i3s.rockflows.experiments.automatictest.ExcelUtils.java

public static void moveColumns(XSSFSheet sheet) throws Exception {

    Row first = sheet.iterator().next();
    Cell firstCell = first.cellIterator().next();
    int firstIndex = firstCell.getColumnIndex();
    if (firstIndex > 2) {
        int difference = firstIndex - 2;
        for (int i = 0; i < difference; i++) {
            deleteColumn(sheet, 0);//from   w  ww. j  a v  a 2s  .  co  m
        }
    }
}

From source file:gov.nih.nci.cananolab.util.ExcelParser.java

License:BSD License

public void printSheet(Sheet sheet) {
    for (Row row : sheet) {
        for (Cell cell : row) {
            CellReference cellRef = new CellReference(cell.getRowIndex(), cell.getColumnIndex());
            System.out.print(cellRef.formatAsString());
            System.out.print(" - ");

            switch (cell.getCellType()) {
            case Cell.CELL_TYPE_STRING:
                System.out.println(cell.getRichStringCellValue().getString());
                break;
            case Cell.CELL_TYPE_NUMERIC:
                if (DateUtil.isCellDateFormatted(cell)) {
                    System.out.println(cell.getDateCellValue());
                } else {
                    System.out.println(cell.getNumericCellValue());
                }/*from   w ww  .  j  a v a2 s  .  c o  m*/
                break;
            case Cell.CELL_TYPE_BOOLEAN:
                System.out.println(cell.getBooleanCellValue());
                break;
            case Cell.CELL_TYPE_FORMULA:
                System.out.println(cell.getCellFormula());
                break;
            default:
                System.out.println();
            }
        }
    }
}

From source file:gov.nih.nci.evs.app.neopl.XLStoXLSX.java

License:Open Source License

/**
 * @param args/*from  w w w.  ja va 2s .  c o  m*/
 * @throws InvalidFormatException
 * @throws IOException
 */

public static void run(String inputfile, String outputfile) throws IOException {
    InputStream in = new BufferedInputStream(new FileInputStream(inputfile));
    try {
        Workbook wbIn = new HSSFWorkbook(in);
        File outFn = new File(outputfile);
        if (outFn.exists()) {
            outFn.delete();
        }

        Workbook wbOut = new XSSFWorkbook();
        int sheetCnt = wbIn.getNumberOfSheets();
        for (int i = 0; i < sheetCnt; i++) {
            Sheet sIn = wbIn.getSheetAt(0);
            Sheet sOut = wbOut.createSheet(sIn.getSheetName());
            Iterator<Row> rowIt = sIn.rowIterator();
            while (rowIt.hasNext()) {
                Row rowIn = rowIt.next();
                Row rowOut = sOut.createRow(rowIn.getRowNum());

                Iterator<Cell> cellIt = rowIn.cellIterator();
                while (cellIt.hasNext()) {
                    Cell cellIn = cellIt.next();
                    Cell cellOut = rowOut.createCell(cellIn.getColumnIndex(), cellIn.getCellType());

                    switch (cellIn.getCellType()) {
                    case Cell.CELL_TYPE_BLANK:
                        break;

                    case Cell.CELL_TYPE_BOOLEAN:
                        cellOut.setCellValue(cellIn.getBooleanCellValue());
                        break;

                    case Cell.CELL_TYPE_ERROR:
                        cellOut.setCellValue(cellIn.getErrorCellValue());
                        break;

                    case Cell.CELL_TYPE_FORMULA:
                        cellOut.setCellFormula(cellIn.getCellFormula());
                        break;

                    case Cell.CELL_TYPE_NUMERIC:
                        cellOut.setCellValue(cellIn.getNumericCellValue());
                        break;

                    case Cell.CELL_TYPE_STRING:
                        cellOut.setCellValue(cellIn.getStringCellValue());
                        break;
                    }

                    {
                        CellStyle styleIn = cellIn.getCellStyle();
                        CellStyle styleOut = cellOut.getCellStyle();
                        styleOut.setDataFormat(styleIn.getDataFormat());
                    }
                    cellOut.setCellComment(cellIn.getCellComment());

                    // HSSFCellStyle cannot be cast to XSSFCellStyle
                    // cellOut.setCellStyle(cellIn.getCellStyle());
                }
            }
        }
        OutputStream out = new BufferedOutputStream(new FileOutputStream(outFn));
        try {
            wbOut.write(out);
        } finally {
            out.close();
        }
    } finally {
        in.close();
    }
}

From source file:graphene.hts.file.ExcelXSSFToJSONConverter.java

License:Apache License

private List internalConvert(final Iterator<Row> rowIter) {
    final List<Map<String, String>> excelSheetConversion = new ArrayList<Map<String, String>>();
    final List<String> headerRow = new ArrayList<String>();
    if (rowIter.hasNext()) {
        final Row row = rowIter.next();
        final Iterator<Cell> cellIterator = row.cellIterator();
        while (cellIterator.hasNext()) {
            final Cell cell = cellIterator.next();
            String cellString = cell.getStringCellValue();
            if (!ValidationUtils.isValid(cellString)) {
                cellString = "Column " + cell.getColumnIndex();
            }/*  w ww.ja va2s.c  o m*/
            headerRow.add(cellString);
            System.out.println("Header Column: " + cellString);
        }

    }
    while (rowIter.hasNext()) {
        final Row row = rowIter.next();
        final Map<String, String> kvMap = new TreeMap<String, String>();
        final Iterator<org.apache.poi.ss.usermodel.Cell> cellIterator = row.cellIterator();
        while (cellIterator.hasNext()) {
            final org.apache.poi.ss.usermodel.Cell cell = cellIterator.next();
            // System.out.println("Header Columns: " + headerRow);
            final int ci = cell.getColumnIndex();
            String key = "Column " + ci;
            if (ci < headerRow.size()) {
                key = headerRow.get(cell.getColumnIndex());
            }
            switch (cell.getCellType()) {
            case Cell.CELL_TYPE_BOOLEAN:
                if (ValidationUtils.isValid(key, cell.getBooleanCellValue())) {
                    kvMap.put(key, new Boolean(cell.getBooleanCellValue()).toString());
                }
                break;
            case Cell.CELL_TYPE_STRING:
                if (ValidationUtils.isValid(key, cell.getStringCellValue())) {
                    kvMap.put(key, cell.getStringCellValue());
                }
                break;
            case Cell.CELL_TYPE_NUMERIC:
                if (ValidationUtils.isValid(key, cell.getNumericCellValue())) {
                    kvMap.put(key, new Double(cell.getNumericCellValue()).toString());
                }
                break;
            case Cell.CELL_TYPE_BLANK:
                break;
            default:
                break;

            }

        }
        excelSheetConversion.add(kvMap);
    }
    logger.debug("Added sheet to conversion.");
    return excelSheetConversion;
}

From source file:guru.qas.martini.report.DefaultState.java

License:Apache License

public void updateLongestExecutions() {
    if (!longestExecutionCells.isEmpty()) {
        for (Cell cell : longestExecutionCells) {
            CellStyle original = cell.getCellStyle();
            Sheet sheet = cell.getSheet();
            Workbook workbook = sheet.getWorkbook();
            CellStyle newStyle = workbook.createCellStyle();
            newStyle.cloneStyleFrom(original);
            int originalFontIndex = original.getFontIndexAsInt();
            Font originalFont = workbook.getFontAt(originalFontIndex);

            Font font = workbook.createFont();
            font.setBold(true);/*from  w  w  w . j  av  a  2 s  .c  om*/
            font.setColor(IndexedColors.DARK_RED.getIndex());
            font.setFontHeight((short) Math.round(originalFont.getFontHeight() * 1.5));
            newStyle.setFont(font);
            cell.setCellStyle(newStyle);

            Row row = cell.getRow();
            short firstCellNum = row.getFirstCellNum();
            short lastCellNum = row.getLastCellNum();

            for (int i = firstCellNum; i < lastCellNum; i++) {
                Cell rowCell = row.getCell(i);
                original = rowCell.getCellStyle();
                CellStyle borderStyle = workbook.createCellStyle();
                borderStyle.cloneStyleFrom(original);
                borderStyle.setBorderTop(BorderStyle.MEDIUM);
                borderStyle.setBorderBottom(BorderStyle.MEDIUM);

                if (i == cell.getColumnIndex()) {
                    borderStyle.setBorderLeft(BorderStyle.MEDIUM);
                    borderStyle.setBorderRight(BorderStyle.MEDIUM);
                } else if (i == firstCellNum) {
                    borderStyle.setBorderLeft(BorderStyle.MEDIUM);
                } else if (i == lastCellNum - 1) {
                    borderStyle.setBorderRight(BorderStyle.MEDIUM);
                }
                rowCell.setCellStyle(borderStyle);
            }
        }
    }
}

From source file:icalendarconverter.ExcelConverter.java

public List<ScheduleClass> readExcel() throws FileNotFoundException, IOException {
    ArrayList<ScheduleClass> scheduleList = new ArrayList<>();

    FileInputStream fis = new FileInputStream(pathFile);

    XSSFWorkbook wb = new XSSFWorkbook(fis);
    XSSFSheet sheet = wb.getSheetAt(0);//  ww  w.  j  a va2s  .c  om
    Iterator<Row> rowIterator = sheet.iterator();

    CellRangeAddress add;
    int colNoIdx = 0;
    ArrayList<String> dosen = new ArrayList<>();
    ArrayList<Integer> idxDosen = new ArrayList<>();
    ArrayList<Integer> colDosen = new ArrayList<>();
    ArrayList<String> location = new ArrayList<>();
    int idxNumber = 0;
    ArrayList<Integer> locationIdx = new ArrayList<>();
    outerloop: for (int j = 0; j < sheet.getLastRowNum(); j++) {
        row = sheet.getRow(j);
        for (int f = 0; f < row.getLastCellNum(); f++) {
            Cell cell = row.getCell(f);
            if (cell.getCellType() == Cell.CELL_TYPE_STRING
                    && cell.getStringCellValue().equalsIgnoreCase("No.")) {
                rowNoIdx = j;
                colNoIdx = cell.getColumnIndex();
            } else if (cell.getCellType() == Cell.CELL_TYPE_STRING
                    && cell.getStringCellValue().equalsIgnoreCase("Nama Mata Kuliah")) {
                colMatkulIdx = cell.getColumnIndex();
                break outerloop;
            }

        }
    }
    //System.out.println("col matkul = "+colMatkulIdx);
    System.out.println("sheet = " + sheet.getLastRowNum());
    outerloop2: for (int i = 0; i < sheet.getLastRowNum(); i++) {
        outerloop: for (int j = 0; j < row.getLastCellNum(); j++) {
            row = sheet.getRow(i);
            if (row == null) {
                i = sheet.getLastRowNum();
                break outerloop2;
            }
            Cell cell = row.getCell(j);
            FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
            if (cell.getColumnIndex() == colNoIdx && i > rowNoIdx + 3
                    && cell.getCellType() != Cell.CELL_TYPE_BLANK
                    && evaluator.evaluate(cell).getCellType() != Cell.CELL_TYPE_NUMERIC) {
                i = sheet.getLastRowNum();
                break outerloop2;
            }
            if (cell.getColumnIndex() == colNoIdx && i > rowNoIdx + 3
                    && cell.getCellType() == Cell.CELL_TYPE_BLANK) {
                i = i + 1;
                break outerloop;
            }

            if (cell.getRowIndex() > rowNoIdx + 1 && cell.getColumnIndex() == (colNoIdx + 1)) {
                if (cell.getCellType() == Cell.CELL_TYPE_BLANK) {
                    i = i + 1;
                    break outerloop;
                }
                String delims = "[,. ]";
                String[] sumary = cell.getStringCellValue().split(delims);
                for (int l = 0; l < sumary.length; l++) {
                    if (sumary[l].equalsIgnoreCase("Mrt")) {
                        sumary[l] = "3";
                    }
                    if (sumary[l].equalsIgnoreCase("Okt")) {
                        sumary[l] = "10";
                    }
                    if (sumary[l].equalsIgnoreCase("`16")) {
                        sumary[l] = "2016";
                    }
                }

                lc = LocalDate.of(Integer.parseInt(sumary[5]), Integer.parseInt(sumary[3]),
                        Integer.parseInt(sumary[2]));
                // System.out.println("LC = "+lc);

                //                        sp = new SimpleDateFormat("EEEE, MMMM d, yyyy");
                //                        String b = sumary[3] + "/" + sumary[2] + "/" + sumary[5];
                //                        date = new Date(b);
                //System.out.println(sp.format(date));
            }
            if (cell.getRowIndex() > rowNoIdx + 1 && cell.getColumnIndex() == (colNoIdx + 2)) {
                if (cell.getStringCellValue().equalsIgnoreCase("LIBUR")) {
                    i = i + 1;
                    break outerloop;
                } else {
                    if (cell.getStringCellValue().equalsIgnoreCase("Shift 1")
                            || cell.getStringCellValue().equalsIgnoreCase("Shift 2")) {
                        CellReference cr = new CellReference(cell.getRowIndex() + 1, cell.getColumnIndex());
                        Row row2 = sheet.getRow(cr.getRow());
                        Cell c = row2.getCell(cr.getCol());
                        String delimsJam = "[-]";
                        String[] arrJam = c.getStringCellValue().split(delimsJam);
                        for (int k = 0; k < arrJam.length; k++) {
                            arrJam[k] = arrJam[k].replace('.', ':');
                        }
                        //                                indoFormatter = DateTimeFormatter
                        //                                        .ofLocalizedTime(FormatStyle.SHORT)
                        //                                        .withLocale(Locale.getDefault());
                        //System.out.println("I3 = " + i);
                        lt = LocalTime.parse(arrJam[0]);
                        //System.out.println(lt+"-"+lt.plusHours(2)); 

                    } else {
                        String delimsJam = "[-]";
                        String[] arrJam = cell.getStringCellValue().split(delimsJam);
                        for (int k = 0; k < arrJam.length; k++) {
                            arrJam[k] = arrJam[k].replace('.', ':');
                        }
                        //                                indoFormatter = DateTimeFormatter
                        //                                        .ofLocalizedTime(FormatStyle.SHORT)
                        //                                        .withLocale(Locale.getDefault());
                        //System.out.println("I3 = " + i);
                        lt = LocalTime.parse(arrJam[0]);
                        //System.out.println(lt+"-"+lt.plusHours(2)); 
                    }

                }

            }
            if (cell.getRowIndex() > rowNoIdx + 1 && cell.getColumnIndex() == colMatkulIdx) {
                subject = cell.getStringCellValue();
                //System.out.println("Subject = "+subject);
            }

            if (cell.getRowIndex() > rowNoIdx && cell.getColumnIndex() >= colMatkulIdx + 1
                    && cell.getColumnIndex() < row.getLastCellNum()) {
                if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
                    //                        location.add(String.valueOf((int)cell.getNumericCellValue()));
                    //                        locationIdx.add(cell.getColumnIndex());
                }
                if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
                    if (cell.getStringCellValue().contains(":")) {
                        String[] splt = cell.getStringCellValue().split(":");
                        String[] splt2 = splt[1].split(",");
                        for (int l = 0; l < splt2.length; l++) {
                            dosen.add(splt2[l].trim());
                            location.add("Lab");
                            //System.out.println(splt2[l] + "= lab");
                        }
                    } else {
                        CellReference cr = new CellReference(1, cell.getColumnIndex());
                        Row row2 = sheet.getRow(cr.getRow());
                        Cell c = row2.getCell(cr.getCol());
                        if (!cell.getStringCellValue().isEmpty()) {
                            dosen.add(cell.getStringCellValue().trim());
                            location.add(String.valueOf((int) c.getNumericCellValue()).trim());
                        }

                        //System.out.print(cell.getStringCellValue() + " Ruang =" + (int) c.getNumericCellValue() + " ");
                    }

                }
                if (cell.getCellType() == Cell.CELL_TYPE_BLANK && cell.getRowIndex() > 2) {
                    CellReference cr = new CellReference(cell.getRowIndex() - 1, cell.getColumnIndex());
                    Row row2 = sheet.getRow(cr.getRow());
                    Cell c = row2.getCell(cr.getCol());
                    CellReference cr2 = new CellReference(1, cell.getColumnIndex());
                    Row row3 = sheet.getRow(cr2.getRow());
                    Cell c2 = row3.getCell(cr2.getCol());
                    if (c.getStringCellValue().contains(":")) {
                        String[] splt = c.getStringCellValue().split(":");
                        String[] splt2 = splt[1].split(",");
                        for (int l = 0; l < splt2.length; l++) {
                            dosen.add("".trim());
                            location.add("");
                            //System.out.println(splt2[l] + "= lab");
                        }
                    } else {
                        if (!c.getStringCellValue().isEmpty()) {
                            dosen.add("");
                            location.add("");
                        }

                        //System.out.print(c.getStringCellValue() + " Ruang = " + (int) c2.getNumericCellValue() + " ");
                    }
                }
                //                   scheduleList.add(new ScheduleClass(lc, lt, lt, subject, dosen.get(j), location.get(j)));
            }
            //                System.out.println("lc = "+lc+",lt = "+lt+",subject = "+subject+",dosen = "+dosen.get(i)+",location = "+location.get(i));
            //                scheduleList.add(new ScheduleClass(lc, lt, lt, subject, dosen.get(j), location.get(j)));

        }

        for (int j = 0; j < dosen.size(); j++) {
            //System.out.println("lc = "+lc+",lt = "+lt+",subject = "+subject+",dosen = "+dosen.get(j)+",location = "+location.get(j));
            scheduleList
                    .add(new ScheduleClass(lc, lt, lt.plusHours(2), subject, dosen.get(j), location.get(j)));
        }
        dosen.clear();
        location.clear();

    }

    return mergeringList(scheduleList);
}

From source file:in.expertsoftware.colorcheck.Reporting_Qtr_Verification.java

public ArrayList<ErrorModel> startReporting_QtrVerification(int SORQ_tokenLocation, int EORQ_tokenLocation,
        ArrayList<String> opeartion_standard_workingSectionList,
        ArrayList<String> financial_standard_workingSectionList, XSSFWorkbook workbook) {
    ArrayList<ErrorModel> errorModelList = new ArrayList<ErrorModel>();
    boolean operationCheck;
    boolean financialCheck;
    int first_Occurance_Of_Financial_Comparision = 0;
    XSSFSheet Sheet = workbook.getSheet("Reporting_Qtr");
    Iterator<Row> rowIterator = Sheet.iterator();
    while (rowIterator.hasNext()) {
        Row row = rowIterator.next();//  w w w . j ava 2 s  .co m
        Iterator<Cell> cellIterator = row.iterator();
        while (cellIterator.hasNext()) {
            Cell cell = cellIterator.next();
            if (cell.getColumnIndex() == 1) {
                String key = cell.getStringCellValue();
                if ((key.equalsIgnoreCase("Financial Comparison"))
                        && (first_Occurance_Of_Financial_Comparision == 0)) {
                    first_Occurance_Of_Financial_Comparision = row.getRowNum() + 1;
                }
            }
        }
    }
    operationCheck = operation_Standard_Workingsection_Verification(SORQ_tokenLocation,
            first_Occurance_Of_Financial_Comparision, Sheet, opeartion_standard_workingSectionList,
            errorModelList, workbook);
    //financialCheck=financial_Standard_Workingsection_Verification(first_Occurance_Of_Financial_Comparision,EORQ_tokenLocation,Sheet,financial_standard_workingSectionList,errorModelList,workbook);                                

    //if return false that means no error.
    if (!operationCheck) {
        reporting_Qtr_operation_Standard_C_To_I_Column_Verification((SORQ_tokenLocation + 3),
                first_Occurance_Of_Financial_Comparision, errorModelList, Sheet, workbook);
    }
    /*if(!financialCheck)
    {
              
    }*/
    return errorModelList;
}

From source file:in.expertsoftware.colorcheck.Reporting_Year_Verification.java

public ArrayList<ErrorModel> startReporting_YearVerification(int SORY_tokenLocation, int EORY_tokenLocation,
        ArrayList<String> opeartion_standard_workingSectionList,
        ArrayList<String> financial_standard_workingSectionList, XSSFWorkbook workbook) {
    ArrayList<ErrorModel> errorModelList = new ArrayList<ErrorModel>();
    boolean operationCheck;
    boolean financialCheck;
    int first_Occurance_Of_Financial_Comparision = 0;
    XSSFSheet Sheet = workbook.getSheet("Reporting_Year");
    Iterator<Row> rowIterator = Sheet.iterator();
    while (rowIterator.hasNext()) {
        Row row = rowIterator.next();//  w  w  w . ja  va2 s.  c  o m
        Iterator<Cell> cellIterator = row.iterator();
        while (cellIterator.hasNext()) {
            Cell cell = cellIterator.next();
            if (cell.getColumnIndex() == 1) {
                String key = cell.getStringCellValue();
                if ((key.equalsIgnoreCase("Financial Comparison"))
                        && (first_Occurance_Of_Financial_Comparision == 0)) {
                    first_Occurance_Of_Financial_Comparision = row.getRowNum() + 1;
                }
            }
        }
    }
    operationCheck = operation_Standard_Workingsection_Verification(SORY_tokenLocation,
            first_Occurance_Of_Financial_Comparision, Sheet, opeartion_standard_workingSectionList,
            errorModelList, workbook);
    //financialCheck=financial_Standard_Workingsection_Verification(first_Occurance_Of_Financial_Comparision,EORY_tokenLocation,Sheet,financial_standard_workingSectionList,errorModelList,workbook);                                

    //if return false that means no error.
    if (!operationCheck) {
        reporting_Year_operation_Standard_C_To_I_Column_Verification((SORY_tokenLocation + 3),
                first_Occurance_Of_Financial_Comparision, errorModelList, Sheet, workbook);
    }
    /*if(!financialCheck)
    {
              
    }*/
    return errorModelList;
}

From source file:in.expertsoftware.colorcheck.VerifyTokens.java

/**
 * Verify_tokens function takes two parameters first is number of sheets present in workbook and second is an instance of workbook.
 * it process each sheet individually and verifying the tokens position as well check tokens are present or not and error is handled by error model.
 * @param NumberOfSheets Number of Sheet present In this workbook
 * @param workbook an instance of XSSFWorkbook
 * @return ArrayList   of type Error and Model
 * /* w w  w  .  ja v a 2 s  .  co m*/
 */
public ArrayList verify_tokens(int NumberOfSheets, XSSFWorkbook workbook) {
    ArrayList<ErrorModel> errorModelList = new ArrayList<ErrorModel>();
    ArrayList<TokenModel> tokenModelList = new ArrayList<TokenModel>();
    ArrayList<String> metadataCount = new ArrayList<String>();
    ArrayList errorAndTokenList = new ArrayList();
    for (int i = 0; i < NumberOfSheets; i++) {
        XSSFSheet Sheet = workbook.getSheetAt(i);
        if (containSheetName(Sheet.getSheetName())) {
            Iterator<Row> rowIterator = Sheet.iterator();
            while (rowIterator.hasNext()) {
                Row row = rowIterator.next();
                Iterator<Cell> cellIterator = row.iterator();
                while (cellIterator.hasNext()) {
                    Cell cell = cellIterator.next();
                    if (cell.getColumnIndex() == 0) {
                        String key = cell.getStringCellValue();
                        switch (Sheet.getSheetName()) {
                        case "BasicInfo":
                            if (!(cell.getCellType() == Cell.CELL_TYPE_BLANK)) {
                                ErrorModel errmodel = new ErrorModel();
                                errmodel.setSheet_name(Sheet.getSheetName());
                                CellReference cellRef = new CellReference(cell);
                                errmodel.setCell_ref(cellRef.formatAsString());
                                errmodel.setRow(cell.getRowIndex() + 1);
                                errmodel.setCol(cell.getColumnIndex() + 1);
                                errmodel.setError_desc("Vulnerable Token present at");
                                errmodel.setError_level("Error");
                                errorModelList.add(errmodel);
                            }
                            break;
                        case "User_Financial_Input":
                            switch (key.trim()) {
                            case "SOUFI":
                                TokenModel tknmodel = new TokenModel();
                                if (metadataCount.contains("SOUFI")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOUFI");
                                }
                                break;

                            case "EOUFI":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOUFI")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOUFI");
                                }
                                break;

                            case "UFCS1":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("UFCS1")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("UFCS1");
                                }
                                break;

                            case "UFCS2":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("UFCS2")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("UFCS2");
                                }
                                break;
                            }
                            break;
                        case "User_Operation_Input":
                            switch (key.trim()) {

                            case "SOUOI":
                                TokenModel tknmodel = new TokenModel();
                                if (metadataCount.contains("SOUOI")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOUOI");
                                }
                                break;

                            case "EOUOI":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOUOI")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOUOI");
                                }
                                break;
                            }
                            break;
                        case "Unit_Map":
                            break;
                        case "Operation_Standard":
                            switch (key.trim()) {
                            case "SOOI":
                                TokenModel tknmodel = new TokenModel();
                                if (metadataCount.contains("SOOI")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOOI");
                                }
                                break;
                            case "EOOI":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOOI")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef1 = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef1.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOOI");
                                }
                                break;
                            case "SOOCS":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("SOOCS")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOOCS");
                                }
                                break;
                            case "EOOCS":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOOCS")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOOCS");
                                }
                                break;
                            case "SOOWD":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("SOOWD")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOOWD");
                                }
                                break;
                            case "EOOWD":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOOWD")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOOWD");
                                }
                                break;

                            }
                            break;
                        case "Financial_Standard":
                            switch (key.trim()) {
                            case "SOFI":
                                TokenModel tknmodel = new TokenModel();
                                if (metadataCount.contains("SOFI")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOFI");
                                }
                                break;
                            case "EOFI":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOFI")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOFI");
                                }
                                break;
                            case "FCS1":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("FCS1")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("FCS1");
                                }
                                break;
                            case "FCS2":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("FCS2")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("FCS2");
                                }
                                break;
                            case "SOFWD":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("SOFWD")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOFWD");
                                }
                                break;
                            case "EOFWD":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOFWD")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOFWD");
                                }
                                break;
                            case "SOFCP":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("SOFCP")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOFCP");
                                }
                                break;
                            case "EOFCP":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOFCP")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOFCP");
                                }
                                break;
                            }
                            break;
                        case "CrossCheck":
                            switch (key.trim()) {
                            case "SOCCK":
                                TokenModel tknmodel = new TokenModel();
                                if (metadataCount.contains("SOCCK")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOCCK");
                                }
                                break;
                            case "EOCCK":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOCCK")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOCCK");
                                }
                                break;
                            }
                            break;
                        case "Reporting_Qtr":
                            switch (key.trim()) {
                            case "SORQ":
                                TokenModel tknmodel = new TokenModel();
                                if (metadataCount.contains("SORQ")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SORQ");
                                }
                                break;
                            case "EORQ":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EORQ")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EORQ");
                                }
                                break;
                            }
                            break;
                        case "Reporting_Year":
                            switch (key.trim()) {
                            case "SORY":
                                TokenModel tknmodel = new TokenModel();
                                if (metadataCount.contains("SORY")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SORY");
                                }
                                break;
                            case "EORY":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EORY")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EORY");
                                }
                                break;
                            }
                            break;
                        case "Chart_Qtr":
                            switch (key.trim()) {
                            case "SOOCQ":
                                TokenModel tknmodel = new TokenModel();
                                if (metadataCount.contains("SOOCQ")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOOCQ");
                                }
                                break;
                            case "EOOCQ":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOOCQ")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOOCQ");
                                }
                                break;
                            case "SOFCQ":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("SOFCQ")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOFCQ");
                                }
                                break;
                            case "EOFCQ":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOFCQ")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOFCQ");
                                }
                                break;
                            }
                            break;
                        case "Chart_Year":
                            switch (key.trim()) {
                            case "SOOCY":
                                TokenModel tknmodel = new TokenModel();
                                if (metadataCount.contains("SOOCY")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOOCY");
                                }
                                break;
                            case "EOOCY":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOOCY")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOOCY");
                                }
                                break;
                            case "SOFCY":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("SOFCY")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOFCY");
                                }
                                break;
                            case "EOFCY":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOFCY")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOFCY");
                                }
                                break;
                            }
                            break;
                        case "Summary":
                            switch (key.trim()) {
                            case "SOS":
                                TokenModel tknmodel = new TokenModel();
                                if (metadataCount.contains("SOS")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("SOS");
                                }
                                break;
                            case "EOS":
                                tknmodel = new TokenModel();
                                if (metadataCount.contains("EOS")) {
                                    ErrorModel errmodel = new ErrorModel();
                                    errmodel.setSheet_name(Sheet.getSheetName());
                                    CellReference cellRef = new CellReference(cell);
                                    errmodel.setCell_ref(cellRef.formatAsString());
                                    errmodel.setRow(cell.getRowIndex() + 1);
                                    errmodel.setCol(cell.getColumnIndex() + 1);
                                    errmodel.setError_desc("Token Present More Than One Time");
                                    errmodel.setError_level("Error");
                                    errorModelList.add(errmodel);
                                } else {
                                    tknmodel.setSheet_name(Sheet.getSheetName());
                                    tknmodel.setToken_name(key.trim());
                                    tknmodel.setRow_no((cell.getRowIndex() + 1));
                                    tokenModelList.add(tknmodel);
                                    metadataCount.add("EOS");
                                }
                                break;
                            }
                            break;
                        case "MetaDataSheet":
                            break;
                        }
                    }
                }
            }
        } else {
            System.out.println("workbook have another sheet");
            ErrorModel errmodel = new ErrorModel();
            errmodel.setError_desc("This is an extra sheet in this workbook");
            errmodel.setSheet_name(Sheet.getSheetName());
            //errmodel.setRow(-2);
            errmodel.setError_level("Warning");
            errorModelList.add(errmodel);
        }
    }
    //for checking every tocken is present or not;  
    errorModelList.addAll(verifyAllTokenPresent(metadataCount));
    errorAndTokenList.add(errorModelList);
    errorAndTokenList.add(tokenModelList);
    return errorAndTokenList;
}

From source file:info.informationsea.tableio.excel.ExcelSheetReader.java

License:Open Source License

@Override
protected Object[] readNextRow() {
    if (sheet.getLastRowNum() < currentRow)
        return null;

    Row row = sheet.getRow(currentRow);//from   w w  w .ja v  a  2s  .c  o  m
    Object[] rowObjects = new Object[row.getLastCellNum()];
    for (Cell cell : row) {
        Object value;
        switch (cell.getCellType()) {
        case Cell.CELL_TYPE_BOOLEAN:
            value = cell.getBooleanCellValue();
            break;
        case Cell.CELL_TYPE_NUMERIC:
            value = cell.getNumericCellValue();
            break;
        case Cell.CELL_TYPE_STRING:
        default:
            value = cell.getStringCellValue();
            break;
        }

        rowObjects[cell.getColumnIndex()] = value;
    }
    currentRow += 1;
    return rowObjects;
}