Statistics
| Branch: | Tag: | Revision:

root / src / gr / ebs / gss / server / ejb / ExternalAPI.java @ a0b9d31e

History | View | Annotate | Download (50.9 kB)

1
/*
2
 * Copyright 2007, 2008, 2009, 2010 Electronic Business Systems Ltd.
3
 *
4
 * This file is part of GSS.
5
 *
6
 * GSS is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * GSS is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with GSS.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
package gr.ebs.gss.server.ejb;
20

    
21
import gr.ebs.gss.client.exceptions.DuplicateNameException;
22
import gr.ebs.gss.client.exceptions.GSSIOException;
23
import gr.ebs.gss.client.exceptions.InsufficientPermissionsException;
24
import gr.ebs.gss.client.exceptions.InvitationUsedException;
25
import gr.ebs.gss.client.exceptions.ObjectNotFoundException;
26
import gr.ebs.gss.client.exceptions.QuotaExceededException;
27
import gr.ebs.gss.server.domain.FileHeader;
28
import gr.ebs.gss.server.domain.FileUploadStatus;
29
import gr.ebs.gss.server.domain.Invitation;
30
import gr.ebs.gss.server.domain.Nonce;
31
import gr.ebs.gss.server.domain.User;
32
import gr.ebs.gss.server.domain.UserClass;
33
import gr.ebs.gss.server.domain.UserLogin;
34
import gr.ebs.gss.server.domain.dto.FileBodyDTO;
35
import gr.ebs.gss.server.domain.dto.FileHeaderDTO;
36
import gr.ebs.gss.server.domain.dto.FolderDTO;
37
import gr.ebs.gss.server.domain.dto.GroupDTO;
38
import gr.ebs.gss.server.domain.dto.PermissionDTO;
39
import gr.ebs.gss.server.domain.dto.StatsDTO;
40
import gr.ebs.gss.server.domain.dto.UserDTO;
41

    
42
import java.io.File;
43
import java.io.IOException;
44
import java.io.InputStream;
45
import java.util.Date;
46
import java.util.List;
47
import java.util.Set;
48

    
49
import javax.ejb.Local;
50
import javax.ejb.TransactionAttribute;
51
import javax.ejb.TransactionAttributeType;
52

    
53
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
54

    
55
/**
56
 * The External API for GSS clients.
57
 *
58
 * @author past
59
 */
