|
2 | 2 |
|
3 | 3 | import java.net.URL; |
4 | 4 | import java.util.ArrayList; |
| 5 | +import java.util.HashSet; |
5 | 6 | import java.util.List; |
6 | 7 | import java.util.ResourceBundle; |
| 8 | +import java.util.Set; |
| 9 | +import java.util.stream.Collectors; |
7 | 10 |
|
8 | 11 | import org.apache.commons.lang.StringUtils; |
9 | 12 | import org.apache.commons.lang3.ArrayUtils; |
|
22 | 25 | import root.core.domain.ASMDiskUsage; |
23 | 26 | import root.core.domain.ArchiveUsage; |
24 | 27 | import root.core.domain.MonitoringResult; |
| 28 | +import root.core.domain.MonitoringYN; |
25 | 29 | import root.core.domain.OSDiskUsage; |
26 | 30 | import root.core.domain.TableSpaceUsage; |
| 31 | +import root.core.domain.MonitoringYN.MonitoringTypeAndYN; |
| 32 | +import root.core.domain.enums.MonitoringType; |
27 | 33 | import root.core.repository.implement.PropertyRepositoryImpl; |
28 | 34 | import root.core.service.contracts.PropertyService; |
29 | 35 | import root.core.service.implement.FilePropertyService; |
30 | 36 | import root.javafx.CustomView.CustomTreeTableView; |
31 | 37 | import root.javafx.CustomView.CustomTreeView; |
32 | 38 | import root.javafx.CustomView.MonitoringTableView; |
33 | | -import root.javafx.Model.DBMonitoringYN; |
34 | | -import root.javafx.Model.ServerMonitoringYN; |
35 | 39 |
|
36 | 40 | public class RunMenuController implements Initializable { |
37 | 41 |
|
@@ -113,14 +117,28 @@ public void initialize(URL location, ResourceBundle resources) { |
113 | 117 | connInfoFileListComboBox.getSelectionModel().select(lastUseConnInfoFile); |
114 | 118 | } |
115 | 119 |
|
| 120 | + List<MonitoringYN> list = new ArrayList<>(); |
| 121 | + List<MonitoringTypeAndYN> childList = new ArrayList<>(); |
| 122 | + childList.add(new MonitoringTypeAndYN(MonitoringType.ARCHIVE, true)); |
| 123 | + childList.add(new MonitoringTypeAndYN(MonitoringType.TABLE_SPACE, true)); |
| 124 | + childList.add(new MonitoringTypeAndYN(MonitoringType.ASM_DISK, true)); |
| 125 | + list.add(new MonitoringYN("DB1", childList)); |
| 126 | + |
| 127 | + List<MonitoringYN> list2 = new ArrayList<>(); |
| 128 | + List<MonitoringTypeAndYN> childList2 = new ArrayList<>(); |
| 129 | + childList2.add(new MonitoringTypeAndYN(MonitoringType.OS_DISK, false)); |
| 130 | + childList2.add(new MonitoringTypeAndYN(MonitoringType.ALERT_LOG, false)); |
| 131 | + list2.add(new MonitoringYN("SERVER1", childList2)); |
| 132 | + addMonitoringPresetPreview(list, list2); |
| 133 | + |
116 | 134 | /* 2. 모니터링 여부 설정 */ |
117 | 135 | // 2-1. 모니터링 여부 Preset 콤보박스 아이템 설정 |
118 | 136 | String curConnInfoFile = connInfoFileListComboBox.getSelectionModel().getSelectedItem(); |
119 | 137 | propService.loadMonitoringInfoConfig(curConnInfoFile); |
120 | 138 | List<String> presetFileList = propService.getMonitoringPresetNameList(); |
121 | 139 | if (presetFileList == null || presetFileList.size() == 0) { |
122 | 140 | // TODO 모니터링 여부 Preset 설정파일이 없는 경우 |
123 | | -// addMonitoringPresetPreview(); |
| 141 | + addMonitoringPresetPreview(list, list2); |
124 | 142 | } else { |
125 | 143 | presetFileListComboBox.getItems().addAll(presetFileList); |
126 | 144 | } |
@@ -229,27 +247,31 @@ private void addMonitoringConnInfoPreview(List<String> dbNameList, List<String> |
229 | 247 | /** |
230 | 248 | * 설정된 모니터링 여부 Preset을 보여주는 TreeTableView를 생성 및 추가한다. |
231 | 249 | * |
232 | | - * @param dbPresetList |
233 | | - * @param serverPresetList |
| 250 | + * @param monitoringYNList |
234 | 251 | */ |
235 | | - private void addMonitoringPresetPreview(List<DBMonitoringYN> dbPresetList, |
236 | | - List<ServerMonitoringYN> serverPresetList) { |
| 252 | + private void addMonitoringPresetPreview(List<MonitoringYN> dbYnList, List<MonitoringYN> serverYnList) { |
| 253 | + |
| 254 | + Set<MonitoringType> dbMonitoringTypeList = new HashSet<>(); |
| 255 | + dbYnList.stream().map(m -> m.getDistinctMonitoringTypes()).collect(Collectors.toList()) |
| 256 | + .forEach(type -> dbMonitoringTypeList.addAll(type)); |
| 257 | + |
| 258 | + Set<MonitoringType> serverMonitoringTypeList = new HashSet<>(); |
| 259 | + serverYnList.stream().map(m -> m.getDistinctMonitoringTypes()).collect(Collectors.toList()) |
| 260 | + .forEach(type -> serverMonitoringTypeList.addAll(type)); |
237 | 261 |
|
238 | 262 | // 모니터링 여부 리스트 TreeTableView - DB |
239 | | - CustomTreeTableView<DBMonitoringYN> dbCtv = new CustomTreeTableView<>("", FontAwesomeIcon.LIST); |
240 | | - dbCtv.addMonitoringInstanceColumn("Instance", "alias"); |
241 | | - dbCtv.addMonitoringYNTableColumn("Archive", "archiveUsageYN"); |
242 | | - dbCtv.addMonitoringYNTableColumn("Table Space", "tableSpaceUsageYN"); |
243 | | - dbCtv.addMonitoringYNTableColumn("ASM Disk", "asmDiskUsageYN"); |
244 | | - dbCtv.addTreeTableItem(new DBMonitoringYN("DB"), dbPresetList, FontAwesomeIcon.DATABASE); |
| 263 | + CustomTreeTableView dbCtv = new CustomTreeTableView("", FontAwesomeIcon.LIST); |
| 264 | + dbCtv.addMonitoringInstanceColumn("Instance", "monitoringAlias"); |
| 265 | + dbMonitoringTypeList.forEach(type -> dbCtv.addMonitoringYNTableColumn(type.getName(), type)); |
| 266 | + dbCtv.addTreeTableItem(new MonitoringYN("DB"), dbYnList, FontAwesomeIcon.DATABASE); |
245 | 267 | setAnchorPaneAnchor(dbCtv, 0, 0, 0, 0); |
246 | 268 | dbPresetAP.getChildren().add(dbCtv); |
247 | 269 |
|
248 | 270 | // 모니터링 여부 리스트 TreeTableView - Server |
249 | | - CustomTreeTableView<ServerMonitoringYN> serverCtv = new CustomTreeTableView<>("", FontAwesomeIcon.LIST); |
250 | | - serverCtv.addMonitoringInstanceColumn("Instance", "alias"); |
251 | | - serverCtv.addMonitoringYNTableColumn("OS Disk", "osDiskUsageYN"); |
252 | | - serverCtv.addTreeTableItem(new ServerMonitoringYN("Server"), serverPresetList, FontAwesomeIcon.SERVER); |
| 271 | + CustomTreeTableView serverCtv = new CustomTreeTableView("", FontAwesomeIcon.LIST); |
| 272 | + serverCtv.addMonitoringInstanceColumn("Instance", "monitoringAlias"); |
| 273 | + serverMonitoringTypeList.forEach(type -> serverCtv.addMonitoringYNTableColumn(type.getName(), type)); |
| 274 | + serverCtv.addTreeTableItem(new MonitoringYN("Server"), serverYnList, FontAwesomeIcon.SERVER); |
253 | 275 | setAnchorPaneAnchor(serverCtv, 0, 0, 0, 0); |
254 | 276 | serverPresetAP.getChildren().add(serverCtv); |
255 | 277 | } |
|
0 commit comments