Shunji Makino 9 лет назад
Родитель
Сommit
445fdc68cc

+ 18 - 68
src/main/java/org/codelibs/fess/app/web/admin/general/AdminGeneralAction.java

@@ -117,59 +117,34 @@ public class AdminGeneralAction extends FessAdminAction {
         });
 
         fessConfig.setLoginRequired(Constants.ON.equalsIgnoreCase(form.loginRequired));
-//boolean updateProperty(Constants.INCREMENTAL_CRAWLING_PROPERTY, getCheckboxValue(form.incrementalCrawling));
         fessConfig.setIncrementalCrawling(Constants.ON.equalsIgnoreCase(form.incrementalCrawling));
-//int     updateProperty(Constants.DAY_FOR_CLEANUP_PROPERTY, form.dayForCleanup.toString());
         fessConfig.setDayForCleanup(form.dayForCleanup);
-//        updateProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, form.crawlingThreadCount.toString());
         fessConfig.setCrawlingThreadCount(form.crawlingThreadCount);
-//        updateProperty(Constants.SEARCH_LOG_PROPERTY, getCheckboxValue(form.searchLog));
         fessConfig.setSearchLog(Constants.ON.equalsIgnoreCase(form.searchLog));
-//        updateProperty(Constants.USER_INFO_PROPERTY, getCheckboxValue(form.userInfo));
         fessConfig.setUserInfo(Constants.ON.equalsIgnoreCase(form.userInfo));
-//        updateProperty(Constants.USER_FAVORITE_PROPERTY, getCheckboxValue(form.userFavorite));
         fessConfig.setUserFavorite(Constants.ON.equalsIgnoreCase(form.userFavorite));
-//        updateProperty(Constants.WEB_API_JSON_PROPERTY, getCheckboxValue(form.webApiJson));
         fessConfig.setWebApiJson(Constants.ON.equalsIgnoreCase(form.webApiJson));
         fessConfig.setDefaultLabelValue(form.defaultLabelValue);
         fessConfig.setDefaultSortValue(form.defaultSortValue);
-//        updateProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY, getCheckboxValue(form.appendQueryParameter));
         fessConfig.setAppendQueryParameter(Constants.ON.equalsIgnoreCase(form.appendQueryParameter));
-//String  updateProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, form.ignoreFailureType);
         fessConfig.setIgnoreFailureType(form.ignoreFailureType);
-//        updateProperty(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, form.failureCountThreshold.toString());
         fessConfig.setFailureCountThreshold(form.failureCountThreshold);
         fessConfig.setWebApiPopularWord(Constants.ON.equalsIgnoreCase(form.popularWord));
-//        updateProperty(Constants.CSV_FILE_ENCODING_PROPERTY, form.csvFileEncoding);
         fessConfig.setCsvFileEncoding(form.csvFileEncoding);
-//        updateProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, form.purgeSearchLogDay.toString());
         fessConfig.setPurgeSearchLogDay(form.purgeSearchLogDay);
-//int     updateProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, form.purgeJobLogDay.toString());
         fessConfig.setPurgeJobLogDay(form.purgeJobLogDay);
-//        updateProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, form.purgeUserInfoDay.toString());
         fessConfig.setPurgeUserInfoDay(form.purgeUserInfoDay);
-//String  updateProperty(Constants.PURGE_BY_BOTS_PROPERTY, form.purgeByBots);
         fessConfig.setPurgeByBots(form.purgeByBots);
-//        updateProperty(Constants.NOTIFICATION_TO_PROPERTY, form.notificationTo);
         fessConfig.setNotificationTo(form.notificationTo);