60
@Local
61
public interface ExternalAPI {
62

    
63
        /**
64
         * Retrieves the root folder for the specified user. The caller must ensure
65
         * that the userId exists.
66
         *
67
         * @param userId
68
         * @return Folder
69
         * @throws ObjectNotFoundException if no Folder or user was found
70
         */
71
        public FolderDTO getRootFolder(Long userId) throws ObjectNotFoundException;
72

    
73
        /**
74
         * Retrieve the folder with the specified ID.
75
         *
76
         * @param userId the ID of the current user
77
         * @param folderId the ID of the folder to retrieve
78
         * @return the folder found
79
         * @throws ObjectNotFoundException if the folder or the user was not found
80
         * @throws InsufficientPermissionsException if ther user does not have read permissions for folder
81
         */
82
        public FolderDTO getFolder(Long userId, Long folderId) throws ObjectNotFoundException,
83
                        InsufficientPermissionsException;
84

    
85
        /**
86
         * Returns the user with the specified ID.
87
         *
88
         * @param userId The ID of the User to be found
89
         * @return The User object
90
         * @throws ObjectNotFoundException if the user cannot be found
91
         */
92
        public User getUser(Long userId) throws ObjectNotFoundException;
93

    
94
        /**
95
         * Returns the user with the specified ID.
96
         *
97
         * @param userId The ID of the User to be found
98
         * @return The User object
99
         * @throws ObjectNotFoundException if the user cannot be found
100
         */
101
        public UserDTO getUserDTO(Long userId) throws ObjectNotFoundException;
102

    
103
        /**
104
         * Returns the group with the specified ID.
105
         *
106
         * @param groupId The ID of the Group to be found
107
         * @return The Group object
108
         * @throws ObjectNotFoundException if the group cannot be found
109
         */
110
        public GroupDTO getGroup(Long groupId) throws ObjectNotFoundException;
111

    
112
        /**
113
         * Returns the group with the specified name that belongs to the
114
         * specified user.
115
         *
116
         * @param userId the ID of the user
117
         * @param name the name of the group
118
         * @return The Group object
119
         * @throws ObjectNotFoundException if the group cannot be found
120
         */
121
        public GroupDTO getGroup(Long userId, String name) throws ObjectNotFoundException;
122

    
123
        /**
124
         * Retrieve the list of groups for a particular user.
125
         *
126
         * @param userId the ID of the User
127
         * @return a List of Groups that belong to the specified User
128
         * @throws ObjectNotFoundException if the user was not found
129
         */
130
        public List<GroupDTO> getGroups(Long userId) throws ObjectNotFoundException;
131

    
132
        /**
133
         * Returns a list of files contained in the folder specified by its id.
134
         *
135
         * @param userId the ID of the User
136
         * @param folderId the ID of the folder containing the files
137
         * @param ignoreDeleted
138
         * @return the list of file header objects
139
         * @throws ObjectNotFoundException if the user or the folder cannot be found
140
         * @throws InsufficientPermissionsException
141
         */
142
        public List<FileHeaderDTO> getFiles(Long userId, Long folderId, boolean ignoreDeleted) throws ObjectNotFoundException,
143
                        InsufficientPermissionsException;
144

    
145
        /**
146
         * Returns a list of users for the specified group
147
         *
148
         * @param userId the ID of the User
149
         * @param groupId the ID of the requested group
150
         * @return List<UserDTO>
151
         * @throws ObjectNotFoundException if the user or group was not found, with
152
         *             the exception message mentioning the precise problem
153
         */
154
        public List<UserDTO> getUsers(Long userId, Long groupId) throws ObjectNotFoundException;
155

    
156
        /**
157
         * Returns a list of users matching the specified username
158
         *
159
         * @param username the username of the User
160
         * @return List<UserDTO>
161
         */
162
        public List<UserDTO> getUsersByUserNameLike(String username);
163

    
164
        /**
165
         * Creates a new folder with the specified owner, parent folder and name.
166
         * New folder has the same permissions as its parent
167
         *
168
         * @param userId
169
         * @param parentId
170
         * @param name
171
         * @return the new folder
172
         * @throws DuplicateNameException if the specified name already exists in
173
         *             the parent folder, as either a folder or file
174
         * @throws ObjectNotFoundException if the user or parent folder was not
175
         *             found, with the exception message mentioning the precise
176
         *             problem
177
         * @throws InsufficientPermissionsException
178
         */
179
        public FolderDTO createFolder(Long userId, Long parentId, String name) throws DuplicateNameException,
180
                        ObjectNotFoundException, InsufficientPermissionsException;
181

    
182
        /**
183
         * Deletes the specified folder, if the specified user has the appropriate
184
         * permission.
185
         *
186
         * @param userId the ID of the current user
187
         * @param folderId the ID of the folder to delete
188
         * @throws InsufficientPermissionsException if the user does not have the
189
         *             appropriate privileges
190
         * @throws ObjectNotFoundException if the user or folder was not found, with
191
         *             the exception message mentioning the precise problem
192
         */
193
        public void deleteFolder(Long userId, Long folderId)
194
                        throws InsufficientPermissionsException, ObjectNotFoundException;
195

    
196
        /**
197
         * Retrieve the subfolders of the specified folder.
198
         *
199
         * @param userId the ID of the current user
200
         * @param folderId the ID of the folder to retrieve
201
         * @return the list of subfolders found
202
         * @throws ObjectNotFoundException if the folder or user was not found
203
         * @throws InsufficientPermissionsException
204
         */
205
        public List<FolderDTO> getSubfolders(Long userId, Long folderId)
206
                        throws ObjectNotFoundException, InsufficientPermissionsException;
207

    
208
        /**
209
         * Retrieve the folder with the specified ID with subfolders.
210
         *
211
         * @param userId the ID of the current user
212
         * @param folderId the ID of the folder to retrieve
213
         * @return the folder found
214
         * @throws ObjectNotFoundException if the folder or the user was not found
215
         * @throws InsufficientPermissionsException if ther user does not have read permissions for folder
216
         */
217
        public FolderDTO getFolderWithSubfolders(Long userId, Long folderId)
218
                        throws ObjectNotFoundException, InsufficientPermissionsException;
219

    
220
        /**
221
         * Retrieve the folder with the specified ID with subfolders.
222
         *
223
         * @param userId the ID of the current user
224
         * @param callingUserId the ID of the user requesting this operation
225
         * @param folderId the ID of the folder to retrieve
226
         * @return the folder found
227
         * @throws ObjectNotFoundException if the folder or the user was not found
228
         * @throws InsufficientPermissionsException if ther user does not have read permissions for folder
229
         */
230
        public FolderDTO getFolderWithSubfolders(Long userId, Long callingUserId, Long folderId)
231
                        throws ObjectNotFoundException, InsufficientPermissionsException;
232
        /**
233
         * Retrieve the subfolders of the specified folder that are shared to others.
234
         *
235
         * @param userId the ID of the current user
236
         * @param folderId the ID of the folder to retrieve
237
         * @return the list of subfolders found
238
         * @throws ObjectNotFoundException if the folder or user was not found
239
         */
240
        public List<FolderDTO> getSharedSubfolders(Long userId, Long folderId) throws ObjectNotFoundException;
241

    
242
        /**
243
         * Retrieve the subfolders of the specified folder that are shared to others.
244
         *
245
         * @param userId the ID of the current user
246
         * @param callingUserId the id of the user requesting this operation
247
         * @param folderId the ID of the folder to retrieve
248
         * @return the list of subfolders found
249
         * @throws ObjectNotFoundException if the folder or user was not found
250
         */
251
        public List<FolderDTO> getSharedSubfolders(Long userId, Long callingUserId, Long folderId) throws ObjectNotFoundException;
252
        /**
253
         * Modifies the specified folder if the specified user has the appropriate
254
         * permission.
255
         *
256
         * @param userId the ID of the current user
257
         * @param folderId the ID of the folder to retrieve
258
         * @param folderName
259
         * @param readForAll
260
         * @param permissions
261
         * @return the updated folder
262
         * @throws InsufficientPermissionsException if the user does not have the
263
         *             appropriate privileges
264
         * @throws ObjectNotFoundException if the user or folder was not found, with
265
         *             the exception message mentioning the precise problem
266
         * @throws DuplicateNameException if the specified name already exists in
267
         *             the parent folder, as either a folder or file
268
         */
269
        public FolderDTO updateFolder(Long userId, Long folderId, String folderName,
270
                                Boolean readForAll,
271
                                Set<PermissionDTO> permissions)
272
                        throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException;
273

    
274
        /**
275
         * Adds a user to the specified group
276
         *
277
         * @param userId the ID of the current user
278
         * @param groupId the id of the new group
279
         * @param userToAddId the id of the user to add
280
         * @throws DuplicateNameException if the user already exists in group
281
         * @throws ObjectNotFoundException if the user or group was not found, with
282
         *             the exception message mentioning the precise problem
283
         * @throws InsufficientPermissionsException
284
         */
285
        public void addUserToGroup(Long userId, Long groupId, Long userToAddId)
286
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException;
287

    
288
        /**
289
         * Creates a new group with the specified owner and name.
290
         *
291
         * @param userId the ID of the current user
292
         * @param name the name of the new group
293
         * @throws DuplicateNameException if the new group name already exists
294
         * @throws ObjectNotFoundException if the user or group was not found, with
295
         *             the exception message mentioning the precise problem
296
         */
297
        public void createGroup(Long userId, String name) throws ObjectNotFoundException, DuplicateNameException;
298

    
299
        /**
300
         * Deletes the specified group in the specified user's namespace.
301
         *
302
         * @param userId the ID of the current user
303
         * @param groupId the ID of the group to delete
304
         * @throws ObjectNotFoundException if the user or group was not found, with
305
         *             the exception message mentioning the precise problem
306
         * @throws InsufficientPermissionsException
307
         */
308
        public void deleteGroup(Long userId, Long groupId) throws ObjectNotFoundException, InsufficientPermissionsException;
309

    
310
        /**
311
         * Creates a new file with the specified owner, parent folder and name. The
312
         * new file has the same permissions as its parent folder. The file contents
313
         * are read from the input stream to a new File object.
314
         *
315
         * @param userId the ID of the current user
316
         * @param folderId the ID of the parent folder
317
         * @param name the name of the new file
318
         * @param mimeType the MIME type of the file
319
         * @param stream the input stream with the file contents
320
         * @return The FileHeaderDTO created
321
         * @throws DuplicateNameException if the specified name already exists in
322
         *             the parent folder, as either a folder or file
323
         * @throws ObjectNotFoundException if the user or parent folder was not
324
         *             found, with the exception message mentioning the precise
325
         *             problem
326
         * @throws GSSIOException if there was an error while storing the file contents
327
         * @throws InsufficientPermissionsException
328
         * @throws QuotaExceededException
329
         */
330
        public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType,
331
                                InputStream stream) throws DuplicateNameException, ObjectNotFoundException,
