private static void checkRow(Row row) { int id = row.getInt("id"); String value = row.getString("data"); String valuePrefix = "rowdata-" + id; assertTrue(value.startsWith(valuePrefix)); assertEquals(valuePrefix.length() + 100, value.length()); }
private static void exportTables( Database database, String namesep, String genericOutputPath, String fieldsep, String rowsep) { try { for (Table table : database) { // Prepare the full csv file path, an integer is added if the file already exists String outputPath = constructOutputPath(genericOutputPath, namesep, table); FileWriter outputFileWriter = new FileWriter(outputPath); BufferedWriter outputBufferedWriter = new BufferedWriter(outputFileWriter); // Write the column names to the csv file ArrayList<String> columns = new ArrayList<String>(); for (Column column : table.getColumns()) { columns.add(column.getName()); } outputBufferedWriter.write(StringUtils.join(columns, fieldsep)); outputBufferedWriter.write(rowsep); // Write the rows to the csv file for (Row row : table) { outputBufferedWriter.write(StringUtils.join(row.values(), fieldsep)); outputBufferedWriter.write(rowsep); } outputBufferedWriter.close(); outputFileWriter.close(); } } catch (IOException ioe) { System.out.println("ERROR: unable to write the csv file to the file system"); closeDatabase(database); System.exit(1); } }
public Discipline(Row disziplin, String ruleNumber) { id = (int) disziplin.get("DisziplinID"); name = (String) disziplin.get("Bezeichnung"); wertung = (byte) disziplin.get("Wertung"); schusszahl = (short) disziplin.get("Schusszahl"); schiesszeit = (short) disziplin.get("Schiesszeit"); stellungsanzahl = (byte) disziplin.get("Stellungsanzahl"); probeschuesse = (short) disziplin.get("Probeschuesse"); probezeit = (short) disziplin.get("Probezeit"); serienlaenge = (short) disziplin.get("Serienlaenge"); this.ruleNumber = ruleNumber; }