-////s       updateProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY, getCheckboxValue(form.suggestSearchLog));
-//        fessConfig.setSuggestSearchLog(form.suggestSearchLog);
-////s       updateProperty(Constants.SUGGEST_DOCUMENTS_PROPERTY, getCheckboxValue(form.suggestDocuments));
-//        fessConfig.setSuggestDocuments(form.suggestDocuments);
-////i       updateProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, form.purgeSuggestSearchLogDay.toString());
-//        fessConfig.setPurgeSuggestSearchLogDay(form.purgeSuggestSearchLogDay);
-////s       updateProperty(Constants.LDAP_PROVIDER_URL, form.ldapProviderUrl);
-//        fessConfig.setLdapProviderUrl(form.ldapProviderUrl);
-////s       updateProperty(Constants.LDAP_SECURITY_PRINCIPAL, form.ldapProviderUrl);
-//        fessConfig.setLdapSecurityPrincipal(form.ldapSecurityPrincipal);
-////s       updateProperty(Constants.LDAP_BASE_DN, form.ldapBaseDn);
-//        fessConfig.setLdapBaseDn(form.ldapBaseDn);
-////s       updateProperty(Constants.LDAP_ACCOUNT_FILTER, form.ldapAccountFilter);
-//        fessConfig.setLdapAccountFilter(form.ldapAccountFilter);
-////s       updateProperty(Constants.NOTIFICATION_LOGIN, form.notificationLogin);
-//        fessConfig.setNotificationLogin(form.notificationLogin);
-////s       updateProperty(Constants.NOTIFICATION_SEARCH_TOP, form.notificationSearchTop);
-//        fessConfig.setNotificationSearchTop(form.notificationSearchTop);
+        fessConfig.setSuggestSearchLog(Constants.ON.equalsIgnoreCase(form.suggestSearchLog));
+        fessConfig.setSuggestDocuments(Constants.ON.equalsIgnoreCase(form.suggestDocuments));
+        fessConfig.setPurgeSuggestSearchLogDay(form.purgeSuggestSearchLogDay);
+        fessConfig.setLdapProviderUrl(form.ldapProviderUrl);
+        fessConfig.setLdapSecurityPrincipal(form.ldapSecurityPrincipal);
+        fessConfig.setLdapBaseDn(form.ldapBaseDn);
+        fessConfig.setLdapAccountFilter(form.ldapAccountFilter);
+        fessConfig.setNotificationLogin(form.notificationLogin);
+        fessConfig.setNotificationSearchTop(form.notificationSearchTop);
 
         fessConfig.storeSystemProperties();
         saveInfo(messages -> messages.addSuccessUpdateCrawlerParams(GLOBAL));