332
                                GSSIOException, InsufficientPermissionsException, QuotaExceededException;
333

    
334
        /**
335
         * Deletes the specified file, provided the specified user has
336
         * the necessary permissions.
337
         *
338
         * @param userId the ID of the current user
339
         * @param fileId the ID of the file to delete
340
         * @throws ObjectNotFoundException if the user or file was not found, with
341
         *             the exception message mentioning the precise problem
342
         * @throws InsufficientPermissionsException if the user does not have the
343
         *             appropriate privileges
344
         */
345
        public void deleteFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
346

    
347
        /**
348
         * Deletes the specified file in the specified user's namespace.
349
         *
350
         * @param userId the ID of the current user
351
         * @param fileIds the IDs of the files to delete
352
         * @throws ObjectNotFoundException if the user or file was not found, with
353
         *             the exception message mentioning the precise problem
354
         * @throws InsufficientPermissionsException if the user does not have the
355
         *             appropriate privileges
356
         */
357
        public void deleteFiles(Long userId, List<Long> fileIds)
358
                        throws ObjectNotFoundException, InsufficientPermissionsException;
359

    
360
        /**
361
         * Creates a new tag for the specified user and file.
362
         *
363
         * @param userId the creator of the tag
364
         * @param fileHeaderId the file that is tagged
365
         * @param tag the tag
366
         * @throws ObjectNotFoundException if the user or the file was not found
367
         */
368
        public void createTag(Long userId, Long fileHeaderId, String tag) throws ObjectNotFoundException;
369

    
370
        /**
371
         * Returns all tags defined by the specified user
372
         *
373
         * @param userId
374
         * @return Set<String>
375
         * @throws ObjectNotFoundException if the user was null
376
         */
377
        public Set<String> getUserTags(final Long userId) throws ObjectNotFoundException;
378

    
379
        /**
380
         * Updates the attributes of the specified file.
381
         *
382
         * @param userId
383
         * @param fileId
384
         * @param name
385
         * @param tagSet a String that contains tags separated by comma
386
         * @param modificationDate the modification date
387
         * @param versioned the new value of the versioned flag
388
         * @param readForAll
389
         * @param permissions
390
         * @throws DuplicateNameException
391
         * @throws ObjectNotFoundException
392
         * @throws InsufficientPermissionsException
393
         */
394
        public void updateFile(Long userId, Long fileId, String name, String tagSet,
395
                        Date modificationDate, Boolean versioned, Boolean readForAll,
396
                        Set<PermissionDTO> permissions)
397
                        throws DuplicateNameException, ObjectNotFoundException, InsufficientPermissionsException;
398

    
399
        /**
400
         * Retrieve the contents of the current body for the file
401
         * with the specified FileHeader ID. The file contents
402
         * are provided as an InputStream from which the caller can
403
         * retrieve the raw bytes.
404
         *
405
         * @param userId the ID of the current user
406
         * @param fileId the ID of the file to retrieve
407
         * @return an InputStream from the current file body contents
408
         * @throws ObjectNotFoundException if the file or the user was not found
409
         * @throws InsufficientPermissionsException  if the user does not have the
410
         *             appropriate privileges
411
         */
412
        public InputStream getFileContents(Long userId, Long fileId)
413
                        throws ObjectNotFoundException, InsufficientPermissionsException;
414

    
415
        /**
416
         * Retrieve the contents of the  body identified by bodyId for the file
417
         * with the specified FileHeader ID. The file contents
418
         * are provided as an InputStream from which the caller can
419
         * retrieve the raw bytes.
420
         *
421
         * @param userId the ID of the current user
422
         * @param fileId the ID of the file to retrieve
423
         * @param bodyId the body ID
424
         * @return an InputStream from the current file body contents
425
         * @throws ObjectNotFoundException if the file or the user was not found
426
         * @throws InsufficientPermissionsException  if the user does not have the
427
         *             appropriate privileges
428
         */
429
        public InputStream getFileContents(Long userId, Long fileId, Long bodyId)
430
                        throws ObjectNotFoundException, InsufficientPermissionsException;
431

    
432
        /**
433
         * Retrieve the file with the specified ID.
434
         *
435
         * @param userId the ID of the current user
436
         * @param fileId the ID of the file to retrieve
437
         * @return the file found
438
         * @throws ObjectNotFoundException if the file or the user was not found, with
439
         *                         the exception message mentioning the precise problem
440
         * @throws InsufficientPermissionsException
441
         */
442
        public FileHeaderDTO getFile(Long userId, Long fileId) throws ObjectNotFoundException,
443
                        InsufficientPermissionsException;
444

    
445
        /**
446
         * Retrieve the filebody with the specified ID.
447
         *
448
         * @param userId the ID of the current user
449
         * @param fileId the ID of the file to retrieve
450
         * @param bodyId the ID of the body
451
         * @return the file found
452
         * @throws ObjectNotFoundException if the file or the user was not found, with
453
         *                         the exception message mentioning the precise problem
454
         * @throws InsufficientPermissionsException
455
         */
456
        public FileBodyDTO getFileBody(Long userId, Long fileId, Long bodyId)
457
                        throws ObjectNotFoundException, InsufficientPermissionsException;
458

    
459
        /**
460
         * Get the resource (file or folder) at the specified path in
461
         * the specified user's namespace. The returned object will be of type
462
         * FileHeaderDTO or FolderDTO.<p><strong>Note:</strong> this method does not
463
         * receive the current user as a parameter, therefore it is unable to perform
464
         * the necessary permission checks and should <strong>NOT</strong> be directly
465
         * exposed to remote clients. It is the caller's responsibility to verify that
466
         * the calling user has the required privileges for performing any subsequent
467
         * action on the resource through one of the other ExternalAPI methods.
468
         *
469
         * @param ownerId the ID of the user owning the namespace
470
         * @param path the absolute path in the user's namespace
471
         * @param ignoreDeleted if true, resources that have been moved to the trash
472
         *                         will be ignored
473
         * @throws ObjectNotFoundException if the user or resource was not found, with
474
         *                         the exception message mentioning the precise problem
475
         * @return the resource found
476
         */
477
        public Object getResourceAtPath(Long ownerId, String path, boolean ignoreDeleted)
478
                        throws ObjectNotFoundException;
