Пример #1
0
 public boolean newSection(Row row, PageSection nextSection) {
   for (PageForm form : nextSection.getPageForms()) {
     FormDisplayCell[][] cellGrid = form.getCellGrid();
     for (FormDisplayCell[] line : cellGrid) {
       int colIdx = 0;
       for (FormDisplayCell cell : line) {
         if (null != cell) {
           //							System.out.println("Model: '" + cell.getCellContents() + "' Spreadsheet: '" +
           // row.getCell(colIdx) + "'");
           switch (cell.getCellType()) {
             case EMPTY:
               colIdx++;
               break;
             case COL_HEADING:
               Cell spreadsheetCell = row.getCell(colIdx);
               // Check that the spreadsheet cell content is the same as the model.
               if (null == spreadsheetCell) {
                 // The spreadsheetCell can be null as long as there is nothing in the model cell.
                 if (!cell.getCellContents().isEmpty()) {
                   return false;
                 }
               } else {
                 try {
                   if (!cell.getCellContents().equals(spreadsheetCell.getStringCellValue())) {
                     // The next section and the current row are not the same.
                     //												System.out.println("Not a new section");
                     return false;
                   }
                 } catch (Exception e) {
                   //											System.out.println("Not a new section (not a String cell)");
                   return false;
                 }
               }
               colIdx++;
               break;
             case ROW_HEADING_NON_REPEAT:
             case ROW_HEADING:
             case CALC:
             case COPYCELL:
             case INPUT:
               colIdx++;
               break;
           }
         }
       }
     }
   }
   System.out.println("Is a new section at row " + row.getRowNum() + 1);
   return true;
 }
Пример #2
0
 public boolean hasData(Company company, GroupEntry ge, Map<String, DataDto> dataLookup) {
   for (FormDisplayCell cell : cells) {
     if (null != cell) {
       if (cell.getCellType().equals(CellType.COPYCELL)
           || cell.getCellType().equals(CellType.INPUT)) {
         DataKey key = new DataKey(cell.getCellContents()); // for
         // data
         // cells
         // getCellContents()
         // is
         // the
         // key.
         key.setCompanyId(company.getId());
         if (null != ge) {
           key.setGroupEntryId(ge.getId());
         }
         if (key.isCg()) {
           key.setCg(false);
           DataDto dto = dataLookup.get(key.getKey(true));
           if (null != dto && !dto.getConfidenceGrade().isEmpty()) {
             return true;
           }
         } else {
           DataDto dto = dataLookup.get(key.getKey(true));
           if (null != dto && !dto.getValue().isEmpty()) {
             return true;
           }
         }
       }
     }
   }
   return false;
 }
Пример #3
0
 protected DataKey makeKey(GroupEntry groupEntry, Company company, FormDisplayCell cell) {
   DataKey key = new DataKey(cell.getCellContents()); // for data cells
   // getCellContents()
   // is the key.
   key.setCompanyId(company.getId());
   key.setGroupEntryId(groupEntry.getId());
   return key;
 }