public static RestActionReporter applyChanges(Map<String, String> data, String basePath, ServiceLocator habitat) {
return applyChanges(data, basePath);
}
public static RestActionReporter applyChanges(Map<String, String> data, String basePath) {
ParameterMap parameters = new ParameterMap();
Map<String, String> currentValues = getCurrentValues(basePath);
for (Map.Entry<String, String> entry : data.entrySet()) {
String currentValue = currentValues.get(basePath + entry.getKey());
if ((currentValue == null) || entry.getValue().equals("") || (!currentValue.equals(entry.getValue()))) {
parameters.add("DEFAULT", basePath + entry.getKey() + "=" + entry.getValue());
}
}
if (!parameters.entrySet().isEmpty()) {
return ResourceUtil.runCommand("set", parameters, null); //TODO The last parameter is resultType and is not used. Refactor the called method to remove it
} else {
return new RestActionReporter(); // noop
}
}