479

    
480
        /**
481
         * Copy the provided file to the specified destination.
482
         *
483
         * @param userId the ID of the current user
484
         * @param fileId the IF of the provided file
485
         * @param dest the path of the new resource
486
         * @throws ObjectNotFoundException if the user, file or destination was not
487
         *                         found, with        the exception message mentioning the precise problem
488
         * @throws DuplicateNameException if the specified name already exists in
489
         *          the destination folder, as either a folder or file
490
         * @throws GSSIOException if there was an error while accessing the file contents
491
         * @throws InsufficientPermissionsException
492
         * @throws QuotaExceededException
493
         */
494
        public void copyFile(Long userId, Long fileId, String dest) throws ObjectNotFoundException,
495
                        DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
496

    
497
        /**
498
         * Copy the provided file to the specified destination.
499
         *
500
         * @param userId the ID of the current user
501
         * @param ownerId the ID of the owner of the destination namespace
502
         * @param fileId the IF of the provided file
503
         * @param dest the path of the new resource
504
         * @throws ObjectNotFoundException if the user, file or destination was not
505
         *                         found, with        the exception message mentioning the precise problem
506
         * @throws DuplicateNameException if the specified name already exists in
507
         *          the destination folder, as either a folder or file
508
         * @throws GSSIOException if there was an error while accessing the file contents
509
         * @throws InsufficientPermissionsException
510
         * @throws QuotaExceededException
511
         */
512
        public void copyFileToPath(Long userId, Long ownerId, Long fileId, String dest) throws ObjectNotFoundException,
513
                        DuplicateNameException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
514

    
515
        /**
516
         * Copy the provided file to the specified destination.
517
         *
518
         * @param userId the ID of the current user
519
         * @param fileIds the IDs of the provided files
520
         * @param destId the ID of the destination folder
521
         * @throws ObjectNotFoundException if the user, file or destination was not
522
         *                         found, with        the exception message mentioning the precise problem
523
         * @throws GSSIOException if there was an error while accessing the file contents
524
         * @throws DuplicateNameException if the specified name already exists in
525
         *          the destination folder, as either a folder or file
526
         * @throws InsufficientPermissionsException
527
         * @throws QuotaExceededException
528
         */
529
        public void copyFiles(Long userId, List<Long> fileIds, Long destId)
530
                        throws ObjectNotFoundException, DuplicateNameException, GSSIOException,
531
                        InsufficientPermissionsException, QuotaExceededException;
532

    
533
        /**
534
         * Copy the provided file to the specified destination.
535
         *
536
         * @param userId the ID of the current user
537
         * @param fileId the IF of the provided file
538
         * @param destId the ID of the destination folder
539
         * @param destName the name of the new file
540
         * @throws ObjectNotFoundException if the user, file or destination was not
541
         *                         found, with        the exception message mentioning the precise problem
542
         * @throws GSSIOException if there was an error while accessing the file contents
543
         * @throws DuplicateNameException if the specified name already exists in
544
         *          the destination folder, as either a folder or file
545
         * @throws InsufficientPermissionsException
546
         * @throws QuotaExceededException
547
         */
548
        public void copyFile(Long userId, Long fileId, Long destId, String destName)
549
                        throws ObjectNotFoundException, DuplicateNameException, GSSIOException,
550
                        InsufficientPermissionsException, QuotaExceededException;
551

    
552
        /**
553
         * Copy the provided folder to the specified destination.
554
         *
555
         * @param userId the ID of the current user
556
         * @param folderId the IF of the provided folder
557
         * @param dest the path of the new folder
558
         * @throws ObjectNotFoundException if the user, folder or destination was not
559
         *                         found, with        the exception message mentioning the precise problem
560
         * @throws DuplicateNameException if the specified name already exists in
561
         *          the destination folder, as either a folder or file
562
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
563
         *          appropriate privileges
564
         */
565
        public void copyFolder(Long userId, Long folderId, String dest) throws ObjectNotFoundException,
566
                        DuplicateNameException, InsufficientPermissionsException;
567

    
568
        /**
569
         * Copy the provided folder to the specified destination.
570
         *
571
         * @param userId the ID of the current user
572
         * @param folderId the IF of the provided folder
573
         * @param destId the ID of the destination folder
574
         * @param destName the name of the new folder
575
         * @throws ObjectNotFoundException if the user, folder or destination was not
576
         *                         found, with        the exception message mentioning the precise problem
577
         * @throws DuplicateNameException if the specified name already exists in
578
         *          the destination folder, as either a folder or file
579
         * @throws InsufficientPermissionsException InsufficientPermissionsException
580
         *                         if the user does not have the appropriate privileges
581
         */
582
        public void copyFolder(Long userId, Long folderId, Long destId, String destName)
583
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException;
584

    
585
        /**
586
         * Copy the provided folder and all its subfolders and files to the specified destination.
587
         *
588
         * @param userId the ID of the current user
589
         * @param ownerId the ID of the owner of the destination namespace
590
         * @param folderId the IF of the provided folder
591
         * @param dest the path of the new folder
592
         * @throws ObjectNotFoundException if the user, folder or destination was not
593
         *                         found, with        the exception message mentioning the precise problem
594
         * @throws DuplicateNameException if the specified name already exists in
595
         *          the destination folder, as either a folder or file
596
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
597
         *          appropriate privileges
598
         * @throws QuotaExceededException if the user quota limit would be exceeded
599
         * @throws GSSIOException if there was an error while accessing the file contents
600
         */
601
        public void copyFolderStructureToPath(Long userId, Long ownerId, Long folderId, String dest) throws ObjectNotFoundException,
602
                        DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
603

    
604
        /**
605
         * Copy the provided folder and all its subfolders and files to the specified destination.
606
         *
607
         * @param userId the ID of the current user
608
         * @param folderId the IF of the provided folder
609
         * @param destId the ID of the destination folder
610
         * @param destName the name of the new folder
611
         * @throws ObjectNotFoundException if the user, folder or destination was not
612
         *                         found, with        the exception message mentioning the precise problem
613
         * @throws DuplicateNameException if the specified name already exists in
614
         *          the destination folder, as either a folder or file
615
         * @throws InsufficientPermissionsException InsufficientPermissionsException
616
         *                         if the user does not have the appropriate privileges
617
         * @throws GSSIOException if there was an error while accessing the file contents
618
         * @throws QuotaExceededException if the user quota limit would be exceeded
619
         */
620
        public void copyFolderStructure(Long userId, Long folderId, Long destId, String destName)
621
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,
622
                        GSSIOException, QuotaExceededException;
623

    
624
        /**
625
         * Marks  the specified file as deleted in the specified user's namespace.
626
         *
627
         * @param userId the ID of the current user
628
         * @param fileId the ID of the file to delete
629
         * @throws ObjectNotFoundException if the user or file was not found, with
630
         *             the exception message mentioning the precise problem
631
         * @throws InsufficientPermissionsException if the user does not have the
632
         *             appropriate privileges
633
         */
