/** * @return a map with the component key as key, and boolean as true if key already exists in db */ public Map<String, Boolean> checkComponentKeys(DbSession dbSession, List<String> newComponentKeys) { return newComponentKeys.stream().collect(Collectors.toMap(Function.identity(), key -> mapper(dbSession).countResourceByKey(key) > 0)); }
/** * * @return a map with currentKey/newKey is a bulk update was executed */ public Map<String, String> simulateBulkUpdateKey(DbSession dbSession, String projectUuid, String stringToReplace, String replacementString) { return collectAllModules(projectUuid, stringToReplace, mapper(dbSession), false) .stream() .collect(Collectors.toMap( ResourceDto::getKey, component -> { String newKey = computeNewKey(component.getKey(), stringToReplace, replacementString); checkProjectKey(newKey); return newKey; })); }
/** * @return a map with the component key as key, and boolean as true if key already exists in db */ public Map<String, Boolean> checkComponentKeys(DbSession dbSession, List<String> newComponentKeys) { return newComponentKeys.stream().collect(Collectors.toMap(Function.identity(), key -> mapper(dbSession).countResourceByKey(key) > 0)); }
/** * * @return a map with currentKey/newKey is a bulk update was executed */ public Map<String, String> simulateBulkUpdateKey(DbSession dbSession, String projectUuid, String stringToReplace, String replacementString) { return collectAllModules(projectUuid, stringToReplace, mapper(dbSession)) .stream() .collect(Collectors.toMap( ResourceDto::getKey, component -> { String newKey = computeNewKey(component.getKey(), stringToReplace, replacementString); checkModuleKey(newKey); return newKey; })); }