Skip to content

Commit

Permalink
0001945: Parameter edit panel doesn't display the correct parameter v…
Browse files Browse the repository at this point in the history
…alue for group if the node specific parameter has been set
  • Loading branch information
chenson42 committed Aug 29, 2014
1 parent d5a2666 commit f2b2b79
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
Expand Up @@ -71,9 +71,7 @@ public interface IParameterService {

public List<DatabaseParameter> getDatabaseParametersFor(String paramKey);

public TypedProperties getDatabaseParametersByNodeGroupId(String nodeGroupId);

public TypedProperties getDatabaseParametersByExternalId(String externalId);
public TypedProperties getDatabaseParameters(String externalId, String nodeGroupId);

public TypedProperties getAllParameters();

Expand Down
Expand Up @@ -216,16 +216,15 @@ public void setDatabaseHasBeenInitialized(boolean databaseHasBeenInitialized) {
this.parameters = null;
}

abstract protected TypedProperties rereadDatabaseParameters(String externalId,
String nodeGroupId);
abstract public TypedProperties getDatabaseParameters(String externalId, String nodeGroupId);

protected TypedProperties rereadDatabaseParameters(Properties p) {
if (databaseHasBeenInitialized) {
TypedProperties properties = rereadDatabaseParameters(ParameterConstants.ALL,
TypedProperties properties = getDatabaseParameters(ParameterConstants.ALL,
ParameterConstants.ALL);
properties.putAll(rereadDatabaseParameters(ParameterConstants.ALL,
properties.putAll(getDatabaseParameters(ParameterConstants.ALL,
p.getProperty(ParameterConstants.NODE_GROUP_ID)));
properties.putAll(rereadDatabaseParameters(
properties.putAll(getDatabaseParameters(
p.getProperty(ParameterConstants.EXTERNAL_ID),
p.getProperty(ParameterConstants.NODE_GROUP_ID)));
databaseHasBeenInitialized = true;
Expand Down
Expand Up @@ -134,10 +134,6 @@ public void saveParameters(String externalId, String nodeGroupId, Map<String, Ob
saveParameter(externalId, nodeGroupId, key, parameters.get(key), lastUpdateBy);
}
}

protected TypedProperties rereadDatabaseParameters(String externalId, String nodeGroupId) {
return readParametersFromDatabase("selectParametersSql", externalId, nodeGroupId);
}

protected TypedProperties readParametersFromDatabase(String sqlKey, Object... values) {
final TypedProperties properties = new TypedProperties();
Expand Down Expand Up @@ -171,12 +167,8 @@ public List<DatabaseParameter> getDatabaseParametersFor(String paramKey) {
new DatabaseParameterMapper(), paramKey);
}

public TypedProperties getDatabaseParametersByNodeGroupId(String nodeGroupId) {
return readParametersFromDatabase("selectParametersByNodeGroupIdSql", nodeGroupId);
}

public TypedProperties getDatabaseParametersByExternalId(String externalId) {
return readParametersFromDatabase("selectParametersByExternalIdSql", externalId);
public TypedProperties getDatabaseParameters(String externalId, String nodeGroupId) {
return readParametersFromDatabase("selectParametersSql", externalId, nodeGroupId);
}

class DatabaseParameterMapper implements ISqlRowMapper<DatabaseParameter> {
Expand Down
Expand Up @@ -91,15 +91,10 @@ protected TypedProperties rereadApplicationParameters() {
}

@Override
protected TypedProperties rereadDatabaseParameters(String externalId, String nodeGroupId) {
public TypedProperties getDatabaseParameters(String externalId, String nodeGroupId) {
return new TypedProperties(properties);
}

@Override
public TypedProperties getDatabaseParametersByExternalId(String externalId) {
return null;
}

@Override
public void deleteParameterWithUpdate(String externalId,
String nodeGroupId, String key) {
Expand Down

0 comments on commit f2b2b79

Please sign in to comment.