634
        public void moveFileToTrash(Long userId, Long fileId) throws ObjectNotFoundException,
635
                        InsufficientPermissionsException;
636

    
637
        /**
638
         * Marks  the specified deleted file as undeleted in the specified user's namespace.
639
         *
640
         * @param userId the ID of the current user
641
         * @param fileId the ID of the file to undelete
642
         * @throws ObjectNotFoundException if the user or file was not found, with
643
         *             the exception message mentioning the precise problem
644
         * @throws InsufficientPermissionsException if the user does not have the
645
         *             appropriate privileges
646
         *
647
         */
648
        public void removeFileFromTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
649

    
650
        /**
651
         * Marks  the specified deleted files as undeleted in the specified user's namespace.
652
         *
653
         * @param userId the ID of the current user
654
         * @param fileIds the IDs of the file to undelete
655
         * @throws ObjectNotFoundException if the user or file was not found, with
656
         *             the exception message mentioning the precise problem
657
         * @throws InsufficientPermissionsException if the user does not have the
658
         *             appropriate privileges
659
         */
660
        public void removeFilesFromTrash(Long userId, List<Long> fileIds) throws ObjectNotFoundException, InsufficientPermissionsException;
661

    
662
        /**
663
         * Marks  the specified folder as deleted in the specified user's namespace.
664
         *
665
         * @param userId the ID of the current user
666
         * @param folderId the ID of the folder to delete
667
         * @throws ObjectNotFoundException if the user or file was not found, with
668
         *             the exception message mentioning the precise problem
669
         * @throws InsufficientPermissionsException if the user does not have the
670
         *             appropriate privileges
671
         */
672
        public void moveFolderToTrash(Long userId, Long folderId)
673
                        throws ObjectNotFoundException, InsufficientPermissionsException;
674

    
675
        /**
676
         * Marks  the specified deleted folder as undeleted in the specified user's namespace.
677
         *
678
         * @param userId the ID of the current user
679
         * @param folderId the ID of the folder to undelete
680
         * @throws ObjectNotFoundException if the user or file was not found, with
681
         *             the exception message mentioning the precise problem
682
         * @throws InsufficientPermissionsException if the user does not have the
683
         *          appropriate privileges
684
         *
685
         */
686
        public void removeFolderFromTrash(Long userId, Long folderId) throws ObjectNotFoundException, InsufficientPermissionsException;
687

    
688
        /**
689
         * Move the provided folder and all its subfolders and files to the specified destination.
690
         *
691
         * @param userId the ID of the current user
692
         * @param folderId the IF of the provided folder
693
         * @param destId the ID of the destination folder
694
         * @param destName the name of the new folder
695
         * @throws ObjectNotFoundException if the user, folder or destination was not
696
         *                         found, with        the exception message mentioning the precise problem
697
         * @throws DuplicateNameException if the specified name already exists in
698
         *          the destination folder, as either a folder or file
699
         * @throws InsufficientPermissionsException if the user does not have the
700
         *          appropriate privileges
701
         * @throws GSSIOException
702
         * @throws QuotaExceededException
703
         */
704
        public void moveFolder(Long userId, Long folderId, Long destId, String destName)
705
                        throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException,
706
                        GSSIOException, QuotaExceededException;
707

    
708
        /**
709
         * Move the provided folder and all its subfolders and files to the specified destination.
710
         *
711
         * @param userId the ID of the current user
712
         * @param ownerId the owner of the destination namespace
713
         * @param folderId the IF of the provided folder
714
         * @param dest the path of the new folder
715
         * @throws ObjectNotFoundException if the user, folder or destination was not
716
         *                         found, with        the exception message mentioning the precise problem
717
         * @throws DuplicateNameException if the specified name already exists in
718
         *          the destination folder, as either a folder or file
719
         * @throws InsufficientPermissionsException InsufficientPermissionsException if the user does not have the
720
         *          appropriate privileges
721
         * @throws GSSIOException
722
         * @throws QuotaExceededException
723
         */
724
        public void moveFolderToPath(Long userId, Long ownerId, Long folderId, String dest) throws ObjectNotFoundException,
725
                        DuplicateNameException, InsufficientPermissionsException, GSSIOException, QuotaExceededException;
726

    
727
        /**
728
         * Move the provided file to the specified destination.
729
         *
730
         * @param userId the ID of the current user
731
         * @param fileId the IF of the provided file
732
         * @param destId the ID of the destination folder
733
         * @param destName the name of the new file
734
         * @throws InsufficientPermissionsException
735
         * @throws ObjectNotFoundException if the user, file or destination was not
736
         *                         found, with        the exception message mentioning the precise problem
737
         * @throws GSSIOException if there was an error while accessing the file contents
738
         * @throws DuplicateNameException if the specified name already exists in
739
         *          the destination folder, as either a folder or file
740
         * @throws QuotaExceededException
741
         */
742
        public void moveFile(Long userId, Long fileId, Long destId, String destName)
743
                        throws InsufficientPermissionsException, ObjectNotFoundException,
744
                        DuplicateNameException, GSSIOException, QuotaExceededException;
745

    
746
        /**
747
         * Move the provided file to the specified destination.
748
         *
749
         * @param userId the ID of the current user
750
         * @param ownerId the owner of the destination namespace
751
         * @param fileId the IF of the provided file
752
         * @param dest the path of the new file
753
         * @throws InsufficientPermissionsException
754
         * @throws ObjectNotFoundException if the user, file or destination was not
755
         *                         found, with        the exception message mentioning the precise problem
756
         * @throws GSSIOException if there was an error while accessing the file contents
757
         * @throws DuplicateNameException if the specified name already exists in
758
         *          the destination folder, as either a folder or file
759
         * @throws QuotaExceededException
760
         */
761
        public void moveFileToPath(Long userId, Long ownerId, Long fileId, String dest) throws ObjectNotFoundException, InsufficientPermissionsException, DuplicateNameException, GSSIOException, QuotaExceededException;
762

    
763
        /**
764
         * move the provided file to the specified destination.
765
         *
766
         * @param userId the ID of the current user
767
         * @param fileIds the IDs of the provided files
768
         * @param destId the ID of the destination folder
769
         * @throws InsufficientPermissionsException
770
         * @throws ObjectNotFoundException if the user, file or destination was not
771
         *                         found, with        the exception message mentioning the precise problem
772
         * @throws GSSIOException if there was an error while accessing the file contents
773
         * @throws DuplicateNameException if the specified name already exists in
774
         *          the destination folder, as either a folder or file
775
         * @throws QuotaExceededException
776
         */
