private Table processJournalName(Table table) throws IOException { ScimapsJournalMatcher scimapsJournalMatcher = new ScimapsJournalMatcher(); // Create new output table Table outputTable = TableUtilities.copyTable(table); outputTable.addColumn(STANDARDIZED_JOURNAL_NAME_COLUMN, String.class); int standardizedJournalNameColumnIndex = outputTable.getColumnNumber(STANDARDIZED_JOURNAL_NAME_COLUMN); // Retrieve iterator Iterator<?> rows = outputTable.tuples(); // Process journal names int rowIndex = 0; while (rows.hasNext()) { Tuple row = (Tuple) rows.next(); if (row.canGetString(journalColumnName)) { String name = row.getString(journalColumnName); String suggestedName = scimapsJournalMatcher.get(name); outputTable.setString(rowIndex, standardizedJournalNameColumnIndex, suggestedName); } rowIndex++; } return outputTable; }
protected static List<Record> readRecordsFromTable( Table table, LogService logger, String labelColumn, String startDateColumn, String endDateColumn, String sizeByColumn, String startDateFormat, String endDateFormat, String categoryColumn) { List<Record> workingRecordSet = new ArrayList<Record>(); for (Iterator<?> rows = table.tuples(); rows.hasNext(); ) { Tuple row = (Tuple) rows.next(); try { Record newRecord = new Record( row, labelColumn, startDateColumn, endDateColumn, sizeByColumn, startDateFormat, endDateFormat, categoryColumn); workingRecordSet.add(newRecord); } catch (InvalidRecordException e) { logger.log(LogService.LOG_WARNING, "A record was ignored: " + e.getMessage(), e); } } return workingRecordSet; }