@Test public void addParentConditionPatchingTest() { patchingRepositoryImpl.addParentConditionPatching("ec2"); patchingRepositoryImpl.addParentConditionPatching("onpremserver"); patchingRepositoryImpl.addParentConditionPatching("s3"); }
public Map<String, Object> addParentConditionPatching(String targetType) { Map<String, Object> parentBool = new HashMap<>(); List<Map<String, Object>> mustList = new ArrayList<>(); Map<String, String> match = new HashMap<>(); match.put(LATEST, "true"); Map<String, Object> matchMap = new HashMap<>(); matchMap.put(MATCH, match); mustList.add(matchMap); Map<String, Object> parentEntryMap = new LinkedHashMap<>(); if ("ec2".equals(targetType)) { match = new HashMap<>(); match.put(STATE_NAME, RUNNING); matchMap = new HashMap<>(); matchMap.put(MATCH, match); mustList.add(matchMap); parentBool.put(MUST, mustList); match = new HashMap<>(); match.put(PLATFORM, WINDOWS); matchMap = new HashMap<>(); matchMap.put(MATCH, match); parentBool.put("must_not", matchMap); Map<String, Object> queryMap = new HashMap<>(); queryMap.put("bool", parentBool); parentEntryMap.put("type", "ec2"); parentEntryMap.put("query", queryMap); } return parentEntryMap; }
PatchingRepositoryImpl implements PatchingRepository, Constants { public Map<String, Object> addParentConditionPatching(String targetType) { Map<String, Object> parentBool = new HashMap<>(); List<Map<String, Object>> mustList = new ArrayList<>(); Map<String, String> match = new HashMap<>(); match.put(LATEST, "true"); Map<String, Object> matchMap = new HashMap<>(); matchMap.put(MATCH, match); mustList.add(matchMap); Map<String, Object> parentEntryMap = new LinkedHashMap<>(); if ("ec2".equals(targetType)) { match = new HashMap<>(); match.put(STATE_NAME, RUNNING); matchMap = new HashMap<>(); matchMap.put(MATCH, match); mustList.add(matchMap); parentBool.put(MUST, mustList); match = new HashMap<>(); match.put(PLATFORM, WINDOWS); matchMap = new HashMap<>(); matchMap.put(MATCH, match); parentBool.put("must_not", matchMap); Map<String, Object> queryMap = new HashMap<>(); queryMap.put("bool", parentBool); parentEntryMap.put("type", "ec2"); parentEntryMap.put("query", queryMap); } return parentEntryMap; } }
PatchingRepositoryImpl implements PatchingRepository, Constants { public Map<String, Object> addParentConditionPatching(String targetType) { Map<String, Object> parentBool = new HashMap<>(); List<Map<String, Object>> mustList = new ArrayList<>(); Map<String, String> match = new HashMap<>(); match.put(LATEST, "true"); Map<String, Object> matchMap = new HashMap<>(); matchMap.put(MATCH, match); mustList.add(matchMap); Map<String, Object> parentEntryMap = new LinkedHashMap<>(); if ("ec2".equals(targetType)) { match = new HashMap<>(); match.put(STATE_NAME, RUNNING); matchMap = new HashMap<>(); matchMap.put(MATCH, match); mustList.add(matchMap); parentBool.put(MUST, mustList); match = new HashMap<>(); match.put(PLATFORM, WINDOWS); matchMap = new HashMap<>(); matchMap.put(MATCH, match); parentBool.put("must_not", matchMap); Map<String, Object> queryMap = new HashMap<>(); queryMap.put("bool", parentBool); parentEntryMap.put("type", "ec2"); parentEntryMap.put("query", queryMap); } return parentEntryMap; }  }
PatchingRepositoryImpl implements PatchingRepository, Constants { public Map<String, Object> addParentConditionPatching(String targetType) { Map<String, Object> parentBool = new HashMap<>(); List<Map<String, Object>> mustList = new ArrayList<>(); Map<String, String> match = new HashMap<>(); match.put(LATEST, "true"); Map<String, Object> matchMap = new HashMap<>(); matchMap.put(MATCH, match); mustList.add(matchMap); Map<String, Object> parentEntryMap = new LinkedHashMap<>(); if ("ec2".equals(targetType)) { match = new HashMap<>(); match.put(STATE_NAME, RUNNING); matchMap = new HashMap<>(); matchMap.put(MATCH, match); mustList.add(matchMap); parentBool.put(MUST, mustList); match = new HashMap<>(); match.put(PLATFORM, WINDOWS); matchMap = new HashMap<>(); matchMap.put(MATCH, match); parentBool.put("must_not", matchMap); Map<String, Object> queryMap = new HashMap<>(); queryMap.put("bool", parentBool); parentEntryMap.put("type", "ec2"); parentEntryMap.put("query", queryMap); } return parentEntryMap; }  @Override List<Map<String, Object>> getPatchingProgress(String assetGroup,
            LocalDate startDate, LocalDate endDate); @Override List<Map<String, Object>> getIssueInfo(String assetGroup); List<Map<String, Object>> getClosedIssueInfo(String assetGroup,
            int size); @Override List<Map<String, Object>> getInstanceInfo(String assetGroup,
            Map<String, String> filters); @Override List<Map<String, Object>> getExecAndDirectorInfo(); @Override long getInstanceInfoCount(String assetGroup,
            Map<String, String> filters, String searchText); @Override String getAmilAvailDate(int year, int quarter); @Override int getPatchingWindow(); @Override Map<String, Long> getQuartersWithPatchingData(String assetGroup); Map<String, Object> addParentConditionPatching(String targetType); @Override List<Map<String, Object>> getOnpremIssueInfo(String assetGroup); @Override List<Map<String, Object>> getOnpremResourceInfo(String assetGroup,
            Map<String, String> filters); @Override Map<String, Object> getDirectorsAndExcutiveSponsers(String appTag,
            String appType); @Override Map<String, Long> getNonCompliantNumberForAgAndResourceType(
            String assetGroup, String resourceType); @Override List<Map<String, Object>> getPatchingPercentForDateRange(String assetGroup, LocalDate fromDate,
			LocalDate toDate); }