777
        public void moveFiles(Long userId, List<Long> fileIds, Long destId)
778
                        throws InsufficientPermissionsException, ObjectNotFoundException,
779
                        DuplicateNameException, GSSIOException, QuotaExceededException;
780

    
781
        /**
782
         * Returns a list of All deleted files of a user.
783
         *
784
         * @param userId the ID of the User
785
         *          * @return the list of deleted file header objects
786
         * @throws ObjectNotFoundException if the user cannot be found
787
         */
788
        public List<FileHeaderDTO> getDeletedFiles(Long userId) throws ObjectNotFoundException;
789

    
790
        /**
791
         * Returns a list of All deleted root folders of a user.
792
         *
793
         * @param userId the ID of the User
794
         *          * @return the list of deleted file header objects
795
         * @throws ObjectNotFoundException if the user cannot be found
796
         */
797
        public List<FolderDTO> getDeletedRootFolders(Long userId) throws ObjectNotFoundException;
798

    
799
        /**
800
         * Empty Trash by deleting all marked as deleted files and folders
801
         * @param userId
802
         * @throws ObjectNotFoundException if something goes wrong in the delete process
803
         * @throws InsufficientPermissionsException if something goes wrong in the delete process
804
         */
805
        public void emptyTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
806

    
807
        /**
808
         * Restores All Trashed Items by undeleting all marked as deleted files and folders
809
         * @param userId
810
         * @throws ObjectNotFoundException if something goes wrong in the delete process
811
         * @throws InsufficientPermissionsException
812
         */
813
        public void restoreTrash(Long userId) throws ObjectNotFoundException, InsufficientPermissionsException;
814

    
815
        /**
816
         * Search the system for a user with the specified username.
817
         * If no such user is found, the method returns null.
818
         *
819
         * @param username the username to search for
820
         * @return the User object with the specified username
821
         */
822
        public User findUser(String username);
823

    
824
        /**
825
         * Create a new user with the specified name, username and e-mail address.
826
         *
827
         * @param username the username of the new user
828
         * @param name the name of the new user
829
         * @param mail the e-mail of the new user
830
         * @param idp the IdP of the new user
831
         * @param idpid the IdP identifier of the new user
832
         * @return the newly-created User object
833
         * @throws DuplicateNameException if a user with the same username already exists
834
         * @throws ObjectNotFoundException if no username was provided
835
         */
836
        public User createUser(String username, String name, String mail, String idp, String idpid)
837
                        throws DuplicateNameException, ObjectNotFoundException;
838

    
839
        /**
840
         * Updates the authentication token for the specified user.
841
         *
842
         * @param userId the ID of the user whose token should be updated
843
         * @return the updated user
844
         * @throws ObjectNotFoundException if the user could not be found
845
         */
846
        public User updateUserToken(Long userId) throws ObjectNotFoundException;
847

    
848
        /**
849
         * Updates the policy acceptance flag for the specified user.
850
         *
851
         * @param userId the ID of the user whose flag should be updated
852
         * @param isAccepted the new value of the flag
853
         * @return the updated user
854
         * @throws ObjectNotFoundException if the user could not be found
855
         */
856
        public User updateUserPolicyAcceptance(Long userId, boolean isAccepted) throws ObjectNotFoundException;
857

    
858
        /**
859
         * Invalidates the authentication token for the specified user.
860
         *
861
         * @param userId the ID of the user whose token should be updated
862
         * @throws ObjectNotFoundException if the user could not be found
863
         */
864
        public void invalidateUserToken(Long userId) throws ObjectNotFoundException;
865

    
866
        /**
867
         * Retrieve folder user and group permissions
868
         *
869
         * @param userId the ID of the user whose token should be updated
870
         * @param folderId the ID of the folder
871
         * @return the Set of permissions from requested folder
872
         * @throws ObjectNotFoundException if the user or folder could not be found
873
         * @throws InsufficientPermissionsException
874
         */
875
        public Set<PermissionDTO> getFolderPermissions(Long userId, Long folderId)
876
                        throws ObjectNotFoundException, InsufficientPermissionsException;
877

    
878
        /**
879
         * Retrieve file user and group permissions
880
         *
881
         * @param userId the ID of the user whose token should be updated
882
         * @param fileId the ID of the folder
883
         * @return the Set of permissions from requested folder
884
         * @throws ObjectNotFoundException if the user or folder could not be found
885
         * @throws InsufficientPermissionsException
886
         */
887
        public Set<PermissionDTO> getFilePermissions(Long userId, Long fileId)
888
                        throws ObjectNotFoundException, InsufficientPermissionsException;
889

    
890
        /**
891
         * Returns a list of all shared root folders of a user.
892
         *
893
         * @param userId the ID of the User
894
         * @return the list of shared root folders
895
         * @throws ObjectNotFoundException if the user cannot be found
896
         */
897
        public List<FolderDTO> getSharedRootFolders(Long userId) throws ObjectNotFoundException;
898

    
899
        /**
900
         * Returns a list of all shared files of a user that are not
901
         * inside other shared folders.
902
         *
903
         * @param userId the ID of the User
904
         * @return the list of shared files
905
         * @throws ObjectNotFoundException if the user cannot be found
906
         */
907
        public List<FileHeaderDTO> getSharedFilesNotInSharedFolders(Long userId) throws ObjectNotFoundException;
908

    
909
        /**
910
         * Returns a list of all shared files of a user.
911
         *
912
         * @param userId the ID of the User
913
         * @return the list of shared files
914
         * @throws ObjectNotFoundException if the user cannot be found
915
         */
916
        public List<FileHeaderDTO> getSharedFiles(Long userId) throws ObjectNotFoundException;
917

    
918
        /**
919
         * Returns a list of all shared folders of a user.
920
         *
921
         * @param userId the ID of the User
922
         * @return the list of shared folders
923
         * @throws ObjectNotFoundException if the user cannot be found
924
         */
925
        public List<FolderDTO> getSharedFolders(Long userId) throws ObjectNotFoundException;
926

    
927
        /**
928
         * Returns a list of all shared root folders of a user that calling
929
         * user has at least read permissions.
930
         *
931
         * @param ownerId the ID of the User
932
         * @return the list of shared root folders
933
         * @param callingUserId
934
         *
935
         * @throws ObjectNotFoundException if the user cannot be found
936
         */
937
        public List<FolderDTO> getSharedRootFolders(Long ownerId, Long callingUserId)
938
                        throws ObjectNotFoundException;
