be.six.reports.data
Class Query

java.lang.Object
  extended by be.six.reports.data.Query
All Implemented Interfaces:
java.lang.Comparable<Query>

public class Query
extends java.lang.Object
implements java.lang.Comparable<Query>

Represents a database query. Is responsible for executing the query it represents and for its own UI

Author:
Joren Six

Method Summary
 void addActionListener(java.awt.event.ActionListener actionListener)
          Adds an action listener to this.
 int compareTo(Query o)
           
 DatabaseResult execute()
          Executes this query.
 DatabaseResult export()
          Executes this query and exports the result to the configured directory
static java.util.List<Query> readQueriesFromDirectory()
          Returns a list of Query objects representing SQL-files in a directory.
 void setSelectedItem(java.lang.Object item)
          Sets the selected query.
 java.lang.String toString()
           
 java.awt.Container ui()
          The user interface for this query.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

ui

public java.awt.Container ui()
The user interface for this query.

Returns:
a Container with the user interface for this Query.

execute

public DatabaseResult execute()
Executes this query.

Returns:
executes the query and returns a database result.

readQueriesFromDirectory

public static java.util.List<Query> readQueriesFromDirectory()
Returns a list of Query objects representing SQL-files in a directory.

Returns:
a list of Query objects representing every SQL-file in the configured directory.

compareTo

public int compareTo(Query o)
Specified by:
compareTo in interface java.lang.Comparable<Query>

export

public DatabaseResult export()
Executes this query and exports the result to the configured directory

Returns:
the DatabaseResult

addActionListener

public void addActionListener(java.awt.event.ActionListener actionListener)
Adds an action listener to this.

Parameters:
actionListener - the action listener

setSelectedItem

public void setSelectedItem(java.lang.Object item)
Sets the selected query.

Parameters:
item - the query to select