fix #1425 boolean support for admin api
This commit is contained in:
parent
7f1defa8f5
commit
48740df262
6 changed files with 31 additions and 23 deletions
|
@ -125,32 +125,32 @@ public class AdminGeneralAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
public static void updateConfig(final FessConfig fessConfig, final EditForm form) {
|
||||
fessConfig.setLoginRequired(Constants.ON.equalsIgnoreCase(form.loginRequired));
|
||||
fessConfig.setResultCollapsed(Constants.ON.equalsIgnoreCase(form.resultCollapsed));
|
||||
fessConfig.setLoginLinkEnabled(Constants.ON.equalsIgnoreCase(form.loginLink));
|
||||
fessConfig.setThumbnailEnabled(Constants.ON.equalsIgnoreCase(form.thumbnail));
|
||||
fessConfig.setIncrementalCrawling(Constants.ON.equalsIgnoreCase(form.incrementalCrawling));
|
||||
fessConfig.setLoginRequired(isCheckboxEnabled(form.loginRequired));
|
||||
fessConfig.setResultCollapsed(isCheckboxEnabled(form.resultCollapsed));
|
||||
fessConfig.setLoginLinkEnabled(isCheckboxEnabled(form.loginLink));
|
||||
fessConfig.setThumbnailEnabled(isCheckboxEnabled(form.thumbnail));
|
||||
fessConfig.setIncrementalCrawling(isCheckboxEnabled(form.incrementalCrawling));
|
||||
fessConfig.setDayForCleanup(form.dayForCleanup);
|
||||
fessConfig.setCrawlingThreadCount(form.crawlingThreadCount);
|
||||
fessConfig.setSearchLog(Constants.ON.equalsIgnoreCase(form.searchLog));
|
||||
fessConfig.setUserInfo(Constants.ON.equalsIgnoreCase(form.userInfo));
|
||||
fessConfig.setUserFavorite(Constants.ON.equalsIgnoreCase(form.userFavorite));
|
||||
fessConfig.setWebApiJson(Constants.ON.equalsIgnoreCase(form.webApiJson));
|
||||
fessConfig.setSearchLog(isCheckboxEnabled(form.searchLog));
|
||||
fessConfig.setUserInfo(isCheckboxEnabled(form.userInfo));
|
||||
fessConfig.setUserFavorite(isCheckboxEnabled(form.userFavorite));
|
||||
fessConfig.setWebApiJson(isCheckboxEnabled(form.webApiJson));
|
||||
fessConfig.setDefaultLabelValue(form.defaultLabelValue);
|
||||
fessConfig.setDefaultSortValue(form.defaultSortValue);
|
||||
fessConfig.setVirtualHostValue(form.virtualHostValue);
|
||||
fessConfig.setAppendQueryParameter(Constants.ON.equalsIgnoreCase(form.appendQueryParameter));
|
||||
fessConfig.setAppendQueryParameter(isCheckboxEnabled(form.appendQueryParameter));
|
||||
fessConfig.setIgnoreFailureType(form.ignoreFailureType);
|
||||
fessConfig.setFailureCountThreshold(form.failureCountThreshold);
|
||||
fessConfig.setWebApiPopularWord(Constants.ON.equalsIgnoreCase(form.popularWord));
|
||||
fessConfig.setWebApiPopularWord(isCheckboxEnabled(form.popularWord));
|
||||
fessConfig.setCsvFileEncoding(form.csvFileEncoding);
|
||||
fessConfig.setPurgeSearchLogDay(form.purgeSearchLogDay);
|
||||
fessConfig.setPurgeJobLogDay(form.purgeJobLogDay);
|
||||
fessConfig.setPurgeUserInfoDay(form.purgeUserInfoDay);
|
||||
fessConfig.setPurgeByBots(form.purgeByBots);
|
||||
fessConfig.setNotificationTo(form.notificationTo);
|
||||
fessConfig.setSuggestSearchLog(Constants.ON.equalsIgnoreCase(form.suggestSearchLog));
|
||||
fessConfig.setSuggestDocuments(Constants.ON.equalsIgnoreCase(form.suggestDocuments));
|
||||
fessConfig.setSuggestSearchLog(isCheckboxEnabled(form.suggestSearchLog));
|
||||
fessConfig.setSuggestDocuments(isCheckboxEnabled(form.suggestDocuments));
|
||||
fessConfig.setPurgeSuggestSearchLogDay(form.purgeSuggestSearchLogDay);
|
||||
fessConfig.setLdapProviderUrl(form.ldapProviderUrl);
|
||||
fessConfig.setLdapSecurityPrincipal(form.ldapSecurityPrincipal);
|
||||
|
|
|
@ -350,9 +350,9 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
entity.setUpdatedBy(username);
|
||||
entity.setUpdatedTime(currentTime);
|
||||
copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
|
||||
entity.setJobLogging(Constants.ON.equals(form.jobLogging) ? Constants.T : Constants.F);
|
||||
entity.setCrawler(Constants.ON.equals(form.crawler) ? Constants.T : Constants.F);
|
||||
entity.setAvailable(Constants.ON.equals(form.available) ? Constants.T : Constants.F);
|
||||
entity.setJobLogging(isCheckboxEnabled(form.jobLogging) ? Constants.T : Constants.F);
|
||||
entity.setCrawler(isCheckboxEnabled(form.crawler) ? Constants.T : Constants.F);
|
||||
entity.setAvailable(isCheckboxEnabled(form.available) ? Constants.T : Constants.F);
|
||||
return entity;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ public class AdminUpgradeAction extends FessAdminAction {
|
|||
return asIndexHtml();
|
||||
});
|
||||
verifyToken(() -> asIndexHtml());
|
||||
if (startReindex(Constants.ON.equalsIgnoreCase(form.replaceAliases))) {
|
||||
if (startReindex(isCheckboxEnabled(form.replaceAliases))) {
|
||||
saveInfo(messages -> messages.addSuccessStartedDataUpdate(GLOBAL));
|
||||
}
|
||||
return redirect(getClass());
|
||||
|
|
|
@ -21,6 +21,7 @@ import javax.annotation.Resource;
|
|||
|
||||
import org.codelibs.core.beans.util.BeanUtil;
|
||||
import org.codelibs.core.beans.util.CopyOptions;
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.web.base.login.FessLoginAssist;
|
||||
import org.codelibs.fess.helper.ActivityHelper;
|
||||
import org.codelibs.fess.helper.SystemHelper;
|
||||
|
@ -202,4 +203,11 @@ public abstract class FessBaseAction extends TypicalAction // has several interf
|
|||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public static boolean isCheckboxEnabled(final String value) {
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return Constants.ON.equalsIgnoreCase(value) || Constants.TRUE.equalsIgnoreCase(value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,9 +168,9 @@ public class CrawlerLogTests extends CrawlTestBase {
|
|||
requestBody.put("target", "all");
|
||||
requestBody.put("script_type", "groovy");
|
||||
requestBody.put("sort_order", 0);
|
||||
requestBody.put("crawler", Constants.ON);
|
||||
requestBody.put("job_logging", Constants.ON);
|
||||
requestBody.put("available", Constants.ON);
|
||||
requestBody.put("crawler", true);
|
||||
requestBody.put("job_logging", true);
|
||||
requestBody.put("available", true);
|
||||
requestBody.put("script_data", buildWebConfigJobScript(webConfigId));
|
||||
createJob(requestBody);
|
||||
}
|
||||
|
|
|
@ -411,9 +411,9 @@ public class SearchApiTests extends CrawlTestBase {
|
|||
requestBody.put("target", "all");
|
||||
requestBody.put("script_type", "groovy");
|
||||
requestBody.put("sort_order", 0);
|
||||
requestBody.put("crawler", Constants.ON);
|
||||
requestBody.put("job_logging", Constants.ON);
|
||||
requestBody.put("available", Constants.ON);
|
||||
requestBody.put("crawler", true);
|
||||
requestBody.put("job_logging", true);
|
||||
requestBody.put("available", true);
|
||||
requestBody.put("script_data", buildFileConfigJobScript(fileConfigId));
|
||||
createJob(requestBody);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue