|
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
DBEngine
connect
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
DatabaseException
- if there is an error accessing data
from the databasepublic boolean isConnected()
DBEngine
isConnected
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
public User loadUser(int id) throws DatabaseException
DBEngine
loadUser
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
id
- the ID for the User being loadedpublic User loadUser(java.lang.String name) throws DatabaseException
DBEngine
loadUser
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
name
- the username of the User being loadedDatabaseException
- if there is an error accessing data
from the databasepublic NewsStory loadNewsStory(int id) throws DatabaseException
DBEngine
loadNewsStory
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
id
- the ID for the news story being loadedDatabaseException
- if there is an error accessing data
from the databasepublic DBIterator loadNewsStories() throws DatabaseException
The remove() method in the DBIterator may or may not function depending on the implementation.
loadNewsStories
in class DBEngine
DatabaseException
- if there is an error accessing data
from the database.public DBIterator loadNewsStories(int field, int order) throws DatabaseException
DBEngine
loadNewsStories
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
field
- 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 databasepublic DBIterator loadNewsStories(int field, int order, int limit) throws DatabaseException
DBEngine
If 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 DBEngine
org.wpi.gdc.cms.db.DBEngine
field
- 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 databasepublic void saveNewsStory(NewsStory newsStory) throws DatabaseException
DBEngine
NewsStory
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 DBEngine
org.wpi.gdc.cms.db.DBEngine
newsStory
- the NewsStory object to saveDatabaseException
- if there is an error saving the
data in the databasepublic int loadNewsStoryCount() throws DatabaseException
DBEngine
loadNewsStoryCount
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
DatabaseException
- if there is an error accessing data
from the databasepublic Event loadEvent(int id) throws DatabaseException
DBEngine
loadEvent
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
id
- the ID for the event group being loadedDatabaseException
- if there is an error accessing data
from the databasepublic Event loadEvent(java.lang.String name) throws DatabaseException
DBEngine
loadEvent
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
name
- 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
DBEngine
The remove() method in the DBIterator may or may not function depending on the implementation.
loadEvents
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
DatabaseException
- if there is an error accessing data
from the databasepublic DBIterator loadEvents(int field, int order) throws DatabaseException
DBEngine
loadEvents
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
field
- 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 databasepublic DBIterator loadEvents(int field, int order, int limit) throws DatabaseException
DBEngine
If 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 DBEngine
org.wpi.gdc.cms.db.DBEngine
field
- 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 databasepublic DBIterator loadEventsFromDate(int range, int order, int limit) throws DatabaseException
DBEngine
range
), 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 DBEngine
org.wpi.gdc.cms.db.DBEngine
range
- 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 databasepublic int loadEventCount() throws DatabaseException
DBEngine
loadEventCount
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
DatabaseException
- if there is an error accessing data
from the databasepublic Icon[] loadIcons() throws DatabaseException
DBEngine
loadIcons
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
DatabaseException
- if there is an error accessing data
from the databasepublic Topic[] loadTopics() throws DatabaseException
DBEngine
loadTopics
in class DBEngine
org.wpi.gdc.cms.db.DBEngine
DatabaseException
- 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 |