private Map<String, CnATreeElement> loadChildrenTitleMap( String uuidParent, Map<String, CnATreeElement> map) { RetrieveInfo ri = RetrieveInfo.getChildrenInstance().setChildrenProperties(true); ControlGroup source = getDao().findByUuid(uuidParent, ri); if (source != null) { for (CnATreeElement element : source.getChildren()) { if (element instanceof IISO27kGroup) { map = loadChildrenTitleMap(element.getUuid(), map); } else { map.put(getNumberOrTitle(element.getTitle()), element); } } } return map; }
/** * Gibt den maximalen Schwellenwert (threshold) * * @param controlGroup * @param typeThreshold * @return */ private Double getThreshold(ControlGroup controlGroup, int typeThreshold) { Double result = Double.valueOf(0); Set<CnATreeElement> children = controlGroup.getChildren(); for (Iterator<CnATreeElement> iterator = children.iterator(); iterator.hasNext(); ) { CnATreeElement cnATreeElement = iterator.next(); if (cnATreeElement instanceof IControl) { IControl control = (IControl) cnATreeElement; switch (typeThreshold) { case TYPE_THRESHOLD1: if (control.getThreshold1() > result) { result = (double) control.getThreshold1(); } break; case TYPE_THRESHOLD2: if (control.getThreshold2() > result) { result = (double) control.getThreshold2(); } break; default: break; } } else if (cnATreeElement instanceof ControlGroup) { Double recursiveResult = getThreshold((ControlGroup) cnATreeElement, typeThreshold); if (recursiveResult > result) { result = recursiveResult; } } } return result; }
/** @param topGroup */ private void getItems(ControlGroup topGroup) { Set<CnATreeElement> groups = topGroup.getChildren(); for (CnATreeElement group : groups) { if (group instanceof ControlGroup) { getSummary((ControlGroup) group); } } }
/** @param group */ private void getSummary(ControlGroup group) { ControlMaturityService maturityService = new ControlMaturityService(ControlMaturityService.TYPE_MATURITY); ControlMaturityService isrService = new ControlMaturityService(ControlMaturityService.TYPE_ISR); if (type == TYPE_MAX) { maturity.put(group.getTitle(), maturityService.getMaxMaturityValue(group)); } else if (type == TYPE_IMPLEMENTATION) { maturity.put(group.getTitle(), maturityService.getMaturityByWeight(group)); } else if (type == TYPE_THRESHOLD1) { maturity.put(group.getTitle(), getThreshold(group, TYPE_THRESHOLD1)); } else if (type == TYPE_THRESHOLD2) { maturity.put(group.getTitle(), getThreshold(group, TYPE_THRESHOLD2)); } else if (type == ISR_TYPE_MAX) { maturity.put(group.getTitle(), isrService.getMaxMaturityValue(group)); } else if (type == ISR_TYPE_IMPLEMENTATION) { maturity.put(group.getTitle(), isrService.getMaturityByWeight(group)); } }