|
WPI GDC CMS 0.0.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--org.wpi.gdc.cms.db.DBEngine
|
+--org.wpi.gdc.cms.db.jdbc.MySQLDBEngine
DBEngine for use with a MySQL database backend.
| Fields inherited from class org.wpi.gdc.cms.db.DBEngine |
INCLUDE_AFTER_TODAY, INCLUDE_BEFORE_TODAY, ORDER_ASCENDING, ORDER_DESCENDING, session |
| Constructor Summary | |
MySQLDBEngine()
|
|
| Method Summary | |
void |
connect(java.lang.String dbURL,
java.util.Properties properties)
Connects to the database using the given db URL from the configuration options. |
boolean |
isConnected()
Determines if the database is connected (ie, a call to connect succeeded). |
Event |
loadEvent(int id)
Events are stored in a database via a numeric ID, this method should load the actual data based on the ID. |
Event |
loadEvent(java.lang.String name)
Each events to be accessed through the website must have a unique name identifier (which will correspond with that event's URL). |
int |
loadEventCount()
Counts the number of event groups available. |
DBIterator |
loadEvents()
Gets an DBIterator over the event groups in the database. |
DBIterator |
loadEvents(int field,
int order)
Gets a DBIterator over the event groups in the database, ordered by the given order. |
DBIterator |
loadEvents(int field,
int order,
int limit)
Gets a DBIterator over the event groups in the database, ordered by the given order, and limited to the given amount. |
DBIterator |
loadEventsFromDate(int range,
int order,
int limit)
Gets a DBIterator over the event groups in the database, either before or after the current day (determined by range), ordered
by the given order, and limited to the given amount. |
Icon[] |
loadIcons()
Gets all the Icons in a database. |
DBIterator |
loadNewsStories()
Gets an DBIterator over the news stories in the database. |
DBIterator |
loadNewsStories(int field,
int order)
Gets a DBIterator over the news stories in the database, ordered by the given order. |
DBIterator |
loadNewsStories(int field,
int order,
int limit)
Gets a DBIterator over the news stories in the database, ordered by the given order, and limited to the given amount. |
NewsStory |
loadNewsStory(int id)
News stories are stored in a database via a numeric ID, this method should load the actual data based on the ID. |
int |
loadNewsStoryCount()
Counts the number of news stories available. |
Topic[] |
loadTopics()
Gets all the Topics in a database. |
User |
loadUser(int id)
Users are stored in a database via a numeric ID, this method should load the actual data based on the ID. |
User |
loadUser(java.lang.String name)
Load a User from the DB based on the username. |
void |
saveNewsStory(NewsStory newsStory)
Save a NewsStory into the database. |
| Methods inherited from class org.wpi.gdc.cms.db.DBEngine |
setSession |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MySQLDBEngine()
| Method Detail |
public void connect(java.lang.String dbURL,
java.util.Properties properties)
throws DatabaseException
DBEngineconnect in class DBEngineorg.wpi.gdc.cms.db.DBEngineDatabaseException - if there is an error accessing data
from the databasepublic boolean isConnected()
DBEngineisConnected in class DBEngineorg.wpi.gdc.cms.db.DBEngine
public User loadUser(int id)
throws DatabaseException
DBEngineloadUser in class DBEngineorg.wpi.gdc.cms.db.DBEngineid - the ID for the User being loaded
public User loadUser(java.lang.String name)
throws DatabaseException
DBEngineloadUser in class DBEngineorg.wpi.gdc.cms.db.DBEnginename - the username of the User being loadedDatabaseException - if there is an error accessing data
from the database
public NewsStory loadNewsStory(int id)
throws DatabaseException
DBEngineloadNewsStory in class DBEngineorg.wpi.gdc.cms.db.DBEngineid - the ID for the news story being loadedDatabaseException - if there is an error accessing data
from the database
public DBIterator loadNewsStories()
throws DatabaseException
The remove() method in the DBIterator may or may not function depending on the implementation.
loadNewsStories in class DBEngineDatabaseException - if there is an error accessing data
from the database.
public DBIterator loadNewsStories(int field,
int order)
throws DatabaseException
DBEngineloadNewsStories in class DBEngineorg.wpi.gdc.cms.db.DBEnginefield - The field to sort by, one of:
NewsStory.FIELD_ID,
NewsStory.FIELD_AUTHOR,
NewsStory.FIELD_TOPIC,
NewsStory.FIELD_POSTED,
NewsStory.FIELD_HEADLINE,
NewsStory.FIELD_ABSTRACT, or
NewsStory.FIELD_BODY.order - The order to sort the new stories, either
DBEngine.ORDER_ASCENDING or DBEngine.ORDER_DESCENDING.java.lang.IllegalArgumentException - if field is not one of
NewsStory.FIELD_ID,
NewsStory.FIELD_AUTHOR,
NewsStory.FIELD_TOPIC,
NewsStory.FIELD_POSTED,
NewsStory.FIELD_HEADLINE,
NewsStory.FIELD_ABSTRACT, or
NewsStory.FIELD_BODY; or if
order is not either DBEngine.ORDER_ASCENDING or DBEngine.ORDER_DESCENDING.DatabaseException - if there is an error accessing data
from the database
public DBIterator loadNewsStories(int field,
int order,
int limit)
throws DatabaseException
DBEngineIf the given limit is more than the number of stories in the database, only the number available will be returned and no other error will occur.
loadNewsStories in class DBEngineorg.wpi.gdc.cms.db.DBEnginefield - The field to sort by, one of:
NewsStory.FIELD_ID,
NewsStory.FIELD_AUTHOR,
NewsStory.FIELD_TOPIC,
NewsStory.FIELD_POSTED,
NewsStory.FIELD_HEADLINE,
NewsStory.FIELD_ABSTRACT, or
NewsStory.FIELD_BODY.order - The order to sort the new stories, either
DBEngine.ORDER_ASCENDING or DBEngine.ORDER_DESCENDING.limit - The total number of stories to retrieve, or a negative
number for all of them.java.lang.IllegalArgumentException - if field is not one of
NewsStory.FIELD_ID,
NewsStory.FIELD_AUTHOR,
NewsStory.FIELD_TOPIC,
NewsStory.FIELD_POSTED,
NewsStory.FIELD_HEADLINE,
NewsStory.FIELD_ABSTRACT, or
NewsStory.FIELD_BODY; or if
order is not either DBEngine.ORDER_ASCENDING or DBEngine.ORDER_DESCENDING.DatabaseException - if there is an error accessing data
from the database
public void saveNewsStory(NewsStory newsStory)
throws DatabaseException
DBEngineNewsStory into the database. Should the
numeric ID be less than 0, the DBEngine should pick one before
saving the story into the database.saveNewsStory in class DBEngineorg.wpi.gdc.cms.db.DBEnginenewsStory - the NewsStory object to saveDatabaseException - if there is an error saving the
data in the database
public int loadNewsStoryCount()
throws DatabaseException
DBEngineloadNewsStoryCount in class DBEngineorg.wpi.gdc.cms.db.DBEngineDatabaseException - if there is an error accessing data
from the database
public Event loadEvent(int id)
throws DatabaseException
DBEngineloadEvent in class DBEngineorg.wpi.gdc.cms.db.DBEngineid - the ID for the event group being loadedDatabaseException - if there is an error accessing data
from the database
public Event loadEvent(java.lang.String name)
throws DatabaseException
DBEngineloadEvent in class DBEngineorg.wpi.gdc.cms.db.DBEnginename - the name for the event group being loadedDatabaseException - if there is an error accessing data
from the database (ie, if that event does not exist)
public DBIterator loadEvents()
throws DatabaseException
DBEngineThe remove() method in the DBIterator may or may not function depending on the implementation.
loadEvents in class DBEngineorg.wpi.gdc.cms.db.DBEngineDatabaseException - if there is an error accessing data
from the database
public DBIterator loadEvents(int field,
int order)
throws DatabaseException
DBEngineloadEvents in class DBEngineorg.wpi.gdc.cms.db.DBEnginefield - The field to sort by, one of:
Event.FIELD_ID,
Event.FIELD_NAME,
Event.FIELD_LOCATION,
Event.FIELD_URL, or
Event.FIELD_PAIRS.order - The order to sort the new stories, either
DBEngine.ORDER_ASCENDING or DBEngine.ORDER_DESCENDING.java.lang.IllegalArgumentException - if field is not one of
Event.FIELD_ID,
Event.FIELD_NAME,
Event.FIELD_LOCATION,
Event.FIELD_URL, or
Event.FIELD_PAIRS; or if
order is not either ORDER_ASCENDING or ORDER_DESCENDING.DatabaseException - if there is an error accessing data
from the database
public DBIterator loadEvents(int field,
int order,
int limit)
throws DatabaseException
DBEngineIf the given limit is more than the number of stories in the database, only the number available will be returned and no other error will occur.
loadEvents in class DBEngineorg.wpi.gdc.cms.db.DBEnginefield - The field to sort by, one of:
Event.FIELD_ID,
Event.FIELD_NAME,
Event.FIELD_LOCATION,
Event.FIELD_URL, or
Event.FIELD_PAIRS.order - The order to sort the new stories, either
DBEngine.ORDER_ASCENDING or DBEngine.ORDER_DESCENDING.limit - The total number of stories to retrieve, or a negative
number for all of them.java.lang.IllegalArgumentException - if field is not one of
Event.FIELD_ID,
Event.FIELD_NAME,
Event.FIELD_LOCATION,
Event.FIELD_URL, or
Event.FIELD_PAIRS; or if
order is not either ORDER_ASCENDING or ORDER_DESCENDING.DatabaseException - if there is an error accessing data
from the database
public DBIterator loadEventsFromDate(int range,
int order,
int limit)
throws DatabaseException
DBEnginerange), ordered
by the given order, and limited to the given amount.
If the given limit is more than the number of event groups in the database, only the number available will be returned and no other error will occur.
loadEventsFromDate in class DBEngineorg.wpi.gdc.cms.db.DBEnginerange - Determines if database will load events before
(DBEngine.INCLUDE_BEFORE_TODAY) or after (DBEngine.INCLUDE_AFTER_TODAY)
the current date.order - The order to sort the new stories, either
DBEngine.ORDER_ASCENDING or DBEngine.ORDER_DESCENDING.limit - The total number of stories to retrieve, or a negative
number for all of them.java.lang.IllegalArgumentException - if range is not either
DBEngine.INCLUDE_BEFORE_TODAY or DBEngine.INCLUDE_AFTER_TODAY; or
if order is not either DBEngine.ORDER_ASCENDING or
DBEngine.ORDER_DESCENDING.DatabaseException - if there is an error accessing data
from the database
public int loadEventCount()
throws DatabaseException
DBEngineloadEventCount in class DBEngineorg.wpi.gdc.cms.db.DBEngineDatabaseException - if there is an error accessing data
from the database
public Icon[] loadIcons()
throws DatabaseException
DBEngineloadIcons in class DBEngineorg.wpi.gdc.cms.db.DBEngineDatabaseException - if there is an error accessing data
from the database
public Topic[] loadTopics()
throws DatabaseException
DBEngineloadTopics in class DBEngineorg.wpi.gdc.cms.db.DBEngineDatabaseException - if there is an error accessing data
from the database
|
WPI GDC CMS 0.0.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||