package journal.action; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import journal.reader.DataJournalEntry; import journal.reader.JournalEntry; import journal.schema.Attribute; import journal.schema.Domain; import journal.schema.TableVersion; public class HighAsciiFinderAction implements Action { private Map<String, List<String>> textAttributes = new HashMap<String, List<String>>(); private List<String> getTextAttributes(TableVersion tableVersion) { String tableName = tableVersion.getTable().getName(); if (!textAttributes.containsKey(tableName)) { List<String> list = new ArrayList<String>(); textAttributes.put(tableName, list); for (Attribute attr : tableVersion) { if (attr.getDomain() == Domain.KEY || attr.getDomain() == Domain.TEXT) { list.add(attr.getName()); } } } return textAttributes.get(tableName); } public void commitMarker(JournalEntry entry) { // TODO Auto-generated method stub } public void deleteValue(JournalEntry entry) { // TODO Auto-generated method stub } public void finish() { // TODO Auto-generated method stub } public void flushMarker(JournalEntry entry) { // TODO Auto-generated method stub } public void putValue(JournalEntry entry) { DataJournalEntry dataEntry = (DataJournalEntry) entry; TableVersion tableVersion = dataEntry.getTableVersion(); boolean leave = false; for (String attr : getTextAttributes(tableVersion)) { if (leave) break; String value = (String) dataEntry.getValue(attr); for (int i = 0; i < value.length(); i++) { if (value.charAt(i) > 127 ) { System.out.println("P: " + entry); leave = true; break; } } } } public void replaceValue(JournalEntry entry) { // TODO Auto-generated method stub } public void start() { // TODO Auto-generated method stub } public void verifyValue(JournalEntry entry) { // TODO Auto-generated method stub } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 7374 | Sven Erik Knop | Rename/move file(s) - correct location for Eclipse project | ||
#1 | 7117 | Sven Erik Knop |
Added HighAsciiFinderAction, an action that displays all journal/checkpoint entries that contain high ascii characters in any of their text fields. Small adjustment in journal.schema.TableVersion to provide an iterator for all attributes: for (Attribute attr : tableVersion) |