netbout-spi-1.5.src.main.java.com.netbout.spi.Bout Maven / Gradle / Ivy
/**
* Copyright (c) 2009-2012, Netbout.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met: 1) Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer. 2) Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution. 3) Neither the name of the NetBout.com nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.netbout.spi;
import java.util.Collection;
import java.util.Date;
/**
* Bout, a conversation room.
*
* Bouts are comparable by their numbers.
*
*
Instances of this interface must be thread-safe.
*
* @author Yegor Bugayenko ([email protected])
* @version $Id: Bout.java 2241 2012-04-08 18:39:18Z guard $
*/
@SuppressWarnings("PMD.TooManyMethods")
public interface Bout extends Comparable {
/**
* Get its unique number.
* @return The number of the bout
*/
Long number();
/**
* When it was created.
* @return The date of creation
*/
Date date();
/**
* Get its title.
* @return The title of the bout
*/
String title();
/**
* Set its title.
* @param text The title of the bout
*/
void rename(String text);
/**
* Get all its participants.
* @return The list of them
*/
Collection participants();
/**
* Confirm participantion in this bout.
*/
void confirm();
/**
* Leave this bout.
*/
void leave();
/**
* Invite new participant.
* @param identity Identity of the participant
* @return This new participant
* @throws DuplicateInvitationException If this person is already here
*/
Participant invite(Identity identity) throws DuplicateInvitationException;
/**
* Get ordered list of all messages of the bout.
* @param query Search query, if necessary
* @return The list of them
*/
Iterable messages(String query);
/**
* Find message by ID.
* @param number Number of the message to get
* @return The message
* @throws MessageNotFoundException If not found
*/
Message message(Long number) throws MessageNotFoundException;
/**
* Post a new message.
* @param text The text of the new message
* @return The message just posted
* @throws MessagePostException If can't post it for some reason
*/
Message post(String text) throws MessagePostException;
}