code clean-up
This commit is contained in:
parent
8317cf22e6
commit
4b298110c4
107 changed files with 329 additions and 330 deletions
|
@ -25,7 +25,7 @@ public class WebApiManagerFactory {
|
|||
protected WebApiManager[] webApiManagers = new WebApiManager[0];
|
||||
|
||||
public void add(final WebApiManager webApiManager) {
|
||||
final List<WebApiManager> list = new ArrayList<WebApiManager>();
|
||||
final List<WebApiManager> list = new ArrayList<>();
|
||||
for (final WebApiManager manager : webApiManagers) {
|
||||
list.add(manager);
|
||||
}
|
||||
|
|
|
@ -106,9 +106,9 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
|
|||
final long allRecordCount = data.getAllRecordCount();
|
||||
final List<Map<String, Object>> documentItems = data.getDocumentItems();
|
||||
|
||||
final List<String> getFields = new ArrayList<String>();
|
||||
final List<String> getFields = new ArrayList<>();
|
||||
// meta tags should be returned
|
||||
final String getFieldsParam = (String) request.getParameter("getfields");
|
||||
final String getFieldsParam = request.getParameter("getfields");
|
||||
if (StringUtil.isNotBlank(getFieldsParam)) {
|
||||
getFields.addAll(Arrays.asList(getFieldsParam.split("\\.")));
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
|
|||
if ("xml".equals(request.getParameter("output"))) {
|
||||
xmlDtd = true;
|
||||
}
|
||||
StringBuilder requestUri = new StringBuilder(request.getRequestURI());
|
||||
final StringBuilder requestUri = new StringBuilder(request.getRequestURI());
|
||||
if (request.getQueryString() != null) {
|
||||
requestUri.append("?").append(request.getQueryString());
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
|
|||
buf.append("</NB>");
|
||||
}
|
||||
long recordNumber = startNumber;
|
||||
for (Map<String, Object> document : documentItems) {
|
||||
for (final Map<String, Object> document : documentItems) {
|
||||
buf.append("<R N=\"");
|
||||
buf.append(recordNumber);
|
||||
buf.append("\">");
|
||||
|
@ -198,7 +198,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
|
|||
document.put("UE", url);
|
||||
document.put("U", URLDecoder.decode(url, Constants.UTF_8));
|
||||
document.put("T", document.remove("title"));
|
||||
float score = Float.parseFloat((String) document.remove("boost"));
|
||||
final float score = Float.parseFloat((String) document.remove("boost"));
|
||||
document.put("RK", (int) (score * 10));
|
||||
document.put("S", ((String) document.remove("content_description")).replaceAll("<(/*)em>", "<$1b>"));
|
||||
document.put("LANG", document.remove("lang"));
|
||||
|
@ -240,7 +240,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
|
|||
} else {
|
||||
charset = (String) document.remove("contentType_s");
|
||||
if (StringUtil.isNotBlank(charset)) {
|
||||
Matcher m = Pattern.compile(".*;\\s*charset=(.+)").matcher(charset);
|
||||
final Matcher m = Pattern.compile(".*;\\s*charset=(.+)").matcher(charset);
|
||||
if (m.matches()) {
|
||||
charset = m.group(1);
|
||||
buf.append(charset);
|
||||
|
@ -327,7 +327,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
static class WrappedWebApiRequest extends WebApiRequest {
|
||||
private Map<String, String[]> parameters;
|
||||
private Map<String, String[]> extraParameters;
|
||||
private final Map<String, String[]> extraParameters;
|
||||
|
||||
public WrappedWebApiRequest(final HttpServletRequest request, final String servletPath, final Map<String, String[]> extraParams) {
|
||||
super(request, servletPath);
|
||||
|
@ -336,7 +336,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
@Override
|
||||
public String getParameter(final String name) {
|
||||
String[] values = getParameterMap().get(name);
|
||||
final String[] values = getParameterMap().get(name);
|
||||
if (values != null) {
|
||||
return values[0];
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
|
|||
@Override
|
||||
public Map<String, String[]> getParameterMap() {
|
||||
if (parameters == null) {
|
||||
parameters = new HashMap<String, String[]>();
|
||||
parameters = new HashMap<>();
|
||||
parameters.putAll(super.getParameterMap());
|
||||
// Parameter of the same key will be overwritten
|
||||
parameters.putAll(extraParameters);
|
||||
|
@ -410,11 +410,11 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
@Override
|
||||
public Map<String, String[]> getFields() {
|
||||
Map<String, String[]> fields = new HashMap<>();
|
||||
for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
|
||||
String key = entry.getKey();
|
||||
final Map<String, String[]> fields = new HashMap<>();
|
||||
for (final Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
|
||||
final String key = entry.getKey();
|
||||
if (key.startsWith("fields.")) {
|
||||
String[] value = simplifyArray(entry.getValue());
|
||||
final String[] value = simplifyArray(entry.getValue());
|
||||
fields.put(key.substring("fields.".length()), value);
|
||||
}
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ public class GsaApiManager extends BaseApiManager implements WebApiManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
public Object getAttribute(final String name) {
|
||||
return request.getAttribute(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -699,11 +699,11 @@ public class JsonApiManager extends BaseApiManager {
|
|||
|
||||
@Override
|
||||
public Map<String, String[]> getFields() {
|
||||
Map<String, String[]> fields = new HashMap<>();
|
||||
for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
|
||||
String key = entry.getKey();
|
||||
final Map<String, String[]> fields = new HashMap<>();
|
||||
for (final Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
|
||||
final String key = entry.getKey();
|
||||
if (key.startsWith("fields.")) {
|
||||
String[] value = simplifyArray(entry.getValue());
|
||||
final String[] value = simplifyArray(entry.getValue());
|
||||
fields.put(key.substring("fields.".length()), value);
|
||||
}
|
||||
}
|
||||
|
@ -777,7 +777,7 @@ public class JsonApiManager extends BaseApiManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
public Object getAttribute(final String name) {
|
||||
return request.getAttribute(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public class AllJobScheduler implements LaJobScheduler {
|
|||
}
|
||||
try {
|
||||
jobHelper.register(scheduledJob);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to update schdule " + scheduledJob, e);
|
||||
}
|
||||
});
|
||||
|
@ -103,7 +103,7 @@ public class AllJobScheduler implements LaJobScheduler {
|
|||
});
|
||||
}
|
||||
|
||||
public void setJobClass(Class<? extends LaJob> jobClass) {
|
||||
public void setJobClass(final Class<? extends LaJob> jobClass) {
|
||||
this.jobClass = jobClass;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ public class BadWordService implements Serializable {
|
|||
}, new EntityRowHandler<BadWord>() {
|
||||
@Override
|
||||
public void handle(final BadWord entity) {
|
||||
final List<String> list = new ArrayList<String>();
|
||||
final List<String> list = new ArrayList<>();
|
||||
addToList(list, entity.getSuggestWord());
|
||||
try {
|
||||
csvWriter.writeValues(list);
|
||||
|
|
|
@ -287,7 +287,7 @@ public class CrawlingInfoService implements Serializable {
|
|||
@SuppressWarnings("resource")
|
||||
final CsvWriter csvWriter = new CsvWriter(writer, cfg);
|
||||
try {
|
||||
final List<String> list = new ArrayList<String>();
|
||||
final List<String> list = new ArrayList<>();
|
||||
list.add("SessionId");
|
||||
list.add("SessionCreatedTime");
|
||||
list.add("Key");
|
||||
|
@ -300,7 +300,7 @@ public class CrawlingInfoService implements Serializable {
|
|||
}, new EntityRowHandler<CrawlingInfoParam>() {
|
||||
@Override
|
||||
public void handle(final CrawlingInfoParam entity) {
|
||||
final List<String> list = new ArrayList<String>();
|
||||
final List<String> list = new ArrayList<>();
|
||||
entity.getCrawlingInfo().ifPresent(crawlingInfo -> {
|
||||
addToList(list, crawlingInfo.getSessionId());
|
||||
addToList(list, crawlingInfo.getCreatedTime());
|
||||
|
|
|
@ -111,7 +111,7 @@ public class DataConfigService implements Serializable {
|
|||
fctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
|
||||
});
|
||||
if (!fctltmList.isEmpty()) {
|
||||
final List<String> labelTypeIds = new ArrayList<String>(fctltmList.size());
|
||||
final List<String> labelTypeIds = new ArrayList<>(fctltmList.size());
|
||||
for (final DataConfigToLabel mapping : fctltmList) {
|
||||
labelTypeIds.add(mapping.getLabelTypeId());
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class DataConfigService implements Serializable {
|
|||
if (isNew) {
|
||||
// Insert
|
||||
if (labelTypeIds != null) {
|
||||
final List<DataConfigToLabel> fctltmList = new ArrayList<DataConfigToLabel>();
|
||||
final List<DataConfigToLabel> fctltmList = new ArrayList<>();
|
||||
for (final String labelTypeId : labelTypeIds) {
|
||||
final DataConfigToLabel mapping = new DataConfigToLabel();
|
||||
mapping.setDataConfigId(dataConfigId);
|
||||
|
@ -151,8 +151,8 @@ public class DataConfigService implements Serializable {
|
|||
fctltmCb.query().setDataConfigId_Equal(dataConfigId);
|
||||
fctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
|
||||
});
|
||||
final List<DataConfigToLabel> newList = new ArrayList<DataConfigToLabel>();
|
||||
final List<DataConfigToLabel> matchedList = new ArrayList<DataConfigToLabel>();
|
||||
final List<DataConfigToLabel> newList = new ArrayList<>();
|
||||
final List<DataConfigToLabel> matchedList = new ArrayList<>();
|
||||
for (final String id : labelTypeIds) {
|
||||
boolean exist = false;
|
||||
for (final DataConfigToLabel mapping : fctltmList) {
|
||||
|
|
|
@ -84,7 +84,7 @@ public class ElevateWordService implements Serializable {
|
|||
wctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
|
||||
});
|
||||
if (!wctltmList.isEmpty()) {
|
||||
final List<String> labelTypeIds = new ArrayList<String>(wctltmList.size());
|
||||
final List<String> labelTypeIds = new ArrayList<>(wctltmList.size());
|
||||
for (final ElevateWordToLabel mapping : wctltmList) {
|
||||
labelTypeIds.add(mapping.getLabelTypeId());
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class ElevateWordService implements Serializable {
|
|||
if (isNew) {
|
||||
// Insert
|
||||
if (labelTypeIds != null) {
|
||||
final List<ElevateWordToLabel> wctltmList = new ArrayList<ElevateWordToLabel>();
|
||||
final List<ElevateWordToLabel> wctltmList = new ArrayList<>();
|
||||
for (final String id : labelTypeIds) {
|
||||
final ElevateWordToLabel mapping = new ElevateWordToLabel();
|
||||
mapping.setElevateWordId(elevateWordId);
|
||||
|
@ -123,8 +123,8 @@ public class ElevateWordService implements Serializable {
|
|||
wctltmCb.query().setElevateWordId_Equal(elevateWordId);
|
||||
wctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
|
||||
});
|
||||
final List<ElevateWordToLabel> newList = new ArrayList<ElevateWordToLabel>();
|
||||
final List<ElevateWordToLabel> matchedList = new ArrayList<ElevateWordToLabel>();
|
||||
final List<ElevateWordToLabel> newList = new ArrayList<>();
|
||||
final List<ElevateWordToLabel> matchedList = new ArrayList<>();
|
||||
for (final String id : labelTypeIds) {
|
||||
boolean exist = false;
|
||||
for (final ElevateWordToLabel mapping : list) {
|
||||
|
@ -236,7 +236,7 @@ public class ElevateWordService implements Serializable {
|
|||
@SuppressWarnings("resource")
|
||||
final CsvWriter csvWriter = new CsvWriter(writer, cfg);
|
||||
try {
|
||||
final List<String> list = new ArrayList<String>();
|
||||
final List<String> list = new ArrayList<>();
|
||||
list.add("SuggestWord");
|
||||
list.add("Reading");
|
||||
list.add("Role");
|
||||
|
@ -249,7 +249,7 @@ public class ElevateWordService implements Serializable {
|
|||
}, new EntityRowHandler<ElevateWord>() {
|
||||
@Override
|
||||
public void handle(final ElevateWord entity) {
|
||||
final List<String> list = new ArrayList<String>();
|
||||
final List<String> list = new ArrayList<>();
|
||||
addToList(list, entity.getSuggestWord());
|
||||
addToList(list, entity.getReading());
|
||||
addToList(list, entity.getTargetRole());
|
||||
|
|
|
@ -129,7 +129,7 @@ public class FailureUrlService implements Serializable {
|
|||
}
|
||||
|
||||
public List<String> getExcludedUrlList(final String configId) {
|
||||
int failureCount = fessConfig.getFailureCountThreshold();
|
||||
final int failureCount = fessConfig.getFailureCountThreshold();
|
||||
final String ignoreFailureType = fessConfig.getIgnoreFailureType();
|
||||
|
||||
if (failureCount < 0) {
|
||||
|
@ -150,7 +150,7 @@ public class FailureUrlService implements Serializable {
|
|||
if (StringUtil.isNotBlank(ignoreFailureType)) {
|
||||
pattern = Pattern.compile(ignoreFailureType);
|
||||
}
|
||||
final List<String> urlList = new ArrayList<String>();
|
||||
final List<String> urlList = new ArrayList<>();
|
||||
for (final FailureUrl failureUrl : list) {
|
||||
if (pattern != null) {
|
||||
if (!pattern.matcher(failureUrl.getUrl()).matches()) {
|
||||
|
|
|
@ -117,7 +117,7 @@ public class FileConfigService implements Serializable {
|
|||
fctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
|
||||
});
|
||||
if (!fctltmList.isEmpty()) {
|
||||
final List<String> labelTypeIds = new ArrayList<String>(fctltmList.size());
|
||||
final List<String> labelTypeIds = new ArrayList<>(fctltmList.size());
|
||||
for (final FileConfigToLabel mapping : fctltmList) {
|
||||
labelTypeIds.add(mapping.getLabelTypeId());
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class FileConfigService implements Serializable {
|
|||
if (isNew) {
|
||||
// Insert
|
||||
if (labelTypeIds != null) {
|
||||
final List<FileConfigToLabel> fctltmList = new ArrayList<FileConfigToLabel>();
|
||||
final List<FileConfigToLabel> fctltmList = new ArrayList<>();
|
||||
for (final String labelTypeId : labelTypeIds) {
|
||||
final FileConfigToLabel mapping = new FileConfigToLabel();
|
||||
mapping.setFileConfigId(fileConfigId);
|
||||
|
@ -156,8 +156,8 @@ public class FileConfigService implements Serializable {
|
|||
fctltmCb.query().setFileConfigId_Equal(fileConfigId);
|
||||
fctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
|
||||
});
|
||||
final List<FileConfigToLabel> newList = new ArrayList<FileConfigToLabel>();
|
||||
final List<FileConfigToLabel> matchedList = new ArrayList<FileConfigToLabel>();
|
||||
final List<FileConfigToLabel> newList = new ArrayList<>();
|
||||
final List<FileConfigToLabel> matchedList = new ArrayList<>();
|
||||
for (final String id : labelTypeIds) {
|
||||
boolean exist = false;
|
||||
for (final FileConfigToLabel mapping : fctltmList) {
|
||||
|
|
|
@ -126,7 +126,7 @@ public class WebConfigService implements Serializable {
|
|||
wctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
|
||||
});
|
||||
if (!wctltmList.isEmpty()) {
|
||||
final List<String> labelTypeIds = new ArrayList<String>(wctltmList.size());
|
||||
final List<String> labelTypeIds = new ArrayList<>(wctltmList.size());
|
||||
for (final WebConfigToLabel mapping : wctltmList) {
|
||||
labelTypeIds.add(mapping.getLabelTypeId());
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public class WebConfigService implements Serializable {
|
|||
if (isNew) {
|
||||
// Insert
|
||||
if (labelTypeIds != null) {
|
||||
final List<WebConfigToLabel> wctltmList = new ArrayList<WebConfigToLabel>();
|
||||
final List<WebConfigToLabel> wctltmList = new ArrayList<>();
|
||||
for (final String id : labelTypeIds) {
|
||||
final WebConfigToLabel mapping = new WebConfigToLabel();
|
||||
mapping.setWebConfigId(webConfigId);
|
||||
|
@ -165,8 +165,8 @@ public class WebConfigService implements Serializable {
|
|||
wctltmCb.query().setWebConfigId_Equal(webConfigId);
|
||||
wctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
|
||||
});
|
||||
final List<WebConfigToLabel> newList = new ArrayList<WebConfigToLabel>();
|
||||
final List<WebConfigToLabel> matchedList = new ArrayList<WebConfigToLabel>();
|
||||
final List<WebConfigToLabel> newList = new ArrayList<>();
|
||||
final List<WebConfigToLabel> matchedList = new ArrayList<>();
|
||||
for (final String id : labelTypeIds) {
|
||||
boolean exist = false;
|
||||
for (final WebConfigToLabel mapping : list) {
|
||||
|
|
|
@ -225,7 +225,7 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
badWordService.store(entity);
|
||||
suggestHelper.addBadWord(entity.getSuggestWord());
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
badWordService.store(entity);
|
||||
suggestHelper.storeAllBadWords();
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
badWordService.delete(entity);
|
||||
suggestHelper.deleteBadWord(entity.getSuggestWord());
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asDetailsHtml());
|
||||
|
|
|
@ -167,7 +167,7 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
try {
|
||||
boostDocumentRuleService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
try {
|
||||
boostDocumentRuleService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
try {
|
||||
boostDocumentRuleService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
|
|
@ -211,7 +211,7 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
try {
|
||||
dataConfigService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
try {
|
||||
dataConfigService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
try {
|
||||
dataConfigService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
@ -313,9 +313,9 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
|
||||
protected void registerHandlerNames(final RenderData data) {
|
||||
final List<String> dataStoreNameList = dataStoreFactory.getDataStoreNameList();
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
for (final String name : dataStoreNameList) {
|
||||
final Map<String, String> map = new HashMap<String, String>();
|
||||
final Map<String, String> map = new HashMap<>();
|
||||
map.put(Constants.ITEM_LABEL, name);
|
||||
map.put(Constants.ITEM_VALUE, name);
|
||||
itemList.add(map);
|
||||
|
|
|
@ -86,7 +86,7 @@ public class AdminDesignAction extends FessAdminAction implements Serializable {
|
|||
|
||||
private List<String> loadFileNameItems() {
|
||||
final File baseDir = new File(getServletContext().getRealPath("/"));
|
||||
final List<String> fileNameItems = new ArrayList<String>();
|
||||
final List<String> fileNameItems = new ArrayList<>();
|
||||
final List<File> fileList = getAccessibleFileList(baseDir);
|
||||
final int length = baseDir.getAbsolutePath().length();
|
||||
for (final File file : fileList) {
|
||||
|
@ -281,7 +281,7 @@ public class AdminDesignAction extends FessAdminAction implements Serializable {
|
|||
}
|
||||
|
||||
private List<File> getAccessibleFileList(final File baseDir) {
|
||||
final List<File> fileList = new ArrayList<File>();
|
||||
final List<File> fileList = new ArrayList<>();
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "images"), fessConfig.getSupportedUploadedMediaExtentionsAsArray(), true));
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "css"), fessConfig.getSupportedUploadedCssExtentionsAsArray(), true));
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "js"), fessConfig.getSupportedUploadedJsExtentionsAsArray(), true));
|
||||
|
|
|
@ -26,5 +26,5 @@ public class ListForm implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Map<String, String> searchParams = new HashMap<String, String>();
|
||||
public Map<String, String> searchParams = new HashMap<>();
|
||||
}
|
||||
|
|
|
@ -275,7 +275,7 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
try {
|
||||
kuromojiService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
try {
|
||||
kuromojiService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
try {
|
||||
kuromojiService.delete(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
|
|
@ -279,7 +279,7 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
try {
|
||||
synonymService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
try {
|
||||
synonymService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
try {
|
||||
synonymService.delete(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
|
|
@ -168,7 +168,7 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
try {
|
||||
duplicateHostService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
try {
|
||||
duplicateHostService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
try {
|
||||
duplicateHostService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
|
|
@ -233,7 +233,7 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
suggestHelper.addElevateWord(entity.getSuggestWord(), entity.getReading(), entity.getLabelTypeValues(),
|
||||
entity.getTargetRole(), entity.getBoost());
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
suggestHelper.deleteAllElevateWord();
|
||||
suggestHelper.storeAllElevateWords();
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
elevateWordService.delete(entity);
|
||||
suggestHelper.deleteElevateWord(entity.getSuggestWord());
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
|
|
@ -185,7 +185,7 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
try {
|
||||
fileAuthenticationService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
try {
|
||||
fileAuthenticationService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
try {
|
||||
fileAuthenticationService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
@ -273,7 +273,7 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected void registerProtocolSchemeItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
final Locale locale = LaRequestUtil.getRequest().getLocale();
|
||||
itemList.add(createItem(ComponentUtil.getMessageManager().getMessage(locale, "labels.file_auth_scheme_samba"), Constants.SAMBA));
|
||||
itemList.add(createItem(ComponentUtil.getMessageManager().getMessage(locale, "labels.file_auth_scheme_ftp"), Constants.FTP));
|
||||
|
@ -281,7 +281,7 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected void registerFileConfigItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
final List<FileConfig> fileConfigList = fileConfigService.getAllFileConfigList(false, false, false, null);
|
||||
for (final FileConfig fileConfig : fileConfigList) {
|
||||
itemList.add(createItem(fileConfig.getName(), fileConfig.getId().toString()));
|
||||
|
@ -290,7 +290,7 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected Map<String, String> createItem(final String label, final String value) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
final Map<String, String> map = new HashMap<>(2);
|
||||
map.put(Constants.ITEM_LABEL, label);
|
||||
map.put(Constants.ITEM_VALUE, value);
|
||||
return map;
|
||||
|
|
|
@ -208,7 +208,7 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
try {
|
||||
fileConfigService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
try {
|
||||
fileConfigService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
try {
|
||||
fileConfigService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
|
|
@ -82,7 +82,7 @@ public class AdminGeneralAction extends FessAdminAction {
|
|||
});
|
||||
|
||||
final String[] toAddresses = form.notificationTo.split(",");
|
||||
final Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
final Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("hostname", systemHelper.getHostname());
|
||||
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
|
@ -188,7 +188,7 @@ public class AdminGeneralAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
private List<String> getDayItems() {
|
||||
final List<String> items = new ArrayList<String>();
|
||||
final List<String> items = new ArrayList<>();
|
||||
for (int i = 0; i < 32; i++) {
|
||||
items.add(Integer.toString(i));
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
keyMatchService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
ComponentUtil.getKeyMatchHelper().update();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
keyMatchService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
ComponentUtil.getKeyMatchHelper().update();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
keyMatchService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
ComponentUtil.getKeyMatchHelper().update();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
|
|
@ -206,7 +206,7 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
try {
|
||||
labelTypeService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
try {
|
||||
labelTypeService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
try {
|
||||
labelTypeService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
|
|
@ -75,7 +75,7 @@ public class AdminLogAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
private List<Map<String, Object>> getLogFileItems() {
|
||||
final List<Map<String, Object>> logFileItems = new ArrayList<Map<String, Object>>();
|
||||
final List<Map<String, Object>> logFileItems = new ArrayList<>();
|
||||
final String logFilePath = systemHelper.getLogFilePath();
|
||||
if (StringUtil.isNotBlank(logFilePath)) {
|
||||
final Path logDirPath = Paths.get(logFilePath);
|
||||
|
|
|
@ -169,7 +169,7 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
try {
|
||||
pathMappingService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
try {
|
||||
pathMappingService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
try {
|
||||
pathMappingService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
|
|
@ -185,7 +185,7 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
try {
|
||||
requestHeaderService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
try {
|
||||
requestHeaderService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
try {
|
||||
requestHeaderService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
@ -273,7 +273,7 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected void registerProtocolSchemeItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
final Locale locale = LaRequestUtil.getRequest().getLocale();
|
||||
itemList.add(createItem(ComponentUtil.getMessageManager().getMessage(locale, "labels.webauth_scheme_basic"), Constants.BASIC));
|
||||
itemList.add(createItem(ComponentUtil.getMessageManager().getMessage(locale, "labels.webauth_scheme_digest"), Constants.DIGEST));
|
||||
|
@ -282,7 +282,7 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected void registerWebConfigItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
final List<WebConfig> webConfigList = webConfigService.getAllWebConfigList(false, false, false, null);
|
||||
for (final WebConfig webConfig : webConfigList) {
|
||||
itemList.add(createItem(webConfig.getName(), webConfig.getId().toString()));
|
||||
|
@ -291,7 +291,7 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected Map<String, String> createItem(final String label, final String value) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
final Map<String, String> map = new HashMap<>(2);
|
||||
map.put(Constants.ITEM_LABEL, label);
|
||||
map.put(Constants.ITEM_VALUE, value);
|
||||
return map;
|
||||
|
|
|
@ -205,7 +205,7 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
try {
|
||||
scheduledJobService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
try {
|
||||
scheduledJobService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
try {
|
||||
scheduledJobService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ListForm implements SearchRequestParams, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
public Object getAttribute(final String name) {
|
||||
return LaRequestUtil.getRequest().getAttribute(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class AdminSysteminfoAction extends FessAdminAction {
|
|||
// ============
|
||||
|
||||
protected void registerEnvItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
for (final Map.Entry<String, String> entry : System.getenv().entrySet()) {
|
||||
itemList.add(createItem(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class AdminSysteminfoAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected void registerPropItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
for (final Map.Entry<Object, Object> entry : System.getProperties().entrySet()) {
|
||||
itemList.add(createItem(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class AdminSysteminfoAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected void registerFessPropItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
for (final Map.Entry<Object, Object> entry : systemProperties.entrySet()) {
|
||||
itemList.add(createItem(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class AdminSysteminfoAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected void registerBugReportItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
for (final String label : bugReportLabels) {
|
||||
itemList.add(createPropItem(label));
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class AdminSysteminfoAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected Map<String, String> createItem(final Object label, final Object value) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
final Map<String, String> map = new HashMap<>(2);
|
||||
map.put(Constants.ITEM_LABEL, label != null ? label.toString() : StringUtil.EMPTY);
|
||||
map.put(Constants.ITEM_VALUE, value != null ? value.toString() : StringUtil.EMPTY);
|
||||
return map;
|
||||
|
|
|
@ -126,7 +126,7 @@ public class AdminUpgradeAction extends FessAdminAction {
|
|||
|
||||
private void upgradeFrom10_0() {
|
||||
|
||||
IndicesAdminClient indicesClient = fessEsClient.admin().indices();
|
||||
final IndicesAdminClient indicesClient = fessEsClient.admin().indices();
|
||||
final String configIndex = ".fess_config";
|
||||
|
||||
try {
|
||||
|
@ -243,18 +243,19 @@ public class AdminUpgradeAction extends FessAdminAction {
|
|||
});
|
||||
|
||||
saveInfo(messages -> messages.addSuccessUpgradeFrom(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to upgrade data.", e);
|
||||
saveError(messages -> messages.addErrorsFailedToUpgradeFrom(GLOBAL, "10.0", e.getLocalizedMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
private void addFieldMapping(IndicesAdminClient indicesClient, final String index, final String type, final String field,
|
||||
private void addFieldMapping(final IndicesAdminClient indicesClient, final String index, final String type, final String field,
|
||||
final String source) {
|
||||
GetFieldMappingsResponse gfmResponse =
|
||||
final GetFieldMappingsResponse gfmResponse =
|
||||
indicesClient.prepareGetFieldMappings(index).addTypes(type).setFields(field).execute().actionGet();
|
||||
if (gfmResponse.fieldMappings(index, type, field).isNull()) {
|
||||
PutMappingResponse pmResponse = indicesClient.preparePutMapping(index).setType(type).setSource(source).execute().actionGet();
|
||||
final PutMappingResponse pmResponse =
|
||||
indicesClient.preparePutMapping(index).setType(type).setSource(source).execute().actionGet();
|
||||
if (!pmResponse.isAcknowledged()) {
|
||||
logger.warn("Failed to add " + field + " to " + index + "/" + type);
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ public class AdminUserAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected Map<String, String> createItem(final String label, final String value) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
final Map<String, String> map = new HashMap<>(2);
|
||||
map.put(Constants.ITEM_LABEL, label);
|
||||
map.put(Constants.ITEM_VALUE, value);
|
||||
return map;
|
||||
|
|
|
@ -183,7 +183,7 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
try {
|
||||
webAuthenticationService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
try {
|
||||
webAuthenticationService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
try {
|
||||
webAuthenticationService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
@ -271,7 +271,7 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected void registerProtocolSchemeItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
final Locale locale = LaRequestUtil.getRequest().getLocale();
|
||||
itemList.add(createItem(ComponentUtil.getMessageManager().getMessage(locale, "labels.webauth_scheme_basic"), Constants.BASIC));
|
||||
itemList.add(createItem(ComponentUtil.getMessageManager().getMessage(locale, "labels.webauth_scheme_digest"), Constants.DIGEST));
|
||||
|
@ -280,7 +280,7 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected void registerWebConfigItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
final List<WebConfig> webConfigList = webConfigService.getAllWebConfigList(false, false, false, null);
|
||||
for (final WebConfig webConfig : webConfigList) {
|
||||
itemList.add(createItem(webConfig.getName(), webConfig.getId().toString()));
|
||||
|
@ -289,7 +289,7 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected Map<String, String> createItem(final String label, final String value) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
final Map<String, String> map = new HashMap<>(2);
|
||||
map.put(Constants.ITEM_LABEL, label);
|
||||
map.put(Constants.ITEM_VALUE, value);
|
||||
return map;
|
||||
|
|
|
@ -208,7 +208,7 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
try {
|
||||
webConfigService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
try {
|
||||
webConfigService.store(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
try {
|
||||
webConfigService.delete(entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
|
|
|
@ -66,8 +66,8 @@ public abstract class FessAdminAction extends FessBaseAction {
|
|||
return LaServletContextUtil.getServletContext();
|
||||
}
|
||||
|
||||
protected String buildThrowableMessage(Throwable t) {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
protected String buildThrowableMessage(final Throwable t) {
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
Throwable current = t;
|
||||
while (current != null) {
|
||||
buf.append(current.getLocalizedMessage()).append(' ');
|
||||
|
|
|
@ -145,7 +145,7 @@ public abstract class FessSearchAction extends FessBaseAction {
|
|||
}
|
||||
}
|
||||
|
||||
final Map<String, String> labelMap = new LinkedHashMap<String, String>();
|
||||
final Map<String, String> labelMap = new LinkedHashMap<>();
|
||||
if (!labelTypeItems.isEmpty()) {
|
||||
for (final Map<String, String> map : labelTypeItems) {
|
||||
labelMap.put(map.get(Constants.ITEM_VALUE), map.get(Constants.ITEM_LABEL));
|
||||
|
@ -155,7 +155,7 @@ public abstract class FessSearchAction extends FessBaseAction {
|
|||
|
||||
// sort
|
||||
if (StringUtil.isBlank(form.sort)) {
|
||||
String[] defaultSortValues = fessConfig.getDefaultSortValues(getUserBean());
|
||||
final String[] defaultSortValues = fessConfig.getDefaultSortValues(getUserBean());
|
||||
if (defaultSortValues.length > 0) {
|
||||
form.sort = String.join(",", defaultSortValues);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class SearchForm implements SearchRequestParams, Serializable {
|
|||
|
||||
@Override
|
||||
public GeoInfo getGeoInfo() {
|
||||
GeoInfo geoInfo = createGeoInfo(LaRequestUtil.getRequest());
|
||||
final GeoInfo geoInfo = createGeoInfo(LaRequestUtil.getRequest());
|
||||
if (geoInfo != null) {
|
||||
return geoInfo;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class SearchForm implements SearchRequestParams, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
public Object getAttribute(final String name) {
|
||||
return LaRequestUtil.getRequest().getAttribute(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public class CacheAction extends FessSearchAction {
|
|||
return redirect(ErrorAction.class);
|
||||
}
|
||||
|
||||
StreamResponse response =
|
||||
final StreamResponse response =
|
||||
asStream(DocumentUtil.getValue(doc, fessConfig.getIndexFieldDocId(), String.class)).contentType("text/html; charset=UTF-8")
|
||||
.data(content.getBytes(Constants.CHARSET_UTF_8));
|
||||
response.headerContentDispositionInline(); // TODO will be fixed in lastaflute
|
||||
|
|
|
@ -40,7 +40,7 @@ public class LogoutAction extends FessSearchAction {
|
|||
|
||||
@Execute
|
||||
public HtmlResponse index() {
|
||||
final String username = getUserBean().map(u -> u.getUserId()).orElse("-");
|
||||
getUserBean().map(u -> u.getUserId()).orElse("-");
|
||||
activityHelper.logout(getUserBean());
|
||||
fessLoginAssist.logout();
|
||||
return redirect(LoginAction.class);
|
||||
|
|
|
@ -177,7 +177,7 @@ public class SearchAction extends FessSearchAction {
|
|||
buf.append(form.q);
|
||||
if (!form.fields.isEmpty() && form.fields.containsKey(LABEL_FIELD)) {
|
||||
final String[] values = form.fields.get(LABEL_FIELD);
|
||||
final List<String> labelList = new ArrayList<String>();
|
||||
final List<String> labelList = new ArrayList<>();
|
||||
if (values != null) {
|
||||
for (final String v : values) {
|
||||
labelList.add(v);
|
||||
|
@ -206,7 +206,7 @@ public class SearchAction extends FessSearchAction {
|
|||
pagingQueryList.add("sort=" + LaFunctions.u(form.sort));
|
||||
}
|
||||
if (form.lang != null) {
|
||||
final Set<String> langSet = new HashSet<String>();
|
||||
final Set<String> langSet = new HashSet<>();
|
||||
for (final String lang : form.lang) {
|
||||
if (StringUtil.isNotBlank(lang) && lang.length() < 1000) {
|
||||
if (Constants.ALL_LANGUAGES.equals(lang)) {
|
||||
|
|
|
@ -71,9 +71,9 @@ public class FessCrawlerThread extends CrawlerThread {
|
|||
ResponseData responseData = null;
|
||||
try {
|
||||
final CrawlingConfig crawlingConfig = crawlingConfigHelper.get(crawlerContext.getSessionId());
|
||||
final Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
final Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put(fessConfig.getIndexFieldUrl(), url);
|
||||
final List<String> roleTypeList = new ArrayList<String>();
|
||||
final List<String> roleTypeList = new ArrayList<>();
|
||||
StreamUtil.of(crawlingConfig.getPermissions()).forEach(p -> roleTypeList.add(p));
|
||||
if (url.startsWith("smb://")) {
|
||||
if (url.endsWith("/")) {
|
||||
|
@ -184,7 +184,7 @@ public class FessCrawlerThread extends CrawlerThread {
|
|||
try {
|
||||
storeChildUrls(childUrlSet.stream().filter(rd -> StringUtil.isNotBlank(rd.getUrl())).collect(Collectors.toSet()),
|
||||
urlQueue.getUrl(), urlQueue.getDepth() != null ? urlQueue.getDepth() + 1 : 1);
|
||||
} catch (Throwable t) {
|
||||
} catch (final Throwable t) {
|
||||
if (!ComponentUtil.available()) {
|
||||
throw new ContainerNotAvailableException(t);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ public class FessCrawlerThread extends CrawlerThread {
|
|||
protected Set<RequestData> getAnchorSet(final Object obj) {
|
||||
List<String> anchorList;
|
||||
if (obj instanceof String) {
|
||||
anchorList = new ArrayList<String>();
|
||||
anchorList = new ArrayList<>();
|
||||
anchorList.add(obj.toString());
|
||||
} else if (obj instanceof List<?>) {
|
||||
anchorList = (List<String>) obj;
|
||||
|
|
|
@ -98,13 +98,13 @@ public abstract class AbstractFessFileTransformer extends AbstractTransformer im
|
|||
|
||||
protected Map<String, Object> generateData(final ResponseData responseData) {
|
||||
final Extractor extractor = getExtractor(responseData);
|
||||
final Map<String, String> params = new HashMap<String, String>();
|
||||
final Map<String, String> params = new HashMap<>();
|
||||
params.put(TikaMetadataKeys.RESOURCE_NAME_KEY, getResourceName(responseData));
|
||||
final String mimeType = responseData.getMimeType();
|
||||
params.put(HttpHeaders.CONTENT_TYPE, mimeType);
|
||||
params.put(HttpHeaders.CONTENT_ENCODING, responseData.getCharSet());
|
||||
final UnsafeStringBuilder contentMetaBuf = new UnsafeStringBuilder(1000);
|
||||
final Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
final Map<String, Object> dataMap = new HashMap<>();
|
||||
final Map<String, Object> metaDataMap = new HashMap<>();
|
||||
String content;
|
||||
try (final InputStream in = responseData.getResponseBody()) {
|
||||
|
@ -286,7 +286,7 @@ public abstract class AbstractFessFileTransformer extends AbstractTransformer im
|
|||
// boost
|
||||
putResultDataBody(dataMap, fessConfig.getIndexFieldBoost(), crawlingConfig.getDocumentBoost());
|
||||
// label: labelType
|
||||
final Set<String> labelTypeSet = new HashSet<String>();
|
||||
final Set<String> labelTypeSet = new HashSet<>();
|
||||
for (final String labelType : crawlingConfig.getLabelTypeValues()) {
|
||||
labelTypeSet.add(labelType);
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ public abstract class AbstractFessFileTransformer extends AbstractTransformer im
|
|||
|
||||
public void addMetaContentMapping(final String metaname, final String dynamicField) {
|
||||
if (metaContentMapping == null) {
|
||||
metaContentMapping = new HashMap<String, String>();
|
||||
metaContentMapping = new HashMap<>();
|
||||
}
|
||||
metaContentMapping.put(metaname, dynamicField);
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
|
|||
|
||||
final Document document = parser.getDocument();
|
||||
|
||||
final Map<String, Object> dataMap = new LinkedHashMap<String, Object>();
|
||||
final Map<String, Object> dataMap = new LinkedHashMap<>();
|
||||
for (final Map.Entry<String, String> entry : fieldRuleMap.entrySet()) {
|
||||
final String path = entry.getValue();
|
||||
try {
|
||||
|
@ -278,7 +278,7 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
|
|||
// boost
|
||||
putResultDataBody(dataMap, fessConfig.getIndexFieldBoost(), crawlingConfig.getDocumentBoost());
|
||||
// label: labelType
|
||||
final Set<String> labelTypeSet = new HashSet<String>();
|
||||
final Set<String> labelTypeSet = new HashSet<>();
|
||||
for (final String labelType : crawlingConfig.getLabelTypeValues()) {
|
||||
labelTypeSet.add(labelType);
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
|
|||
labelTypeSet.addAll(labelTypeHelper.getMatchedLabelValueSet(url));
|
||||
putResultDataBody(dataMap, fessConfig.getIndexFieldLabel(), labelTypeSet);
|
||||
// role: roleType
|
||||
final List<String> roleTypeList = new ArrayList<String>();
|
||||
final List<String> roleTypeList = new ArrayList<>();
|
||||
StreamUtil.of(crawlingConfig.getPermissions()).forEach(p -> roleTypeList.add(p));
|
||||
putResultDataBody(dataMap, fessConfig.getIndexFieldRole(), roleTypeList);
|
||||
// id
|
||||
|
@ -315,7 +315,7 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
|
|||
}
|
||||
|
||||
protected String getLangXpath(final FessConfig fessConfig, final Map<String, String> xpathConfigMap) {
|
||||
String xpath = xpathConfigMap.get("default.lang");
|
||||
final String xpath = xpathConfigMap.get("default.lang");
|
||||
if (StringUtil.isNotBlank(xpath)) {
|
||||
return xpath;
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
|
|||
}
|
||||
|
||||
protected String getContentXpath(final FessConfig fessConfig, final Map<String, String> xpathConfigMap) {
|
||||
String xpath = xpathConfigMap.get("default.content");
|
||||
final String xpath = xpathConfigMap.get("default.content");
|
||||
if (StringUtil.isNotBlank(xpath)) {
|
||||
return xpath;
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
|
|||
}
|
||||
|
||||
protected String getDigestXpath(final FessConfig fessConfig, final Map<String, String> xpathConfigMap) {
|
||||
String xpath = xpathConfigMap.get("default.digest");
|
||||
final String xpath = xpathConfigMap.get("default.digest");
|
||||
if (StringUtil.isNotBlank(xpath)) {
|
||||
return xpath;
|
||||
}
|
||||
|
@ -398,8 +398,8 @@ public class FessXpathTransformer extends XpathTransformer implements FessTransf
|
|||
|
||||
protected Node pruneNode(final Node node) {
|
||||
final NodeList nodeList = node.getChildNodes();
|
||||
final List<Node> childNodeList = new ArrayList<Node>();
|
||||
final List<Node> removedNodeList = new ArrayList<Node>();
|
||||
final List<Node> childNodeList = new ArrayList<>();
|
||||
final List<Node> removedNodeList = new ArrayList<>();
|
||||
for (int i = 0; i < nodeList.getLength(); i++) {
|
||||
final Node childNode = nodeList.item(i);
|
||||
if (isPrunedTag(childNode.getNodeName())) {
|
||||
|
|
|
@ -241,7 +241,7 @@ public abstract class DictionaryFile<T extends DictionaryItem> {
|
|||
if (endPage > allPageCount) {
|
||||
endPage = allPageCount;
|
||||
}
|
||||
final List<Integer> pageNumberList = new ArrayList<Integer>();
|
||||
final List<Integer> pageNumberList = new ArrayList<>();
|
||||
for (int i = startPage; i <= endPage; i++) {
|
||||
pageNumberList.add(i);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class KuromojiFile extends DictionaryFile<KuromojiItem> {
|
|||
}
|
||||
|
||||
if (offset >= kuromojiItemList.size() || offset < 0) {
|
||||
return new PagingList<KuromojiItem>(Collections.<KuromojiItem> emptyList(), offset, size, kuromojiItemList.size());
|
||||
return new PagingList<>(Collections.<KuromojiItem> emptyList(), offset, size, kuromojiItemList.size());
|
||||
}
|
||||
|
||||
int toIndex = offset + size;
|
||||
|
@ -87,7 +87,7 @@ public class KuromojiFile extends DictionaryFile<KuromojiItem> {
|
|||
toIndex = kuromojiItemList.size();
|
||||
}
|
||||
|
||||
return new PagingList<KuromojiItem>(kuromojiItemList.subList(offset, toIndex), offset, size, kuromojiItemList.size());
|
||||
return new PagingList<>(kuromojiItemList.subList(offset, toIndex), offset, size, kuromojiItemList.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,7 +114,7 @@ public class KuromojiFile extends DictionaryFile<KuromojiItem> {
|
|||
}
|
||||
|
||||
protected void reload(final KuromojiUpdater updater, final InputStream in) {
|
||||
final List<KuromojiItem> itemList = new ArrayList<KuromojiItem>();
|
||||
final List<KuromojiItem> itemList = new ArrayList<>();
|
||||
try (BufferedReader reader =
|
||||
new BufferedReader(new InputStreamReader(in != null ? in : dictionaryManager.getContentInputStream(this), Constants.UTF_8))) {
|
||||
long id = 0;
|
||||
|
|
|
@ -78,7 +78,7 @@ public class SeunjeonFile extends DictionaryFile<SeunjeonItem> {
|
|||
}
|
||||
|
||||
if (offset >= seunjeonItemList.size() || offset < 0) {
|
||||
return new PagingList<SeunjeonItem>(Collections.<SeunjeonItem> emptyList(), offset, size, seunjeonItemList.size());
|
||||
return new PagingList<>(Collections.<SeunjeonItem> emptyList(), offset, size, seunjeonItemList.size());
|
||||
}
|
||||
|
||||
int toIndex = offset + size;
|
||||
|
@ -86,7 +86,7 @@ public class SeunjeonFile extends DictionaryFile<SeunjeonItem> {
|
|||
toIndex = seunjeonItemList.size();
|
||||
}
|
||||
|
||||
return new PagingList<SeunjeonItem>(seunjeonItemList.subList(offset, toIndex), offset, size, seunjeonItemList.size());
|
||||
return new PagingList<>(seunjeonItemList.subList(offset, toIndex), offset, size, seunjeonItemList.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -113,7 +113,7 @@ public class SeunjeonFile extends DictionaryFile<SeunjeonItem> {
|
|||
}
|
||||
|
||||
protected void reload(final SynonymUpdater updater, final InputStream in) {
|
||||
final List<SeunjeonItem> itemList = new ArrayList<SeunjeonItem>();
|
||||
final List<SeunjeonItem> itemList = new ArrayList<>();
|
||||
try (BufferedReader reader =
|
||||
new BufferedReader(new InputStreamReader(in != null ? in : dictionaryManager.getContentInputStream(this), Constants.UTF_8))) {
|
||||
long id = 0;
|
||||
|
@ -127,7 +127,7 @@ public class SeunjeonFile extends DictionaryFile<SeunjeonItem> {
|
|||
}
|
||||
|
||||
final List<String> inputStrings = split(line, ",");
|
||||
String[] inputs = new String[inputStrings.size()];
|
||||
final String[] inputs = new String[inputStrings.size()];
|
||||
for (int i = 0; i < inputs.length; i++) {
|
||||
inputs[i] = unescape(inputStrings.get(i)).trim();
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ public class SeunjeonFile extends DictionaryFile<SeunjeonItem> {
|
|||
}
|
||||
|
||||
private static List<String> split(final String s, final String separator) {
|
||||
final List<String> list = new ArrayList<String>(2);
|
||||
final List<String> list = new ArrayList<>(2);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int pos = 0;
|
||||
final int end = s.length();
|
||||
|
|
|
@ -78,7 +78,7 @@ public class SynonymFile extends DictionaryFile<SynonymItem> {
|
|||
}
|
||||
|
||||
if (offset >= synonymItemList.size() || offset < 0) {
|
||||
return new PagingList<SynonymItem>(Collections.<SynonymItem> emptyList(), offset, size, synonymItemList.size());
|
||||
return new PagingList<>(Collections.<SynonymItem> emptyList(), offset, size, synonymItemList.size());
|
||||
}
|
||||
|
||||
int toIndex = offset + size;
|
||||
|
@ -86,7 +86,7 @@ public class SynonymFile extends DictionaryFile<SynonymItem> {
|
|||
toIndex = synonymItemList.size();
|
||||
}
|
||||
|
||||
return new PagingList<SynonymItem>(synonymItemList.subList(offset, toIndex), offset, size, synonymItemList.size());
|
||||
return new PagingList<>(synonymItemList.subList(offset, toIndex), offset, size, synonymItemList.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,7 +114,7 @@ public class SynonymFile extends DictionaryFile<SynonymItem> {
|
|||
}
|
||||
|
||||
protected void reload(final SynonymUpdater updater, final InputStream in) {
|
||||
final List<SynonymItem> itemList = new ArrayList<SynonymItem>();
|
||||
final List<SynonymItem> itemList = new ArrayList<>();
|
||||
try (BufferedReader reader =
|
||||
new BufferedReader(new InputStreamReader(in != null ? in : dictionaryManager.getContentInputStream(this), Constants.UTF_8))) {
|
||||
long id = 0;
|
||||
|
@ -197,7 +197,7 @@ public class SynonymFile extends DictionaryFile<SynonymItem> {
|
|||
}
|
||||
|
||||
private static List<String> split(final String s, final String separator) {
|
||||
final List<String> list = new ArrayList<String>(2);
|
||||
final List<String> list = new ArrayList<>(2);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int pos = 0;
|
||||
final int end = s.length();
|
||||
|
|
|
@ -22,7 +22,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
public class DataStoreFactory {
|
||||
protected Map<String, DataStore> dataStoreMap = new LinkedHashMap<String, DataStore>();
|
||||
protected Map<String, DataStore> dataStoreMap = new LinkedHashMap<>();
|
||||
|
||||
public void add(final String name, final DataStore dataStore) {
|
||||
if (name == null || dataStore == null) {
|
||||
|
@ -37,7 +37,7 @@ public class DataStoreFactory {
|
|||
|
||||
public List<String> getDataStoreNameList() {
|
||||
final Set<String> nameSet = dataStoreMap.keySet();
|
||||
final List<String> nameList = new ArrayList<String>();
|
||||
final List<String> nameList = new ArrayList<>();
|
||||
nameList.addAll(nameSet);
|
||||
return nameList;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public abstract class AbstractDataStoreImpl implements DataStore {
|
|||
final Map<String, String> paramMap = initParamMap;
|
||||
|
||||
// default values
|
||||
final Map<String, Object> defaultDataMap = new HashMap<String, Object>();
|
||||
final Map<String, Object> defaultDataMap = new HashMap<>();
|
||||
|
||||
// cid
|
||||
final String configId = config.getConfigId();
|
||||
|
@ -79,13 +79,13 @@ public abstract class AbstractDataStoreImpl implements DataStore {
|
|||
// boost
|
||||
defaultDataMap.put(fessConfig.getIndexFieldBoost(), config.getBoost().toString());
|
||||
// label: labelType
|
||||
final List<String> labelTypeList = new ArrayList<String>();
|
||||
final List<String> labelTypeList = new ArrayList<>();
|
||||
for (final String labelType : config.getLabelTypeValues()) {
|
||||
labelTypeList.add(labelType);
|
||||
}
|
||||
defaultDataMap.put(fessConfig.getIndexFieldLabel(), labelTypeList);
|
||||
// role: roleType
|
||||
final List<String> roleTypeList = new ArrayList<String>();
|
||||
final List<String> roleTypeList = new ArrayList<>();
|
||||
StreamUtil.of(config.getPermissions()).forEach(p -> roleTypeList.add(p));
|
||||
defaultDataMap.put(fessConfig.getIndexFieldRole(), roleTypeList);
|
||||
// mimetype
|
||||
|
|
|
@ -85,7 +85,7 @@ public class CsvDataStoreImpl extends AbstractDataStoreImpl {
|
|||
|
||||
protected List<File> getCsvFileList(final Map<String, String> paramMap) {
|
||||
String value = paramMap.get(CSV_FILES_PARAM);
|
||||
final List<File> fileList = new ArrayList<File>();
|
||||
final List<File> fileList = new ArrayList<>();
|
||||
if (StringUtil.isBlank(value)) {
|
||||
value = paramMap.get(CSV_DIRS_PARAM);
|
||||
if (StringUtil.isBlank(value)) {
|
||||
|
@ -186,9 +186,9 @@ public class CsvDataStoreImpl extends AbstractDataStoreImpl {
|
|||
List<String> list;
|
||||
boolean loop = true;
|
||||
while ((list = csvReader.readValues()) != null && loop && alive) {
|
||||
final Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
final Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.putAll(defaultDataMap);
|
||||
final Map<String, String> resultMap = new LinkedHashMap<String, String>();
|
||||
final Map<String, String> resultMap = new LinkedHashMap<>();
|
||||
resultMap.putAll(paramMap);
|
||||
resultMap.put("csvfile", csvFile.getAbsolutePath());
|
||||
resultMap.put("csvfilename", csvFile.getName());
|
||||
|
@ -258,7 +258,7 @@ public class CsvDataStoreImpl extends AbstractDataStoreImpl {
|
|||
|
||||
String url;
|
||||
if (target instanceof DataStoreCrawlingException) {
|
||||
DataStoreCrawlingException dce = (DataStoreCrawlingException) target;
|
||||
final DataStoreCrawlingException dce = (DataStoreCrawlingException) target;
|
||||
url = dce.getUrl();
|
||||
if (dce.aborted()) {
|
||||
loop = false;
|
||||
|
|
|
@ -56,7 +56,7 @@ public class CsvListDataStoreImpl extends CsvDataStoreImpl {
|
|||
if (paramMap.containsKey(Constants.NUM_OF_THREADS)) {
|
||||
try {
|
||||
nThreads = Integer.parseInt(paramMap.get(Constants.NUM_OF_THREADS));
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
logger.warn(Constants.NUM_OF_THREADS + " is not int value.", e);
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class CsvListDataStoreImpl extends CsvDataStoreImpl {
|
|||
new FileListIndexUpdateCallbackImpl(callback, crawlerClientFactory, nThreads)) {
|
||||
super.storeData(dataConfig, fileListIndexUpdateCallback, paramMap, scriptMap, defaultDataMap);
|
||||
fileListIndexUpdateCallback.commit();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throw new DataStoreException(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ public class DatabaseDataStoreImpl extends AbstractDataStoreImpl {
|
|||
rs = stmt.executeQuery(sql); // SQL generated by an administrator
|
||||
boolean loop = true;
|
||||
while (rs.next() && loop && alive) {
|
||||
final Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
final Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.putAll(defaultDataMap);
|
||||
for (final Map.Entry<String, String> entry : scriptMap.entrySet()) {
|
||||
final Object convertValue = convertValue(entry.getValue(), rs, paramMap);
|
||||
|
@ -138,7 +138,7 @@ public class DatabaseDataStoreImpl extends AbstractDataStoreImpl {
|
|||
|
||||
String url;
|
||||
if (target instanceof DataStoreCrawlingException) {
|
||||
DataStoreCrawlingException dce = (DataStoreCrawlingException) target;
|
||||
final DataStoreCrawlingException dce = (DataStoreCrawlingException) target;
|
||||
url = dce.getUrl();
|
||||
if (dce.aborted()) {
|
||||
loop = false;
|
||||
|
|
|
@ -90,14 +90,14 @@ public class EsDataStoreImpl extends AbstractDataStoreImpl {
|
|||
.build();
|
||||
logger.info("Connecting to " + hostsStr + " with [" + settings.toDelimitedString(',') + "]");
|
||||
final InetSocketTransportAddress[] addresses = StreamUtil.of(hostsStr.split(",")).map(h -> {
|
||||
String[] values = h.trim().split(":");
|
||||
final String[] values = h.trim().split(":");
|
||||
try {
|
||||
if (values.length == 1) {
|
||||
return new InetSocketTransportAddress(InetAddress.getByName(values[0]), 9300);
|
||||
} else if (values.length == 2) {
|
||||
return new InetSocketTransportAddress(InetAddress.getByName(values[0]), Integer.parseInt(values[1]));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to parse address: " + h, e);
|
||||
}
|
||||
return null;
|
||||
|
@ -151,7 +151,7 @@ public class EsDataStoreImpl extends AbstractDataStoreImpl {
|
|||
break;
|
||||
}
|
||||
|
||||
final Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
final Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.putAll(defaultDataMap);
|
||||
final Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.putAll(paramMap);
|
||||
|
@ -204,7 +204,7 @@ public class EsDataStoreImpl extends AbstractDataStoreImpl {
|
|||
|
||||
String url;
|
||||
if (target instanceof DataStoreCrawlingException) {
|
||||
DataStoreCrawlingException dce = (DataStoreCrawlingException) target;
|
||||
final DataStoreCrawlingException dce = (DataStoreCrawlingException) target;
|
||||
url = dce.getUrl();
|
||||
if (dce.aborted()) {
|
||||
loop = false;
|
||||
|
|
|
@ -36,7 +36,7 @@ public class EsListDataStoreImpl extends EsDataStoreImpl {
|
|||
if (paramMap.containsKey(Constants.NUM_OF_THREADS)) {
|
||||
try {
|
||||
nThreads = Integer.parseInt(paramMap.get(Constants.NUM_OF_THREADS));
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (final NumberFormatException e) {
|
||||
logger.warn(Constants.NUM_OF_THREADS + " is not int value.", e);
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class EsListDataStoreImpl extends EsDataStoreImpl {
|
|||
new FileListIndexUpdateCallbackImpl(callback, crawlerClientFactory, nThreads)) {
|
||||
super.storeData(dataConfig, fileListIndexUpdateCallback, paramMap, scriptMap, defaultDataMap);
|
||||
fileListIndexUpdateCallback.commit();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
throw new DataStoreException(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,11 +54,11 @@ public class FileListIndexUpdateCallbackImpl implements IndexUpdateCallback, Aut
|
|||
|
||||
protected CrawlerClientFactory crawlerClientFactory;
|
||||
|
||||
protected List<String> deleteIdList = new ArrayList<String>(100);
|
||||
protected List<String> deleteIdList = new ArrayList<>(100);
|
||||
|
||||
protected int maxDeleteDocumentCacheSize = 100;
|
||||
|
||||
private ExecutorService executor;
|
||||
private final ExecutorService executor;
|
||||
|
||||
protected FileListIndexUpdateCallbackImpl(final IndexUpdateCallback indexUpdateCallback,
|
||||
final CrawlerClientFactory crawlerClientFactory, final int nThreads) {
|
||||
|
@ -67,7 +67,7 @@ public class FileListIndexUpdateCallbackImpl implements IndexUpdateCallback, Aut
|
|||
executor = newFixedThreadPool(nThreads < 1 ? 1 : nThreads);
|
||||
}
|
||||
|
||||
protected ExecutorService newFixedThreadPool(int nThreads) {
|
||||
protected ExecutorService newFixedThreadPool(final int nThreads) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Executor Thread Pool: " + nThreads);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class FileListIndexUpdateCallbackImpl implements IndexUpdateCallback, Aut
|
|||
});
|
||||
}
|
||||
|
||||
protected String getParamValue(Map<String, String> paramMap, String key, String defaultValue) {
|
||||
protected String getParamValue(final Map<String, String> paramMap, final String key, final String defaultValue) {
|
||||
return paramMap.getOrDefault(key, defaultValue);
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ public class FileListIndexUpdateCallbackImpl implements IndexUpdateCallback, Aut
|
|||
if (dataMap.containsKey(Constants.SESSION_ID)) {
|
||||
responseData.setSessionId((String) dataMap.get(Constants.SESSION_ID));
|
||||
} else {
|
||||
responseData.setSessionId((String) paramMap.get(Constants.CRAWLING_INFO_ID));
|
||||
responseData.setSessionId(paramMap.get(Constants.CRAWLING_INFO_ID));
|
||||
}
|
||||
|
||||
final RuleManager ruleManager = SingletonLaContainer.getComponent(RuleManager.class);
|
||||
|
@ -221,7 +221,7 @@ public class FileListIndexUpdateCallbackImpl implements IndexUpdateCallback, Aut
|
|||
return indexUpdateCallback.getExecuteTime();
|
||||
}
|
||||
|
||||
public void setMaxDeleteDocumentCacheSize(int maxDeleteDocumentCacheSize) {
|
||||
public void setMaxDeleteDocumentCacheSize(final int maxDeleteDocumentCacheSize) {
|
||||
this.maxDeleteDocumentCacheSize = maxDeleteDocumentCacheSize;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Map;
|
|||
public class FacetQueryView {
|
||||
protected String title;
|
||||
|
||||
protected Map<String, String> queryMap = new LinkedHashMap<String, String>();
|
||||
protected Map<String, String> queryMap = new LinkedHashMap<>();
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
|
|
|
@ -36,7 +36,7 @@ public class GeoInfo {
|
|||
|
||||
private QueryBuilder builder;
|
||||
|
||||
public GeoInfo(HttpServletRequest request) {
|
||||
public GeoInfo(final HttpServletRequest request) {
|
||||
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
final String[] geoFields = fessConfig.getQueryGeoFieldsAsArray();
|
||||
|
@ -48,9 +48,9 @@ public class GeoInfo {
|
|||
.forEach(
|
||||
e -> {
|
||||
final String key = e.getKey();
|
||||
for (String geoField : geoFields) {
|
||||
for (final String geoField : geoFields) {
|
||||
if (key.startsWith("geo." + geoField + ".")) {
|
||||
String distanceKey = key.replaceFirst(".point$", ".distance");
|
||||
final String distanceKey = key.replaceFirst(".point$", ".distance");
|
||||
final String distance = request.getParameter(distanceKey);
|
||||
if (StringUtil.isNotBlank(distance)) {
|
||||
StreamUtil.of(e.getValue()).forEach(
|
||||
|
@ -60,14 +60,14 @@ public class GeoInfo {
|
|||
list = new ArrayList<>();
|
||||
geoMap.put(geoField, list);
|
||||
}
|
||||
String[] values = pt.split(",");
|
||||
final String[] values = pt.split(",");
|
||||
if (values.length == 2) {
|
||||
try {
|
||||
double lat = Double.parseDouble(values[0]);
|
||||
double lon = Double.parseDouble(values[1]);
|
||||
final double lat = Double.parseDouble(values[0]);
|
||||
final double lon = Double.parseDouble(values[1]);
|
||||
list.add(QueryBuilders.geoDistanceQuery(geoField).distance(distance).lat(lat)
|
||||
.lon(lon));
|
||||
} catch (Exception ex) {
|
||||
} catch (final Exception ex) {
|
||||
throw new InvalidQueryException(messages -> messages
|
||||
.addErrorsInvalidQueryUnknown(UserMessages.GLOBAL_PROPERTY_KEY), ex
|
||||
.getLocalizedMessage());
|
||||
|
@ -84,11 +84,11 @@ public class GeoInfo {
|
|||
}
|
||||
});
|
||||
|
||||
QueryBuilder[] queryBuilders = geoMap.values().stream().map(list -> {
|
||||
final QueryBuilder[] queryBuilders = geoMap.values().stream().map(list -> {
|
||||
if (list.size() == 1) {
|
||||
return list.get(0);
|
||||
} else if (list.size() > 1) {
|
||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||
final BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||
list.forEach(q -> boolQuery.should(q));
|
||||
return boolQuery;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public class GeoInfo {
|
|||
if (queryBuilders.length == 1) {
|
||||
builder = queryBuilders[0];
|
||||
} else if (queryBuilders.length > 1) {
|
||||
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||
final BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
|
||||
StreamUtil.of(queryBuilders).forEach(q -> boolQuery.must(q));
|
||||
builder = boolQuery;
|
||||
}
|
||||
|
|
|
@ -49,43 +49,43 @@ public interface SearchRequestParams {
|
|||
|
||||
Locale getLocale();
|
||||
|
||||
public default String[] simplifyArray(String[] values) {
|
||||
public default String[] simplifyArray(final String[] values) {
|
||||
return StreamUtil.of(values).filter(q -> StringUtil.isNotBlank(q)).distinct().toArray(n -> new String[n]);
|
||||
}
|
||||
|
||||
public default String[] getParamValueArray(HttpServletRequest request, String param) {
|
||||
public default String[] getParamValueArray(final HttpServletRequest request, final String param) {
|
||||
return simplifyArray(request.getParameterValues(param));
|
||||
}
|
||||
|
||||
public default FacetInfo createFacetInfo(HttpServletRequest request) {
|
||||
String[] fields = getParamValueArray(request, "facet.field");
|
||||
String[] queries = getParamValueArray(request, "facet.query");
|
||||
public default FacetInfo createFacetInfo(final HttpServletRequest request) {
|
||||
final String[] fields = getParamValueArray(request, "facet.field");
|
||||
final String[] queries = getParamValueArray(request, "facet.query");
|
||||
if (fields.length == 0 && queries.length == 0) {
|
||||
return null;
|
||||
}
|
||||
FacetInfo facetInfo = new FacetInfo();
|
||||
final FacetInfo facetInfo = new FacetInfo();
|
||||
facetInfo.field = fields;
|
||||
facetInfo.query = queries;
|
||||
String sizeStr = request.getParameter("facet.size");
|
||||
final String sizeStr = request.getParameter("facet.size");
|
||||
if (StringUtil.isNotBlank(sizeStr)) {
|
||||
facetInfo.size = Integer.parseInt(sizeStr);
|
||||
}
|
||||
String minDocCountStr = request.getParameter("facet.minDocCount");
|
||||
final String minDocCountStr = request.getParameter("facet.minDocCount");
|
||||
if (StringUtil.isNotBlank(minDocCountStr)) {
|
||||
facetInfo.minDocCount = Long.parseLong(minDocCountStr);
|
||||
}
|
||||
String sort = request.getParameter("facet.sort");
|
||||
final String sort = request.getParameter("facet.sort");
|
||||
if (StringUtil.isNotBlank(sort)) {
|
||||
facetInfo.sort = sort;
|
||||
}
|
||||
String missing = request.getParameter("facet.missing");
|
||||
final String missing = request.getParameter("facet.missing");
|
||||
if (StringUtil.isNotBlank(missing)) {
|
||||
facetInfo.missing = missing;
|
||||
}
|
||||
return facetInfo;
|
||||
}
|
||||
|
||||
public default GeoInfo createGeoInfo(HttpServletRequest request) {
|
||||
public default GeoInfo createGeoInfo(final HttpServletRequest request) {
|
||||
return new GeoInfo(request);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -310,7 +310,7 @@ public class FessEsClient implements Client {
|
|||
final String configType = values[1];
|
||||
boolean exists = false;
|
||||
try {
|
||||
IndicesExistsResponse response =
|
||||
final IndicesExistsResponse response =
|
||||
client.admin().indices().prepareExists(configIndex).execute().actionGet(fessConfig.getIndexSearchTimeout());
|
||||
exists = response.isExists();
|
||||
} catch (final Exception e) {
|
||||
|
@ -369,13 +369,13 @@ public class FessEsClient implements Client {
|
|||
// alias
|
||||
final String aliasConfigDirPath = indexConfigPath + "/" + configIndex + "/alias";
|
||||
try {
|
||||
File aliasConfigDir = ResourceUtil.getResourceAsFile(aliasConfigDirPath);
|
||||
final File aliasConfigDir = ResourceUtil.getResourceAsFile(aliasConfigDirPath);
|
||||
if (aliasConfigDir.isDirectory()) {
|
||||
StreamUtil.of(aliasConfigDir.listFiles((dir, name) -> name.endsWith(".json"))).forEach(
|
||||
f -> {
|
||||
final String aliasName = f.getName().replaceFirst(".json$", "");
|
||||
final String source = FileUtil.readUTF8(f);
|
||||
IndicesAliasesResponse response =
|
||||
final IndicesAliasesResponse response =
|
||||
client.admin().indices().prepareAliases().addAlias(configIndex, aliasName, source).execute()
|
||||
.actionGet(fessConfig.getIndexIndicesTimeout());
|
||||
if (response.isAcknowledged()) {
|
||||
|
@ -385,9 +385,9 @@ public class FessEsClient implements Client {
|
|||
}
|
||||
});
|
||||
}
|
||||
} catch (ResourceNotFoundRuntimeException e) {
|
||||
} catch (final ResourceNotFoundRuntimeException e) {
|
||||
// ignore
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn(aliasConfigDirPath + " is not found.", e);
|
||||
}
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ public class FessEsClient implements Client {
|
|||
try {
|
||||
client.admin().indices().prepareFlush().setForce(true).execute()
|
||||
.actionGet(ComponentUtil.getFessConfig().getIndexIndicesTimeout());
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to flush indices.", e);
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -185,7 +185,7 @@ public class DataConfig extends BsDataConfig implements CrawlingConfig {
|
|||
public void initializeClientFactory(final CrawlerClientFactory crawlerClientFactory) {
|
||||
final Map<String, String> paramMap = getHandlerParameterMap();
|
||||
|
||||
final Map<String, Object> factoryParamMap = new HashMap<String, Object>();
|
||||
final Map<String, Object> factoryParamMap = new HashMap<>();
|
||||
crawlerClientFactory.setInitParameterMap(factoryParamMap);
|
||||
|
||||
// parameters
|
||||
|
@ -206,7 +206,7 @@ public class DataConfig extends BsDataConfig implements CrawlingConfig {
|
|||
final String webAuthStr = paramMap.get(CRAWLER_WEB_AUTH);
|
||||
if (StringUtil.isNotBlank(webAuthStr)) {
|
||||
final String[] webAuthNames = webAuthStr.split(",");
|
||||
final List<Authentication> basicAuthList = new ArrayList<Authentication>();
|
||||
final List<Authentication> basicAuthList = new ArrayList<>();
|
||||
for (final String webAuthName : webAuthNames) {
|
||||
final String scheme = paramMap.get(CRAWLER_WEB_AUTH + "." + webAuthName + ".scheme");
|
||||
final String hostname = paramMap.get(CRAWLER_WEB_AUTH + "." + webAuthName + ".host");
|
||||
|
@ -272,8 +272,7 @@ public class DataConfig extends BsDataConfig implements CrawlingConfig {
|
|||
}
|
||||
|
||||
// request header
|
||||
final List<org.codelibs.fess.crawler.client.http.RequestHeader> rhList =
|
||||
new ArrayList<org.codelibs.fess.crawler.client.http.RequestHeader>();
|
||||
final List<org.codelibs.fess.crawler.client.http.RequestHeader> rhList = new ArrayList<>();
|
||||
int count = 1;
|
||||
String headerName = paramMap.get(CRAWLER_WEB_HEADER_PREFIX + count + ".name");
|
||||
while (StringUtil.isNotBlank(headerName)) {
|
||||
|
|
|
@ -53,7 +53,7 @@ public class FileAuthentication extends BsFileAuthentication {
|
|||
final FileConfigService fileConfigService = ComponentUtil.getComponent(FileConfigService.class);
|
||||
try {
|
||||
fileConfig = fileConfigService.getFileConfig(getFileConfigId()).get();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("File Config " + getFileConfigId() + " does not exist.", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ public class FileConfig extends BsFileConfig implements CrawlingConfig {
|
|||
|
||||
if (includedDocPathPatterns == null) {
|
||||
if (StringUtil.isNotBlank(getIncludedDocPaths())) {
|
||||
final List<Pattern> pathPatterList = new ArrayList<Pattern>();
|
||||
final List<Pattern> pathPatterList = new ArrayList<>();
|
||||
final String[] paths = getIncludedDocPaths().split("[\r\n]");
|
||||
for (final String u : paths) {
|
||||
if (StringUtil.isNotBlank(u) && !u.trim().startsWith("#")) {
|
||||
|
@ -161,7 +161,7 @@ public class FileConfig extends BsFileConfig implements CrawlingConfig {
|
|||
|
||||
if (excludedDocPathPatterns == null) {
|
||||
if (StringUtil.isNotBlank(getExcludedDocPaths())) {
|
||||
final List<Pattern> pathPatterList = new ArrayList<Pattern>();
|
||||
final List<Pattern> pathPatterList = new ArrayList<>();
|
||||
final String[] paths = getExcludedDocPaths().split("[\r\n]");
|
||||
for (final String u : paths) {
|
||||
if (StringUtil.isNotBlank(u) && !u.trim().startsWith("#")) {
|
||||
|
@ -202,7 +202,7 @@ public class FileConfig extends BsFileConfig implements CrawlingConfig {
|
|||
final FileAuthenticationService fileAuthenticationService = ComponentUtil.getComponent(FileAuthenticationService.class);
|
||||
|
||||
// Parameters
|
||||
final Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
final Map<String, Object> paramMap = new HashMap<>();
|
||||
clientFactory.setInitParameterMap(paramMap);
|
||||
|
||||
final Map<String, String> clientConfigMap = getConfigParameterMap(ConfigName.CLIENT);
|
||||
|
|
|
@ -57,7 +57,7 @@ public class RequestHeader extends BsRequestHeader {
|
|||
final WebConfigService webConfigService = ComponentUtil.getComponent(WebConfigService.class);
|
||||
try {
|
||||
webConfig = webConfigService.getWebConfig(getWebConfigId()).get();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Web Config " + getWebConfigId() + " does not exist.", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ public class WebAuthentication extends BsWebAuthentication {
|
|||
final WebConfigService webConfigService = ComponentUtil.getComponent(WebConfigService.class);
|
||||
try {
|
||||
webConfig = webConfigService.getWebConfig(getWebConfigId()).get();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Web Config " + getWebConfigId() + " does not exist.", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ public class WebConfig extends BsWebConfig implements CrawlingConfig {
|
|||
|
||||
if (includedDocUrlPatterns == null) {
|
||||
if (StringUtil.isNotBlank(getIncludedDocUrls())) {
|
||||
final List<Pattern> urlPatterList = new ArrayList<Pattern>();
|
||||
final List<Pattern> urlPatterList = new ArrayList<>();
|
||||
final String[] urls = getIncludedDocUrls().split("[\r\n]");
|
||||
for (final String u : urls) {
|
||||
if (StringUtil.isNotBlank(u) && !u.trim().startsWith("#")) {
|
||||
|
@ -160,7 +160,7 @@ public class WebConfig extends BsWebConfig implements CrawlingConfig {
|
|||
|
||||
if (excludedDocUrlPatterns == null) {
|
||||
if (StringUtil.isNotBlank(getExcludedDocUrls())) {
|
||||
final List<Pattern> urlPatterList = new ArrayList<Pattern>();
|
||||
final List<Pattern> urlPatterList = new ArrayList<>();
|
||||
final String[] urls = getExcludedDocUrls().split("[\r\n]");
|
||||
for (final String u : urls) {
|
||||
if (StringUtil.isNotBlank(u) && !u.trim().startsWith("#")) {
|
||||
|
@ -202,7 +202,7 @@ public class WebConfig extends BsWebConfig implements CrawlingConfig {
|
|||
final RequestHeaderService requestHeaderService = ComponentUtil.getComponent(RequestHeaderService.class);
|
||||
|
||||
// HttpClient Parameters
|
||||
final Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
final Map<String, Object> paramMap = new HashMap<>();
|
||||
clientFactory.setInitParameterMap(paramMap);
|
||||
|
||||
final Map<String, String> clientConfigMap = getConfigParameterMap(ConfigName.CLIENT);
|
||||
|
@ -216,7 +216,7 @@ public class WebConfig extends BsWebConfig implements CrawlingConfig {
|
|||
}
|
||||
|
||||
final List<WebAuthentication> webAuthList = webAuthenticationService.getWebAuthenticationList(getId());
|
||||
final List<Authentication> basicAuthList = new ArrayList<Authentication>();
|
||||
final List<Authentication> basicAuthList = new ArrayList<>();
|
||||
for (final WebAuthentication webAuth : webAuthList) {
|
||||
basicAuthList.add(webAuth.getAuthentication());
|
||||
}
|
||||
|
@ -224,8 +224,7 @@ public class WebConfig extends BsWebConfig implements CrawlingConfig {
|
|||
|
||||
// request header
|
||||
final List<RequestHeader> requestHeaderList = requestHeaderService.getRequestHeaderList(getId());
|
||||
final List<org.codelibs.fess.crawler.client.http.RequestHeader> rhList =
|
||||
new ArrayList<org.codelibs.fess.crawler.client.http.RequestHeader>();
|
||||
final List<org.codelibs.fess.crawler.client.http.RequestHeader> rhList = new ArrayList<>();
|
||||
for (final RequestHeader requestHeader : requestHeaderList) {
|
||||
rhList.add(requestHeader.getCrawlerRequestHeader());
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ContainerNotAvailableException extends FessSystemException {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ContainerNotAvailableException(Throwable cause) {
|
||||
public ContainerNotAvailableException(final Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public class DataStoreCrawlingException extends CrawlingAccessException {
|
|||
|
||||
private final String url;
|
||||
|
||||
private boolean abort;
|
||||
private final boolean abort;
|
||||
|
||||
public DataStoreCrawlingException(final String url, final String message, final Exception e) {
|
||||
this(url, message, e, false);
|
||||
|
|
|
@ -169,7 +169,7 @@ public class Crawler implements Serializable {
|
|||
System.getProperties().entrySet().stream().forEach(e -> logger.debug("Property: " + e.getKey() + "=" + e.getValue()));
|
||||
System.getenv().entrySet().forEach(e -> logger.debug("Env: " + e.getKey() + "=" + e.getValue()));
|
||||
logger.debug("Option: " + options);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class SuggestCreator implements Serializable {
|
|||
System.getProperties().entrySet().stream().forEach(e -> logger.debug("Property: " + e.getKey() + "=" + e.getValue()));
|
||||
System.getenv().entrySet().forEach(e -> logger.debug("Env: " + e.getKey() + "=" + e.getValue()));
|
||||
logger.debug("Option: " + options);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class ActivityHelper {
|
|||
LOGIN, LOGOUT, ACCESS;
|
||||
}
|
||||
|
||||
public void setLoggerName(String loggerName) {
|
||||
public void setLoggerName(final String loggerName) {
|
||||
this.loggerName = loggerName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class CrawlingConfigHelper implements Serializable {
|
|||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CrawlingConfigHelper.class);
|
||||
|
||||
protected final Map<String, CrawlingConfig> crawlingConfigMap = new ConcurrentHashMap<String, CrawlingConfig>();
|
||||
protected final Map<String, CrawlingConfig> crawlingConfigMap = new ConcurrentHashMap<>();
|
||||
|
||||
protected int count = 1;
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ public class CrawlingInfoHelper implements Serializable {
|
|||
}
|
||||
|
||||
if (infoMap != null) {
|
||||
final List<CrawlingInfoParam> crawlingInfoParamList = new ArrayList<CrawlingInfoParam>();
|
||||
final List<CrawlingInfoParam> crawlingInfoParamList = new ArrayList<>();
|
||||
for (final Map.Entry<String, String> entry : infoMap.entrySet()) {
|
||||
final CrawlingInfoParam crawlingInfoParam = new CrawlingInfoParam();
|
||||
crawlingInfoParam.setCrawlingInfoId(crawlingInfo.getId());
|
||||
|
@ -144,7 +144,7 @@ public class CrawlingInfoHelper implements Serializable {
|
|||
|
||||
public Map<String, String> getInfoMap(final String sessionId) {
|
||||
final List<CrawlingInfoParam> crawlingInfoParamList = getCrawlingInfoService().getLastCrawlingInfoParamList(sessionId);
|
||||
final Map<String, String> map = new HashMap<String, String>();
|
||||
final Map<String, String> map = new HashMap<>();
|
||||
for (final CrawlingInfoParam crawlingInfoParam : crawlingInfoParamList) {
|
||||
map.put(crawlingInfoParam.getKey(), crawlingInfoParam.getValue());
|
||||
}
|
||||
|
@ -173,11 +173,11 @@ public class CrawlingInfoHelper implements Serializable {
|
|||
queryRequestBuilder.setPreference(Constants.SEARCH_PREFERENCE_PRIMARY);
|
||||
return true;
|
||||
}, (queryRequestBuilder, execTime, searchResponse) -> {
|
||||
final List<Map<String, String>> sessionIdList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> sessionIdList = new ArrayList<>();
|
||||
searchResponse.ifPresent(response -> {
|
||||
final Terms terms = response.getAggregations().get(fessConfig.getIndexFieldSegment());
|
||||
for (final Bucket bucket : terms.getBuckets()) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
final Map<String, String> map = new HashMap<>(2);
|
||||
map.put(fessConfig.getIndexFieldSegment(), bucket.getKey().toString());
|
||||
map.put(FACET_COUNT_KEY, Long.toString(bucket.getDocCount()));
|
||||
sessionIdList.add(map);
|
||||
|
|
|
@ -92,16 +92,16 @@ public class DataIndexHelper implements Serializable {
|
|||
}
|
||||
|
||||
protected void doCrawl(final String sessionId, final List<DataConfig> configList) {
|
||||
int multiprocessCrawlingCount = ComponentUtil.getFessConfig().getCrawlingThreadCount();
|
||||
final int multiprocessCrawlingCount = ComponentUtil.getFessConfig().getCrawlingThreadCount();
|
||||
|
||||
final long startTime = System.currentTimeMillis();
|
||||
|
||||
final IndexUpdateCallback indexUpdateCallback = ComponentUtil.getComponent(IndexUpdateCallback.class);
|
||||
|
||||
final List<String> sessionIdList = new ArrayList<String>();
|
||||
final Map<String, String> initParamMap = new HashMap<String, String>();
|
||||
final List<String> sessionIdList = new ArrayList<>();
|
||||
final Map<String, String> initParamMap = new HashMap<>();
|
||||
dataCrawlingThreadList.clear();
|
||||
final List<String> dataCrawlingThreadStatusList = new ArrayList<String>();
|
||||
final List<String> dataCrawlingThreadStatusList = new ArrayList<>();
|
||||
for (final DataConfig dataConfig : configList) {
|
||||
final String sid = crawlingConfigHelper.store(sessionId, dataConfig);
|
||||
sessionIdList.add(sid);
|
||||
|
|
|
@ -34,7 +34,7 @@ public class DuplicateHostHelper implements Serializable {
|
|||
@PostConstruct
|
||||
public void init() {
|
||||
if (duplicateHostList == null) {
|
||||
duplicateHostList = new ArrayList<DuplicateHost>();
|
||||
duplicateHostList = new ArrayList<>();
|
||||
}
|
||||
final DuplicateHostService duplicateHostService = ComponentUtil.getComponent(DuplicateHostService.class);
|
||||
duplicateHostList.addAll(duplicateHostService.getDuplicateHostList());
|
||||
|
@ -46,7 +46,7 @@ public class DuplicateHostHelper implements Serializable {
|
|||
|
||||
public void add(final DuplicateHost duplicateHost) {
|
||||
if (duplicateHostList == null) {
|
||||
duplicateHostList = new ArrayList<DuplicateHost>();
|
||||
duplicateHostList = new ArrayList<>();
|
||||
}
|
||||
duplicateHostList.add(duplicateHost);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class FileTypeHelper {
|
|||
|
||||
protected String defaultValue = "others";
|
||||
|
||||
protected Map<String, String> mimetypeMap = new HashMap<String, String>();
|
||||
protected Map<String, String> mimetypeMap = new HashMap<>();
|
||||
|
||||
public void add(final String mimetype, final String filetype) {
|
||||
mimetypeMap.put(mimetype, filetype);
|
||||
|
|
|
@ -26,7 +26,7 @@ public class IntervalControlHelper {
|
|||
|
||||
public long crawlerWaitMillis = 10000;
|
||||
|
||||
protected List<IntervalRule> ruleList = new ArrayList<IntervalRule>();
|
||||
protected List<IntervalRule> ruleList = new ArrayList<>();
|
||||
|
||||
public void checkCrawlerStatus() {
|
||||
while (!crawlerRunning) {
|
||||
|
@ -102,7 +102,7 @@ public class IntervalControlHelper {
|
|||
toHours = tints[0];
|
||||
toMinutes = tints[1];
|
||||
final String[] values = days.split(",");
|
||||
final List<Integer> list = new ArrayList<Integer>();
|
||||
final List<Integer> list = new ArrayList<>();
|
||||
for (final String value : values) {
|
||||
try {
|
||||
list.add(Integer.parseInt(value.trim()));
|
||||
|
|
|
@ -121,12 +121,12 @@ public class JobHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isAvailable(String id) {
|
||||
public boolean isAvailable(final String id) {
|
||||
return ComponentUtil.getComponent(ScheduledJobBhv.class).selectByPK(id).filter(e -> Boolean.TRUE.equals(e.getAvailable()))
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
public void store(JobLog jobLog) {
|
||||
public void store(final JobLog jobLog) {
|
||||
ComponentUtil.getComponent(JobLogBhv.class).insertOrUpdate(jobLog, op -> {
|
||||
op.setRefresh(true);
|
||||
});
|
||||
|
|
|
@ -44,7 +44,7 @@ public class LabelTypeHelper implements Serializable {
|
|||
@Resource
|
||||
protected RoleQueryHelper roleQueryHelper;
|
||||
|
||||
protected volatile List<LabelTypeItem> labelTypeItemList = new ArrayList<LabelTypeItem>();
|
||||
protected volatile List<LabelTypeItem> labelTypeItemList = new ArrayList<>();
|
||||
|
||||
protected volatile List<LabelTypePattern> labelTypePatternList;
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class LabelTypeHelper implements Serializable {
|
|||
}
|
||||
|
||||
private void buildLabelTypeItems(final List<LabelType> labelTypeList) {
|
||||
final List<LabelTypeItem> itemList = new ArrayList<LabelTypeItem>();
|
||||
final List<LabelTypeItem> itemList = new ArrayList<>();
|
||||
for (final LabelType labelType : labelTypeList) {
|
||||
final LabelTypeItem item = new LabelTypeItem();
|
||||
item.setLabel(labelType.getName());
|
||||
|
@ -79,11 +79,11 @@ public class LabelTypeHelper implements Serializable {
|
|||
init();
|
||||
}
|
||||
|
||||
final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
final Set<String> roleSet = roleQueryHelper.build();
|
||||
if (roleSet.isEmpty()) {
|
||||
for (final LabelTypeItem item : labelTypeItemList) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
final Map<String, String> map = new HashMap<>(2);
|
||||
map.put(Constants.ITEM_LABEL, item.getLabel());
|
||||
map.put(Constants.ITEM_VALUE, item.getValue());
|
||||
itemList.add(map);
|
||||
|
@ -92,7 +92,7 @@ public class LabelTypeHelper implements Serializable {
|
|||
for (final LabelTypeItem item : labelTypeItemList) {
|
||||
for (final String roleValue : roleSet) {
|
||||
if (item.getRoleValueList().contains(roleValue)) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
final Map<String, String> map = new HashMap<>(2);
|
||||
map.put(Constants.ITEM_LABEL, item.getLabel());
|
||||
map.put(Constants.ITEM_VALUE, item.getValue());
|
||||
itemList.add(map);
|
||||
|
@ -110,7 +110,7 @@ public class LabelTypeHelper implements Serializable {
|
|||
synchronized (this) {
|
||||
if (labelTypePatternList == null) {
|
||||
final List<LabelType> labelTypeList = getLabelTypeService().getLabelTypeList();
|
||||
final List<LabelTypePattern> list = new ArrayList<LabelTypePattern>();
|
||||
final List<LabelTypePattern> list = new ArrayList<>();
|
||||
for (final LabelType labelType : labelTypeList) {
|
||||
final String includedPaths = labelType.getIncludedPaths();
|
||||
final String excludedPaths = labelType.getExcludedPaths();
|
||||
|
@ -132,7 +132,7 @@ public class LabelTypeHelper implements Serializable {
|
|||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
final Set<String> valueSet = new HashSet<String>();
|
||||
final Set<String> valueSet = new HashSet<>();
|
||||
for (final LabelTypePattern pattern : labelTypePatternList) {
|
||||
if (pattern.match(path)) {
|
||||
valueSet.add(pattern.getValue());
|
||||
|
|
|
@ -37,7 +37,7 @@ public class PathMappingHelper implements Serializable {
|
|||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PathMappingHelper.class);
|
||||
|
||||
private final Map<String, List<PathMapping>> pathMappingMap = new HashMap<String, List<PathMapping>>();
|
||||
private final Map<String, List<PathMapping>> pathMappingMap = new HashMap<>();
|
||||
|
||||
volatile List<PathMapping> cachedPathMappingList = null;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public class PermissionHelper {
|
|||
return permission;
|
||||
}
|
||||
|
||||
public String decode(String value) {
|
||||
public String decode(final String value) {
|
||||
if (StringUtil.isBlank(value)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -62,15 +62,15 @@ public class PermissionHelper {
|
|||
return value;
|
||||
}
|
||||
|
||||
public void setRolePrefix(String rolePrefix) {
|
||||
public void setRolePrefix(final String rolePrefix) {
|
||||
this.rolePrefix = rolePrefix;
|
||||
}
|
||||
|
||||
public void setGroupPrefix(String groupPrefix) {
|
||||
public void setGroupPrefix(final String groupPrefix) {
|
||||
this.groupPrefix = groupPrefix;
|
||||
}
|
||||
|
||||
public void setUserPrefix(String userPrefix) {
|
||||
public void setUserPrefix(final String userPrefix) {
|
||||
this.userPrefix = userPrefix;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class PopularWordHelper {
|
|||
return cache.get(
|
||||
getCacheKey(baseSeed, baseTags, baseRoles, baseFields, baseExcludes),
|
||||
() -> {
|
||||
final List<String> wordList = new ArrayList<String>();
|
||||
final List<String> wordList = new ArrayList<>();
|
||||
final SuggestHelper suggestHelper = ComponentUtil.getSuggestHelper();
|
||||
final PopularWordsRequestBuilder popularWordsRequestBuilder =
|
||||
suggestHelper.suggester().popularWords()
|
||||
|
|
|
@ -748,7 +748,7 @@ public class QueryHelper implements Serializable {
|
|||
}
|
||||
|
||||
final HttpServletRequest request = LaRequestUtil.getOptionalRequest().orElse(null);
|
||||
final Map<String, String[]> queryParamMap = new HashMap<String, String[]>();
|
||||
final Map<String, String[]> queryParamMap = new HashMap<>();
|
||||
for (final Map.Entry<String, String[]> entry : queryRequestHeaderMap.entrySet()) {
|
||||
final String[] values = entry.getValue();
|
||||
final String[] newValues = new String[values.length];
|
||||
|
|
|
@ -218,7 +218,7 @@ public class RoleQueryHelper {
|
|||
|
||||
public void addCookieNameMapping(final String cookieName, final String roleName) {
|
||||
if (cookieNameMap == null) {
|
||||
cookieNameMap = new HashMap<String, String>();
|
||||
cookieNameMap = new HashMap<>();
|
||||
}
|
||||
cookieNameMap.put(cookieName, roleName);
|
||||
}
|
||||
|
|
|
@ -65,15 +65,15 @@ public class SearchLogHelper {
|
|||
|
||||
public int userInfoCacheSize = 1000;
|
||||
|
||||
protected volatile Queue<SearchLog> searchLogQueue = new ConcurrentLinkedQueue<SearchLog>();
|
||||
protected volatile Queue<SearchLog> searchLogQueue = new ConcurrentLinkedQueue<>();
|
||||
|
||||
protected volatile Queue<ClickLog> clickLogQueue = new ConcurrentLinkedQueue<ClickLog>();
|
||||
protected volatile Queue<ClickLog> clickLogQueue = new ConcurrentLinkedQueue<>();
|
||||
|
||||
protected Map<String, Long> userInfoCache;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
userInfoCache = new LruHashMap<String, Long>(userInfoCacheSize);
|
||||
userInfoCache = new LruHashMap<>(userInfoCacheSize);
|
||||
}
|
||||
|
||||
public void addSearchLog(final LocalDateTime requestedTime, final String queryId, final String query, final int pageStart,
|
||||
|
@ -139,13 +139,13 @@ public class SearchLogHelper {
|
|||
public void storeSearchLog() {
|
||||
if (!searchLogQueue.isEmpty()) {
|
||||
final Queue<SearchLog> queue = searchLogQueue;
|
||||
searchLogQueue = new ConcurrentLinkedQueue<SearchLog>();
|
||||
searchLogQueue = new ConcurrentLinkedQueue<>();
|
||||
processSearchLogQueue(queue);
|
||||
}
|
||||
|
||||
if (!clickLogQueue.isEmpty()) {
|
||||
final Queue<ClickLog> queue = clickLogQueue;
|
||||
clickLogQueue = new ConcurrentLinkedQueue<ClickLog>();
|
||||
clickLogQueue = new ConcurrentLinkedQueue<>();
|
||||
processClickLogQueue(queue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class SystemHelper implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected final Map<String, String> designJspFileNameMap = new HashMap<String, String>();
|
||||
protected final Map<String, String> designJspFileNameMap = new HashMap<>();
|
||||
|
||||
protected final AtomicBoolean forceStop = new AtomicBoolean(false);
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public class UserInfoHelper {
|
|||
if (session != null) {
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
|
||||
final List<String> docIdList = new ArrayList<String>();
|
||||
final List<String> docIdList = new ArrayList<>();
|
||||
for (final Map<String, Object> map : documentItems) {
|
||||
final Object docId = map.get(fessConfig.getIndexFieldDocId());
|
||||
if (docId != null && docId.toString().length() > 0) {
|
||||
|
@ -144,7 +144,7 @@ public class UserInfoHelper {
|
|||
@SuppressWarnings("unchecked")
|
||||
Map<String, String[]> resultDocIdsCache = (Map<String, String[]>) session.getAttribute(Constants.RESULT_DOC_ID_CACHE);
|
||||
if (resultDocIdsCache == null) {
|
||||
resultDocIdsCache = new LruHashMap<String, String[]>(resultDocIdsCacheSize);
|
||||
resultDocIdsCache = new LruHashMap<>(resultDocIdsCacheSize);
|
||||
session.setAttribute(Constants.RESULT_DOC_ID_CACHE, resultDocIdsCache);
|
||||
}
|
||||
return resultDocIdsCache;
|
||||
|
|
|
@ -125,13 +125,13 @@ public class ViewHelper implements Serializable {
|
|||
|
||||
protected boolean useSession = true;
|
||||
|
||||
private final Map<String, String> pageCacheMap = new ConcurrentHashMap<String, String>();
|
||||
private final Map<String, String> pageCacheMap = new ConcurrentHashMap<>();
|
||||
|
||||
private final Map<String, String> initFacetParamMap = new HashMap<String, String>();
|
||||
private final Map<String, String> initFacetParamMap = new HashMap<>();
|
||||
|
||||
private final Map<String, String> initGeoParamMap = new HashMap<String, String>();
|
||||
private final Map<String, String> initGeoParamMap = new HashMap<>();
|
||||
|
||||
private final List<FacetQueryView> facetQueryViewList = new ArrayList<FacetQueryView>();
|
||||
private final List<FacetQueryView> facetQueryViewList = new ArrayList<>();
|
||||
|
||||
public String cacheTemplateName = "cache";
|
||||
|
||||
|
|
|
@ -128,16 +128,16 @@ public class WebFsIndexHelper implements Serializable {
|
|||
}
|
||||
|
||||
protected void doCrawl(final String sessionId, final List<WebConfig> webConfigList, final List<FileConfig> fileConfigList) {
|
||||
int multiprocessCrawlingCount = ComponentUtil.getFessConfig().getCrawlingThreadCount();
|
||||
final int multiprocessCrawlingCount = ComponentUtil.getFessConfig().getCrawlingThreadCount();
|
||||
|
||||
final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
|
||||
final long startTime = System.currentTimeMillis();
|
||||
|
||||
final List<String> sessionIdList = new ArrayList<String>();
|
||||
final List<String> sessionIdList = new ArrayList<>();
|
||||
crawlerList.clear();
|
||||
final List<String> crawlerStatusList = new ArrayList<String>();
|
||||
final List<String> crawlerStatusList = new ArrayList<>();
|
||||
// Web
|
||||
for (final WebConfig webConfig : webConfigList) {
|
||||
final String sid = crawlingConfigHelper.store(sessionId, webConfig);
|
||||
|
@ -184,7 +184,7 @@ public class WebFsIndexHelper implements Serializable {
|
|||
final EsUrlFilterService urlFilterService = ComponentUtil.getComponent(EsUrlFilterService.class);
|
||||
try {
|
||||
urlFilterService.delete(sid);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to delete url filters for " + sid);
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ public class WebFsIndexHelper implements Serializable {
|
|||
final EsUrlFilterService urlFilterService = ComponentUtil.getComponent(EsUrlFilterService.class);
|
||||
try {
|
||||
urlFilterService.delete(sid);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to delete url filters for " + sid);
|
||||
}
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ public class WebFsIndexHelper implements Serializable {
|
|||
try {
|
||||
// clear url filter
|
||||
urlFilterService.delete(sid);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to delete UrlFilter for " + sid, e);
|
||||
}
|
||||
|
||||
|
@ -522,14 +522,14 @@ public class WebFsIndexHelper implements Serializable {
|
|||
// clear queue
|
||||
urlQueueService.clearCache();
|
||||
urlQueueService.delete(sid);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to delete UrlQueue for " + sid, e);
|
||||
}
|
||||
|
||||
try {
|
||||
// clear
|
||||
dataService.delete(sid);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to delete AccessResult for " + sid, e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,6 +107,7 @@ public class IndexUpdater extends Thread {
|
|||
// nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
@PreDestroy
|
||||
public void destroy() {
|
||||
if (!finishCrawling) {
|
||||
|
@ -220,7 +221,7 @@ public class IndexUpdater extends Thread {
|
|||
if (arList.isEmpty()) {
|
||||
try {
|
||||
Thread.sleep(fessConfig.getIndexerWebfsCommitMarginTimeAsInteger().longValue());
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// ignore
|
||||
}
|
||||
cleanupTime = -1;
|
||||
|
|
|
@ -142,12 +142,12 @@ public class CrawlJob {
|
|||
return jvmOptions(REMOTE_DEBUG_OPTIONS);
|
||||
}
|
||||
|
||||
public CrawlJob jvmOptions(String option) {
|
||||
public CrawlJob jvmOptions(final String option) {
|
||||
this.jvmOptions = option;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CrawlJob lastaEnv(String env) {
|
||||
public CrawlJob lastaEnv(final String env) {
|
||||
this.lastaEnv = env;
|
||||
return this;
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ public class CrawlJob {
|
|||
}
|
||||
|
||||
protected void executeCrawler() {
|
||||
final List<String> cmdList = new ArrayList<String>();
|
||||
final List<String> cmdList = new ArrayList<>();
|
||||
final String cpSeparator = SystemUtils.IS_OS_WINDOWS ? ";" : ":";
|
||||
final ServletContext servletContext = ComponentUtil.getComponent(ServletContext.class);
|
||||
final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
|
||||
|
|
|
@ -26,7 +26,7 @@ public class GroovyExecutor extends JobExecutor {
|
|||
|
||||
@Override
|
||||
public Object execute(final String script) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
final Map<String, Object> params = new HashMap<>();
|
||||
params.put("container", SingletonLaContainerFactory.getContainer());
|
||||
params.put("executor", this);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ public class LdapManager {
|
|||
public String[] getRoles(final LdapUser ldapUser, final String bindDn, final String accountFilter) {
|
||||
final SystemHelper systemHelper = ComponentUtil.getSystemHelper();
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
final List<String> roleList = new ArrayList<String>();
|
||||
final List<String> roleList = new ArrayList<>();
|
||||
|
||||
if (fessConfig.isLdapRoleSearchUserEnabled()) {
|
||||
roleList.add(systemHelper.getSearchRoleByUser(ldapUser.getName()));
|
||||
|
@ -180,7 +180,7 @@ public class LdapManager {
|
|||
}
|
||||
|
||||
protected void setAttributeValue(final List<SearchResult> result, final String name, final Consumer<Object> consumer) {
|
||||
List<Object> attrList = getAttributeValueList(result, name);
|
||||
final List<Object> attrList = getAttributeValueList(result, name);
|
||||
if (!attrList.isEmpty()) {
|
||||
consumer.accept(attrList.get(0));
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ public class LdapManager {
|
|||
return attrList;
|
||||
}
|
||||
return Collections.emptyList();
|
||||
} catch (NamingException e) {
|
||||
} catch (final NamingException e) {
|
||||
throw new LdapOperationException("Failed to parse attribute values for " + name, e);
|
||||
}
|
||||
}
|
||||
|
@ -843,7 +843,7 @@ public class LdapManager {
|
|||
|
||||
}
|
||||
|
||||
public void apply(Group group) {
|
||||
public void apply(final Group group) {
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
if (!fessConfig.isLdapAdminEnabled()) {
|
||||
return;
|
||||
|
@ -879,8 +879,8 @@ public class LdapManager {
|
|||
});
|
||||
}
|
||||
|
||||
protected void modifyGroupAttributes(Group group, Supplier<Hashtable<String, String>> adminEnv, String entryDN,
|
||||
List<SearchResult> result, FessConfig fessConfig) {
|
||||
protected void modifyGroupAttributes(final Group group, final Supplier<Hashtable<String, String>> adminEnv, final String entryDN,
|
||||
final List<SearchResult> result, final FessConfig fessConfig) {
|
||||
final List<ModificationItem> modifyList = new ArrayList<>();
|
||||
|
||||
final String attrGidNumber = fessConfig.getLdapAttrGidNumber();
|
||||
|
|
|
@ -114,7 +114,7 @@ public interface FessProp {
|
|||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> map = (Map<String, String>) propMap.get(DEFAULT_SORT_VALUES);
|
||||
if (map == null) {
|
||||
String value = getSystemProperty(Constants.DEFAULT_SORT_VALUE_PROPERTY);
|
||||
final String value = getSystemProperty(Constants.DEFAULT_SORT_VALUE_PROPERTY);
|
||||
if (StringUtil.isBlank(value)) {
|
||||
map = Collections.emptyMap();
|
||||
} else {
|
||||
|
@ -165,7 +165,7 @@ public interface FessProp {
|
|||
@SuppressWarnings("unchecked")
|
||||
Map<String, String> map = (Map<String, String>) propMap.get(DEFAULT_LABEL_VALUES);
|
||||
if (map == null) {
|
||||
String value = getSystemProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY);
|
||||
final String value = getSystemProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY);
|
||||
if (StringUtil.isBlank(value)) {
|
||||
map = Collections.emptyMap();
|
||||
} else {
|
||||
|
@ -645,9 +645,9 @@ public interface FessProp {
|
|||
if (values.length == 2) {
|
||||
final String[] subValues = values[1].split(":");
|
||||
if (subValues.length == 2) {
|
||||
return new Tuple3<String, String, String>(values[0], subValues[0], subValues[1]);
|
||||
return new Tuple3<>(values[0], subValues[0], subValues[1]);
|
||||
} else {
|
||||
return new Tuple3<String, String, String>(values[0], values[1], Constants.MAPPING_TYPE_ARRAY);
|
||||
return new Tuple3<>(values[0], values[1], Constants.MAPPING_TYPE_ARRAY);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -710,7 +710,7 @@ public interface FessProp {
|
|||
params = StreamUtil.of(getQueryLanguageMapping().split("\n")).filter(StringUtil::isNotBlank).map(v -> {
|
||||
final String[] values = v.split("=");
|
||||
if (values.length == 2) {
|
||||
return new Pair<String, String>(values[0], values[1]);
|
||||
return new Pair<>(values[0], values[1]);
|
||||
}
|
||||
return null;
|
||||
}).collect(Collectors.toMap(Pair::getFirst, d -> d.getSecond()));
|
||||
|
@ -854,14 +854,14 @@ public interface FessProp {
|
|||
return StreamUtil.of(getCrawlerFileProtocolsAsArray()).anyMatch(s -> url.startsWith(s));
|
||||
}
|
||||
|
||||
public default void processSearchPreference(SearchRequestBuilder searchRequestBuilder, OptionalThing<FessUserBean> userBean) {
|
||||
public default void processSearchPreference(final SearchRequestBuilder searchRequestBuilder, final OptionalThing<FessUserBean> userBean) {
|
||||
userBean.map(user -> {
|
||||
if (user.hasRoles(getAuthenticationAdminRolesAsArray())) {
|
||||
return Constants.SEARCH_PREFERENCE_PRIMARY;
|
||||
}
|
||||
return user.getUserId();
|
||||
}).ifPresent(p -> searchRequestBuilder.setPreference(p)).orElse(() -> LaRequestUtil.getOptionalRequest().map(r -> {
|
||||
HttpSession session = r.getSession(false);
|
||||
final HttpSession session = r.getSession(false);
|
||||
if (session != null) {
|
||||
return session.getId();
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class FessApiFailureHook implements ApiFailureHook { // #change_it for ha
|
|||
// Assist Logic
|
||||
// ============
|
||||
protected JsonResponse<TooSimpleFailureBean> asJson(final TooSimpleFailureBean bean) {
|
||||
return new JsonResponse<TooSimpleFailureBean>(bean);
|
||||
return new JsonResponse<>(bean);
|
||||
}
|
||||
|
||||
protected TooSimpleFailureBean createFailureBean(final ApiFailureResource resource) {
|
||||
|
|
|
@ -160,9 +160,9 @@ public class FessMultipartRequestHandler implements MultipartRequestHandler {
|
|||
// Handling Parts
|
||||
// ==============
|
||||
protected void prepareElementsHash() {
|
||||
elementsText = new Hashtable<String, String[]>();
|
||||
elementsFile = new Hashtable<String, MultipartFormFile>();
|
||||
elementsAll = new Hashtable<String, Object>();
|
||||
elementsText = new Hashtable<>();
|
||||
elementsFile = new Hashtable<>();
|
||||
elementsAll = new Hashtable<>();
|
||||
}
|
||||
|
||||
protected List<FileItem> parseRequest(final HttpServletRequest request, final ServletFileUpload upload) throws FileUploadException {
|
||||
|
|
|
@ -54,13 +54,13 @@ public class ScreenShotManager {
|
|||
|
||||
public int screenShotPathCacheSize = 10;
|
||||
|
||||
private final List<ScreenShotGenerator> generatorList = new ArrayList<ScreenShotGenerator>();
|
||||
private final List<ScreenShotGenerator> generatorList = new ArrayList<>();
|
||||
|
||||
public String imageExtention = "png";
|
||||
|
||||
public int splitSize = 5;
|
||||
|
||||
private final BlockingQueue<ScreenShotTask> screenShotTaskQueue = new LinkedBlockingQueue<ScreenShotTask>();
|
||||
private final BlockingQueue<ScreenShotTask> screenShotTaskQueue = new LinkedBlockingQueue<>();
|
||||
|
||||
private boolean generating;
|
||||
|
||||
|
@ -141,7 +141,7 @@ public class ScreenShotManager {
|
|||
|
||||
public void storeRequest(final String queryId, final List<Map<String, Object>> documentItems) {
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
final Map<String, String> dataMap = new HashMap<String, String>(documentItems.size());
|
||||
final Map<String, String> dataMap = new HashMap<>(documentItems.size());
|
||||
for (final Map<String, Object> docMap : documentItems) {
|
||||
final String docid = (String) docMap.get(fessConfig.getIndexFieldDocId());
|
||||
final String screenShotPath = getImageFilename(docMap);
|
||||
|
@ -174,7 +174,7 @@ public class ScreenShotManager {
|
|||
Map<String, Map<String, String>> screenShotPathCache =
|
||||
(Map<String, Map<String, String>>) session.getAttribute(Constants.SCREEN_SHOT_PATH_CACHE);
|
||||
if (screenShotPathCache == null) {
|
||||
screenShotPathCache = new LruHashMap<String, Map<String, String>>(screenShotPathCacheSize);
|
||||
screenShotPathCache = new LruHashMap<>(screenShotPathCacheSize);
|
||||
session.setAttribute(Constants.SCREEN_SHOT_PATH_CACHE, screenShotPathCache);
|
||||
}
|
||||
return screenShotPathCache;
|
||||
|
|
|
@ -28,7 +28,7 @@ public abstract class BaseScreenShotGenerator implements ScreenShotGenerator {
|
|||
@Resource
|
||||
protected ServletContext application;
|
||||
|
||||
protected final Map<String, String> conditionMap = new HashMap<String, String>();
|
||||
protected final Map<String, String> conditionMap = new HashMap<>();
|
||||
|
||||
public int directoryNameLength = 5;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ public class CommandGenerator extends BaseScreenShotGenerator {
|
|||
}
|
||||
|
||||
final String outputPath = outputFile.getAbsolutePath();
|
||||
final List<String> cmdList = new ArrayList<String>();
|
||||
final List<String> cmdList = new ArrayList<>();
|
||||
for (final String value : commandList) {
|
||||
cmdList.add(value.replace("${url}", url).replace("${outputFile}", outputPath));
|
||||
}
|
||||
|
|
|
@ -126,8 +126,6 @@ public final class ComponentUtil {
|
|||
|
||||
private static final String SAMBA_HELPER = "sambaHelper";
|
||||
|
||||
private static final String FTP_HELPER = "ftpHelper";
|
||||
|
||||
private static final String VIEW_HELPER = "viewHelper";
|
||||
|
||||
private static final String SYSTEM_HELPER = "systemHelper";
|
||||
|
@ -341,7 +339,7 @@ public final class ComponentUtil {
|
|||
public static <T> T getComponent(final Class<T> clazz) {
|
||||
try {
|
||||
return SingletonLaContainer.getComponent(clazz);
|
||||
} catch (NullPointerException e) {
|
||||
} catch (final NullPointerException e) {
|
||||
throw new ContainerNotAvailableException(e);
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +347,7 @@ public final class ComponentUtil {
|
|||
public static <T> T getComponent(final String componentName) {
|
||||
try {
|
||||
return SingletonLaContainer.getComponent(componentName);
|
||||
} catch (NullPointerException e) {
|
||||
} catch (final NullPointerException e) {
|
||||
throw new ContainerNotAvailableException(e);
|
||||
}
|
||||
}
|
||||
|
@ -361,7 +359,7 @@ public final class ComponentUtil {
|
|||
public static boolean available() {
|
||||
try {
|
||||
return SingletonLaContainer.getComponent(SYSTEM_HELPER) != null;
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// ignore
|
||||
}
|
||||
return false;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue