code cleanup
This commit is contained in:
parent
4db1d46171
commit
a1f73a419a
30 changed files with 77 additions and 75 deletions
|
@ -92,7 +92,7 @@ public class EsApiManager extends BaseApiManager {
|
|||
}).orElse(() -> {
|
||||
throw new WebApiException(HttpServletResponse.SC_FORBIDDEN, "Invalid session.");
|
||||
});
|
||||
} catch (WebApiException e) {
|
||||
} catch (final WebApiException e) {
|
||||
logger.debug("Web API access error. ", e);
|
||||
e.sendError(response);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class AllJobScheduler implements LaJobScheduler {
|
|||
protected Class<? extends LaJob> jobClass = ScriptExecutorJob.class;
|
||||
|
||||
@Override
|
||||
public void schedule(LaCron cron) {
|
||||
public void schedule(final LaCron cron) {
|
||||
scheduledJobService.start(cron);
|
||||
|
||||
final String myName = fessConfig.getSchedulerTargetName();
|
||||
|
|
|
@ -35,7 +35,7 @@ public class ScriptExecutorJob implements LaJob {
|
|||
private static final Logger logger = LoggerFactory.getLogger(ScriptExecutorJob.class);
|
||||
|
||||
@Override
|
||||
public void run(LaJobRuntime runtime) {
|
||||
public void run(final LaJobRuntime runtime) {
|
||||
final ScheduledJob scheduledJob = (ScheduledJob) runtime.getParameterMap().get(Constants.SCHEDULED_JOB); // TODO null check
|
||||
final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
|
||||
final JobManager jobManager = ComponentUtil.getJobManager();
|
||||
|
|
|
@ -52,15 +52,16 @@ public class AccessContextLogic {
|
|||
// ===================================================================================
|
||||
// Create Context
|
||||
// ==============
|
||||
public AccessContext create(AccessContextResource resource, UserTypeSupplier userTypeSupplier, UserBeanSupplier userBeanSupplier,
|
||||
AppTypeSupplier appTypeSupplier) {
|
||||
public AccessContext create(final AccessContextResource resource, final UserTypeSupplier userTypeSupplier,
|
||||
final UserBeanSupplier userBeanSupplier, final AppTypeSupplier appTypeSupplier) {
|
||||
final AccessContext context = new AccessContext();
|
||||
context.setAccessLocalDateTimeProvider(() -> timeManager.currentDateTime());
|
||||
context.setAccessUserProvider(() -> buildAccessUserTrace(resource, userTypeSupplier, appTypeSupplier));
|
||||
return context;
|
||||
}
|
||||
|
||||
private String buildAccessUserTrace(AccessContextResource resource, UserTypeSupplier userTypeSupplier, AppTypeSupplier appTypeSupplier) {
|
||||
private String buildAccessUserTrace(final AccessContextResource resource, final UserTypeSupplier userTypeSupplier,
|
||||
final AppTypeSupplier appTypeSupplier) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(userTypeSupplier.supply().orElse("_"));
|
||||
sb.append(",").append(appTypeSupplier.supply()).append(",").append(resource.getModuleName());
|
||||
|
|
|
@ -109,7 +109,7 @@ public class ScheduledJobService implements Serializable {
|
|||
scheduledJobBhv.insertOrUpdate(scheduledJob, op -> {
|
||||
op.setRefresh(true);
|
||||
});
|
||||
JobManager jobManager = ComponentUtil.getJobManager();
|
||||
final JobManager jobManager = ComponentUtil.getJobManager();
|
||||
jobManager.schedule(cron -> register(cron, scheduledJob));
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ public class ScheduledJobService implements Serializable {
|
|||
});
|
||||
}
|
||||
|
||||
protected void register(LaCron cron, final ScheduledJob scheduledJob) {
|
||||
protected void register(final LaCron cron, final ScheduledJob scheduledJob) {
|
||||
if (scheduledJob == null) {
|
||||
throw new ScheduledJobException("No job.");
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class ScheduledJobService implements Serializable {
|
|||
}
|
||||
|
||||
final CronParamsSupplier paramsOp = () -> {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
final Map<String, Object> params = new HashMap<>();
|
||||
params.put(Constants.SCHEDULED_JOB, scheduledJob);
|
||||
return params;
|
||||
};
|
||||
|
@ -162,7 +162,7 @@ public class ScheduledJobService implements Serializable {
|
|||
}
|
||||
} else if (StringUtil.isNotBlank(scheduledJob.getCronExpression())) {
|
||||
logger.info("Starting Job " + id + ":" + scheduledJob.getName());
|
||||
String cronExpression = scheduledJob.getCronExpression();
|
||||
final String cronExpression = scheduledJob.getCronExpression();
|
||||
job.reschedule(cronExpression, op -> op.changeNoticeLogToDebug().params(paramsOp));
|
||||
}
|
||||
}).orElse(
|
||||
|
@ -181,18 +181,18 @@ public class ScheduledJobService implements Serializable {
|
|||
});
|
||||
}
|
||||
|
||||
private OptionalThing<LaScheduledJob> findJobByUniqueOf(LaJobUnique jobUnique) {
|
||||
private OptionalThing<LaScheduledJob> findJobByUniqueOf(final LaJobUnique jobUnique) {
|
||||
final JobManager jobManager = ComponentUtil.getJobManager();
|
||||
try {
|
||||
return jobManager.findJobByUniqueOf(jobUnique);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
return OptionalThing.empty();
|
||||
}
|
||||
}
|
||||
|
||||
public void unregister(final ScheduledJob scheduledJob) {
|
||||
try {
|
||||
JobManager jobManager = ComponentUtil.getJobManager();
|
||||
final JobManager jobManager = ComponentUtil.getJobManager();
|
||||
if (jobManager.isSchedulingDone()) {
|
||||
jobManager.findJobByUniqueOf(LaJobUnique.of(scheduledJob.getId())).ifPresent(job -> {
|
||||
job.unschedule();
|
||||
|
@ -222,7 +222,7 @@ public class ScheduledJobService implements Serializable {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void start(LaCron cron) {
|
||||
public void start(final LaCron cron) {
|
||||
scheduledJobBhv.selectCursor(cb -> {
|
||||
cb.query().setAvailable_Equal(Constants.T);
|
||||
cb.query().addOrderBy_SortOrder_Asc();
|
||||
|
@ -230,7 +230,7 @@ public class ScheduledJobService implements Serializable {
|
|||
}, scheduledJob -> {
|
||||
try {
|
||||
register(cron, scheduledJob);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to start Job " + scheduledJob.getId(), e);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -72,7 +72,7 @@ public class UserService implements Serializable {
|
|||
|
||||
}
|
||||
|
||||
public void chnagePassword(String username, String password) {
|
||||
public void chnagePassword(final String username, final String password) {
|
||||
ComponentUtil.getLdapManager().changePassword(username, password);
|
||||
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
|
|
|
@ -153,7 +153,7 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
try {
|
||||
groupService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to add " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL), () -> asEditHtml());
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
try {
|
||||
groupService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to delete " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ public class AdminJoblogAction extends FessAdminAction {
|
|||
@Execute
|
||||
public HtmlResponse deleteall() {
|
||||
verifyToken(() -> asListHtml());
|
||||
List<String> jobStatusList = new ArrayList<>();
|
||||
final List<String> jobStatusList = new ArrayList<>();
|
||||
jobStatusList.add(Constants.OK);
|
||||
jobStatusList.add(Constants.FAIL);
|
||||
jobLogService.deleteByJobStatus(jobStatusList);
|
||||
|
|
|
@ -153,7 +153,7 @@ public class AdminRoleAction extends FessAdminAction {
|
|||
try {
|
||||
roleService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to add " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL), () -> asEditHtml());
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class AdminRoleAction extends FessAdminAction {
|
|||
try {
|
||||
roleService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to delete " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
}
|
||||
|
|
|
@ -354,7 +354,7 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
return asHtml(path_AdminScheduler_AdminSchedulerEditJsp);
|
||||
}
|
||||
|
||||
private HtmlResponse asDetailsHtml(String id) {
|
||||
private HtmlResponse asDetailsHtml(final String id) {
|
||||
return asHtml(path_AdminScheduler_AdminSchedulerDetailsJsp).renderWith(data -> {
|
||||
RenderDataUtil.register(data, "systemJobId", fessConfig.isSystemJobId(id));
|
||||
});
|
||||
|
|
|
@ -195,7 +195,7 @@ public class AdminUserAction extends FessAdminAction {
|
|||
try {
|
||||
userService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to add " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL), () -> asEditHtml());
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ public class AdminUserAction extends FessAdminAction {
|
|||
try {
|
||||
userService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to update " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class AdminUserAction extends FessAdminAction {
|
|||
try {
|
||||
userService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to delete " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ public class AdminWizardAction extends FessAdminAction {
|
|||
verifyToken(() -> asIndexHtml());
|
||||
if (!processHelper.isProcessRunning()) {
|
||||
final List<ScheduledJob> scheduledJobList = scheduledJobService.getCrawlerJobList();
|
||||
JobManager jobManager = ComponentUtil.getJobManager();
|
||||
final JobManager jobManager = ComponentUtil.getJobManager();
|
||||
for (final ScheduledJob scheduledJob : scheduledJobList) {
|
||||
jobManager.findJobByUniqueOf(LaJobUnique.of(scheduledJob.getId())).ifPresent(job -> {
|
||||
job.launchNow();
|
||||
|
|
|
@ -107,7 +107,7 @@ public abstract class FessAdminAction extends FessBaseAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResponse hookBefore(ActionRuntime runtime) {
|
||||
public ActionResponse hookBefore(final ActionRuntime runtime) {
|
||||
final String username = getUserBean().map(u -> u.getUserId()).orElse("-");
|
||||
final String requestPath = runtime.getRequestPath();
|
||||
final String executeName = runtime.getExecuteMethod().getName();
|
||||
|
@ -116,7 +116,7 @@ public abstract class FessAdminAction extends FessBaseAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void hookFinally(ActionRuntime runtime) {
|
||||
public void hookFinally(final ActionRuntime runtime) {
|
||||
super.hookFinally(runtime);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class ProfileAction extends FessSearchAction {
|
|||
|
||||
@Execute
|
||||
public HtmlResponse changePassword(final ProfileForm form) {
|
||||
VaErrorHook toIndexPage = () -> {
|
||||
final VaErrorHook toIndexPage = () -> {
|
||||
form.clearSecurityInfo();
|
||||
return asIndexHtml();
|
||||
};
|
||||
|
@ -69,7 +69,7 @@ public class ProfileAction extends FessSearchAction {
|
|||
try {
|
||||
userService.chnagePassword(username, form.newPassword);
|
||||
saveInfo(messages -> messages.addSuccessChangedPassword(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to change password for " + username, e);
|
||||
throwValidationError(messages -> messages.addErrorsFailedToChangePassword(GLOBAL), toIndexPage);
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public abstract class AbstractFessFileTransformer extends AbstractTransformer im
|
|||
}
|
||||
}
|
||||
|
||||
Pair<String, String> mapping = fessConfig.getCrawlerMetadataNameMapping(key);
|
||||
final Pair<String, String> mapping = fessConfig.getCrawlerMetadataNameMapping(key);
|
||||
if (mapping != null) {
|
||||
if (Constants.MAPPING_TYPE_ARRAY.equalsIgnoreCase(mapping.getSecond())) {
|
||||
dataMap.put(mapping.getFirst(), values);
|
||||
|
@ -148,7 +148,7 @@ public abstract class AbstractFessFileTransformer extends AbstractTransformer im
|
|||
} else {
|
||||
logger.warn("Unknown mapping type: {}={}", key, mapping);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
logger.warn("Failed to parse " + values[0], e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -540,7 +540,7 @@ public class FessEsClient implements Client {
|
|||
|
||||
try {
|
||||
searchResponse = searchRequestBuilder.execute().actionGet();
|
||||
} catch (SearchPhaseExecutionException e) {
|
||||
} catch (final SearchPhaseExecutionException e) {
|
||||
throw new InvalidQueryException(messages -> messages.addErrorsInvalidQueryParseError(UserMessages.GLOBAL_PROPERTY_KEY),
|
||||
"Invalid query: " + searchRequestBuilder, e);
|
||||
}
|
||||
|
|
|
@ -28,8 +28,9 @@ public class ScheduledJob extends BsScheduledJob {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String getScriptType() {
|
||||
String st = super.getScriptType();
|
||||
final String st = super.getScriptType();
|
||||
if (StringUtil.isBlank(st)) {
|
||||
return "groovy";
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class User extends BsUser implements FessUser {
|
|||
return "User [name=" + name + ", roles=" + Arrays.toString(roles) + ", groups=" + Arrays.toString(groups) + "]";
|
||||
}
|
||||
|
||||
public void setOriginalPassword(String originalPassword) {
|
||||
public void setOriginalPassword(final String originalPassword) {
|
||||
this.originalPassword = originalPassword;
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class FessUserNotFoundException extends FessSystemException {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public FessUserNotFoundException(String username) {
|
||||
public FessUserNotFoundException(final String username) {
|
||||
super("User is not found: " + username);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,11 +19,11 @@ public class LdapOperationException extends FessSystemException {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public LdapOperationException(String message, Throwable cause) {
|
||||
public LdapOperationException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public LdapOperationException(String message) {
|
||||
public LdapOperationException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@ public class WebApiException extends FessSystemException {
|
|||
this(statusCode, e.getMessage(), e);
|
||||
}
|
||||
|
||||
public void sendError(HttpServletResponse response) {
|
||||
public void sendError(final HttpServletResponse response) {
|
||||
try {
|
||||
response.sendError(statusCode, getMessage());
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
throw new FessSystemException("SC:" + statusCode + ": " + getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -312,8 +312,8 @@ public class Crawler implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
private String getValueFromMap(Map<String, String> dataMap, String key, String defaultValue) {
|
||||
String value = dataMap.get(key);
|
||||
private String getValueFromMap(final Map<String, String> dataMap, final String key, final String defaultValue) {
|
||||
final String value = dataMap.get(key);
|
||||
if (StringUtil.isBlank(value)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ public class ProcessHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized JobProcess startProcess(String sessionId, List<String> cmdList, Consumer<ProcessBuilder> pbCall) {
|
||||
ProcessBuilder pb = new ProcessBuilder(cmdList);
|
||||
public synchronized JobProcess startProcess(final String sessionId, final List<String> cmdList, final Consumer<ProcessBuilder> pbCall) {
|
||||
final ProcessBuilder pb = new ProcessBuilder(cmdList);
|
||||
pbCall.accept(pb);
|
||||
destroyProcess(sessionId);
|
||||
JobProcess jobProcess;
|
||||
|
|
|
@ -434,8 +434,8 @@ public class QueryHelper implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
private QueryBuilder convertPhraseQuery(QueryContext context, PhraseQuery query) {
|
||||
Term[] terms = query.getTerms();
|
||||
private QueryBuilder convertPhraseQuery(final QueryContext context, final PhraseQuery query) {
|
||||
final Term[] terms = query.getTerms();
|
||||
if (terms.length == 0) {
|
||||
throw new InvalidQueryException(messages -> messages.addErrorsInvalidQueryUnknown(UserMessages.GLOBAL_PROPERTY_KEY),
|
||||
"Unknown phrase query: " + query);
|
||||
|
|
|
@ -110,7 +110,7 @@ public class SystemHelper implements Serializable {
|
|||
shutdownHookList.forEach(action -> {
|
||||
try {
|
||||
action.run();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to process shutdown task.", e);
|
||||
}
|
||||
});
|
||||
|
@ -242,20 +242,20 @@ public class SystemHelper implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
public void sleep(int sec) {
|
||||
public void sleep(final int sec) {
|
||||
try {
|
||||
Thread.sleep(sec * 1000L);
|
||||
} catch (InterruptedException e) {
|
||||
} catch (final InterruptedException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
public void addShutdownHook(Runnable hook) {
|
||||
public void addShutdownHook(final Runnable hook) {
|
||||
shutdownHookList.add(hook);
|
||||
}
|
||||
|
||||
public String getHostname() {
|
||||
Map<String, String> env = System.getenv();
|
||||
final Map<String, String> env = System.getenv();
|
||||
if (env.containsKey("COMPUTERNAME")) {
|
||||
return env.get("COMPUTERNAME");
|
||||
} else if (env.containsKey("HOSTNAME")) {
|
||||
|
@ -263,13 +263,13 @@ public class SystemHelper implements Serializable {
|
|||
}
|
||||
try {
|
||||
return InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
} catch (final UnknownHostException e) {
|
||||
logger.debug("Unknown hostname.", e);
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
public void setupAdminHtmlData(TypicalAction action, ActionRuntime runtime) {
|
||||
public void setupAdminHtmlData(final TypicalAction action, final ActionRuntime runtime) {
|
||||
// nothing
|
||||
}
|
||||
|
||||
|
|
|
@ -350,7 +350,7 @@ public class CrawlJob {
|
|||
propFile = File.createTempFile("crawler_", ".properties");
|
||||
cmdList.add(propFile.getAbsolutePath());
|
||||
try (FileOutputStream out = new FileOutputStream(propFile)) {
|
||||
Properties prop = new Properties();
|
||||
final Properties prop = new Properties();
|
||||
prop.putAll(ComponentUtil.getSystemProperties());
|
||||
prop.store(out, cmdList.toString());
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ public class SuggestJob {
|
|||
propFile = File.createTempFile("crawler_", ".properties");
|
||||
cmdList.add(propFile.getAbsolutePath());
|
||||
try (FileOutputStream out = new FileOutputStream(propFile)) {
|
||||
Properties prop = new Properties();
|
||||
final Properties prop = new Properties();
|
||||
prop.putAll(ComponentUtil.getSystemProperties());
|
||||
prop.store(out, cmdList.toString());
|
||||
}
|
||||
|
|
|
@ -424,7 +424,7 @@ public class LdapManager {
|
|||
});
|
||||
}
|
||||
|
||||
public void changePassword(String username, String password) {
|
||||
public void changePassword(final String username, final String password) {
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
if (!fessConfig.isLdapAdminEnabled()) {
|
||||
return;
|
||||
|
|
|
@ -230,7 +230,7 @@ public interface FessProp {
|
|||
|
||||
String getJobSystemJobIds();
|
||||
|
||||
public default boolean isSystemJobId(String id) {
|
||||
public default boolean isSystemJobId(final String id) {
|
||||
if (StringUtil.isBlank(getJobSystemJobIds())) {
|
||||
return false;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ public interface FessProp {
|
|||
|
||||
String getSmbAvailableSidTypes();
|
||||
|
||||
public default boolean isAvailableSmbSidType(int sidType) {
|
||||
public default boolean isAvailableSmbSidType(final int sidType) {
|
||||
if (StringUtil.isBlank(getSmbAvailableSidTypes())) {
|
||||
return false;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public interface FessProp {
|
|||
|
||||
String getOnlineHelpSupportedLangs();
|
||||
|
||||
public default boolean isOnlineHelpSupportedLang(String lang) {
|
||||
public default boolean isOnlineHelpSupportedLang(final String lang) {
|
||||
if (StringUtil.isBlank(getOnlineHelpSupportedLangs())) {
|
||||
return false;
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ public interface FessProp {
|
|||
|
||||
String getJobTemplateTitleData();
|
||||
|
||||
public default String getJobTemplateTitle(String type) {
|
||||
public default String getJobTemplateTitle(final String type) {
|
||||
if (Constants.WEB_CRAWLER_TYPE.equals(type)) {
|
||||
return getJobTemplateTitleWeb();
|
||||
} else if (Constants.FILE_CRAWLER_TYPE.equals(type)) {
|
||||
|
@ -307,9 +307,9 @@ public interface FessProp {
|
|||
public default Class<? extends LaJob> getSchedulerJobClassAsClass() {
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends LaJob> clazz = (Class<? extends LaJob>) Class.forName(getSchedulerJobClass());
|
||||
final Class<? extends LaJob> clazz = (Class<? extends LaJob>) Class.forName(getSchedulerJobClass());
|
||||
return clazz;
|
||||
} catch (ClassNotFoundException e) {
|
||||
} catch (final ClassNotFoundException e) {
|
||||
throw new ClassNotFoundRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ public interface FessProp {
|
|||
|
||||
String getCrawlerMetadataContentExcludes();
|
||||
|
||||
public default boolean isCrawlerMetadataContentIncluded(String name) {
|
||||
public default boolean isCrawlerMetadataContentIncluded(final String name) {
|
||||
Pattern[] patterns = (Pattern[]) propMap.get(CRAWLER_METADATA_CONTENT_EXCLUDES);
|
||||
if (patterns == null) {
|
||||
patterns =
|
||||
|
@ -335,14 +335,14 @@ public interface FessProp {
|
|||
|
||||
String getCrawlerMetadataNameMapping();
|
||||
|
||||
public default Pair<String, String> getCrawlerMetadataNameMapping(String name) {
|
||||
public default Pair<String, String> getCrawlerMetadataNameMapping(final String name) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Pair<String, String>> params = (Map<String, Pair<String, String>>) propMap.get(CRAWLER_METADATA_NAME_MAPPING);
|
||||
if (params == null) {
|
||||
params = StreamUtil.of(getCrawlerMetadataNameMapping().split("\n")).filter(v -> StringUtil.isNotBlank(v)).map(v -> {
|
||||
String[] values = v.split("=");
|
||||
final String[] values = v.split("=");
|
||||
if (values.length == 2) {
|
||||
String[] subValues = values[1].split(":");
|
||||
final String[] subValues = values[1].split(":");
|
||||
if (subValues.length == 2) {
|
||||
return new Tuple3<String, String, String>(values[0], subValues[0], subValues[1]);
|
||||
} else {
|
||||
|
@ -382,7 +382,7 @@ public interface FessProp {
|
|||
|
||||
String getQueryLanguageMapping();
|
||||
|
||||
public default String getQueryLanguage(Locale locale) {
|
||||
public default String getQueryLanguage(final Locale locale) {
|
||||
if (locale == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ public interface FessProp {
|
|||
Map<String, String> params = (Map<String, String>) propMap.get(QUERY_LANGUAGE_MAPPING);
|
||||
if (params == null) {
|
||||
params = StreamUtil.of(getQueryLanguageMapping().split("\n")).filter(v -> StringUtil.isNotBlank(v)).map(v -> {
|
||||
String[] values = v.split("=");
|
||||
final String[] values = v.split("=");
|
||||
if (values.length == 2) {
|
||||
return new Pair<String, String>(values[0], values[1]);
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ public interface FessProp {
|
|||
|
||||
String getSupportedUploadedFiles();
|
||||
|
||||
public default boolean isSupportedUploadedFile(String name) {
|
||||
public default boolean isSupportedUploadedFile(final String name) {
|
||||
return StreamUtil.of(getSuggestPopularWordExcludes().split(",")).filter(s -> StringUtil.isNotBlank(s))
|
||||
.anyMatch(s -> s.equals(name));
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ public interface FessProp {
|
|||
String getLdapAdminUserBaseDn();
|
||||
|
||||
public default String getLdapAdminUserSecurityPrincipal(final String name) {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
buf.append(String.format(getLdapAdminUserFilter(), name));
|
||||
if (StringUtil.isNotBlank(getLdapAdminUserBaseDn())) {
|
||||
buf.append(',').append(getLdapAdminUserBaseDn());
|
||||
|
@ -464,7 +464,7 @@ public interface FessProp {
|
|||
String getLdapAdminRoleBaseDn();
|
||||
|
||||
public default String getLdapAdminRoleSecurityPrincipal(final String name) {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
buf.append(String.format(getLdapAdminRoleFilter(), name));
|
||||
if (StringUtil.isNotBlank(getLdapAdminRoleBaseDn())) {
|
||||
buf.append(',').append(getLdapAdminRoleBaseDn());
|
||||
|
@ -489,7 +489,7 @@ public interface FessProp {
|
|||
String getLdapAdminGroupBaseDn();
|
||||
|
||||
public default String getLdapAdminGroupSecurityPrincipal(final String name) {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
buf.append(String.format(getLdapAdminGroupFilter(), name));
|
||||
if (StringUtil.isNotBlank(getLdapAdminGroupBaseDn())) {
|
||||
buf.append(',').append(getLdapAdminGroupBaseDn());
|
||||
|
@ -499,7 +499,7 @@ public interface FessProp {
|
|||
|
||||
String getAuthenticationAdminUsers();
|
||||
|
||||
public default boolean isAdminUser(String username) {
|
||||
public default boolean isAdminUser(final String username) {
|
||||
return StreamUtil.of(getAuthenticationAdminUsers().split(",")).anyMatch(s -> s.equals(username));
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ public class FessFunctions {
|
|||
return parseDate(value, Constants.ISO_DATETIME_FORMAT);
|
||||
}
|
||||
|
||||
public static Date parseDate(final String value, String format) {
|
||||
public static Date parseDate(final String value, final String format) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class FessFunctions {
|
|||
public static String pagingQuery(final String query) {
|
||||
final HttpServletRequest request = LaRequestUtil.getRequest();
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> pagingQueryList = (List<String>) request.getAttribute(Constants.PAGING_QUERY_LIST);
|
||||
final List<String> pagingQueryList = (List<String>) request.getAttribute(Constants.PAGING_QUERY_LIST);
|
||||
if (pagingQueryList != null) {
|
||||
final String prefix;
|
||||
if (query != null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue