1 /*******************************************************************************
2 * Copyright � Igor Barma, Alexandre Desoubeaux, Christian Martel, Eric Brun, Mathieu Amblard, Gwenael Gevet, Pierre Guillot, 2012
3 * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Alexandre Lefevre, Marc Salvat 2014-2016
4 * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Marc Salvat, Marc Suarez, Harifetra Ramamonjy 2017
6 * This file is part of the work and learning management system Pentila Nero.
8 * Pentila Nero is free software. You can redistribute it and/or modify since
9 * you respect the terms of either (at least one of the both license) :
10 * - under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, either version 3 of the
12 * License, or (at your option) any later version.
13 * - the CeCILL-C as published by CeCILL-C; either version 1 of the
14 * License, or any later version
15 * - the GNU Lesser General Public License as published by the
16 * Free Software Foundation, either version 3 of the license,
17 * or (at your option) any later version.
19 * There are special exceptions to the terms and conditions of the
20 * licenses as they are applied to this software. View the full text of
21 * the exception in file LICENSE-PROJECT.txt in the directory of this software
24 * Pentila Nero is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * Licenses for more details.
29 * You should have received a copy of the GNU Affero General Public License
30 * and the CeCILL-C and the GNU Lesser General Public License along with
31 * Pentila Nero. If not, see :
32 * <http://www.gnu.org/licenses/> and
33 * <http://www.cecill.info/licences.fr.html>.
34 ******************************************************************************/
35 package com.pentila.entSavoie.utils;
37 import com.liferay.portal.kernel.exception.PortalException;
38 import com.liferay.portal.kernel.exception.SystemException;
39 import com.liferay.portal.kernel.repository.model.Folder;
40 import com.liferay.portal.service.ServiceContext;
41 import com.liferay.portlet.documentlibrary.model.DLFolderConstants;
42 import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil;
43 import com.pentila.entSavoie.casier.Constants;
45 public class IGFoldersUtil {
46 public static Folder getTmpFolder(long userId, long groupId) throws PortalException, SystemException {
47 return getTmpFolder(userId, groupId, true);
50 public static Folder getTmpFolder(long userId, long groupId, boolean createIt) throws PortalException, SystemException {
51 Folder rootFolder = null;
52 //Selon s'il s'agit d'un group d'organizatoin ou d'utilisateur, le nom
56 rootFolder = DLAppLocalServiceUtil.getFolder(groupId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, Constants.TMP_IMG_FOLDER_NAME);
57 } catch (Exception e) {
59 // signifie une mauvaise initialisation du portail. Cree le dossier
60 rootFolder = DLAppLocalServiceUtil.addFolder(
63 DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
64 Constants.TMP_IMG_FOLDER_NAME,
65 "Dossier temporaire pour les images.",
66 new ServiceContext());
72 public static Folder getActuFolder(long userId, long groupId) throws PortalException, SystemException {
73 return getActuFolder(userId, groupId, true);
76 public static Folder getActuFolder(long userId, long groupId, boolean createIt) throws PortalException, SystemException {
77 Folder rootFolder = null;
78 //Selon s'il s'agit d'un group d'organizatoin ou d'utilisateur, le nom
82 rootFolder = DLAppLocalServiceUtil.getFolder(groupId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, Constants.ACTU_IMG_FOLDER_NAME);
83 } catch (Exception e) {
85 // signifie une mauvaise initialisation du portail. Cree le dossier
86 rootFolder = DLAppLocalServiceUtil.addFolder(
89 DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
90 Constants.ACTU_IMG_FOLDER_NAME,
91 "Dossier pour les images des actualites.",
92 new ServiceContext());
98 public static Folder getMenuImgFolder(long userId, long groupId) throws PortalException, SystemException {
99 return getMenuImgFolder(userId, groupId, true);
102 public static Folder getMenuImgFolder(long userId, long groupId, boolean createIt) throws PortalException, SystemException {
103 Folder rootFolder = null;
104 //Selon s'il s'agit d'un group d'organizatoin ou d'utilisateur, le nom
108 rootFolder = DLAppLocalServiceUtil.getFolder(groupId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, Constants.MENU_IMG_FOLDER_NAME);
109 } catch (Exception e) {
111 // signifie une mauvaise initialisation du portail. Cree le dossier
112 rootFolder = DLAppLocalServiceUtil.addFolder(
115 DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
116 Constants.MENU_IMG_FOLDER_NAME,
117 "Dossier pour les images des menus.",
118 new ServiceContext());
124 public static Folder getRecetteFolder(long userId, long groupId) throws PortalException, SystemException {
125 return getRecetteFolder(userId, groupId, true);
128 public static Folder getRecetteFolder(long userId, long groupId, boolean createIt) throws PortalException, SystemException {
129 Folder rootFolder = null;
130 //Selon s'il s'agit d'un group d'organizatoin ou d'utilisateur, le nom
134 rootFolder = DLAppLocalServiceUtil.getFolder(groupId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, Constants.RECETTE_IMG_FOLDER_NAME);
135 } catch (Exception e) {
137 // signifie une mauvaise initialisation du portail. Cree le dossier
138 rootFolder = DLAppLocalServiceUtil.addFolder(
141 DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
142 Constants.RECETTE_IMG_FOLDER_NAME,
143 "Dossier pour les images des recettes.",
144 new ServiceContext());