939

    
940
        /**
941
         * Returns a list of all shared  files of a user that calling user has
942
         * at least read permissions..
943
         *
944
         * @param ownerId the ID of the User
945
         * @return the list of shared files
946
         * @param callingUserId
947
         * @throws ObjectNotFoundException if the user cannot be found
948
         */
949
        public List<FileHeaderDTO> getSharedFiles(Long ownerId, Long callingUserId)
950
                        throws ObjectNotFoundException;
951

    
952
        /**
953
         * Remove a user member from a group
954
         *
955
         * @param userId the ID of the User owning the group
956
         * @param groupId the ID of the requested group
957
         * @param memberId the ID of the member to be removed
958
         *
959
         * @throws ObjectNotFoundException if the user or group was not found, with
960
         *             the exception message mentioning the precise problem
961
         * @throws InsufficientPermissionsException
962
         */
963
        public void removeMemberFromGroup(Long userId, Long groupId, Long memberId)
964
                        throws ObjectNotFoundException, InsufficientPermissionsException;
965

    
966
        /**
967
         * Retrieves the list of users sharing files to user identified by user id
968
         * @param userId
969
         * @return the List of users sharing files to user
970
         * @throws ObjectNotFoundException
971
         */
972
        public List<UserDTO> getUsersSharingFoldersForUser(Long userId) throws ObjectNotFoundException;
973

    
974
        /**
975
         * Search Files
976
         *
977
         * @param userId
978
         * @param query
979
         * @return list of files that match query
980
         * @throws ObjectNotFoundException if no user or query was specified
981
         */
982
        public List<FileHeader> searchFiles(Long userId, String query) throws ObjectNotFoundException;
983

    
984
        /**
985
         * Creates a nonce for the specified user.
986
         *
987
         * @param userId the ID of the user
988
         * @return the new nonce
989
         * @throws ObjectNotFoundException if the user could not be found
990
         */
991
        public Nonce createNonce(Long userId) throws ObjectNotFoundException;
992

    
993
        /**
994
         * Find the nonce object for the specified encoded nonce, that should be
995
         * associated with the specified user.
996
         *
997
         * @param nonce the issued nonce in Base64 encoding
998
         * @param userId the ID of the user for whom this nonce should have been issued
999
         * @return the retrieved nonce object
1000
         * @throws ObjectNotFoundException if the nonce or user were not found
1001
         */
1002
        public Nonce getNonce(String nonce, Long userId) throws ObjectNotFoundException;
1003

    
1004
        /**
1005
         * Remove the specified nonce from the persistent store.
1006
         *
1007
         * @param id the ID of the nonce
1008
         * @throws ObjectNotFoundException if the specified nonce could not be found
1009
         */
1010
        public void removeNonce(Long id) throws ObjectNotFoundException;
1011

    
1012
        /**
1013
         * Activate the supplied nonce for the specified user.
1014
         *
1015
         * @param userId the ID of the user
1016
         * @param nonce the nonce to activate
1017
         * @param nonceExpiryDate the expiry date of the nonce
1018
         * @throws ObjectNotFoundException
1019
         */
1020
        public void activateUserNonce(Long userId, String nonce, Date nonceExpiryDate) throws ObjectNotFoundException;
1021

    
1022
        /**
1023
         * Retrieves user statistics.
1024
         *
1025
         * @param userId the ID of the user
1026
         * @return the statistics
1027
         * @throws ObjectNotFoundException
1028
         *
1029
         */
1030
        public StatsDTO getUserStatistics(Long userId) throws ObjectNotFoundException;
1031

    
1032
        /**
1033
         * Retrieves file versions
1034
         *
1035
         * @param userId the ID of the user
1036
         * @param fileId the ID of the file
1037
         * @return the list of filebodies
1038
         * @throws ObjectNotFoundException
1039
         * @throws InsufficientPermissionsException
1040
         *
1041
         */
1042
        public List<FileBodyDTO> getVersions(Long userId, Long fileId)
1043
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1044

    
1045
        /**
1046
         * Restore the file contents to the specified version.
1047
         *
1048
         * @param userId the ID of the user
1049
         * @param fileId the ID of the file
1050
         * @param version the version number of the desired file contents
1051
         * @throws ObjectNotFoundException if the user or file was not
1052
         *                         found, with        the exception message mentioning the precise problem
1053
         * @throws InsufficientPermissionsException if the user does not have the
1054
         *          appropriate privileges
1055
         * @throws QuotaExceededException if the user quota limit would be exceeded
1056
         * @throws GSSIOException if there was an error while accessing the file contents
1057
         */
1058
        public void restoreVersion(Long userId, Long fileId, int version)
1059
                        throws ObjectNotFoundException, InsufficientPermissionsException,  GSSIOException, QuotaExceededException;
1060

    
1061
        /**
1062
         * Remove file version identified by bodyId
1063
         *
1064
         * @param userId the ID of the user
1065
         * @param fileId the ID of the file
1066
         * @param bodyId the ID of the body
1067
         *
1068
         * @throws ObjectNotFoundException
1069
         * @throws InsufficientPermissionsException
1070
         *
1071
         */
1072
        public void removeVersion(Long userId, Long fileId, Long bodyId)
1073
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1074

    
1075
        /**
1076
         * Removes all old file versions for specified file keeping only the current revision
1077
         *
1078
         * @param userId the ID of the user
1079
         * @param fileId the ID of the file
1080
         *
1081
         * @throws ObjectNotFoundException
1082
         * @throws InsufficientPermissionsException
1083
         *
1084
         */
1085
        public void removeOldVersions(Long userId, Long fileId)
1086
                        throws ObjectNotFoundException, InsufficientPermissionsException;
1087

    
1088
        /**
1089
         * It is used by the Solr mbean to rebuild the index.
1090
         */
1091
        public String rebuildSolrIndex();
1092

    
1093
        /**
1094
         * It is used by the Solr mbean to refresh the index. It does not delete anything just re-add everything in the index
1095
         */
1096
        public String refreshSolrIndex();
1097
        
1098
        /**
1099
         * Creates a new file with the specified owner, parent folder and name. The
1100
         * new file has the same permissions as its parent folder. The file contents
1101
         * are already uploaded outside of externalAPI and the uploaded file is used as a parameter.
1102
         *
1103
         * @param userId the ID of the current user
1104
         * @param folderId the ID of the parent folder
1105
         * @param name the name of the new file
1106
         * @param mimeType the MIME type of the file
1107
         * @param fileSize the uploaded file size
1108
         * @param filePath the uploaded file full path
1109
         * @return The FileHeaderDTO created
1110
         * @throws DuplicateNameException if the specified name already exists in
1111
         *             the parent folder, as either a folder or file
1112
         * @throws ObjectNotFoundException if the user or parent folder was not
1113
         *             found, with the exception message mentioning the precise
1114
         *             problem
1115
         * @throws GSSIOException if there was an error while storing the file contents
1116
         * @throws InsufficientPermissionsException
1117
         * @throws QuotaExceededException
1118
         */
