#1304 add output logs

This commit is contained in:
Shinsuke Sugaya 2017-10-12 22:25:42 +09:00
parent 614544bf7a
commit c68d8967ad
5 changed files with 20 additions and 13 deletions

View file

@ -54,9 +54,10 @@ public class LabelTypeHelper {
update();
}
public void update() {
public int update() {
final List<LabelType> labelTypeList = ComponentUtil.getComponent(LabelTypeService.class).getLabelTypeList();
buildLabelTypeItems(labelTypeList);
return labelTypeList.size();
}
public void refresh(final List<LabelType> labelTypeList) {

View file

@ -46,7 +46,7 @@ public class PathMappingHelper {
update();
}
public void update() {
public int update() {
final List<String> ptList = new ArrayList<>();
ptList.add(Constants.PROCESS_TYPE_DISPLAYING);
ptList.add(Constants.PROCESS_TYPE_BOTH);
@ -58,9 +58,11 @@ public class PathMappingHelper {
cb.query().setProcessType_InScope(ptList);
cb.fetchFirst(ComponentUtil.getFessConfig().getPagePathMappingMaxFetchSizeAsInteger());
});
return cachedPathMappingList.size();
} catch (final Exception e) {
logger.warn("Failed to load path mappings.", e);
}
return 0;
}
public void setPathMappingList(final String sessionId, final List<PathMapping> pathMappingList) {

View file

@ -49,8 +49,8 @@ public class RelatedContentHelper {
reload();
}
public void update() {
reload();
public int update() {
return reload();
}
public List<RelatedContent> getAvailableRelatedContentList() {
@ -63,7 +63,7 @@ public class RelatedContentHelper {
});
}
protected void reload() {
protected int reload() {
final Map<String, Pair<Map<String, String>, List<Pair<Pattern, String>>>> relatedContentMap = new HashMap<>();
getAvailableRelatedContentList().stream().forEach(entity -> {
final String key = getHostKey(entity);
@ -84,6 +84,7 @@ public class RelatedContentHelper {
}
});
this.relatedContentMap = relatedContentMap;
return relatedContentMap.size();
}
protected String getHostKey(final RelatedContent entity) {

View file

@ -38,8 +38,8 @@ public class RelatedQueryHelper {
reload();
}
public void update() {
reload();
public int update() {
return reload();
}
public List<RelatedQuery> getAvailableRelatedQueryList() {
@ -51,7 +51,7 @@ public class RelatedQueryHelper {
});
}
protected void reload() {
protected int reload() {
final Map<String, Map<String, String[]>> relatedQueryMap = new HashMap<>();
getAvailableRelatedQueryList().stream().forEach(entity -> {
final String key = getHostKey(entity);
@ -63,6 +63,7 @@ public class RelatedQueryHelper {
map.put(toLowerCase(entity.getTerm()), entity.getQueries());
});
this.relatedQueryMap = relatedQueryMap;
return relatedQueryMap.size();
}
protected String getHostKey(final RelatedQuery entity) {

View file

@ -355,11 +355,13 @@ public class SystemHelper {
ComponentUtil.getRelatedQueryHelper().update();
}
public void updateConfiguration() {
ComponentUtil.getLabelTypeHelper().update();
ComponentUtil.getPathMappingHelper().update();
ComponentUtil.getRelatedContentHelper().update();
ComponentUtil.getRelatedQueryHelper().update();
public String updateConfiguration() {
final StringBuilder buf = new StringBuilder();
buf.append("Label: ").append(ComponentUtil.getLabelTypeHelper().update()).append("\n");
buf.append("PathMapping: ").append(ComponentUtil.getPathMappingHelper().update()).append("\n");
buf.append("RelatedContent: ").append(ComponentUtil.getRelatedContentHelper().update()).append("\n");
buf.append("RelatedQuery: ").append(ComponentUtil.getRelatedQueryHelper().update()).append("\n");
return buf.toString();
}
public String generateAccessToken() {