1 /*
2 * Copyright (C) 2003-2007 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.relations;
18
19 import java.util.List;
20
21 import javax.jcr.Node;
22
23 import org.exoplatform.services.jcr.ext.common.SessionProvider;
24 /**
25 * @author monica franceschini
26 */
27 public interface RelationsService {
28
29 /**
30 * Returns true is the given node has relation
31 * @param node Specify the node wants to check relation
32 * @see Node
33 * @throws Exception
34 */
35 public boolean hasRelations(Node node) throws Exception;
36
37 /**
38 * Gets all node that has relation to the given node
39 * @param node Specify the node wants to get all node relative to it
40 * @param provider The SessionProvider object is used to managed Sessions
41 * @see Node
42 * @see SessionProvider
43 * @throws Exception
44 */
45 public List<Node> getRelations(Node node, SessionProvider provider) throws Exception;
46
47 /**
48 * Removes the relation to the given node by specified the relationPath params
49 * @param node Specify the node wants to remove a relation
50 * @param relationPath The path of relation
51 * @see Node
52 * @throws Exception
53 */
54 public void removeRelation(Node node, String relationPath) throws Exception;
55
56 /**
57 * Inserts a new relation is specified by relationPath params to the given node
58 * @param node Specify the node wants to insert a new relation
59 * @param relationPath The path of relation
60 * @param workspaceName The name of workspace
61 * @see Node
62 * @throws Exception
63 */
64 public void addRelation(Node node, String relationPath, String workspaceName) throws Exception;
65
66 /**
67 * Initial the root of relation node and its sub node
68 * @throws Exception
69 */
70 public void init() throws Exception ;
71 }