Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
$URL: https://source.sakaiproject.org/svn/message/tags/sakai-10.1/message-api/api/src/java/org/sakaiproject/message/api/MessageChannel.java $ $Id: MessageChannel.java 105079 2012-02-24 23:08:11Z ottenhoff@longsight.com $ Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 The Sakai Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.opensource.org/licenses/ECL-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
 
 
 package org.sakaiproject.message.api;
 
 // import
 import java.util.List;
 

MessageChannel is the base interface for Sakai communications service message channels. Extensions to this interface configure types of communications channels (Chat, Announcements, etc.)

Channels contains collections of messages, each Message (or extension) object. Each chat channel has a unique channel id (read only), and is a Sakai Resource.

The chat channel can be asked:

  • for an iterator on the messages, with a filter
  • to find a specific message
  • to add a new message
  • to update an existing message
  • to remove an existing message

The chat channel can be subscribed to providing notification when:

  • a new message has been posted
  • a message has been changed
  • a message has been removed
  • the channel has been removed

Security on the channel include:

  • message.channel.read
  • message.channel.remove.any
  • message.channel.remove.own
  • message.channel.post
Security Roles for the channel include:
  • message.member: read, remove.own, post
  • message.administrator: chat.member, remove.any

Event handling is defined in the specific extension classes.

Author(s):
Sakai Software Development Team
 
 public interface MessageChannel extends Entity
 {
Access the context of the resource.

Returns:
The context.
 
check permissions for getMessages() or getMessage().

Returns:
true if the user is allowed to get messages from this channel, false if not.
 
 	boolean allowGetMessages();

Get the number of messages in this particular channel.

Returns:
The count.
	int getCount() throws PermissionException;

        
Get the number of messages in this particular channel if the filter were applied.

Parameters:
filter A filtering object to accept messages, or null if no filtering is desired.
Returns:
The count.
	int getCount(Filter filterthrows PermissionException;

Return a list of all or filtered messages in the channel. The order in which the messages will be found in the iteration is by date, oldest first if ascending is true, newest first if ascending is false.

Parameters:
filter A filtering object to accept messages, or null if no filtering is desired.
ascending Order of messages, ascending if true, descending if false
Returns:
a list of channel Message objects or specializations of Message objects (may be empty).
Throws:
org.sakaiproject.exception.PermissionException if the user does not have read permission to the channel.
	List<MessagegetMessages(Filter filterboolean ascendingthrows PermissionException;

        
Return a list of all or filtered messages in the channel. The order in which the messages will be found in the iteration is by date, oldest first if ascending is true, newest first if ascending is false. See getMessagesSearch() for detail on the possible differences between search and filter retrievals.

Parameters:
filter A filtering object to accept messages, or null if no filtering is desired.
ascending Order of messages, ascending if true, descending if false
pages An indication of the range of messages we are looking for
Returns:
a list of channel Message objects or specializations of Message objects (may be empty).
Throws:
org.sakaiproject.exception.PermissionException if the user does not have read permission to the channel.
	List<MessagegetMessages(Filter filterboolean ascendingPagingPosition pagesthrows PermissionException;

Return a list of all public messages in the channel. The order in which the messages will be found in the iteration is by date, oldest first if ascending is true, newest first if ascending is false.

Parameters:
filter Optional additional filtering object to accept messages, or null
ascending Order of messages, ascending if true, descending if false
Returns:
a list of channel Message objects or specializations of Message objects (may be empty).
	List<MessagegetMessagesPublic(Filter filterboolean ascending);

Return a specific channel message, as specified by message name.

Parameters:
messageId The id of the message to get.
Returns:
the Message that has the specified id.
Throws:
org.sakaiproject.exception.IdUnusedException If this name is not a defined message in this channel.
org.sakaiproject.exception.PermissionException If the user does not have any permissions to read the message.
check permissions for editMessage()

Parameters:
id The message id.
Returns:
true if the user is allowed to update the message, false if not.
	boolean allowEditMessage(String messageId);

Return a specific channel message, as specified by message name, locked for update. Must commitEdit() to make official, or cancelEdit() when done!

Parameters:
messageId The id of the message to get.
Returns:
the Message that has the specified id.
Throws:
org.sakaiproject.exception.IdUnusedException If this name is not a defined message in this channel.
org.sakaiproject.exception.PermissionException If the user does not have any permissions to edit the message.
org.sakaiproject.exception.InUseException if the message is locked for edit by someone else.
Commit the changes made to a MessageEdit object for announcement reorder, and release the lock. The MessageEdit is disabled, and not to be used after this call. If the message is in a form that the user has no permission to store, a PermissionException is thrown, and the edit is canceled.

Parameters:
user The UserEdit object to commit.
Commit the changes made to a MessageEdit object, and release the lock. The MessageEdit is disabled, and not to be used after this call. If the message is in a form that the user has no permission to store, a PermissionException is thrown, and the edit is canceled.

Parameters:
user The UserEdit object to commit.
Commit the changes made to a MessageEdit object, and release the lock. The MessageEdit is disabled, and not to be used after this call. If the message is in a form that the user has no permission to store, a PermissionException is thrown, and the edit is canceled.

Parameters:
user The UserEdit object to commit.
priority The notification priority for this commit.
	void commitMessage(MessageEdit editint priority);

Commit the changes made to a MessageEdit object, and release the lock. The MessageEdit is disabled, and not to be used after this call. If the message is in a form that the user has no permission to store, a PermissionException is thrown, and the edit is canceled. Used when a scheduled notification is made for this message.

Parameters:
user The UserEdit object to commit.
priority The notification priority for this commit.
invokee The id for the object to be called when the scheduled notification fires.
	void commitMessage(MessageEdit editint priorityString invokee);

Cancel the changes made to a MessageEdit object, and release the lock. The MessageEdit is disabled, and not to be used after this call.

Parameters:
user The UserEdit object to commit.
check permissions for addMessage().

Returns:
true if the user is allowed to addMessage(...), false if not.
	boolean allowAddMessage();

check permission for adding draft message and modifying it afterwards.
Check if the user has permission to add a channel-wide (not grouped) message.

Returns:
true if the user has permission to add a channel-wide (not grouped) message.
Add a new message to this channel. Must commitEdit() to make official, or cancelEdit() when done!

Returns:
The newly added message, locked for update.
Throws:
org.sakaiproject.exception.PermissionException If the user does not have write permission to the channel.
check permissions for removeMessage().

Parameters:
message The message from this channel to remove.
Returns:
true if the user is allowed to removeMessage(...), false if not.
	boolean allowRemoveMessage(Message message);

Remove a message from the channel based on message id

Parameters:
messageId The messageId for the message of the channel to remove.
Throws:
org.sakaiproject.exception.PermissionException if the user does not have permission to remove the message.
	void removeMessage(String messageIdthrows PermissionException;

Remove a message from the channel - it must be locked from editMessage().

Parameters:
message The message from this channel to remove.
Throws:
org.sakaiproject.exception.PermissionException if the user does not have permission to remove the message.
Merge in a new message as defined in the xml. Must commitEdit() to make official, or cancelEdit() when done!

Parameters:
el The message information in XML in a DOM element.
Returns:
The newly added message, locked for update.
Throws:
org.sakaiproject.exception.PermissionException If the user does not have write permission to the channel.
org.sakaiproject.exception.IdUsedException if the user id is already used.
Get the collection of Groups defined for the context of this channel that the end user has add message permissions in.

Returns:
The Collection (Group) of groups defined for the context of this channel that the end user has add message permissions in, empty if none.
Get the collection of Group defined for the context of this channel that the end user has get message permissions in.

Returns:
The Collection (Group) of groups defined for the context of this channel that the end user has get message permissions in, empty if none.
Get the collection of Group defined for the context of this channel that the end user has remove message permissions in.

Parameters:
own true if the message is the user's own, false if it is someone else's.
Returns:
The Collection (Group) of groups defined for the context of this channel that the end user has get message permissions in, empty if none.
New to GrepCode? Check out our FAQ X