--- /dev/null
+/*******************************************************************************
+ * Copyright � Igor Barma, Alexandre Desoubeaux, Christian Martel, Eric Brun, Mathieu Amblard, Gwenael Gevet, Pierre Guillot, 2012
+ * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Alexandre Lefevre, Marc Salvat 2014-2016
+ * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Marc Salvat, Marc Suarez, Harifetra Ramamonjy 2017
+ *
+ * This file is part of the work and learning management system Pentila Nero.
+ *
+ * Pentila Nero is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ * - the GNU Lesser General Public License as published by the
+ * Free Software Foundation, either version 3 of the license,
+ * or (at your option) any later version.
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE-PROJECT.txt in the directory of this software
+ * distribution.
+ *
+ * Pentila Nero is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * and the CeCILL-C and the GNU Lesser General Public License along with
+ * Pentila Nero. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ ******************************************************************************/
+package com.pentila.util;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.directory.Attributes;
+
+import com.liferay.portal.kernel.exception.SystemException;
+import com.liferay.portal.kernel.json.JSONException;
+import com.liferay.portal.kernel.json.JSONFactoryUtil;
+import com.liferay.portal.kernel.json.JSONObject;
+import com.liferay.portal.kernel.log.Log;
+import com.liferay.portal.kernel.log.LogFactoryUtil;
+import com.liferay.portal.kernel.repository.model.FileEntry;
+import com.liferay.portal.kernel.repository.model.Folder;
+import com.liferay.portal.kernel.search.Hits;
+import com.liferay.portal.kernel.util.HttpUtil;
+//import com.liferay.portal.util.PrefsPropsUtil;
+import com.liferay.portal.kernel.util.PrefsPropsUtil;
+import com.liferay.portal.kernel.util.PropsUtil;
+import com.liferay.portal.kernel.util.StringPool;
+import com.liferay.portal.model.Group;
+import com.liferay.portal.model.Portlet;
+import com.liferay.portal.model.User;
+import com.liferay.portal.service.PortletLocalServiceUtil;
+import com.liferay.portal.util.PortalUtil;
+import com.liferay.portlet.blogs.model.BlogsEntry;
+import com.liferay.portlet.documentlibrary.model.DLFileEntry;
+import com.liferay.portlet.documentlibrary.model.DLFolder;
+import com.liferay.portlet.messageboards.model.MBCategory;
+import com.liferay.portlet.messageboards.model.MBMessage;
+import com.pentila.entSavoie.agenda.model.EventAgenda;
+import com.pentila.entSavoie.applicationManager.model.AMSingleUsers;
+import com.pentila.entSavoie.applicationManager.service.AMSingleUsersLocalServiceUtil;
+import com.pentila.entSavoie.cahierDeTexte.model.EventCDT;
+import com.pentila.entSavoie.internalMessaging.model.InternalMessage;
+import com.pentila.entSavoie.internalMessaging.model.Message;
+import com.pentila.entSavoie.internalMessaging.model.RssItem;
+import com.pentila.entSavoie.synchroLdap.impl.MembershipManager;
+import com.pentila.entSavoie.synchroLdap.impl.SynchronizationManager;
+import com.pentila.entSavoie.userPurge.UserPurgeImpl;
+import com.pentila.entSavoie.utils.ENTMainUtilsLocalService;
+import com.pentila.entSavoie.utils.ENTMainUtilsLocalServiceUtil;
+
+public class ENTMainUtilsLocalServiceImpl implements ENTMainUtilsLocalService {
+
+ private static Log logger = LogFactoryUtil.getLog(ENTMainUtilsLocalServiceImpl.class);
+
+ // This map contains all pairs propertyKey / propertyValue, so that they are loaded only once
+ // and provided by the map when asked (in order to minimize IOs on portal-ext.properties file)
+ private static Map<String, String> propertiesMap = new HashMap<String, String>();
+
+ public static final String ENT_ORGROOT_NAME = "ent.orgRoot.name";
+ public static final String ENT_ORGROOT_MAIL = "ent.orgRoot.mail";
+ public static final String ENT_ORGROOT_PORTALMEMBERSNAME = "ent.orgRoot.portalMembersName";
+ public static final String ENT_ORGROOT_DEPARTMENT = "ent.orgRoot.department";
+ public static final String ENT_GOOGLEANALYTICS_CODE = "ent.google.analytics.code";
+ public static final String ENT_CHART = "ent.chart";
+ public static final String XMPP_HOST = "xmpp.host";
+ public static final String XMPP_ENABLE = "xmpp.enable";
+ public static final String XMPP_DOMAIN = "xmpp.domain";
+ public static final String VISIO_URL = "visio.url";
+ public static final String VISIO_RTMP_DOMAIN = "visio.rtmp.domain";
+ public static final String VISIO_RTMP_SERVICE = "visio.rtmp.service";
+ public static final String VISIO_SALT = "visio.salt";
+ public static final String MAIL_NOREPLY = "ent.mail.noreply";
+ public static final String MAIL_REPLY_SUBJECT = "ent.mail.reply.subject";
+ public static final String MAIL_REPLY_BODY = "ent.mail.reply.body";
+ public static final String VISIO_ADMIN_LOGIN = "visio.admin.login";
+ public static final String VISIO_ADMIN_PASSWORD = "visio.admin.password";
+ public static final String FILE_ERROR_SWF = "file.error.swf";
+ public static final String FILE_ERROR_FLV = "file.error.flv";
+ public static final String ENT_CONFIRMATION_SENDER_ID = "ent.confirmation.sender.id";
+ public static final String ENT_SCHOOL_IMPORT_TYPE = "ent.school.import.type";
+ public static final String ENT_GROUP_MANAGMENT = "ent.group.managment";
+ public static final String ENT_LDAP_SCHEMA_SUPANN = "ent.ldap.schema.supann";
+ public static final String FLASH_FILE_STATE_PROGRESS = "actualite.flash.file.state.progress";
+ public static final String FLASH_FILE_STATE_ERROR = "actualite.flash.file.state.error";
+ public static final String FLASH_FILE_STATE_CONVERT = "actualite.flash.file.state.convert";
+ public static final String XITI_ENABLE = "xiti.enable";
+ public static final String XITI_ID_PROJET = "xiti.id.projet";
+ public static final String XITI_ID_PLATEFORME = "xiti.id.plateforme";
+ public static final String XITI_ID_COLLECTIVITE = "xiti.id.collectivite";
+ public static final String XITI_LIST_ETAB_ID = "xiti.list.etab.id";
+ public static final String LDAP_IMPORT_MODIFY_DATE = "ldap.import.enable.modifyDate";
+ public static final String ENT_GROUP_INTRANET_ENABLE = "ent.group.intranet.enable";
+ public static final String ENT_LDAP_SYNCHRO_ROLE_DEFAULT = "ent.ldap.synchro.role.default";
+ public static final String ENT_LDAP_SYNCHRO_ETAB_NAME = "ent.ldap.synchro.etab.name";
+ public static final String ENT_LDAP_SYNCHRO_FORCE_LIST_INST = "ent.ldap.synchro.force.listinst";
+ public static final String ENT_AGENDA_ENABLE_FORCESUBSCRIBE = "ent.agenda.enable.forceSubscribe";
+ public static final String ENT_MOBILE_NOTIFICATION_ENABLE = "ent.mobile.notification.enable";
+ public static final String ENT_NOTIFICATIONS_ENABLE = "ent.notifications.enable";
+ public static final String ENT_MAILFORWARD_ENABLE = "ent.mailforward.enable";
+ public static final String PUBLIC_BLOG_URL = "ent.public.web.blog.url";
+ public static final String PUBLIC_FRONT_BLOG_URL = "ent.public.front.blog.url";
+ public static final String WORDPRESS_USERNAME = "wordpress.username";
+ public static final String WORDPRESS_PASSWORD = "wordpress.password";
+ public static final String WORDPRESS_URL = "wordpress.url";
+ public static final String WORDPRESS_ADMIN_SUFFIX_URL = "wordpress.admin.suffix.url";
+ public static final String WORDPRESS_SUFFIX_URL = "wodpress.suffix.url";
+ public static final String ENT_MAIL_ACADEMIC_SUFFIX = "ent.mail.academic.suffix";
+ public static final String WEBDAV_ENABLE = "webdav.enable";
+ public static final String ENT_GROUP_DEFAULT_VIEW = "ent.group.default.view";
+ public static final String SHIBBOLETH_AUTH_ENABLED = "shibboleth.auth.enable";
+ public static final String SHIBBOLETH_LOGOUT_URL = "shibboleth.logout.url";
+ public static final String ENT_MAILSENDER_USE_FORWARD = "ent.mailSender.use.forward";
+ public static final String PIWIK_ENABLE = "piwik.enable";
+ public static final String PIWIK_URL = "piwik.url";
+ public static final String PIWIK_API_URL = "piwik.api_url";
+ public static final String PIWIK_SITE_ID = "piwik.siteId";
+ public static final String PIWIK_TOKEN_AUTH = "piwik.token_auth";
+ public static final String LDAP_AUTH_MAIL_FILTER = "ldap.auth.mail.search.filter";
+ public static final String VIEW_AJAX_JSP_KEY = "portlet.key.view.ajax.jsp";
+ public static final String DEFAULT_PORLET_HEIGHT = "default.portlet.height";
+ public static final String SPECIAL_PORTLETS_THEME = "special.portlets.theme";
+ public static final String ENT_FULLSCREEN_ALLOWED = "ent.fullscreen.allowed";
+ public static final String ENT_FULLSCREEN_MAXIMIZE_KEY = "ent.fullscreen.maximize.key";
+ public static final String ENT_LIST_ROLES_ENABLED = "ent.list.roles.enabled";
+ public static final String ENT_LIST_ROLES_NATIONAUX_ENABLED = "ent.list.roles.nationaux.enabled";
+ public static final String ENT_IMPORT_UTILISATEURS_ENABLED = "ent.import.utilisateurs.enabled";
+ public static final String ENT_IMPORT_UTILISATEURS_PATH = "ent.import.utilisateurs.path";
+ public static final String ENT_KEY_LANGUAGE_SUFFIX = "ent.key.language.suffix";
+ public static final String ENT_SOCIAL_ACTIVITY_ENABLED = "ent.social.activity.enabled";
+ public static final String ENT_MENU_CATEGORIES = "ent.menu.categories";
+ public static final String ENT_MENU_LINK_ETAB_CATEGORY = "ent.menu.link.etab.category";
+ public static final String ENT_CAPTCHA_PUBLIC_KEY = "ent.captcha.public.key";
+ public static final String ENT_CAPTCHA_PRIVATE_KEY = "ent.captcha.private.key";
+ public static final String ENT_PLATEFORM_NAME = "ent.plateform.name";
+ public static final String ENT_RESET_PASSWORD_URL = "ent.reset.password.url";
+ public static final String ENT_VIE_SCOLAIRE_USER_ID = "ent.vie.scolaire.user.id";
+ public static final String MIME_TYPES = "mime.types";
+ public static final String ENT_POPULATION_MANAGER_ID = "ent.population.manager.id";
+ public static final String ENT_INCIDENTS_USERS_NOTIFICATION = "ent.incidents.users.notication";
+ public static final String LOGIN_DEFAULT_PAGE_LANDING = "login.default.page.landing";
+ public static final String LOGIN_DEFAULT_APPLICATION_LANDING = "login.default.application.landing";
+ public static final String ENT_LSO_ENABLED = "ent.lso.enabled";
+ public static final String ENT_LSO_GROUP_LANDING_PAGE = "ent.lso.group.landing.page";
+ public static final String JDBC_ENTLOG_URL = "jdbc.entlog.url";
+ public static final String JDBC_DEFAULT_USER = "jdbc.default.username";
+ public static final String JDBC_DEFAULT_PASSWD = "jdbc.default.password";
+ public static final String DL_HOOK_FILE_SYSTEM_ROOT_DIR = "dl.hook.file.system.root.dir";
+ public static final String USER_PURGE_OUTPUT_FILE = "user.purge.output.file";
+ public static final String SWFTOOLS_DIRECTORY = "swftools.directory";
+ public static final String DL_STORE_ISCO3 = "dl.store.isCO3";
+ public static final String MAIL_DEFAULT_ACCOUNTS = "mail.default.accounts";
+ public static final String HELP_MENU_LINK = "help.menu.link";
+ public static final String SUPPORT_LOCAL_ADMINS_ENABLE = "support.local.admins.enable";
+ public static final String SUPPORT_ADMIN_USURPATION_ENABLE = "support.admin.usurpation.enable";
+ public static final String SUPPORT_MAIL = "support.mail";
+ public static final String EDT_PRIVATE_KEY_PATH = "edt.private.key.path";
+ public static final String IMPORT_DEVMODE = "import.devmode";
+ public static final String SYNCHRO_FORCE_PARENT_MEMBERSHIP = "synchro.force.parent.membership";
+ public static final String EDT_IMPORTFILES_DIRECTORY = "edt.importfiles.directory";
+ public static final String MESSAGING_STUDENT_MAX_RECEIVERS = "messaging.student.max.receivers";
+ public static final String MESSAGING_PARENT_MAX_RECEIVERS = "messaging.parent.max.receivers";
+ public static final String MESSAGING_PERSONAL_MAX_RECEIVERS = "messaging.personal.max.receivers";
+ public static final String PRONOTE_STUDENT_LINK_LIST = "pronote.student.link.list";
+ public static final String PRONOTE_PARENT_LINK_LIST = "pronote.parent.link.list";
+ public static final String PRONOTE_TEACHER_LINK_LIST = "pronote.teacher.link.list";
+ public static final String ENT_MENU_PORTLET_HIDDEN = "ent.menu.portlet.hidden";
+
+
+ /**
+ * Upload
+ */
+ public static final String UPLOAD_SERVLET_REQUEST_MAX_SIZE = "com.liferay.portal.upload.UploadServletRequestImpl.max.size";
+
+ /**
+ * File maximum size
+ */
+ public static final String DL_FILE_MAX_SIZE = "dl.file.max.size";
+
+ /**
+ * Etherpad constant
+ */
+ public static final String ETHERPAD_URL = "etherpad.url";
+ public static final String ETHERPAD_API_KEY = "etherpad.api.key";
+
+ /**
+ * Constant define in ext to parametized the URL of apps
+ */
+ public static final String PORTLET_URL_RACK = "portlet.url.rack";
+ public static final String PORTLET_URL_SCHOOLBAB = "portlet.url.schoolbag";
+ public static final String PORTLET_URL_NEWS = "portlet.url.news";
+ public static final String PORTLET_URL_FORUM = "portlet.url.forum";
+ public static final String PORTLET_URL_GROUP = "portlet.url.group";
+ public static final String PORTLET_URL_MESSAGING = "portlet.url.messaging";
+ public static final String PORTLET_URL_TEXTBOOK = "portlet.url.textbook";
+ public static final String PORTLET_URL_SEARCHENGINE = "portlet.url.searchengine";
+ public static final String PORTLET_URL_AGENDA = "portlet.url.agenda";
+
+ /**
+ * Platforms
+ */
+ public static final String PLATFORM = "platform";
+ public static final String PLATFORM_HN_PROD = "HN_PROD";
+ public static final String PLATFORM_HN_PREPROD = "HN_PREPROD";
+ public static final String PLATFORM_CO3_PROD = "CO3_PROD";
+ public static final String PLATFORM_CO3_PREPROD = "CO3_PREPROD";
+ public static final String PLATFORM_CAIRNS_PROD = "CAIRNS_PROD";
+ public static final String PLATFORM_CAIRNS_PREPROD = "CAIRNS_PREPROD";
+
+ /**
+ * Oauth
+ */
+ public static final String OAUTH_CLIENT_ID = "oauth.clientid";
+ public static final String OAUTH_SECRET_ID = "oauth.secretid";
+
+ /**
+ * service
+ */
+ public static final String SERVICE_GUIDE_PATH = "guide.";
+
+ /**
+ * EDX
+ */
+ public static final String EDX_BASEURL = "edx.baseurl";
+ public static final String EDX_ACCESS_TOKEN= "edx.accesstoken";
+ /**
+ * Method to get the upload max size from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of com.liferay.portal.upload.UploadServletRequestImpl.max.size value in portal ext
+ */
+ public boolean isImportDevMode(long companyId) {
+ if (propertiesMap.containsKey(IMPORT_DEVMODE)) {
+ return propertiesMap.get(IMPORT_DEVMODE).equals("true");
+ }
+ boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, IMPORT_DEVMODE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(IMPORT_DEVMODE, res ? "true" : "false");
+ return res;
+ }
+
+
+ /**
+ * Method to get the upload max size from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of com.liferay.portal.upload.UploadServletRequestImpl.max.size value in portal ext
+ */
+ public long getUploadServletRequestMaxSize(long companyId){
+ if (propertiesMap.containsKey(UPLOAD_SERVLET_REQUEST_MAX_SIZE)) {
+ return Long.parseLong(propertiesMap.get(UPLOAD_SERVLET_REQUEST_MAX_SIZE));
+ }
+ long res = 0;
+ try {
+ res = PrefsPropsUtil.getLong(companyId, UPLOAD_SERVLET_REQUEST_MAX_SIZE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(UPLOAD_SERVLET_REQUEST_MAX_SIZE, res + "");
+ return res;
+ }
+
+ /**
+ * Method to get the dl file max size from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of dl.file.max.size value in portal ext
+ */
+ public long getDLFileMaxSize(long companyId){
+ if (propertiesMap.containsKey(DL_FILE_MAX_SIZE)) {
+ return Long.parseLong(propertiesMap.get(DL_FILE_MAX_SIZE));
+ }
+ long res = 0;
+ try {
+ res = PrefsPropsUtil.getLong(companyId, DL_FILE_MAX_SIZE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(DL_FILE_MAX_SIZE, res + "");
+ return res;
+ }
+
+
+ /**
+ * Method to get the etherpad URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of etherpad.url value in portal ext
+ */
+ public String getEtherpadUrl(long companyId){
+ if (propertiesMap.containsKey(ETHERPAD_URL)) {
+ return propertiesMap.get(ETHERPAD_URL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ETHERPAD_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ETHERPAD_URL, res);
+ return res;
+ }
+
+ /**
+ * Method to get the etherpad URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of etherpad.api.key value in portal ext
+ */
+ public String getEtherpadApiKey(long companyId){
+ if (propertiesMap.containsKey(ETHERPAD_API_KEY)) {
+ return propertiesMap.get(ETHERPAD_API_KEY);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ETHERPAD_API_KEY);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ETHERPAD_API_KEY, res);
+ return res;
+ }
+
+ /**
+ * Method to get the help URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of help.menu.link value in portal ext
+ */
+ public String getHelpMenuLink(long companyId){
+ if (propertiesMap.containsKey(HELP_MENU_LINK)) {
+ return propertiesMap.get(HELP_MENU_LINK);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, HELP_MENU_LINK);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(HELP_MENU_LINK, res);
+ return res;
+ }
+
+ /**
+ * Method to get the mail default account from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of mail.default.accounts value in portal ext
+ */
+ public String getMailDefaultAccount(long companyId){
+ if (propertiesMap.containsKey(MAIL_DEFAULT_ACCOUNTS)) {
+ return propertiesMap.get(MAIL_DEFAULT_ACCOUNTS);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, MAIL_DEFAULT_ACCOUNTS);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(MAIL_DEFAULT_ACCOUNTS, res);
+ return res;
+ }
+
+ /**
+ * Method to get the rack URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of portal.url.rack value in portal ext
+ */
+ public String getPortletUrlRack(long companyId){
+ if (propertiesMap.containsKey(PORTLET_URL_RACK)) {
+ return propertiesMap.get(PORTLET_URL_RACK);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PORTLET_URL_RACK);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PORTLET_URL_RACK, res);
+ return res;
+ }
+
+ /*
+ * Method to get the schoolbag URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of portal.url.schoolbag value in portal ext
+ */
+ public String getPortletUrlSchoolBag(long companyId){
+ if (propertiesMap.containsKey(PORTLET_URL_SCHOOLBAB)) {
+ return propertiesMap.get(PORTLET_URL_SCHOOLBAB);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PORTLET_URL_SCHOOLBAB);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PORTLET_URL_SCHOOLBAB, res);
+ return res;
+ }
+ /*
+ * Method to get the news URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of portal.url.news value in portal ext
+ */
+ public String getPortletUrlNews(long companyId){
+ if (propertiesMap.containsKey(PORTLET_URL_NEWS)) {
+ return propertiesMap.get(PORTLET_URL_NEWS);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PORTLET_URL_NEWS);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PORTLET_URL_NEWS, res);
+ return res;
+ }
+ /*
+ * Method to get the forum URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of portal.url.forum value in portal ext
+ */
+ public String getPortletUrlForum(long companyId){
+ if (propertiesMap.containsKey(PORTLET_URL_FORUM)) {
+ return propertiesMap.get(PORTLET_URL_FORUM);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PORTLET_URL_FORUM);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PORTLET_URL_FORUM, res);
+ return res;
+ }
+ /*
+ * Method to get the group URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of portal.url.group value in portal ext
+ */
+ public String getPortletUrlGroup(long companyId){
+ if (propertiesMap.containsKey(PORTLET_URL_GROUP)) {
+ return propertiesMap.get(PORTLET_URL_GROUP);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PORTLET_URL_GROUP);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PORTLET_URL_GROUP, res);
+ return res;
+ }
+ /*
+ * Method to get the messaging URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of portal.url.messaging value in portal ext
+ */
+ public String getPortletUrlMessaging(long companyId){
+ if (propertiesMap.containsKey(PORTLET_URL_MESSAGING)) {
+ return propertiesMap.get(PORTLET_URL_MESSAGING);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PORTLET_URL_MESSAGING);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PORTLET_URL_MESSAGING, res);
+ return res;
+ }
+ /*
+ * Method to get the textbook URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of portal.url.textbook value in portal ext
+ */
+ public String getPortletUrlTextbook(long companyId){
+ if (propertiesMap.containsKey(PORTLET_URL_TEXTBOOK)) {
+ return propertiesMap.get(PORTLET_URL_TEXTBOOK);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PORTLET_URL_TEXTBOOK);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PORTLET_URL_TEXTBOOK, res);
+ return res;
+ }
+ /*
+ * Method to get the search engine URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of portal.url.searchengine value in portal ext
+ */
+ public String getPortletUrlSearchengine(long companyId){
+ if (propertiesMap.containsKey(PORTLET_URL_SEARCHENGINE)) {
+ return propertiesMap.get(PORTLET_URL_SEARCHENGINE);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PORTLET_URL_SEARCHENGINE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PORTLET_URL_SEARCHENGINE, res);
+ return res;
+ }
+ /*
+ * Method to get the agenda URL from portal-ext
+ * @param companyId the company id of the context
+ * @return the value of portal.url.agenda value in portal ext
+ */
+ public String getPortletUrlAgenda(long companyId){
+ if (propertiesMap.containsKey(PORTLET_URL_AGENDA)) {
+ return propertiesMap.get(PORTLET_URL_AGENDA);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PORTLET_URL_AGENDA);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PORTLET_URL_AGENDA, res);
+ return res;
+ }
+
+
+ public String getSwfToolsDirectory(long companyId) {
+ if (propertiesMap.containsKey(SWFTOOLS_DIRECTORY)) {
+ return propertiesMap.get(SWFTOOLS_DIRECTORY);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, SWFTOOLS_DIRECTORY);
+ } catch (SystemException e) {
+ e.printStackTrace();
+ }
+ propertiesMap.put(SWFTOOLS_DIRECTORY, res);
+ return res;
+ }
+
+ public boolean isEntLsoEnabled(long companyId) {
+ if (propertiesMap.containsKey(ENT_LSO_ENABLED)) {
+ return propertiesMap.get(ENT_LSO_ENABLED).equals("true");
+ }
+ boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, ENT_LSO_ENABLED);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_LSO_ENABLED, res ? "true" : "false");
+ return res;
+ }
+
+ public String getLSOGroupLandingPage(long companyId) {
+ if (propertiesMap.containsKey(ENT_LSO_GROUP_LANDING_PAGE)) {
+ return propertiesMap.get(ENT_LSO_GROUP_LANDING_PAGE);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ENT_LSO_GROUP_LANDING_PAGE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_LSO_GROUP_LANDING_PAGE, res);
+ return res;
+ }
+
+
+ public String getLoginDefaultPageLanding(long companyId) {
+ if (propertiesMap.containsKey(LOGIN_DEFAULT_PAGE_LANDING)) {
+ return propertiesMap.get(LOGIN_DEFAULT_PAGE_LANDING);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, LOGIN_DEFAULT_PAGE_LANDING);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(LOGIN_DEFAULT_PAGE_LANDING, res);
+ return res;
+
+ }
+
+ /**
+ * Get default application to load on login
+ */
+ public String getLoginDefaultApplicationLanding(long companyId) {
+ if (propertiesMap.containsKey(LOGIN_DEFAULT_APPLICATION_LANDING)) {
+ return propertiesMap.get(LOGIN_DEFAULT_APPLICATION_LANDING);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, LOGIN_DEFAULT_APPLICATION_LANDING);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(LOGIN_DEFAULT_APPLICATION_LANDING, res);
+ return res;
+
+ }
+
+
+ public String getAuthMailFilter(long companyId) {
+ if (propertiesMap.containsKey(LDAP_AUTH_MAIL_FILTER)) {
+ return propertiesMap.get(LDAP_AUTH_MAIL_FILTER);
+ }
+ String res = "mail=@email_address@)";
+ try {
+ res = PrefsPropsUtil.getString(companyId, LDAP_AUTH_MAIL_FILTER);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(LDAP_AUTH_MAIL_FILTER, res);
+ return res;
+ }
+
+ public long getEntConfirmationSenderId(long companyId) {
+ if (propertiesMap.containsKey(ENT_CONFIRMATION_SENDER_ID)) {
+ try {
+ return Long.parseLong(propertiesMap.get(ENT_CONFIRMATION_SENDER_ID));
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ Long res = new Long(0);
+ try {
+ res = PrefsPropsUtil.getLong(companyId, ENT_CONFIRMATION_SENDER_ID);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_CONFIRMATION_SENDER_ID, ""+res);
+ return res;
+ }
+
+ public Boolean isGroupManagment(long companyId) {
+ if (propertiesMap.containsKey(ENT_GROUP_MANAGMENT)) {
+ return propertiesMap.get(ENT_GROUP_MANAGMENT).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, ENT_GROUP_MANAGMENT);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_GROUP_MANAGMENT, res ? "true" : "false");
+ return res;
+ }
+
+
+ public Boolean isSchemaSupann(long companyId) {
+ if (propertiesMap.containsKey(ENT_LDAP_SCHEMA_SUPANN)) {
+ return propertiesMap.get(ENT_LDAP_SCHEMA_SUPANN).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, ENT_LDAP_SCHEMA_SUPANN);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_LDAP_SCHEMA_SUPANN, res ? "true" : "false");
+ return res;
+ }
+
+ public boolean isENTMailSenderUseForward(long companyId) {
+ if (propertiesMap.containsKey(ENT_MAILSENDER_USE_FORWARD)) {
+ return propertiesMap.get(ENT_MAILSENDER_USE_FORWARD).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, ENT_MAILSENDER_USE_FORWARD);
+ } catch (SystemException e) {
+ logger.error(e);
+ return false;
+ }
+ propertiesMap.put(ENT_MAILSENDER_USE_FORWARD, res ? "true" : "false");
+ return res;
+ }
+
+
+
+ public Boolean isGroupIntranetEnable(long companyId) {
+ if (propertiesMap.containsKey(ENT_GROUP_INTRANET_ENABLE)) {
+ return propertiesMap.get(ENT_GROUP_INTRANET_ENABLE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, ENT_GROUP_INTRANET_ENABLE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_GROUP_INTRANET_ENABLE, res ? "true" : "false");
+ return res;
+ }
+
+ public String getEntGroupDefaultView(long companyId) {
+ if (propertiesMap.containsKey(ENT_GROUP_DEFAULT_VIEW)) {
+ return propertiesMap.get(ENT_GROUP_DEFAULT_VIEW);
+ }
+ String res = "actualites_WAR_actualitesportlet";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ENT_GROUP_DEFAULT_VIEW);
+ } catch (SystemException e) {
+ logger.error(e);
+ return "actualites_WAR_actualitesportlet";
+ }
+ propertiesMap.put(ENT_GROUP_DEFAULT_VIEW, res);
+ return res;
+ }
+
+
+ public Boolean getEntSchoolImportType(long companyId) {
+ if (propertiesMap.containsKey(ENT_SCHOOL_IMPORT_TYPE)) {
+ return propertiesMap.get(ENT_SCHOOL_IMPORT_TYPE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, ENT_SCHOOL_IMPORT_TYPE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_SCHOOL_IMPORT_TYPE, res ? "true" : "false");
+ return res;
+ }
+
+ public String getXmppHost(long companyId) {
+ if (propertiesMap.containsKey(XMPP_HOST)) {
+ return propertiesMap.get(XMPP_HOST);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, XMPP_HOST);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(XMPP_HOST, res);
+ return res;
+
+ }
+
+ public String getXmppDomain(long companyId) {
+ if (propertiesMap.containsKey(XMPP_DOMAIN)) {
+ return propertiesMap.get(XMPP_DOMAIN);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, XMPP_DOMAIN);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(XMPP_DOMAIN, res);
+ return res;
+
+ }
+
+ public boolean isXmppEnable(long companyId) {
+ if (propertiesMap.containsKey(XMPP_ENABLE)) {
+ return propertiesMap.get(XMPP_ENABLE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, XMPP_ENABLE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(XMPP_ENABLE, res ? "true" : "false");
+ return res;
+ }
+
+ public Boolean isLDAPImportModifyDate(long companyId){
+ if (propertiesMap.containsKey(LDAP_IMPORT_MODIFY_DATE)) {
+ return propertiesMap.get(LDAP_IMPORT_MODIFY_DATE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, LDAP_IMPORT_MODIFY_DATE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(LDAP_IMPORT_MODIFY_DATE, res ? "true" : "false");
+ return res;
+ }
+
+ public String getVisioUrl(long companyId) {
+ if (propertiesMap.containsKey(VISIO_URL)) {
+ return propertiesMap.get(VISIO_URL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, VISIO_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(VISIO_URL, res);
+ return res;
+
+ }
+
+ public String getVisioRtmpDomain(long companyId) {
+ if (propertiesMap.containsKey(VISIO_RTMP_DOMAIN)) {
+ return propertiesMap.get(VISIO_RTMP_DOMAIN);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, VISIO_RTMP_DOMAIN);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(VISIO_RTMP_DOMAIN, res);
+ return res;
+
+ }
+
+ public String getVisioRtmpService(long companyId) {
+ if (propertiesMap.containsKey(VISIO_RTMP_SERVICE)) {
+ return propertiesMap.get(VISIO_RTMP_SERVICE);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, VISIO_RTMP_SERVICE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(VISIO_RTMP_SERVICE, res);
+ return res;
+
+ }
+
+ public String getVisioSalt(long companyId) {
+ if (propertiesMap.containsKey(VISIO_SALT)) {
+ return propertiesMap.get(VISIO_SALT);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, VISIO_SALT);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(VISIO_SALT, res);
+ return res;
+
+ }
+
+ public String getVisioAdminLogin(long companyId) {
+ if (propertiesMap.containsKey(VISIO_ADMIN_LOGIN)) {
+ return propertiesMap.get(VISIO_ADMIN_LOGIN);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, VISIO_ADMIN_LOGIN);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(VISIO_ADMIN_LOGIN, res);
+ return res;
+
+ }
+
+ public String getVisioAdminPassword(long companyId) {
+ if (propertiesMap.containsKey(VISIO_ADMIN_PASSWORD)) {
+ return propertiesMap.get(VISIO_ADMIN_PASSWORD);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, VISIO_ADMIN_PASSWORD);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(VISIO_ADMIN_PASSWORD, res);
+ return res;
+
+ }
+
+ public String getENTGoogleAnalyticsCode(long companyId) {
+ if (propertiesMap.containsKey(ENT_GOOGLEANALYTICS_CODE)) {
+ return propertiesMap.get(ENT_GOOGLEANALYTICS_CODE);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ENT_GOOGLEANALYTICS_CODE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_GOOGLEANALYTICS_CODE, res);
+ return res;
+ }
+
+ public String getENTOrgRootName(long companyId) {
+ if (propertiesMap.containsKey(ENT_ORGROOT_NAME)) {
+ return propertiesMap.get(ENT_ORGROOT_NAME);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ENT_ORGROOT_NAME);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_ORGROOT_NAME, res);
+ return res;
+ }
+
+ public String getENTOrgRootSuffixeMail(long companyId) {
+ if (propertiesMap.containsKey(ENT_ORGROOT_MAIL)) {
+ return propertiesMap.get(ENT_ORGROOT_MAIL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ENT_ORGROOT_MAIL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_ORGROOT_MAIL, res);
+ return res;
+ }
+
+ public String getENTOrgRootPortalMembersName(long companyId) {
+ if (propertiesMap.containsKey(ENT_ORGROOT_PORTALMEMBERSNAME)) {
+ return propertiesMap.get(ENT_ORGROOT_PORTALMEMBERSNAME);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ENT_ORGROOT_PORTALMEMBERSNAME);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_ORGROOT_PORTALMEMBERSNAME, res);
+ return res;
+ }
+
+ public String getENTOrgRootDepartment(long companyId) {
+ if (propertiesMap.containsKey(ENT_ORGROOT_DEPARTMENT)) {
+ return propertiesMap.get(ENT_ORGROOT_DEPARTMENT);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ENT_ORGROOT_DEPARTMENT);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_ORGROOT_DEPARTMENT, res);
+ return res;
+ }
+
+ public String getENTChart(long companyId) {
+ if (propertiesMap.containsKey(ENT_CHART)) {
+ return propertiesMap.get(ENT_CHART);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ENT_CHART);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_CHART, res);
+ return res;
+ }
+
+ public String getENTSynchroDefaultRole(long companyId) {
+ if (propertiesMap.containsKey(ENT_LDAP_SYNCHRO_ROLE_DEFAULT)) {
+ return propertiesMap.get(ENT_LDAP_SYNCHRO_ROLE_DEFAULT);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ENT_LDAP_SYNCHRO_ROLE_DEFAULT);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_LDAP_SYNCHRO_ROLE_DEFAULT, res);
+ return res;
+ }
+
+ public String getENTSynchroEtabName(long companyId) {
+ if (propertiesMap.containsKey(ENT_LDAP_SYNCHRO_ETAB_NAME)) {
+ return propertiesMap.get(ENT_LDAP_SYNCHRO_ETAB_NAME);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ENT_LDAP_SYNCHRO_ETAB_NAME);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_LDAP_SYNCHRO_ETAB_NAME, res);
+ return res;
+ }
+
+ /*
+ * Method to know if we force the list inst creation during synchro
+ * @param companyId the company id of the context
+ * @return the value of "ent.ldap.synchro.force.listinst" value in portal ext
+ */
+ public boolean isENTSynchroForceListeInst(long companyId) {
+ if (propertiesMap.containsKey(ENT_LDAP_SYNCHRO_FORCE_LIST_INST)) {
+ return propertiesMap.get(ENT_LDAP_SYNCHRO_FORCE_LIST_INST).equals("true");
+ }
+ boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, ENT_LDAP_SYNCHRO_FORCE_LIST_INST);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_LDAP_SYNCHRO_FORCE_LIST_INST, res ? "true" : "false");
+ return res;
+ }
+
+ public String getMailNoReply(long companyId) {
+ if (propertiesMap.containsKey(MAIL_NOREPLY)) {
+ return propertiesMap.get(MAIL_NOREPLY);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, MAIL_NOREPLY);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(MAIL_NOREPLY, res);
+ return res;
+ }
+
+ public String getMailRedirectSubject(long companyId) {
+ if (propertiesMap.containsKey(MAIL_REPLY_SUBJECT)) {
+ return propertiesMap.get(MAIL_REPLY_SUBJECT);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, MAIL_REPLY_SUBJECT);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(MAIL_REPLY_SUBJECT, res);
+ return res;
+ }
+
+ public String getMailRedirectBody(long companyId) {
+ if (propertiesMap.containsKey(MAIL_REPLY_BODY)) {
+ return propertiesMap.get(MAIL_REPLY_BODY);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, MAIL_REPLY_BODY);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(MAIL_REPLY_BODY, res);
+ return res;
+ }
+
+ public String getFileErrorSwf(long companyId) {
+ if (propertiesMap.containsKey(FILE_ERROR_SWF)) {
+ return propertiesMap.get(FILE_ERROR_SWF);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, FILE_ERROR_SWF);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(FILE_ERROR_SWF, res);
+ return res;
+ }
+
+ public String getFileErrorFlv(long companyId) {
+ if (propertiesMap.containsKey(FILE_ERROR_FLV)) {
+ return propertiesMap.get(FILE_ERROR_FLV);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, FILE_ERROR_FLV);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(FILE_ERROR_FLV, res);
+ return res;
+ }
+
+ public String getFlashFileStateProgress(long companyId) {
+ if (propertiesMap.containsKey(FLASH_FILE_STATE_PROGRESS)) {
+ return propertiesMap.get(FLASH_FILE_STATE_PROGRESS);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, FLASH_FILE_STATE_PROGRESS);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(FLASH_FILE_STATE_PROGRESS, res);
+ return res;
+ }
+
+ public String getFlashFileStateError(long companyId) {
+ if (propertiesMap.containsKey(FLASH_FILE_STATE_ERROR)) {
+ return propertiesMap.get(FLASH_FILE_STATE_ERROR);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, FLASH_FILE_STATE_ERROR);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(FLASH_FILE_STATE_ERROR, res);
+ return res;
+ }
+
+ public String getFlashFileStateConvert(long companyId) {
+ if (propertiesMap.containsKey(FLASH_FILE_STATE_CONVERT)) {
+ return propertiesMap.get(FLASH_FILE_STATE_CONVERT);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, FLASH_FILE_STATE_CONVERT);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(FLASH_FILE_STATE_CONVERT, res);
+ return res;
+ }
+
+
+ public boolean isForceSubscribeAgenda(long companyId) {
+ if (propertiesMap.containsKey(ENT_AGENDA_ENABLE_FORCESUBSCRIBE)) {
+ return propertiesMap.get(ENT_AGENDA_ENABLE_FORCESUBSCRIBE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, ENT_AGENDA_ENABLE_FORCESUBSCRIBE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_AGENDA_ENABLE_FORCESUBSCRIBE, res ? "true" : "false");
+ return res;
+ }
+
+ public boolean isEnableMobileNtification(long companyId) {
+ if (propertiesMap.containsKey(ENT_MOBILE_NOTIFICATION_ENABLE)) {
+ return propertiesMap.get(ENT_MOBILE_NOTIFICATION_ENABLE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, ENT_MOBILE_NOTIFICATION_ENABLE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_MOBILE_NOTIFICATION_ENABLE, res ? "true" : "false");
+ return res;
+ }
+
+ public boolean isEnableServicesNotifications(long companyId) {
+ if (propertiesMap.containsKey(ENT_NOTIFICATIONS_ENABLE)) {
+ return propertiesMap.get(ENT_NOTIFICATIONS_ENABLE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, ENT_NOTIFICATIONS_ENABLE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_NOTIFICATIONS_ENABLE, res ? "true" : "false");
+ return res;
+ }
+
+ public boolean isEnableMailForward(long companyId) {
+ if (propertiesMap.containsKey(ENT_MAILFORWARD_ENABLE)) {
+ return propertiesMap.get(ENT_MAILFORWARD_ENABLE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, ENT_MAILFORWARD_ENABLE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_MAILFORWARD_ENABLE, res ? "true" : "false");
+ return res;
+ }
+
+ public boolean getPiwikEnable(long companyId) {
+ if (propertiesMap.containsKey(PIWIK_ENABLE)) {
+ return propertiesMap.get(PIWIK_ENABLE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, PIWIK_ENABLE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PIWIK_ENABLE, res ? "true" : "false");
+ return res;
+ }
+
+ public String getPiwikUrl(long companyId) {
+ if (propertiesMap.containsKey(PIWIK_URL)) {
+ return propertiesMap.get(PIWIK_URL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PIWIK_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PIWIK_URL, res);
+ return res;
+ }
+
+ public String getPiwikApiUrl(long companyId) {
+ if (propertiesMap.containsKey(PIWIK_API_URL)) {
+ return propertiesMap.get(PIWIK_API_URL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PIWIK_API_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PIWIK_API_URL, res);
+ return res;
+ }
+
+ public String getPiwikSiteId(long companyId) {
+ if (propertiesMap.containsKey(PIWIK_SITE_ID)) {
+ return propertiesMap.get(PIWIK_SITE_ID);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PIWIK_SITE_ID);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PIWIK_SITE_ID, res);
+ return res;
+ }
+
+ public String getPiwikTokenAuth(long companyId) {
+ if (propertiesMap.containsKey(PIWIK_TOKEN_AUTH)) {
+ return propertiesMap.get(PIWIK_TOKEN_AUTH);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PIWIK_TOKEN_AUTH);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PIWIK_TOKEN_AUTH, res);
+ return res;
+ }
+
+ public boolean getXitiEnable(long companyId) {
+ if (propertiesMap.containsKey(XITI_ENABLE)) {
+ return propertiesMap.get(XITI_ENABLE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, XITI_ENABLE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(XITI_ENABLE, res ? "true" : "false");
+ return res;
+ }
+
+ public int getXitiIdProjet(long companyId) {
+ if (propertiesMap.containsKey(XITI_ID_PROJET)) {
+ try {
+ return Integer.parseInt(propertiesMap.get(XITI_ID_PROJET));
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ Integer res = new Integer(-1);
+ try {
+ res = PrefsPropsUtil.getInteger(companyId, XITI_ID_PROJET);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(XITI_ID_PROJET, ""+res);
+ return res;
+ }
+
+ public int getXitiIdPlateforme(long companyId) {
+ if (propertiesMap.containsKey(XITI_ID_PLATEFORME)) {
+ try {
+ return Integer.parseInt(propertiesMap.get(XITI_ID_PLATEFORME));
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ Integer res = new Integer(-1);
+ try {
+ res = PrefsPropsUtil.getInteger(companyId, XITI_ID_PLATEFORME);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(XITI_ID_PLATEFORME, ""+res);
+ return res;
+ }
+
+ public int getXitiIdCollectivite(long companyId) {
+ if (propertiesMap.containsKey(XITI_ID_COLLECTIVITE)) {
+ try {
+ return Integer.parseInt(propertiesMap.get(XITI_ID_COLLECTIVITE));
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ Integer res = new Integer(-1);
+ try {
+ res = PrefsPropsUtil.getInteger(companyId, XITI_ID_COLLECTIVITE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(XITI_ID_COLLECTIVITE, ""+res);
+ return res;
+ }
+
+ public int getXitiEtabId(long companyId, long etabId) throws JSONException {
+ if (propertiesMap.containsKey(XITI_LIST_ETAB_ID)) {
+ try {
+ return Integer.parseInt(propertiesMap.get(XITI_LIST_ETAB_ID));
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ Integer res = new Integer(2);
+ try {
+ String listXitiEtabIdString = PrefsPropsUtil.getString(companyId, XITI_LIST_ETAB_ID);
+ JSONObject listXitiEtabId = JSONFactoryUtil.createJSONObject(listXitiEtabIdString);
+ int xitiEtabId = listXitiEtabId.getInt(String.valueOf(etabId));
+ if(xitiEtabId != 0){
+ res = xitiEtabId;
+ }
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(XITI_LIST_ETAB_ID, ""+res);
+ return res;
+ }
+
+ public String getPublicBlogUrl(long companyId) {
+ if (propertiesMap.containsKey(PUBLIC_BLOG_URL)) {
+ return propertiesMap.get(PUBLIC_BLOG_URL);
+ }
+ String res = "";
+ try {
+ res = PortalUtil.getPortalProperties().getProperty("absolute.url") + PrefsPropsUtil.getString(companyId, PUBLIC_BLOG_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PUBLIC_BLOG_URL, res);
+ return res;
+ }
+
+ public String getPublicFrontBlogUrl(long companyId) {
+ if (propertiesMap.containsKey(PUBLIC_FRONT_BLOG_URL)) {
+ return propertiesMap.get(PUBLIC_FRONT_BLOG_URL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, PUBLIC_FRONT_BLOG_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PUBLIC_FRONT_BLOG_URL, res);
+ return res;
+ }
+
+ public String getWordpressUsername(long companyId) {
+ if (propertiesMap.containsKey(WORDPRESS_USERNAME)) {
+ return propertiesMap.get(WORDPRESS_USERNAME);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, WORDPRESS_USERNAME);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(WORDPRESS_USERNAME, res);
+ return res;
+ }
+
+ public String getWordpressPassword(long companyId) {
+ if (propertiesMap.containsKey(WORDPRESS_PASSWORD)) {
+ return propertiesMap.get(WORDPRESS_PASSWORD);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, WORDPRESS_PASSWORD);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(WORDPRESS_PASSWORD, res);
+ return res;
+ }
+
+ public String getWordpressUrl(long companyId) {
+ if (propertiesMap.containsKey(WORDPRESS_URL)) {
+ return propertiesMap.get(WORDPRESS_URL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, WORDPRESS_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(WORDPRESS_URL, res);
+ return res;
+ }
+
+ public String getWordpressAdminSuffixUrl(long companyId) {
+ if (propertiesMap.containsKey(WORDPRESS_ADMIN_SUFFIX_URL)) {
+ return propertiesMap.get(WORDPRESS_ADMIN_SUFFIX_URL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, WORDPRESS_ADMIN_SUFFIX_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(WORDPRESS_ADMIN_SUFFIX_URL, res);
+ return res;
+ }
+
+ public String getWordpressSuffixUrl(long companyId) {
+ if (propertiesMap.containsKey(WORDPRESS_SUFFIX_URL)) {
+ return propertiesMap.get(WORDPRESS_SUFFIX_URL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, WORDPRESS_SUFFIX_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(WORDPRESS_SUFFIX_URL, res);
+ return res;
+ }
+
+ public boolean isShibbolethAuthEnable(long companyId) {
+ if (propertiesMap.containsKey(SHIBBOLETH_AUTH_ENABLED)) {
+ return propertiesMap.get(SHIBBOLETH_AUTH_ENABLED).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, SHIBBOLETH_AUTH_ENABLED);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(SHIBBOLETH_AUTH_ENABLED, res ? "true" : "false");
+ return res;
+ }
+
+ public String getShibbolethLogoutUrl(long companyId) {
+ if (propertiesMap.containsKey(SHIBBOLETH_LOGOUT_URL)) {
+ return propertiesMap.get(SHIBBOLETH_LOGOUT_URL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, SHIBBOLETH_LOGOUT_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(SHIBBOLETH_LOGOUT_URL, res);
+ return res;
+ }
+
+ public String getMailAcademicSuffix(long companyId) {
+ if (propertiesMap.containsKey(ENT_MAIL_ACADEMIC_SUFFIX)) {
+ return propertiesMap.get(ENT_MAIL_ACADEMIC_SUFFIX);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(companyId, ENT_MAIL_ACADEMIC_SUFFIX);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_MAIL_ACADEMIC_SUFFIX, res);
+ return res;
+ }
+
+ public boolean isWebDAVEnable(long companyId) {
+ if (propertiesMap.containsKey(WEBDAV_ENABLE)) {
+ return propertiesMap.get(WEBDAV_ENABLE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, WEBDAV_ENABLE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(WEBDAV_ENABLE, res ? "true" : "false");
+ return res;
+ }
+
+ public String getViewAjaxJSPKey() {
+ if (propertiesMap.containsKey(VIEW_AJAX_JSP_KEY)) {
+ return propertiesMap.get(VIEW_AJAX_JSP_KEY);
+ }
+ String res = "view-ajax-jsp";
+ try {
+ res = PrefsPropsUtil.getString(VIEW_AJAX_JSP_KEY);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(VIEW_AJAX_JSP_KEY, res);
+ return res;
+ }
+
+ public int getDefaultPortletHeight() {
+ if (propertiesMap.containsKey(DEFAULT_PORLET_HEIGHT)) {
+ try {
+ return Integer.parseInt(propertiesMap.get(DEFAULT_PORLET_HEIGHT));
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ Integer res = new Integer(800);
+ try {
+ res = PrefsPropsUtil.getInteger(DEFAULT_PORLET_HEIGHT);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(DEFAULT_PORLET_HEIGHT, res+"");
+ return res;
+ }
+
+ public List<String> getSpecialPortletsTheme(long companyId) {
+ List<String> portlets = new ArrayList<String>();
+ String res = "";
+ if (propertiesMap.containsKey(SPECIAL_PORTLETS_THEME)) {
+ res = propertiesMap.get(SPECIAL_PORTLETS_THEME);
+ } else {
+ try {
+ res = PrefsPropsUtil.getString(companyId, SPECIAL_PORTLETS_THEME);
+ propertiesMap.put(SPECIAL_PORTLETS_THEME, res);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ }
+ String[] portletsArray = res.split(",");
+ for(int i=0; i<portletsArray.length; i++){
+ portlets.add(portletsArray[i]);
+ }
+ return portlets;
+ }
+
+ public boolean getEntFullScreenAllowed() {
+ if (propertiesMap.containsKey(ENT_FULLSCREEN_ALLOWED)) {
+ return propertiesMap.get(ENT_FULLSCREEN_ALLOWED).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(ENT_FULLSCREEN_ALLOWED);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_FULLSCREEN_ALLOWED, res ? "true" : "false");
+ return res;
+ }
+
+ public String getEntFullScreenMaximizeKey() {
+ if (propertiesMap.containsKey(ENT_FULLSCREEN_MAXIMIZE_KEY)) {
+ return propertiesMap.get(ENT_FULLSCREEN_MAXIMIZE_KEY);
+ }
+ String res = "32";
+ try {
+ res = PrefsPropsUtil.getString(ENT_FULLSCREEN_MAXIMIZE_KEY);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_FULLSCREEN_MAXIMIZE_KEY, res);
+ return res;
+ }
+
+ public String[] getEntListRolesEnabled() {
+ if (propertiesMap.containsKey(ENT_LIST_ROLES_ENABLED)) {
+ String roles = propertiesMap.get(ENT_LIST_ROLES_ENABLED);
+ if(!roles.isEmpty()){
+ return roles.split(",");
+ }
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(ENT_LIST_ROLES_ENABLED).trim();
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_LIST_ROLES_ENABLED, res);
+ if(!res.isEmpty()){
+ return res.split(",");
+ }
+ return null;
+ }
+
+ public String[] getEntListRolesNationauxEnabled() {
+ if (propertiesMap.containsKey(ENT_LIST_ROLES_NATIONAUX_ENABLED)) {
+ String roles = propertiesMap.get(ENT_LIST_ROLES_NATIONAUX_ENABLED);
+ if(!roles.isEmpty()){
+ return roles.split(",");
+ }
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(ENT_LIST_ROLES_NATIONAUX_ENABLED).trim();
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_LIST_ROLES_NATIONAUX_ENABLED, res);
+ if(!res.isEmpty()){
+ return res.split(",");
+ }
+ return null;
+ }
+
+ public boolean getEntImportUtilisateursEnabled() {
+ if (propertiesMap.containsKey(ENT_IMPORT_UTILISATEURS_ENABLED)) {
+ return propertiesMap.get(ENT_IMPORT_UTILISATEURS_ENABLED).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(ENT_IMPORT_UTILISATEURS_ENABLED);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_IMPORT_UTILISATEURS_ENABLED, res ? "true" : "false");
+ return res;
+ }
+
+ public String getEntImportUtilisateursPath() {
+ if (propertiesMap.containsKey(ENT_IMPORT_UTILISATEURS_PATH)) {
+ return propertiesMap.get(ENT_IMPORT_UTILISATEURS_PATH);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(ENT_IMPORT_UTILISATEURS_PATH);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_IMPORT_UTILISATEURS_PATH, res);
+ return res;
+ }
+
+ public String getEntKeyLanguageSuffix() {
+ if (propertiesMap.containsKey(ENT_KEY_LANGUAGE_SUFFIX)) {
+ return propertiesMap.get(ENT_KEY_LANGUAGE_SUFFIX);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(ENT_KEY_LANGUAGE_SUFFIX);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_KEY_LANGUAGE_SUFFIX, res);
+ return res;
+ }
+
+ public boolean getEntSocialActivityEnabled() {
+ if (propertiesMap.containsKey(ENT_SOCIAL_ACTIVITY_ENABLED)) {
+ return propertiesMap.get(ENT_SOCIAL_ACTIVITY_ENABLED).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(ENT_SOCIAL_ACTIVITY_ENABLED);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_SOCIAL_ACTIVITY_ENABLED, res ? "true" : "false");
+ return res;
+ }
+
+ public String getEntCaptchaPublicKey() {
+ if (propertiesMap.containsKey(ENT_CAPTCHA_PUBLIC_KEY)) {
+ return propertiesMap.get(ENT_CAPTCHA_PUBLIC_KEY);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(ENT_CAPTCHA_PUBLIC_KEY);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_CAPTCHA_PUBLIC_KEY, res);
+ return res;
+ }
+
+ public String getEntCaptchaPrivateKey() {
+ if (propertiesMap.containsKey(ENT_CAPTCHA_PRIVATE_KEY)) {
+ return propertiesMap.get(ENT_CAPTCHA_PRIVATE_KEY);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(ENT_CAPTCHA_PRIVATE_KEY);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_CAPTCHA_PRIVATE_KEY, res);
+ return res;
+ }
+
+ public String getEntPlateformName() {
+ if (propertiesMap.containsKey(ENT_PLATEFORM_NAME)) {
+ return propertiesMap.get(ENT_PLATEFORM_NAME);
+ }
+ String res = "";
+ try {
+ res= PrefsPropsUtil.getString(ENT_PLATEFORM_NAME);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_PLATEFORM_NAME, res);
+ return res;
+ }
+
+ public String getEntResetPasswordUrl() {
+ if (propertiesMap.containsKey(ENT_RESET_PASSWORD_URL)) {
+ return propertiesMap.get(ENT_RESET_PASSWORD_URL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(ENT_RESET_PASSWORD_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_RESET_PASSWORD_URL, res);
+ return res;
+ }
+
+ // methodes pour pouvoir lancer les synchro depuis l'interface
+ public void startLDAPSynchro(long companyId, boolean force) {
+ try {
+ SynchronizationManager.runSynchronization(force);
+ } catch (Exception e) {
+ logger.error("Error in runSynchronization", e);
+ }
+
+ }
+
+ /*
+ * Map entre les objets du model et les portlets ou ils sont principalement utilises
+ */
+ private static final Map<String, String> MAP_MODEL_PORTLET;
+ static {
+ Map<String, String> aMap = new HashMap<String, String>();
+ aMap.put(BlogsEntry.class.getName(), "actualites_WAR_actualitesportlet");
+ aMap.put(DLFileEntry.class.getName(), "cartable_WAR_cartableportlet");
+ aMap.put(FileEntry.class.getName(), "cartable_WAR_cartableportlet");
+ aMap.put(DLFolder.class.getName(), "cartable_WAR_cartableportlet");
+ aMap.put(Folder.class.getName(), "cartable_WAR_cartableportlet");
+ aMap.put(EventCDT.class.getName(), "cahierDeTexte_WAR_cahierDeTexteportlet");
+ aMap.put(EventAgenda.class.getName(), "agenda_WAR_agendaportlet");
+ aMap.put(MBMessage.class.getName(), "forum_WAR_forumportlet");
+ aMap.put(MBCategory.class.getName(), "forum_WAR_forumportlet");
+ aMap.put(Message.class.getName(), "internalMessaging_WAR_internalMessagingportlet");
+ aMap.put(InternalMessage.class.getName(), "internalMessaging_WAR_internalMessagingportlet");
+ aMap.put(RssItem.class.getName(), "internalMessaging_WAR_internalMessagingportlet");
+ aMap.put(Group.class.getName(), "accesAteliers_WAR_accesAteliersportlet");
+ aMap.put(Hits.class.getName(), "moteurDeRecherche_WAR_moteurDeRechercheportlet");
+ MAP_MODEL_PORTLET = Collections.unmodifiableMap(aMap);
+ }
+
+ public String getPortletId(String className){
+ if(MAP_MODEL_PORTLET.containsKey(className)){
+ return MAP_MODEL_PORTLET.get(className);
+ }
+ return "";
+ }
+
+ public String addUrlAjaxParameters(String url, String className, boolean displayInGroup){
+ Portlet portlet;
+ if(displayInGroup){
+ portlet = PortletLocalServiceUtil.getPortletById("menuPageGroupe_WAR_menuPageGroupeportlet");
+ url = HttpUtil.removeParameter(url, "p_p_id");
+ url = HttpUtil.removeParameter(url, "p_p_lifecycle");
+ url = HttpUtil.removeParameter(url, "p_p_state");
+ url = HttpUtil.removeParameter(url, "p_p_mode");
+ url = HttpUtil.removeParameter(url, "p_p_col_id");
+ url = HttpUtil.removeParameter(url, "p_p_col_count");
+ } else {
+ portlet = PortletLocalServiceUtil.getPortletById(getPortletId(className));
+ }
+ Map<String, String> map = portlet.getInitParams();
+ String viewAjaxJSPKey = ENTMainUtilsLocalServiceUtil.getViewAjaxJSPKey();
+ url = HttpUtil.addParameter(url, "p_p_id", portlet.getPortletId());
+ url = HttpUtil.addParameter(url, "p_p_lifecycle", 0);
+ url = HttpUtil.addParameter(url, "p_p_state", "exclusive");
+ url = HttpUtil.addParameter(url, "p_p_mode", "view");
+ url = HttpUtil.addParameter(url, "p_p_col_id", "column-1");
+ url = HttpUtil.addParameter(url, "p_p_col_count", 1);
+ url = HttpUtil.addParameter(url, "jspPage", map.get(viewAjaxJSPKey));
+ if(displayInGroup){
+ url = HttpUtil.addParameter(url, "p_p_id_display", getPortletId(className));
+ }
+ return url;
+ }
+
+ public String[] getEntCategories(){
+ if (propertiesMap.containsKey(ENT_MENU_CATEGORIES)) {
+ String categories = propertiesMap.get(ENT_MENU_CATEGORIES);
+ if(!categories.isEmpty()){
+ return categories.split(",");
+ }
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(ENT_MENU_CATEGORIES, "").trim();
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_MENU_CATEGORIES, res);
+ if(!res.isEmpty()){
+ return res.split(",");
+ }
+ String[] defaultCategories = {"Menu"};
+ return defaultCategories;
+ }
+
+ public String getEntLinkEtabCategory(){
+ if (propertiesMap.containsKey(ENT_MENU_LINK_ETAB_CATEGORY)) {
+ return propertiesMap.get(ENT_MENU_LINK_ETAB_CATEGORY);
+ }
+ String res = "Liens";
+ try {
+ res = PrefsPropsUtil.getString(ENT_MENU_LINK_ETAB_CATEGORY, "Liens").trim();
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_MENU_LINK_ETAB_CATEGORY, res);
+ return res;
+ }
+
+ public String[] getMimeTypes() {
+ if (propertiesMap.containsKey(MIME_TYPES)) {
+ String mimeTypes = propertiesMap.get(MIME_TYPES);
+ if (!mimeTypes.isEmpty()) {
+ return mimeTypes.split(",");
+ }
+ }
+ String res = "";
+ String[] mimeTypes = PropsUtil.getArray(MIME_TYPES);
+ if (mimeTypes != null) {
+ for (int i = 0 ; i < mimeTypes.length ; i++) {
+ String mimeType = mimeTypes[i];
+ res += mimeType;
+ if (i != mimeTypes.length - 1) {
+ res += ",";
+ }
+ }
+ }
+ propertiesMap.put(MIME_TYPES, res);
+ return mimeTypes;
+ }
+
+ public long getEntPopulationManagerId(){
+ if (propertiesMap.containsKey(ENT_POPULATION_MANAGER_ID)) {
+ try {
+ return Integer.parseInt(propertiesMap.get(ENT_POPULATION_MANAGER_ID));
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ Long res = new Long(1007835);
+ try {
+ res = PrefsPropsUtil.getLong(ENT_POPULATION_MANAGER_ID, 1007835);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_POPULATION_MANAGER_ID, res+"");
+ return res;
+ }
+
+ public boolean isReferentNumerique(User user){
+ try {
+ List<AMSingleUsers> singleUsers = AMSingleUsersLocalServiceUtil.getUsersByPopulationId(getEntPopulationManagerId());
+
+ for (AMSingleUsers su : singleUsers) {
+ if(su.getUserId() == user.getUserId()){
+ return true;
+ }
+ }
+ } catch(Exception e){
+ // La population definie dans les properties n'existe pas
+ }
+
+ return false;
+ }
+
+ public Long[] getEntIncidentsUsersNotification() {
+ String users = "";
+ if (propertiesMap.containsKey(ENT_INCIDENTS_USERS_NOTIFICATION)) {
+ users = propertiesMap.get(ENT_INCIDENTS_USERS_NOTIFICATION);
+ }
+ else {
+ try {
+ users = PrefsPropsUtil.getString(ENT_INCIDENTS_USERS_NOTIFICATION).trim();
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ }
+ if(!users.isEmpty()){
+ String[] arr = users.split(",");
+ Long[] array = new Long[arr.length];
+ for(int i=0; i<arr.length; i++){
+ array[i] = Long.valueOf(arr[i]);
+ }
+ propertiesMap.put(ENT_POPULATION_MANAGER_ID, users);
+ return array;
+ }
+ return null;
+ }
+
+ public String getJdbcEntlogUrl() {
+ if (propertiesMap.containsKey(JDBC_ENTLOG_URL)) {
+ return propertiesMap.get(JDBC_ENTLOG_URL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(JDBC_ENTLOG_URL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(JDBC_ENTLOG_URL, res);
+ return res;
+ }
+
+ public String getJdbcEntlogUser() {
+ if (propertiesMap.containsKey(JDBC_DEFAULT_USER)) {
+ return propertiesMap.get(JDBC_DEFAULT_USER);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(JDBC_DEFAULT_USER);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(JDBC_DEFAULT_USER, res);
+ return res;
+ }
+
+ public String getJdbcEntlogPasswd() {
+ if (propertiesMap.containsKey(JDBC_DEFAULT_PASSWD)) {
+ return propertiesMap.get(JDBC_DEFAULT_PASSWD);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(JDBC_DEFAULT_PASSWD);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(JDBC_DEFAULT_PASSWD, res);
+ return res;
+ }
+
+ /**
+ * Purges all expired users in LDAP (ENTValidAccount = 2)
+ * @return the list of purged userIds
+ */
+ public List<Long> purgeExpiredUsers(long companyId) {
+ try {
+ return UserPurgeImpl.purgeExpiredUsers(companyId);
+ } catch (Exception e) {
+ logger.error(e);
+ return null;
+ }
+ }
+
+ /**
+ * Purges a user in LDAP, given by its screenName
+ * @return true if purge has succeeded
+ */
+ public boolean purgeUserInLDAP(long companyId, String screenName) {
+ try {
+ return UserPurgeImpl.purgeUserInLDAP(companyId, screenName);
+ } catch (Exception e) {
+ logger.error(e);
+ return false;
+ }
+ }
+
+ /**
+ * Purges a user in DB, given by its userId
+ * @return true if purge has succeeded
+ */
+ public boolean purgeUserInDB(long userId) {
+ try {
+ return UserPurgeImpl.purgeUserInDB(userId);
+ } catch (Exception e) {
+ logger.error(e);
+ return false;
+ }
+ }
+
+
+ public String getDlHookFileSystemRootDir() {
+ if (propertiesMap.containsKey(DL_HOOK_FILE_SYSTEM_ROOT_DIR)) {
+ return propertiesMap.get(DL_HOOK_FILE_SYSTEM_ROOT_DIR);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(DL_HOOK_FILE_SYSTEM_ROOT_DIR);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(DL_HOOK_FILE_SYSTEM_ROOT_DIR, res);
+ return res;
+ }
+
+
+ public String getUserPurgeOutputFile() {
+ if (propertiesMap.containsKey(USER_PURGE_OUTPUT_FILE)) {
+ return propertiesMap.get(USER_PURGE_OUTPUT_FILE);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(USER_PURGE_OUTPUT_FILE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(USER_PURGE_OUTPUT_FILE, res);
+ return res;
+ }
+
+ public Boolean isDlStoreCO3(long companyId) {
+ if (propertiesMap.containsKey(DL_STORE_ISCO3)) {
+ return propertiesMap.get(DL_STORE_ISCO3).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, DL_STORE_ISCO3);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(DL_STORE_ISCO3, res ? "true" : "false");
+ return res;
+ }
+
+ public Boolean sendSupportToLocalAdmins(long companyId) {
+ if (propertiesMap.containsKey(SUPPORT_LOCAL_ADMINS_ENABLE)) {
+ return propertiesMap.get(SUPPORT_LOCAL_ADMINS_ENABLE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, SUPPORT_LOCAL_ADMINS_ENABLE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(SUPPORT_LOCAL_ADMINS_ENABLE, res ? "true" : "false");
+ return res;
+ }
+
+ public Boolean allowUsurpationForSupportAdmin(long companyId) {
+ if (propertiesMap.containsKey(SUPPORT_ADMIN_USURPATION_ENABLE)) {
+ return propertiesMap.get(SUPPORT_ADMIN_USURPATION_ENABLE).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, SUPPORT_ADMIN_USURPATION_ENABLE);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(SUPPORT_ADMIN_USURPATION_ENABLE, res ? "true" : "false");
+ return res;
+ }
+
+ public String getPlatform() {
+ if (propertiesMap.containsKey(PLATFORM)) {
+ return propertiesMap.get(PLATFORM);
+ }
+ String res = PLATFORM_CO3_PROD;
+ try {
+ res = PrefsPropsUtil.getString(PLATFORM);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ if (!res.equals(PLATFORM_HN_PROD) && !res.equals(PLATFORM_HN_PREPROD)
+ && !res.equals(PLATFORM_CO3_PROD) && !res.equals(PLATFORM_CO3_PREPROD)
+ && !res.equals(PLATFORM_CAIRNS_PROD) && !res.equals(PLATFORM_CAIRNS_PREPROD)) {
+ logger.error("The platform name should be either '"+PLATFORM_HN_PROD+"' or '"+PLATFORM_HN_PREPROD+"' or '"+PLATFORM_CO3_PROD+"' or '"+ PLATFORM_CO3_PREPROD+"' or '"+PLATFORM_CAIRNS_PROD+"' or '"+PLATFORM_CAIRNS_PREPROD+"'.");
+ return "";
+ }
+
+ propertiesMap.put(PLATFORM, res);
+ return res;
+ }
+
+ public String getSupportMail() {
+ if (propertiesMap.containsKey(SUPPORT_MAIL)) {
+ return propertiesMap.get(SUPPORT_MAIL);
+ }
+ String res = "assistance@pentila.com";
+ try {
+ res = PrefsPropsUtil.getString(SUPPORT_MAIL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(SUPPORT_MAIL, res);
+ return res;
+ }
+
+ public String getEdtPrivateKeyPath() {
+ if (propertiesMap.containsKey(EDT_PRIVATE_KEY_PATH)) {
+ return propertiesMap.get(EDT_PRIVATE_KEY_PATH);
+ }
+ String res = "/home/pentila/ssl/privkey.pem";
+ try {
+ res = PrefsPropsUtil.getString(EDT_PRIVATE_KEY_PATH);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(EDT_PRIVATE_KEY_PATH, res);
+ return res;
+ }
+
+ public long getENTVieScolaireUserId() {
+ if (propertiesMap.containsKey(ENT_VIE_SCOLAIRE_USER_ID)) {
+ return Long.parseLong(propertiesMap.get(ENT_VIE_SCOLAIRE_USER_ID));
+ }
+
+ long userId = 0;
+ try {
+ userId = PrefsPropsUtil.getLong(ENT_VIE_SCOLAIRE_USER_ID);
+ } catch (SystemException e) {
+ logger.error(e);
+ userId = 0;
+ }
+ propertiesMap.put(ENT_VIE_SCOLAIRE_USER_ID, String.valueOf(userId));
+ return userId;
+ }
+
+ public User synchronizeUser(long companyId, Attributes attributes) {
+ User user = null;
+ try {
+ user = SynchronizationManager.synchronizeUser(companyId, attributes, StringPool.BLANK, true);
+ } catch (Exception e) {
+ logger.error("Unable to run user synchronization", e);
+ }
+ return user;
+ }
+
+ public boolean manageUserMembership(long companyId, Attributes attributes) {
+
+ return MembershipManager.manageUserMembership(companyId, attributes);
+
+ }
+
+ public boolean isForceParentMembership(long companyId) {
+ if (propertiesMap.containsKey(SYNCHRO_FORCE_PARENT_MEMBERSHIP)) {
+ return propertiesMap.get(SYNCHRO_FORCE_PARENT_MEMBERSHIP).equals("true");
+ }
+ Boolean res = false;
+ try {
+ res = PrefsPropsUtil.getBoolean(companyId, SYNCHRO_FORCE_PARENT_MEMBERSHIP);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(SYNCHRO_FORCE_PARENT_MEMBERSHIP, res ? "true" : "false");
+ return res;
+ }
+
+ public String getEdtImportFilesDirectory() {
+ if (propertiesMap.containsKey(EDT_IMPORTFILES_DIRECTORY)) {
+ return propertiesMap.get(EDT_IMPORTFILES_DIRECTORY);
+ }
+ String res = "/home/pentila/edt_import";
+ try {
+ res = PrefsPropsUtil.getString(EDT_IMPORTFILES_DIRECTORY);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(EDT_IMPORTFILES_DIRECTORY, res);
+ return res;
+ }
+
+ public String getOauthClientId() {
+ if (propertiesMap.containsKey(OAUTH_CLIENT_ID)) {
+ return propertiesMap.get(OAUTH_CLIENT_ID);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(OAUTH_CLIENT_ID);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(OAUTH_CLIENT_ID, res);
+ return res;
+ }
+
+ public String getOauthSecretId() {
+ if (propertiesMap.containsKey(OAUTH_SECRET_ID)) {
+ return propertiesMap.get(OAUTH_SECRET_ID);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(OAUTH_SECRET_ID);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(OAUTH_SECRET_ID, res);
+ return res;
+ }
+
+ public String getServiceGuidePath(String serviceName) {
+ String propertyKey = SERVICE_GUIDE_PATH + serviceName;
+ if (propertiesMap.containsKey(propertyKey)) {
+ return propertiesMap.get(propertyKey);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(propertyKey);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(propertyKey, res);
+ return res;
+ }
+
+ public int getMessagingStudentMaxReceivers(){
+ if (propertiesMap.containsKey(MESSAGING_STUDENT_MAX_RECEIVERS)) {
+ try {
+ return Integer.parseInt(propertiesMap.get(MESSAGING_STUDENT_MAX_RECEIVERS));
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ int res = 3000;
+ try {
+ res = PrefsPropsUtil.getInteger(MESSAGING_STUDENT_MAX_RECEIVERS);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(MESSAGING_STUDENT_MAX_RECEIVERS, res+"");
+ return res;
+ }
+
+ public int getMessagingParentMaxReceivers(){
+ if (propertiesMap.containsKey(MESSAGING_PARENT_MAX_RECEIVERS)) {
+ try {
+ return Integer.parseInt(propertiesMap.get(MESSAGING_PARENT_MAX_RECEIVERS));
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ int res = 5000;
+ try {
+ res = PrefsPropsUtil.getInteger(MESSAGING_PARENT_MAX_RECEIVERS);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(MESSAGING_PARENT_MAX_RECEIVERS, res+"");
+ return res;
+ }
+
+ public int getMessagingPersonalMaxReceivers(){
+ if (propertiesMap.containsKey(MESSAGING_PERSONAL_MAX_RECEIVERS)) {
+ try {
+ return Integer.parseInt(propertiesMap.get(MESSAGING_PERSONAL_MAX_RECEIVERS));
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ int res = 5000;
+ try {
+ res = PrefsPropsUtil.getInteger(MESSAGING_PERSONAL_MAX_RECEIVERS);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(MESSAGING_PERSONAL_MAX_RECEIVERS, res+"");
+ return res;
+ }
+
+ public String getPronoteStudentLinkList() {
+ if (propertiesMap.containsKey(PRONOTE_STUDENT_LINK_LIST)) {
+ return propertiesMap.get(PRONOTE_STUDENT_LINK_LIST);
+ }
+ String res = "Travail à faire,Dernieres notes,Dernières évaluations";
+ try {
+ res = PrefsPropsUtil.getString(PRONOTE_STUDENT_LINK_LIST);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PRONOTE_STUDENT_LINK_LIST, res);
+ return res;
+ }
+
+ public String getPronoteParentLinkList() {
+ if (propertiesMap.containsKey(PRONOTE_PARENT_LINK_LIST)) {
+ return propertiesMap.get(PRONOTE_PARENT_LINK_LIST);
+ }
+ String res = "Travail à faire,Dernieres notes,Dernières évaluations";
+ try {
+ res = PrefsPropsUtil.getString(PRONOTE_PARENT_LINK_LIST);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PRONOTE_PARENT_LINK_LIST, res);
+ return res;
+ }
+
+ public String getPronoteTeacherLinkList() {
+ if (propertiesMap.containsKey(PRONOTE_TEACHER_LINK_LIST)) {
+ return propertiesMap.get(PRONOTE_TEACHER_LINK_LIST);
+ }
+ String res = "Appel et suivi,Saisie des notes,Saisie du cahier de textes";
+ try {
+ res = PrefsPropsUtil.getString(PRONOTE_TEACHER_LINK_LIST);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(PRONOTE_TEACHER_LINK_LIST, res);
+ return res;
+ }
+
+
+
+ public String getEdxBaseUrl() {
+ if (propertiesMap.containsKey(EDX_BASEURL)) {
+ return propertiesMap.get(EDX_BASEURL);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(EDX_BASEURL);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(EDX_BASEURL, res);
+ return res;
+ }
+
+ public String getEdxAccessToken() {
+ if (propertiesMap.containsKey(EDX_ACCESS_TOKEN)) {
+ return propertiesMap.get(EDX_ACCESS_TOKEN);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(EDX_ACCESS_TOKEN);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(EDX_ACCESS_TOKEN, res);
+ return res;
+ }
+
+ public String getEntMenuPortletHidden() {
+ if (propertiesMap.containsKey(ENT_MENU_PORTLET_HIDDEN)) {
+ return propertiesMap.get(ENT_MENU_PORTLET_HIDDEN);
+ }
+ String res = "";
+ try {
+ res = PrefsPropsUtil.getString(ENT_MENU_PORTLET_HIDDEN);
+ } catch (SystemException e) {
+ logger.error(e);
+ }
+ propertiesMap.put(ENT_MENU_PORTLET_HIDDEN, res);
+ return res;
+ }
+}