1119
        public FileHeaderDTO createFile(Long userId, Long folderId, String name, String mimeType, long fileSize, String filePath)
1120
                        throws DuplicateNameException, ObjectNotFoundException, GSSIOException,
1121
                        InsufficientPermissionsException, QuotaExceededException;
1122

    
1123
        /**
1124
         * Create a new FileBody with the supplied uploaded file as contents and make it the current body
1125
         * of the file.
1126
         *
1127
         * @param userId the ID of the current user
1128
         * @param fileId the ID of the file header object
1129
         * @param mimeType the content type of the file
1130
         * @param fileSize the uploaded file size
1131
         * @param filePath the uploaded file full path
1132
         * @return The FileHeaderDTO updated
1133
         * @throws ObjectNotFoundException if the user or file was not found, with
1134
         *                         the exception message mentioning the precise problem
1135
         * @throws GSSIOException when an IO exception occurs
1136
         * @throws InsufficientPermissionsException
1137
         * @throws QuotaExceededException
1138
         */
1139
        public FileHeaderDTO updateFileContents(Long userId, Long fileId, String mimeType,
1140
                                long fileSize, String filePath) throws ObjectNotFoundException, GSSIOException,
1141
                                InsufficientPermissionsException, QuotaExceededException;
1142

    
1143
        /**
1144
         * Create a file based on inputstream without using transaction.
1145
         *
1146
         * @param stream
1147
         * @param userId
1148
         * @return the file
1149
         * @throws IOException
1150
         * @throws ObjectNotFoundException
1151
         */
1152
        @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
1153
        public File uploadFile(InputStream stream, Long userId)
1154
                        throws IOException, ObjectNotFoundException;
1155

    
1156
        public void createFileUploadProgress(Long userId, String filename,
1157
                                Long bytesTransfered, Long fileSize) throws ObjectNotFoundException;
1158

    
1159
        public FileUploadStatus getFileUploadStatus(Long userId, String fileName);
1160

    
1161
        public void removeFileUploadProgress(Long userId, String filename)
1162
                        throws ObjectNotFoundException;
1163

    
1164
        /**
1165
         * Fetch the file body with the specified version number.
1166
         *
1167
         * @param userId the ID of the current user
1168
         * @param fileId the ID of the file header
1169
         * @param version the version number
1170
         * @return the file body
1171
         * @throws ObjectNotFoundException if the user file or version
1172
         *                         were not found
1173
         * @throws InsufficientPermissionsException if the user does not
1174
         *                         have enough privileges for reading this file
1175
         */
1176
        public FileBodyDTO getFileVersion(Long userId, Long fileId, int version) throws ObjectNotFoundException, InsufficientPermissionsException;
1177

    
1178
        /**
1179
         * Search the system for a user with the specified email address.
1180
         * If no such user is found, the method returns null.
1181
         */
1182
        public User findUserByEmail(String email);
1183

    
1184
        /**
1185
         * Update the user with the values from the supplied object.
1186
         */
1187
        public void updateUser(User user);
1188

    
1189
        /**
1190
         * Update accounting information for given user.
1191
         *
1192
         * @param user The user to update
1193
         * @param date Date of transaction
1194
         * @param bandwidthDiff Bandwidth used; positive for addition,
1195
         * negative for subtraction (e.g. to rollback)
1196
         */
1197
        public void updateAccounting(User user, Date date, long bandwidthDiff);
1198

    
1199
        /**
1200
         * Check if the user with the specified ID has permission to read the
1201
         * folder with the supplied ID.
1202
         */
1203
        public boolean canReadFolder(Long userId, Long folderId) throws ObjectNotFoundException;
1204

    
1205
        /**
1206
         * Reset WebDAV password for given user.
1207
         *
1208
         * @param userId
1209
         * @return the new password
1210
         * @throws ObjectNotFoundException
1211
         */
1212
        public String resetWebDAVPassword(Long userId) throws ObjectNotFoundException;
1213

    
1214
        /**
1215
         * Find the invite for the specified invitation code.
1216
         *
1217
         * @param code the invitation code
1218
         * @return the Invitation or null if not found
1219
         */
1220
        public Invitation findInvite(String code);
1221

    
1222
        /**
1223
         * Create a new user in the connected IdP.
1224
         *
1225
         * @param username the username of the new user
1226
         * @param firstname the first name of the new user
1227
         * @param lastname the last name of the new user
1228
         * @param email the e-mail of the new user
1229
         * @param password the password of the new user
1230
         */
1231
        public void createLdapUser(String username, String firstname, String lastname, String email, String password);
1232

    
1233
        /**
1234
         * Retrieves the available user classes.
1235
         */
1236
        public List<UserClass> getUserClasses();
1237

    
1238
        /**
1239
         * Upgrades the user class to the default "coupon bearer" class and marks
1240
         * the provided coupon as used.
1241
         *
1242
         * @param username the username of the user
1243
         * @param code the coupon code
1244
         * @return the new user class
1245
         * @throws InvitationUsedException when trying to reuse an already used invitation
1246
         * @throws ObjectNotFoundException if the user was not found
1247
         */
1248
        public UserClass upgradeUserClass(String username, String code)
1249
                        throws ObjectNotFoundException, InvitationUsedException;
1250

    
1251
        /**
1252
         * Retrieve the user class for coupon-bearing users.
1253
         */
1254
        public UserClass getCouponUserClass();
1255

    
1256
        /**
1257
         * Delete the actual file in the specified file system path.
1258
         */
1259
        public void deleteActualFile(String path);
1260
        
1261
        /**
1262
         * Update the userLogin with the values from the supplied object.
1263
         */
1264
        public void addUserLogin(UserLogin userLogin);
1265
        
1266
        /**
1267
         * Retrieves the user's current session login and the user's last login
1268
         * @param userId
1269
         * @return a list of last two user logins
1270
         * @throws ObjectNotFoundException 
1271
         */
1272
        public List<UserLogin> getLastUserLogins(Long userId) throws ObjectNotFoundException;
1273

    
1274
        /**
1275
         * Posts the file specified by id to solr indexing server
1276
         *
1277
     * @param solr
1278
         * @param id
1279
         */
1280
        public void postFileToSolr(CommonsHttpSolrServer solr, Long id);
1281
        
1282

    
1283

    
1284
}