1 | <?php |
||
23 | class FolderService extends Service { |
||
24 | |||
25 | private $l10n; |
||
26 | private $timeFactory; |
||
27 | private $autoPurgeMinimumInterval; |
||
28 | private $folderMapper; |
||
29 | |||
30 | public function __construct(FolderMapper $folderMapper, |
||
41 | |||
42 | /** |
||
43 | * Returns all folders of a user |
||
44 | * @param string $userId the name of the user |
||
45 | * @return array of folders |
||
46 | */ |
||
47 | public function findAll($userId) { |
||
50 | |||
51 | |||
52 | private function validateFolder($folderName, $userId){ |
||
67 | |||
68 | |||
69 | /** |
||
70 | * Creates a new folder |
||
71 | * @param string $folderName the name of the folder |
||
72 | * @param string $userId the name of the user for whom it should be created |
||
73 | * @param int $parentId the parent folder id, deprecated we don't nest |
||
74 | * folders |
||
75 | * @throws ServiceConflictException if name exists already |
||
76 | * @throws ServiceValidationException if the folder has invalid parameters |
||
77 | * @return Folder the newly created folder |
||
78 | */ |
||
79 | public function create($folderName, $userId, $parentId=0) { |
||
89 | |||
90 | |||
91 | /** |
||
92 | * @throws ServiceException if the folder does not exist |
||
93 | */ |
||
94 | public function open($folderId, $opened, $userId){ |
||
99 | |||
100 | |||
101 | /** |
||
102 | * Renames a folder |
||
103 | * @param int $folderId the id of the folder that should be deleted |
||
104 | * @param string $folderName the new name of the folder |
||
105 | * @param string $userId the name of the user for security reasons |
||
106 | * @throws ServiceConflictException if name exists already |
||
107 | * @throws ServiceValidationException if the folder has invalid parameters |
||
108 | * @throws ServiceNotFoundException if the folder does not exist |
||
109 | * @return Folder the updated folder |
||
110 | */ |
||
111 | public function rename($folderId, $folderName, $userId){ |
||
118 | |||
119 | |||
120 | /** |
||
121 | * Use this to mark a folder as deleted. That way it can be un-deleted |
||
122 | * @param int $folderId the id of the folder that should be deleted |
||
123 | * @param string $userId the name of the user for security reasons |
||
124 | * @throws ServiceNotFoundException when folder does not exist |
||
125 | */ |
||
126 | public function markDeleted($folderId, $userId) { |
||
131 | |||
132 | |||
133 | /** |
||
134 | * Use this to restore a folder |
||
135 | * @param int $folderId the id of the folder that should be restored |
||
136 | * @param string $userId the name of the user for security reasons |
||
137 | * @throws ServiceNotFoundException when folder does not exist |
||
138 | */ |
||
139 | public function unmarkDeleted($folderId, $userId) { |
||
144 | |||
145 | |||
146 | /** |
||
147 | * Deletes all deleted folders |
||
148 | * @param string $userId if given it purges only folders of that user |
||
149 | * @param boolean $useInterval defaults to true, if true it only purges |
||
150 | * entries in a given interval to give the user a chance to undo the |
||
151 | * deletion |
||
152 | */ |
||
153 | public function purgeDeleted($userId=null, $useInterval=true) { |
||
167 | |||
168 | |||
169 | /** |
||
170 | * Deletes all folders of a user |
||
171 | * @param string $userId the name of the user |
||
172 | */ |
||
173 | public function deleteUser($userId) { |
||
176 | |||
177 | |||
178 | } |
||
179 |