Class SetCoolerMessage
java.lang.Object
org.deltava.dao.DAO
org.deltava.dao.SetCoolerMessage
A Data Access Object to handle writing Water Cooler message threads and posts.
- Since:
- 1.0
- Version:
- 9.0
- Author:
- Luke
-
Field Summary
Fields inherited from class DAO
_queryMax, _queryStart, _queryTimeout, WGS84_SRIDModifier and TypeFieldDescriptionprotected intThe maximum number of rows to return.protected intThe row number at which to start returning results.protected intThe query timeout, in seconds.protected static final intThe SRID used for geolocation queries. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearReport(int id) Clears content reports from a Water Cooler discussion thread.voidclearWarning(int id) Clears content warnings from all posts in a Water Cooler discussion thread.voiddelete(int id) Deletes a Message Thread and all associated posts.voiddelete(int threadID, int postID) Deletes a Message.voidmarkRead(int threadID, int userID) Marks a Message Thread as being read by a particular user.voidmoderateThread(int id, boolean doHide, boolean doLock) Moderates a Thread by updating the locked and hidden flags.voidreport(MessageThread mt, int id) Writes a content warning report for a particular Water Cooler discussion thread.voidrestickThread(int id, Instant sDate, boolean stickyChannel) Updates the sticky date on a Water Cooler Message Thread.voidsetChannel(int threadID, String newChannel) Changes the Channel for a Message Thread.voidRecalculates Thread information by querying existing Thread Posts.voidunstickThread(int id) Unsticks a Water Cooler Message Thread.voidUpdates an existing Post in the Water Cooler.voidupdateSubject(int threadID, String subj) Updates the Subject of a Message Thread.voidviewThread(int id) Marks a Message Thread as being viewed.voidWrites a vote in a Water Cooler discussion poll.voidWrites a new Post to the Water Cooler.voidWrites a new Message Thread into the database.voidwrite(ThreadUpdate upd) Writes a Discussion Thread update to the database.Methods inherited from class DAO
commitTransaction, createTimestamp, executeIDs, executeUpdate, executeUpdate, expandDate, formatDBName, formatLocation, getNewID, getQueryCount, prepare, prepareWithoutLimits, rollbackTransaction, setQueryMax, setQueryStart, setQueryTimeout, startTransaction, toID, toID, toInstantModifier and TypeMethodDescriptionprotected voidCommits a multi-step transaction to the database.protected static TimestampNull-safe conversion of an Instant to a Timestamp.Helper method to extract database ID data from the result set.protected static intexecuteUpdate(PreparedStatement ps, int minUpdateCount) Executes an UPDATE transaction on a prepared statement, and throws aSQLExceptionif less than the expected number of rows were updated.protected static intexecuteUpdate(PreparedStatement ps, int minPerUpdate, int minTotal) Executes an batched UPDATE transaction on a prepared statement, and throws aSQLExceptionif less than the expected number of rows were updated per batch entry.protected static InstantexpandDate(Date dt) Converts a date-only JDBC value into a full timestamp.protected static StringformatDBName(String db) Formats a database name by converting to lowercase.protected static StringConverts a geographic location into a MySQL WKT formatted point.protected intgetNewID()Returns the AUTO_INC column value generated by the previous JDBC transaction.static final longReturns the total number of queries executed since the JVM was started.protected PreparedStatementInitialize the prepared statement with an arbitrary SQL statement.protected PreparedStatementInitialize the prepared statement with an abitrary SQL statement, without applying the DAO's query result limitations.protected voidRolls back a multi-step transaction before it is completed.final voidsetQueryMax(int maxRows) Sets the maximum number of rows in the returned result set.final voidsetQueryStart(int rowStart) Sets the first row of the results to return.voidsetQueryTimeout(int timeout) Sets the timeout for any SQL operations.protected voidMarks the start of a multi-step database transaction.protected static IntegerConverts a Database bean or an Integer into an Integer.protected static Collection<Integer> toID(Collection<?> ids) Converts a collection of Objects into Integer IDs.protected static InstantNull-safe conversion of a Timestamp to an Instant.
-
Constructor Details
-
SetCoolerMessage
Initializes the Data Access Object.- Parameters:
c- the JDBC connection to use
-
-
Method Details
-
write
Writes a new Post to the Water Cooler.- Parameters:
msg- the Message post bean- Throws:
DAOException- if a JDBC error occurs
-
update
Updates an existing Post in the Water Cooler.- Parameters:
msg- the Message post bean- Throws:
DAOException- if a JDBC error occurs
-
write
Writes a new Message Thread into the database.- Parameters:
t- the Message Thread- Throws:
DAOException- if a JDBC error occursIllegalStateException- if there are no Posts in the Thread
-
write
Writes a Discussion Thread update to the database.- Parameters:
upd- the ThreadUpdate bean- Throws:
DAOException- if a JDBC error occurs
-
markRead
Marks a Message Thread as being read by a particular user.- Parameters:
threadID- the Message Thread IDuserID- the User dataase ID- Throws:
DAOException- if a JDBC error occurs
-
viewThread
Marks a Message Thread as being viewed.- Parameters:
id- the Message Thread ID- Throws:
DAOException- if a JDBC error occurs
-
setChannel
Changes the Channel for a Message Thread.- Parameters:
threadID- the Message Thread IDnewChannel- the new Channel name- Throws:
DAOException- if a JDBC error occurs
-
updateSubject
Updates the Subject of a Message Thread.- Parameters:
threadID- the Message Thread IDsubj- the new Subject- Throws:
DAOException- if a JDBC error occurs
-
moderateThread
Moderates a Thread by updating the locked and hidden flags.- Parameters:
id- the thread IDdoHide- TRUE if the thread should be hidden, otherwise FALSEdoLock- TRUE if the thread should be locked, otherwise FALSE- Throws:
DAOException- if a JDBC error occurs
-
delete
Deletes a Message.- Parameters:
threadID- the Message Thread database IDpostID- the Post database ID- Throws:
DAOException- if a JDBC error occurs
-
delete
Deletes a Message Thread and all associated posts.- Parameters:
id- the Message Thread database ID- Throws:
DAOException- if a JDBC error occurs
-
synchThread
Recalculates Thread information by querying existing Thread Posts.- Parameters:
mt- the Message Thread- Throws:
DAOException- if a JDBC error occurs
-
unstickThread
Unsticks a Water Cooler Message Thread.- Parameters:
id- the Message Thread's database ID- Throws:
DAOException- if a JDBC error occurs
-
restickThread
Updates the sticky date on a Water Cooler Message Thread. This will unstick the thread if the date is null or in the past.- Parameters:
id- the Message Thread's database IDsDate- the new sticky datestickyChannel- TRUE if sticky in channel only, otherwise FALSE- Throws:
DAOException- if a JDBC error occurs- See Also:
-
report
Writes a content warning report for a particular Water Cooler discussion thread.- Parameters:
mt- the MessageThread beanid- the user's database ID- Throws:
DAOException- if a JDBC error occurs
-
vote
Writes a vote in a Water Cooler discussion poll.- Parameters:
vote- the PollVote bean- Throws:
DAOException- if a JDBC error occurs
-
clearWarning
Clears content warnings from all posts in a Water Cooler discussion thread.- Parameters:
id- the thread ID- Throws:
DAOException- if a JDBC error occurs
-
clearReport
Clears content reports from a Water Cooler discussion thread.- Parameters:
id- the thread ID- Throws:
DAOException- if a JDBC error occurs
-