|
@@ -29,40 +29,32 @@ public class ForbiddenPageIdsLogicService { |
|
@@ -29,40 +29,32 @@ public class ForbiddenPageIdsLogicService { |
29
|
|
29
|
|
30
|
private static final String key = "SEARCH_FORBIDDEN_SKNLIST_%s";
|
30
|
private static final String key = "SEARCH_FORBIDDEN_SKNLIST_%s";
|
31
|
|
31
|
|
32
|
- private Map<String, List<String>> skn_forbiddenPageIds_map = null;
|
32
|
+ private Map<String, List<String>> sknForbiddenPageIdsMap = null;
|
|
|
33
|
+ private Map<String, Integer> pageForbiddenSknCountMap = null;
|
33
|
|
34
|
|
34
|
- public List<String> getPageIdForbiddenSkns(String pageId) {
|
|
|
35
|
- if (skn_forbiddenPageIds_map == null || skn_forbiddenPageIds_map.isEmpty()) {
|
|
|
36
|
- return new ArrayList<String>();
|
|
|
37
|
- }
|
|
|
38
|
- return skn_forbiddenPageIds_map.get(pageId);
|
|
|
39
|
- }
|
|
|
40
|
-
|
|
|
41
|
- public synchronized Map<String, Integer> reloadForbiddenPageIds() {
|
|
|
42
|
- Map<String, Integer> pageCountMap = new HashMap<String, Integer>();
|
35
|
+ public synchronized void reloadForbiddenPageIds() {
|
43
|
try {
|
36
|
try {
|
44
|
INDEX_REBUILD_LOG.info("do reloadForbiddenPageIds .........");
|
37
|
INDEX_REBUILD_LOG.info("do reloadForbiddenPageIds .........");
|
45
|
List<String> allPageIds = SearchPageIdDefine.getAllPgeIds();
|
38
|
List<String> allPageIds = SearchPageIdDefine.getAllPgeIds();
|
46
|
- Map<String, List<String>> temp = new HashMap<String, List<String>>();
|
39
|
+ Map<String, List<String>> sknForbiddenPageIdsMap_temp = new HashMap<String, List<String>>();
|
|
|
40
|
+ Map<String, Integer> pageForbiddenSknCountMap_temp = new HashMap<String, Integer>();
|
47
|
for (String pageId : allPageIds) {
|
41
|
for (String pageId : allPageIds) {
|
48
|
Set<String> forbiddenSknSet = this.getPageForbiddenSknSet(pageId);
|
42
|
Set<String> forbiddenSknSet = this.getPageForbiddenSknSet(pageId);
|
49
|
for (String forbiddenSkn : forbiddenSknSet) {
|
43
|
for (String forbiddenSkn : forbiddenSknSet) {
|
50
|
- List<String> pageIds = temp.get(forbiddenSkn);
|
44
|
+ List<String> pageIds = sknForbiddenPageIdsMap_temp.get(forbiddenSkn);
|
51
|
if (pageIds == null) {
|
45
|
if (pageIds == null) {
|
52
|
pageIds = new ArrayList<String>();
|
46
|
pageIds = new ArrayList<String>();
|
53
|
- temp.put(forbiddenSkn, pageIds);
|
47
|
+ sknForbiddenPageIdsMap_temp.put(forbiddenSkn, pageIds);
|
54
|
}
|
48
|
}
|
55
|
pageIds.add(pageId);
|
49
|
pageIds.add(pageId);
|
56
|
}
|
50
|
}
|
57
|
- pageCountMap.put(pageId, forbiddenSknSet.size());
|
51
|
+ pageForbiddenSknCountMap_temp.put(pageId, forbiddenSknSet.size());
|
58
|
}
|
52
|
}
|
59
|
- skn_forbiddenPageIds_map = temp;
|
53
|
+ sknForbiddenPageIdsMap = sknForbiddenPageIdsMap_temp;
|
|
|
54
|
+ pageForbiddenSknCountMap = pageForbiddenSknCountMap_temp;
|
60
|
} catch (Exception e) {
|
55
|
} catch (Exception e) {
|
61
|
INDEX_REBUILD_LOG.error(e.getMessage(), e);
|
56
|
INDEX_REBUILD_LOG.error(e.getMessage(), e);
|
62
|
- } finally {
|
|
|
63
|
-
|
|
|
64
|
}
|
57
|
}
|
65
|
- return pageCountMap;
|
|
|
66
|
}
|
58
|
}
|
67
|
|
59
|
|
68
|
private Set<String> getPageForbiddenSknSet(String pageId) {
|
60
|
private Set<String> getPageForbiddenSknSet(String pageId) {
|
|
@@ -78,7 +70,7 @@ public class ForbiddenPageIdsLogicService { |
|
@@ -78,7 +70,7 @@ public class ForbiddenPageIdsLogicService { |
78
|
}
|
70
|
}
|
79
|
|
71
|
|
80
|
private boolean isNeedReload() {
|
72
|
private boolean isNeedReload() {
|
81
|
- if (skn_forbiddenPageIds_map == null || skn_forbiddenPageIds_map.isEmpty()) {
|
73
|
+ if (sknForbiddenPageIdsMap == null || sknForbiddenPageIdsMap.isEmpty()) {
|
82
|
return true;
|
74
|
return true;
|
83
|
}
|
75
|
}
|
84
|
return false;
|
76
|
return false;
|
|
@@ -95,17 +87,29 @@ public class ForbiddenPageIdsLogicService { |
|
@@ -95,17 +87,29 @@ public class ForbiddenPageIdsLogicService { |
95
|
}
|
87
|
}
|
96
|
}
|
88
|
}
|
97
|
|
89
|
|
98
|
- public String getSknForbiddenPageIds(ProductIBO productIBO) {
|
90
|
+ public Map<String, Integer> getPageForbiddenSknCountMap() {
|
99
|
checkAndInit();
|
91
|
checkAndInit();
|
100
|
- Integer productSkn = productIBO.getProductSkn();
|
|
|
101
|
- if (productSkn == null) {
|
92
|
+ return this.pageForbiddenSknCountMap;
|
|
|
93
|
+ }
|
|
|
94
|
+
|
|
|
95
|
+ public String getSknForbiddenPageIds(String productSkn) {
|
|
|
96
|
+ checkAndInit();
|
|
|
97
|
+ if (StringUtils.isBlank(productSkn)) {
|
102
|
return "";
|
98
|
return "";
|
103
|
}
|
99
|
}
|
104
|
- List<String> forbidPageIds = skn_forbiddenPageIds_map.get(productSkn.toString());
|
100
|
+ List<String> forbidPageIds = sknForbiddenPageIdsMap.get(productSkn);
|
105
|
if (forbidPageIds == null || forbidPageIds.isEmpty()) {
|
101
|
if (forbidPageIds == null || forbidPageIds.isEmpty()) {
|
106
|
return "";
|
102
|
return "";
|
107
|
}
|
103
|
}
|
108
|
return StringUtils.join(forbidPageIds, ",");
|
104
|
return StringUtils.join(forbidPageIds, ",");
|
109
|
}
|
105
|
}
|
110
|
|
106
|
|
|
|
107
|
+ public String getSknForbiddenPageIds(ProductIBO productIBO) {
|
|
|
108
|
+ Integer productSkn = productIBO.getProductSkn();
|
|
|
109
|
+ if (productSkn == null) {
|
|
|
110
|
+ return "";
|
|
|
111
|
+ }
|
|
|
112
|
+ return this.getSknForbiddenPageIds(productSkn.toString());
|
|
|
113
|
+ }
|
|
|
114
|
+
|
111
|
} |
115
|
} |