@@ -182,59 +157,34 @@ public class AdminGeneralAction extends FessAdminAction {
 
     protected void updateForm(final EditForm form) {
         form.loginRequired = fessConfig.isLoginRequired() ? Constants.TRUE : Constants.FALSE;
-//boolean form.incrementalCrawling = systemProperties.getProperty(Constants.INCREMENTAL_CRAWLING_PROPERTY, Constants.TRUE);
         form.incrementalCrawling = fessConfig.isIncrementalCrawling() ? Constants.TRUE : Constants.FALSE;
-//int     form.dayForCleanup = getPropertyAsInteger(Constants.DAY_FOR_CLEANUP_PROPERTY, Constants.DEFAULT_DAY_FOR_CLEANUP);
         form.dayForCleanup = fessConfig.getDayForCleanup();
-//        form.crawlingThreadCount = getPropertyAsInteger(Constants.CRAWLING_THREAD_COUNT_PROPERTY, 5);
         form.crawlingThreadCount = fessConfig.getCrawlingThreadCount();
-//        form.searchLog = systemProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE);
         form.searchLog = fessConfig.isSearchLog() ? Constants.TRUE : Constants.FALSE;
-//        form.userInfo = systemProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE);
         form.userInfo = fessConfig.isUserInfo() ? Constants.TRUE : Constants.FALSE;
-//        form.userFavorite = systemProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE);
         form.userFavorite = fessConfig.isUserFavorite() ? Constants.TRUE : Constants.FALSE;
-//        form.webApiJson = systemProperties.getProperty(Constants.WEB_API_JSON_PROPERTY, Constants.TRUE);
         form.webApiJson = fessConfig.isWebApiJson() ? Constants.TRUE : Constants.FALSE;
         form.defaultLabelValue = fessConfig.getDefaultLabelValue();
         form.defaultSortValue = fessConfig.getDefaultSortValue();
-//        form.appendQueryParameter = systemProperties.getProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY, Constants.FALSE);
         form.appendQueryParameter = fessConfig.isAppendQueryParameter() ? Constants.TRUE : Constants.FALSE;
-//String  form.ignoreFailureType = systemProperties.getProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, Constants.DEFAULT_IGNORE_FAILURE_TYPE);
         form.ignoreFailureType = fessConfig.getIgnoreFailureType();
-//        form.failureCountThreshold = getPropertyAsInteger(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, Constants.DEFAULT_FAILURE_COUNT);
         form.failureCountThreshold = fessConfig.getFailureCountThreshold();
         form.popularWord = fessConfig.isWebApiPopularWord() ? Constants.TRUE : Constants.FALSE;
-//        form.csvFileEncoding = systemProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
         form.csvFileEncoding = fessConfig.getCsvFileEncoding();
-//        form.purgeSearchLogDay = Integer.parseInt(systemProperties.getProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY));
         form.purgeSearchLogDay = fessConfig.getPurgeSearchLogDay();
-//int     form.purgeJobLogDay = Integer.parseInt(systemProperties.getProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY));
         form.purgeJobLogDay = fessConfig.getPurgeJobLogDay();
-//        form.purgeUserInfoDay = Integer.parseInt(systemProperties.getProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY));
         form.purgeUserInfoDay = fessConfig.getPurgeUserInfoDay();
-//String  form.purgeByBots = systemProperties.getProperty(Constants.PURGE_BY_BOTS_PROPERTY, Constants.DEFAULT_PURGE_BY_BOTS);
         form.purgeByBots = fessConfig.getPurgeByBots();
-//        form.notificationTo = systemProperties.getProperty(Constants.NOTIFICATION_TO_PROPERTY, StringUtil.EMPTY);
         form.notificationTo = fessConfig.getNotificationTo();
-////s       form.suggestSearchLog = systemProperties.getProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY, Constants.TRUE);
-//        form.suggestSearchLog = fessConfig.getSuggestSearchLog();
-////s       form.suggestDocuments = systemProperties.getProperty(Constants.SUGGEST_DOCUMENTS_PROPERTY, Constants.TRUE);
-//        form.suggestDocuments = fessConfig.getSuggestDocuments();
-////i       form.purgeSuggestSearchLogDay = Integer.parseInt(systemProperties.getProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_SUGGEST_PURGE_DAY));
-//        form.purgeSuggestSearchLogDay = fessConfig.getPurgeSuggestSearchLogDay();
-////s       form.ldapProviderUrl = systemProperties.getProperty(Constants.LDAP_PROVIDER_URL, StringUtil.EMPTY);
-//        form.ldapProviderUrl = fessConfig.getLdapProviderUrl();
-////s       form.ldapSecurityPrincipal = systemProperties.getProperty(Constants.LDAP_SECURITY_PRINCIPAL, StringUtil.EMPTY);
-//        form.ldapSecurityPrincipal = fessConfig.getLdapSecurityPrincipal();
-////s       form.ldapBaseDn = systemProperties.getProperty(Constants.LDAP_BASE_DN, StringUtil.EMPTY);
-//        form.ldapBaseDn = fessConfig.getLdapBaseDn();
-////s       form.ldapAccountFilter = systemProperties.getProperty(Constants.LDAP_ACCOUNT_FILTER, StringUtil.EMPTY);
-//        form.ldapAccountFilter = fessConfig.getLdapAccountFilter();
-////s       form.notificationLogin = systemProperties.getProperty(Constants.NOTIFICATION_LOGIN, StringUtil.EMPTY);
-//        form.notificationLogin = fessConfig.getNotificationLogin();
-////s       form.notificationSearchTop = systemProperties.getProperty(Constants.NOTIFICATION_SEARCH_TOP, StringUtil.EMPTY);
-//        form.notificationSearchTop = fessConfig.getNotificationSearchTop();
+        form.suggestSearchLog = fessConfig.isSuggestSearchLog() ? Constants.TRUE : Constants.FALSE;
+        form.suggestDocuments = fessConfig.isSuggestDocuments() ? Constants.TRUE : Constants.FALSE;
+        form.purgeSuggestSearchLogDay = fessConfig.getPurgeSuggestSearchLogDay();
+        form.ldapProviderUrl = fessConfig.getLdapProviderUrl();
+        form.ldapSecurityPrincipal = fessConfig.getLdapSecurityPrincipal();
+        form.ldapBaseDn = fessConfig.getLdapBaseDn();
+        form.ldapAccountFilter = fessConfig.getLdapAccountFilter();
+        form.notificationLogin = fessConfig.getNotificationLogin();
+        form.notificationSearchTop = fessConfig.getNotificationSearchTop();
     }
 
     private void updateProperty(final String key, final String value) {

+ 55 - 20
src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java

@@ -203,7 +203,7 @@ public interface FessProp {
     public default boolean isLoginRequired() {
         return getSystemPropertyAsBoolean(Constants.LOGIN_REQUIRED_PROPERTY, false);
     }
-//TODO boolean    
+
     public default void setIncrementalCrawling(final boolean value) {
         setSystemPropertyAsBoolean(Constants.INCREMENTAL_CRAWLING_PROPERTY, value);
     }
@@ -211,7 +211,7 @@ public interface FessProp {
     public default boolean isIncrementalCrawling() {
         return getSystemPropertyAsBoolean(Constants.INCREMENTAL_CRAWLING_PROPERTY, true);
     }
-//TODO int
+
     public default void setDayForCleanup(final int value) {
         setSystemPropertyAsInt(Constants.DAY_FOR_CLEANUP_PROPERTY, value);
     }
@@ -267,7 +267,7 @@ public interface FessProp {
     public default boolean isAppendQueryParameter() {
         return getSystemPropertyAsBoolean(Constants.APPEND_QUERY_PARAMETER_PROPERTY, false);
     }
-//TODO String
+
     public default void setIgnoreFailureType(final String value) {
         setSystemProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, value);
     }
@@ -308,7 +308,7 @@ public interface FessProp {
         return getSystemPropertyAsInt(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, Integer.parseInt(Constants.DEFAULT_PURGE_DAY));
     }
     
-    //TODO int
+
     public default void setPurgeJobLogDay(final int value) {
         setSystemPropertyAsInt(Constants.PURGE_JOB_LOG_DAY_PROPERTY, value);
     }
@@ -318,14 +318,13 @@ public interface FessProp {
     }
     
     public default void setPurgeUserInfoDay(final int value) {
-        setSystemPropertyAsInt(Constants.PURGE_BY_BOTS_PROPERTY, value);
+        setSystemPropertyAsInt(Constants.PURGE_USER_INFO_DAY_PROPERTY, value);
     }
     
     public default int getPurgeUserInfoDay() {
-        return getSystemPropertyAsInt(Constants.PURGE_BY_BOTS_PROPERTY, Integer.parseInt(Constants.DEFAULT_PURGE_BY_BOTS));
+        return getSystemPropertyAsInt(Constants.PURGE_USER_INFO_DAY_PROPERTY, Integer.parseInt(Constants.DEFAULT_PURGE_DAY));
     }
     
-    //TODO string
     public default void setPurgeByBots(final String value) {
         setSystemProperty(Constants.PURGE_BY_BOTS_PROPERTY, value);
     }
@@ -342,32 +341,56 @@ public interface FessProp {
         return getSystemProperty(Constants.NOTIFICATION_TO_PROPERTY, StringUtil.EMPTY);
     }
     
+    public default void setSuggestSearchLog(final boolean value) {
+        setSystemPropertyAsBoolean(Constants.SUGGEST_SEARCH_LOG_PROPERTY, value);
+    }
+    
+    public default boolean isSuggestSearchLog() {
+        return getSystemPropertyAsBoolean(Constants.SUGGEST_SEARCH_LOG_PROPERTY, true);
+    }
+    
+    public default void setSuggestDocuments(final boolean value) {
+        setSystemPropertyAsBoolean(Constants.SUGGEST_DOCUMENTS_PROPERTY, value);
+    }
     
+    public default boolean isSuggestDocuments() {
+        return getSystemPropertyAsBoolean(Constants.SUGGEST_DOCUMENTS_PROPERTY, true);
+    }
+    
+    public default void setPurgeSuggestSearchLogDay(final int value) {
+        setSystemPropertyAsInt(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, value);
+    }
     
-    //TODO
+    public default int getPurgeSuggestSearchLogDay() {
+        return getSystemPropertyAsInt(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, Integer.parseInt(Constants.DEFAULT_SUGGEST_PURGE_DAY));
+    }
+
+    public default void setLdapInitialContextFactory(final String value) {
+        setSystemProperty(Constants.LDAP_INITIAL_CONTEXT_FACTORY, value);
+    }
 
     public default String getLdapInitialContextFactory() {
         return getSystemProperty(Constants.LDAP_INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
     }
 
-    public default void setLdapInitialContextFactory(final String value) {
-        setSystemProperty(Constants.LDAP_INITIAL_CONTEXT_FACTORY, value);
+    public default void setLdapSecurityAuthentication(final String value) {
+        setSystemProperty(Constants.LDAP_SECURITY_AUTHENTICATION, value);
     }
 
     public default String getLdapSecurityAuthentication() {
         return getSystemProperty(Constants.LDAP_SECURITY_AUTHENTICATION, "simple");
     }
 
-    public default void setLdapSecurityAuthentication(final String value) {
-        setSystemProperty(Constants.LDAP_SECURITY_AUTHENTICATION, value);
+    public default void setLdapProviderUrl(final String value) {
+        setSystemProperty(Constants.LDAP_PROVIDER_URL, value);
     }
 
     public default String getLdapProviderUrl() {
         return getSystemProperty(Constants.LDAP_PROVIDER_URL);
     }
 
-    public default void setLdapProviderUrl(final String value) {
-        setSystemProperty(Constants.LDAP_PROVIDER_URL, value);
+    public default void setLdapSecurityPrincipal(final String value) {
+        setSystemProperty(Constants.LDAP_SECURITY_PRINCIPAL, value);
     }
 
     public default String getLdapSecurityPrincipal(final String username) {
@@ -378,24 +401,36 @@ public interface FessProp {
         return getSystemProperty(Constants.LDAP_SECURITY_PRINCIPAL);
     }
 
-    public default void setLdapSecurityPrincipal(final String value) {
-        setSystemProperty(Constants.LDAP_SECURITY_PRINCIPAL, value);
+    public default void setLdapBaseDn(final String value) {
+        setSystemProperty(Constants.LDAP_BASE_DN, value);
     }
 
     public default String getLdapBaseDn() {
         return getSystemProperty(Constants.LDAP_BASE_DN);
     }
 
-    public default void setLdapBaseDn(final String value) {
-        setSystemProperty(Constants.LDAP_BASE_DN, value);
+    public default void setLdapAccountFilter(final String value) {
+        setSystemProperty(Constants.LDAP_ACCOUNT_FILTER, value);
     }
 
     public default String getLdapAccountFilter() {
         return getSystemProperty(Constants.LDAP_ACCOUNT_FILTER);
     }
 
-    public default void setLdapAccountFilter(final String value) {
-        setSystemProperty(Constants.LDAP_ACCOUNT_FILTER, value);
+    public default void setNotificationLogin(final String value) {
+        setSystemProperty(Constants.NOTIFICATION_LOGIN, value);
+    }
+    
+    public default String getNotificationLogin() {
+        return getSystemProperty(Constants.NOTIFICATION_LOGIN, StringUtil.EMPTY);
+    }
+    
+    public default void setNotificationSearchTop(final String value) {
+        setSystemProperty(Constants.NOTIFICATION_SEARCH_TOP, value);
+    }
+    
+    public default String getNotificationSearchTop() {
+        return getSystemProperty(Constants.NOTIFICATION_SEARCH_TOP, StringUtil.EMPTY);
     }
 
     //