Пример #1
0
  public String readCGCell(Row row, int cellIdx, DataDto dto, CellType cellType) {
    Cell cell = row.getCell(cellIdx);
    if (null == cell) {
      log.warn(
          "Table import. Table "
              + metaData.getTableName()
              + " Cell at row: "
              + (row.getRowNum() + 1)
              + " col: "
              + (cellIdx + 1)
              + " current value: "
              + dto.getConfidenceGrade()
              + " cell is null.");
      return null;
    }
    if (cell.getCellType() != Cell.CELL_TYPE_STRING) {
      log.warn(
          "Table import. Table "
              + metaData.getTableName()
              + " Cell at row: "
              + (row.getRowNum() + 1)
              + " col: "
              + (cellIdx + 1)
              + " current value: "
              + dto.getConfidenceGrade()
              + " CG cell is not of type String.");
      return null;
    }

    RichTextString cg = cell.getRichStringCellValue();
    return cg.getString();
  }
Пример #2
0
 protected void updateDtoConfidenceGrade(
     Row row, int cellIdx, DataDto dto, CellType cellType, String editedCGString) {
   if (null == editedCGString) {
     return;
   }
   if (editedCGString.isEmpty()) {
     return;
   }
   if (editedCGString.equals(dto.getConfidenceGrade())) {
     return;
   }
   // value has changed so convert it to CG index and store it as an edit
   ConfidenceGrade confidenceGrade = confidenceGradeService.getConfidenceGrade(editedCGString);
   if (null == confidenceGrade) {
     metaData.addWarning(
         row.getRowNum(),
         cellIdx,
         dto.getValue(),
         editedCGString,
         "This is not a valid value for a Confidence Grade. It cannot be changed.");
     return;
   }
   if (CellType.INPUT == cellType) {
     // value has changed so store it as an edit.
     dto.setUpdatedConfidenceGrade("" + confidenceGrade.getId());
   }
 }
Пример #3
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;
 }