View Javadoc
1   /*
2    * Copyright (C) 2003-2008 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.services.cms.documents;
18  
19  import java.util.List;
20  
21  import javax.jcr.Node;
22  
23  /**
24   * Manages favorites of users.
25   *
26   * @LevelAPI Experimental
27   */
28  public interface FavoriteService {
29  
30    /**
31     * Adds favorite to a node.
32     * 
33     * @param node The node to which favorite is added.
34     * @param userName The user who added favorite to the node.
35     * @throws Exception The exception will be raised if the node can not add
36     *           mixin.
37     */
38   public void addFavorite(Node node, String userName) throws Exception;
39  
40  
41    /**
42     * Removes favorite from a node.
43     * 
44     * @param node The node from which favorite is removed.
45     * @param userName The user who removed favorite from the node.
46     * @throws Exception
47     */
48   public void removeFavorite(Node node, String userName) throws Exception;
49  
50    /**
51     * Gets all favorite nodes by a given user.
52     * 
53     * @param workspace The workspace from which the favorite nodes are got.
54     * @param repository The repository from which the favorite nodes are got.
55     * @param userName The user who added favorite.
56     * @return The favorite node added by the user.
57     * @throws Exception
58     */
59   public List<Node> getAllFavoriteNodesByUser(String workspace, String repository,
60       String userName) throws Exception;
61  
62    /**
63     * Checks if a node is in favorite list of a given user.
64     * 
65     * @param userName The given user.
66     * @param node The node to be checked.
67     */
68   public boolean isFavoriter(String userName, Node node) throws Exception ;
69  
70  }