+ /**
+ * Some "getter" for total row count
+ *
+ * @return Total row count
+ */
+ @Override
+ public int getTotalCount () {
+ // Trace message
+ this.getLogger().trace("CALLED!"); //NOI18N
+
+ try {
+ // Do a deprecated call
+ // @todo this needs rewrite!
+ return this.readContactList().size();
+ } catch (final BadTokenException ex) {
+ this.abortProgramWithException(ex);
+ }
+
+ // Invalid return
+ this.getLogger().trace("Returning -1 ... : EXIT!"); //NOI18N
+ return -1;
+ }
+
+ /**
+ * Checks whether at least one row is found with given boolean value.
+ *
+ * @param columnName Column to check for boolean value
+ * @param bool Boolean value to check
+ * @return Whether boolean value is found and returns at least one row
+ */
+ @Override
+ public boolean isRowFound (final String columnName, final boolean bool) {
+ // Trace message
+ this.getLogger().trace(MessageFormat.format("columnName={0},bool={1} - CALLED!", columnName, bool)); //NOI18N
+
+ // Is at least one entry found?
+ if (this.getTotalCount() == 0) {
+ // No entry found at all
+ return false;
+ }
+
+ // Default is not found
+ boolean isFound = false;
+
+ // Firsr rewind
+ this.rewind();
+
+ // Then loop through all lines
+ while (!this.isEndOfFile()) {
+ // Read line
+ String line = this.readLine();
+
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("line={0}", line));
+
+ try {
+ // And parse it to a Contact instance
+ Contact contact = this.parseLineToContact(line);
+
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("contact={0}", contact));
+
+ // This should not be null
+ if (contact == null) {
+ // Throw exception
+ throw new NullPointerException("contact is null");
+ }
+
+ // Now let the contact object check if it has such attribute
+ if (contact.isValueEqual(columnName, bool)) {
+ // Yes, it is set
+ isFound = true;
+ break;
+ }
+ } catch (final BadTokenException ex) {
+ // Don't continue with bad data
+ this.abortProgramWithException(ex);
+ }
+ }
+
+ // Trace message
+ this.getLogger().trace(MessageFormat.format("isFound={0} - EXIT!", isFound));
+
+ // Return result
+ return isFound;
+ }
+