public static void setText(String scope, String name, String text) { scope = normalizeScope(scope); Variable var = getScopeFolder(scope).getCheckedVariable(name); if (var.type == VarType.bool) { if (text.equals("true")) text = "1"; else if (text.equals("false")) text = "0"; } var.validateConformantValue(text); if (!var.fireFilters(scope, name, text)) return; if (var.type == VarType.guard) { /* * We need to iterate over all the secret variables in the same folder and * unset them. */ for (Setting setting : var.folder.getSettings()) { if ((setting instanceof Variable) && ((Variable) setting).type == VarType.secret) { Variable secretVar = (Variable) setting; String secretName; if (name.contains("/")) secretName = name.substring(0, name.lastIndexOf("/")) + "/" + secretVar.name; else secretName = secretVar.name; setText(scope, secretName, null); } } } ConfigStorage storage = getConfigStorage(scope, true); ConfigVariable storedVar = storage.getVariable(name); if (storedVar == null) { storedVar = storage.createVariable(); storedVar.setName(name); storage.getVariables().add(storedVar); } storedVar.setValue(text); var.value = text; var.fireListeners(scope, name); }