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.drives;
18
19 import java.util.List;
20 import java.util.Set;
21
22 /**
23 * Function to manage Drive to be able to add, remove or manage them.
24 *
25 * @LevelAPI Experimental
26 */
27 public interface ManageDriveService {
28
29 public static String COLLABORATION_DRIVE = "Collaboration";
30
31 /**
32 * Get Drive name which point to root folder of default workspace
33 * @return String Name of drive.
34 */
35 public String getDriveOfDefaultWorkspace() throws Exception;
36
37 /**
38 * Register a new drive to workspace or update if the drive is existing
39 *
40 * @param name drive name
41 * @param workspace the workspace name where will store the drive
42 * @param permissions specify who can access to this drive
43 * @param homePath specify the location of drive
44 * @param views include all views can see in drive
45 * @param icon the drive icon which can see in drive browser
46 * @param viewReferences the boolean to set default for drive can view
47 * references node or not
48 * @param viewNonDocument the boolean to set default for drive can view non
49 * document node or not
50 * @param viewSideBar the boolean to set default for drive can view side bar
51 * or not
52 * @param showHiddenNode the boolean to set default for drive can see hidden
53 * node or not
54 * @param allowCreateFolder the string to specify which type of folder can add
55 * in the drive
56 * @param allowNodeTypesOnTree
57 * @throws Exception
58 */
59 public void addDrive(String name,
60 String workspace,
61 String permissions,
62 String homePath,
63 String views,
64 String icon,
65 boolean viewReferences,
66 boolean viewNonDocument,
67 boolean viewSideBar,
68 boolean showHiddenNode,
69 String allowCreateFolder,
70 String allowNodeTypesOnTree) throws Exception;
71
72 /**
73 * Return an DriveData Object
74 * @param driveName the string contain the drive name
75 * @see DriveData
76 * @return DriveData with specified drive name and repository
77 * @throws Exception
78 */
79 public DriveData getDriveByName(String driveName) throws Exception;
80
81 /**
82 * Return the list of DriveData
83 * This method will look up in all workspaces of repository to find DriveData with
84 * specified permission
85 * @param permission the string contain the permission
86 * @return list of DriveData with specified repository and permission
87 * @see DriveData
88 * @throws Exception
89 */
90 public List<DriveData> getAllDriveByPermission(String permission) throws Exception;
91
92 /**
93 * Remove drive with specified drive name and repository
94 * @param driveName drive name
95 * @throws Exception
96 */
97 public void removeDrive(String driveName) throws Exception;
98
99 /**
100 * This method will look up in all workspaces of current repository to find DriveData
101 *
102 * @param withVirtualDrives true: include Virtual Drives, false: not include Virtual Drives
103 * @return list of DriveData with specified repository
104 * @throws Exception
105 */
106 public List<DriveData> getAllDrives(boolean withVirtualDrives) throws Exception;
107
108 /**
109 * This method will look up in all workspaces of current repository to find DriveData
110 * @return list of DriveData with specified repository
111 * @throws Exception
112 */
113 public List<DriveData> getAllDrives() throws Exception;
114
115 /**
116 * This method will check to make sure the view is not in used before remove this view
117 * @param viewName view name
118 * @return the status of current view is in used or not
119 * @throws Exception
120 */
121 public boolean isUsedView(String viewName) throws Exception;
122
123 /**
124 * Register all drive plugins
125 *
126 * @throws Exception
127 */
128 public void init() throws Exception;
129
130 /**
131 * Get all drives by user roles
132 * @param userId User name
133 * @param roles Roles of user
134 * @return list of drives
135 * @throws Exception
136 */
137 public List<DriveData> getDriveByUserRoles(String userId, List<String> roles) throws Exception;
138
139 /**
140 * Get all main drives.
141 *
142 * @param userId Name of user
143 * @param userRoles Roles of user
144 * @return list of drives
145 * @throws Exception
146 */
147 public List<DriveData> getMainDrives(String userId, List<String> userRoles) throws Exception;
148
149 /**
150 * Get all personal drives.
151 *
152 * @param userId Name of user
153 * @return list of drives
154 * @throws Exception
155 */
156 public List<DriveData> getPersonalDrives(String userId) throws Exception;
157
158 /**
159 * Get all group drives
160 * @param userId Name of user
161 * @param userRoles Roles of user
162 * @return list of drives
163 * @throws Exception
164 */
165 public List<DriveData> getGroupDrives(String userId, List<String> userRoles) throws Exception;
166
167 /**
168 * Get the Groups drive
169 * @return The Groups drive
170 */
171 public DriveData getGroupDriveTemplate();
172
173 /**
174 * Check if a drive is vitual(Group Drive Template)
175 * @param driveName the string contain the drive name
176 * @return true: is Virtual Drive, false: not is Virtual Drive
177 */
178 public boolean isVitualDrive(String driveName);
179
180 /**
181 * Clear all drives cache
182 */
183 public void clearAllDrivesCache();
184
185 /**
186 * Clear group drives cache
187 * @param userId User name of current user
188 */
189 public void clearGroupCache(String userId);
190
191 /**
192 * Inform when have new role added
193 * @return Boolean
194 */
195 public boolean newRoleUpdated();
196
197 /**
198 * Set the status of new added role
199 * @param newRoleUpdated
200 */
201 public void setNewRoleUpdated(boolean newRoleUpdated);
202
203 /**
204 * Get deleted drive names.
205 *
206 * @return list of deleted drive names
207 * @throws Exception
208 */
209 public Set<String> getDeletedDriveNames() throws Exception;
210 }