|
30 | 30 | import xyz.erupt.core.util.Erupts;
|
31 | 31 | import xyz.erupt.jpa.dao.EruptDao;
|
32 | 32 | import xyz.erupt.jpa.model.MetaModelUpdateVo;
|
| 33 | +import xyz.erupt.linq.lambda.LambdaSee; |
33 | 34 | import xyz.erupt.tpl.engine.EngineConst;
|
34 | 35 | import xyz.erupt.upms.handler.ViaMenuValueCtrl;
|
35 | 36 |
|
|
62 | 63 | @EruptI18n
|
63 | 64 | public class CloudNode extends MetaModelUpdateVo implements DataProxy<CloudNode>, TagsFetchHandler, Tpl.TplHandler {
|
64 | 65 |
|
65 |
| - public static final String NODE_NAME = "nodeName"; |
| 66 | + public static final String NODE_NAME = LambdaSee.field(CloudNode::getNodeName); |
66 | 67 |
|
67 |
| - private static final String REGISTER_TYPE = "registerType"; |
68 |
| - |
69 |
| - private static final String ADDRESSES = "addresses"; |
70 |
| - |
71 |
| - public static final String ACCESS_TOKEN = "accessToken"; |
| 68 | + public static final String ACCESS_TOKEN = LambdaSee.field(CloudNode::getAccessToken); |
72 | 69 |
|
73 | 70 | @Column(unique = true)
|
74 | 71 | @EruptField(
|
@@ -181,26 +178,21 @@ public void afterFetch(Collection<Map<String, Object>> list) {
|
181 | 178 | String token = it.toString();
|
182 | 179 | map.put(ACCESS_TOKEN, token.substring(0, 3) + "******" + token.substring(token.length() - 3));
|
183 | 180 | });
|
184 |
| - String eruptNumStr = "eruptNum"; |
185 |
| - String instanceNumStr = "instanceNum"; |
186 |
| - String version = "version"; |
187 |
| - String eruptModuleNum = "eruptModuleNum"; |
188 |
| - map.put(eruptNumStr, '-'); |
189 |
| - map.put(instanceNumStr, '-'); |
190 |
| - map.put(version, '-'); |
191 |
| - map.put(eruptModuleNum, '-'); |
| 181 | + map.put(LambdaSee.field(CloudNode::getEruptNum), '-'); |
| 182 | + map.put(LambdaSee.field(CloudNode::getInstanceNum), '-'); |
| 183 | + map.put(LambdaSee.field(CloudNode::getVersion), '-'); |
| 184 | + map.put(LambdaSee.field(CloudNode::getEruptModuleNum), '-'); |
192 | 185 | try {
|
193 | 186 | MetaNode metaNode = nodeManager.getNode(map.get(NODE_NAME).toString());
|
194 | 187 | Optional.ofNullable(nodeManager.getNode(map.get(NODE_NAME).toString())).ifPresent(metaNode1 -> {
|
195 |
| - Function<Collection<String>, Object> function = (it) -> null == it ? 0 : String.format("<a href='javascript:alert(\"%s\");'>%d</a>", |
196 |
| - String.join("\\u000a", it), it.size()); |
197 |
| - map.put(eruptNumStr, function.apply(metaNode.getErupts())); |
198 |
| - map.put(instanceNumStr, metaNode.getLocations().size()); |
199 |
| - map.put(eruptModuleNum, function.apply(metaNode.getEruptModules())); |
200 |
| - map.put(version, metaNode.getVersion()); |
| 188 | + Function<Collection<String>, Object> function = (it) -> null == it ? 0 : String.format("<a href='javascript:alert(`%s`);'>%d</a>", String.join("\\u000a", it), it.size()); |
| 189 | + map.put(LambdaSee.field(CloudNode::getEruptNum), function.apply(metaNode.getErupts())); |
| 190 | + map.put(LambdaSee.field(CloudNode::getInstanceNum), metaNode.getLocations().size()); |
| 191 | + map.put(LambdaSee.field(CloudNode::getEruptModuleNum), function.apply(metaNode.getEruptModules())); |
| 192 | + map.put(LambdaSee.field(CloudNode::getVersion), metaNode.getVersion()); |
201 | 193 | });
|
202 | 194 | } catch (Exception e) {
|
203 |
| - map.put(version, String.format("<span style='color:#f00'>%s</span>", e.getMessage())); |
| 195 | + map.put(LambdaSee.field(CloudNode::getVersion), String.format("<span style='color:#f00'>%s</span>", e.getMessage())); |
204 | 196 | log.warn("node warn → " + map.get(NODE_NAME), e);
|
205 | 197 | }
|
206 | 198 | }
|
|
0 commit comments