|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.uplanet.lucy.server.newsagent.NewsAgent
@Scriptable public final class NewsAgent
Handles messages that exist beyond application scope.
Users MUST call done()
when finished using the agent to
ensure that all resources such as SQL statements are properly closed and freed.
Method Summary | |
---|---|
static NewsAgent |
createInstance(de.uplanet.jdbc.JdbcConnection p_conn)
Factory method for creating a news agent. |
Message |
createNewMessage()
Create a new message. |
Message |
createNewMessage(java.lang.String p_strMessageId)
Create a new message with the given message identifier. |
boolean |
deleteMessage(java.lang.String p_strMessageId)
Delete the specified message. |
boolean |
deleteMessagesForApplication(java.lang.String p_strAppGuid)
Delete all messages that belong to the specified application GUID. |
boolean |
deleteMessagesForUser(java.lang.String p_strUserId)
Delete all messages that are addressed to the specified user. |
void |
done()
Deprecated. This method must not be called anymore. |
java.lang.String |
dump()
Dump this object to a String . |
int |
filter(IFilter p_filter)
Filter the messages that have already being loaded. |
Message |
get(int p_iIndex)
Get the message at the specified index out of the filtered collection. |
void |
getRichSiteSummary(java.io.Writer p_writer,
java.lang.String p_strResourceUrl,
java.lang.String p_strEncodingDecl,
int p_iMaxCount)
Create a Rich Site Summary containing all news for which the anonymous user is a recipient. |
java.lang.String |
getTarget(java.lang.String p_strAppGuid)
Get the registered target GUID for an application. |
int |
load(IFilter p_filter,
IOrder p_order,
int p_iMaxCount)
Load messages from the database. |
Message |
loadMessage(java.lang.String p_strMessageId)
Load the specified message from the database. |
void |
markDeleted(java.lang.String p_strMessageId,
java.lang.String p_strUserId)
Mark a message as deleted for the specified user. |
void |
markRead(java.lang.String p_strMessageId,
java.lang.String p_strUserId)
Mark a message as read for the specified user. |
boolean |
registerTarget(java.lang.String p_strAppGuid,
java.lang.String p_strTargetGuid)
Register or re-register a link target for an application. |
boolean |
save(Message p_message)
Save the message to the database. |
int |
size()
Get the number of messages in the filtered collection. |
void |
sort(IOrder p_order)
Sort the messages in the filtered messages collection. |
void |
unregisterTarget(java.lang.String p_strAppGuid)
Unregister the link target for the given application. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static NewsAgent createInstance(de.uplanet.jdbc.JdbcConnection p_conn)
@Deprecated public void done()
public Message createNewMessage()
public Message createNewMessage(java.lang.String p_strMessageId)
The newly created message is not inserted into the messages collection.
public void markRead(java.lang.String p_strMessageId, java.lang.String p_strUserId)
Either of the parameters may be null
, however
the method does nothing in these cases.
p_strMessageId
- The GUID of the message.p_strUserId
- The GUID of the user.public void markDeleted(java.lang.String p_strMessageId, java.lang.String p_strUserId)
Either of the parameters may be null
, however
the method does nothing in these cases.
p_strMessageId
- The GUID of the message.p_strUserId
- The GUID of the user.public int load(IFilter p_filter, IOrder p_order, int p_iMaxCount)
p_filter
- The filter to be applied when loading.p_order
- The order in which the messages should be loaded.p_iMaxCount
- The maximum number of messages to be loaded or -1
if all
messages should be loaded.
public Message loadMessage(java.lang.String p_strMessageId)
The internal state of the news agent is not affected by calling this method. In particular, the content of the messages collection and of the filtered messages collection is not changed.
p_strMessageId
- The GUID of the message to be loaded.
null
if the message could not be found.public boolean save(Message p_message)
p_message
- The message to save.
true
if the message was saved, false
otherwise.
java.sql.SQLException
de.uplanet.jdbc.sqlhelper.SqlHelperException
java.io.IOException
Implement recipient update. |
public boolean registerTarget(java.lang.String p_strAppGuid, java.lang.String p_strTargetGuid)
p_strAppGuid
- The application for which the target should be registered.p_strTargetGuid
- The identifier of the link target.public void unregisterTarget(java.lang.String p_strAppGuid)
Call this method whenever an application is deleted.
p_strAppGuid
- The GUID of the application.public java.lang.String getTarget(java.lang.String p_strAppGuid)
p_strAppGuid
- The application GUID.
public boolean deleteMessage(java.lang.String p_strMessageId)
p_strMessageId
- The GUID of the message that should be deleted.
true
if the message could be deleted, false
otherwise.public boolean deleteMessagesForApplication(java.lang.String p_strAppGuid)
p_strAppGuid
- The application GUID for which the messages should be deleted.
true
if the the messages could be deleted, false
otherwise.public boolean deleteMessagesForUser(java.lang.String p_strUserId)
p_strUserId
- The GUID of the user for whom the messages should be deleted.
true
if the the messages could be deleted, false
otherwise.
Implement this method. |
public void sort(IOrder p_order)
p_order
- The sorting criterion.public int filter(IFilter p_filter)
p_filter
- The filter criterion.
size()
.public int size()
public Message get(int p_iIndex)
p_iIndex
- The index of the message.
null
if there
are no filtered messages available or an error occurred.public void getRichSiteSummary(java.io.Writer p_writer, java.lang.String p_strResourceUrl, java.lang.String p_strEncodingDecl, int p_iMaxCount)
Calling this method does not affect the internal state of this object.
p_writer
- The stream where to write the data to.p_strResourceUrl
- The URL for this resource (rdf:about
).p_strEncodingDecl
- The encoding declaration to be used in the
XML text declaration.p_iMaxCount
- The maximum number of news to be contained in the summary.
-1
indicates that this count is unlimited.public java.lang.String dump()
String
.
This method is provided for debugging purposes only. |
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |