@Component @Named(value="messageStream") @Singleton public class MessageStreamScriptService extends Object implements org.xwiki.script.service.ScriptService
MessageStream
functionality, allowing to post messages from the current user.Modifier and Type | Field and Description |
---|---|
protected org.xwiki.context.Execution |
execution
Provides access to the current context.
|
Constructor and Description |
---|
MessageStreamScriptService() |
Modifier and Type | Method and Description |
---|---|
boolean |
deleteMessage(String id)
Delete an existing message, identified by its unique ID, if the current user is the author of that message.
|
Exception |
getLastError()
Get the error generated while performing the previously called action.
|
boolean |
isActive() |
boolean |
postDirectMessageToUser(String message,
DocumentReference user)
Post a private message to another user.
|
boolean |
postMessageToGroup(String message,
DocumentReference group)
Post a message to a specific group of users.
|
boolean |
postPersonalMessage(String message)
Post a message to the user's personal stream, displayed on his profile page and aggregated into their follower's
streams.
|
boolean |
postPublicMessage(String message)
Post a message to the user's stream, visible to everyone.
|
protected void |
setError(Exception e)
Store a caught exception in the context, so that it can be later retrieved using
getLastError() . |
@Inject protected org.xwiki.context.Execution execution
public boolean postPublicMessage(String message)
message
- the message to storetrue
if the message was successfully posted, false
otherwisepublic boolean postPersonalMessage(String message)
message
- the message to storetrue
if the message was successfully posted, false
otherwisepublic boolean postDirectMessageToUser(String message, DocumentReference user)
message
- the message to senduser
- the target usertrue
if the message was successfully posted, false
otherwisepublic boolean postMessageToGroup(String message, DocumentReference group)
message
- the message to sendgroup
- the target grouptrue
if the message was successfully posted, false
otherwisepublic boolean deleteMessage(String id)
id
- the unique ID of the messagetrue
if the message was successfully deleted, false
otherwise@Unstable public boolean isActive()
public Exception getLastError()
null
if no exception was thrownprotected void setError(Exception e)
getLastError()
.e
- the exception to store, can be null
to clear the previously stored exceptiongetLastError()
Copyright © 2004–2017 XWiki. All rights reserved.