PatchingRepositoryImpl implements PatchingRepository, Constants { public Map<String, Object> addParentConditionPatching(String targetType) { Map<String, Object> parentBool = new HashMap<>(); List<Map<String, Object>> mustList = new ArrayList<>(); Map<String, String> match = new HashMap<>(); match.put(LATEST, "true"); Map<String, Object> matchMap = new HashMap<>(); matchMap.put(MATCH, match); mustList.add(matchMap); Map<String, Object> parentEntryMap = new LinkedHashMap<>(); if ("ec2".equals(targetType)) { match = new HashMap<>(); match.put(STATE_NAME, RUNNING); matchMap = new HashMap<>(); matchMap.put(MATCH, match); mustList.add(matchMap); parentBool.put(MUST, mustList); match = new HashMap<>(); match.put(PLATFORM, WINDOWS); matchMap = new HashMap<>(); matchMap.put(MATCH, match); parentBool.put("must_not", matchMap); Map<String, Object> queryMap = new HashMap<>(); queryMap.put("bool", parentBool); parentEntryMap.put("type", "ec2"); parentEntryMap.put("query", queryMap); } return parentEntryMap; }  @Override List<Map<String, Object>> getPatchingProgress(String assetGroup,
            LocalDate startDate, LocalDate endDate); @Override List<Map<String, Object>> getIssueInfo(String assetGroup); List<Map<String, Object>> getClosedIssueInfo(String assetGroup,
            int size); @Override List<Map<String, Object>> getInstanceInfo(String assetGroup,
            Map<String, String> filters); @Override List<Map<String, Object>> getExecAndDirectorInfo(); @Override long getInstanceInfoCount(String assetGroup,
            Map<String, String> filters, String searchText); @Override String getAmilAvailDate(int year, int quarter); @Override int getPatchingWindow(); @Override Map<String, Long> getQuartersWithPatchingData(String assetGroup); Map<String, Object> addParentConditionPatching(String targetType); @Override List<Map<String, Object>> getOnpremIssueInfo(String assetGroup); @Override List<Map<String, Object>> getOnpremResourceInfo(String assetGroup,
            Map<String, String> filters); @Override Map<String, Object> getDirectorsAndExcutiveSponsers(String appTag,
            String appType); @Override Map<String, Long> getNonCompliantNumberForAgAndResourceType(
            String assetGroup, String resourceType); @Override List<Map<String, Object>> getPatchingPercentForDateRange(String assetGroup, LocalDate fromDate,
			LocalDate toDate);  }