Robustness fixes
This commit is contained in:
parent
af1d6546eb
commit
2d9aefd079
1 changed files with 18 additions and 10 deletions
|
|
@ -53,7 +53,6 @@ public abstract class ConfigPage extends WAPage {
|
||||||
|
|
||||||
|
|
||||||
public ConfigPage(Class<? extends WAConfiguration> configClass) {
|
public ConfigPage(Class<? extends WAConfiguration> configClass) {
|
||||||
//super(WAServicePage.NAVIGATION_NAME +"/"+ serviceName +"/"+ name);
|
|
||||||
this.configClass = configClass;
|
this.configClass = configClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,22 +68,28 @@ public abstract class ConfigPage extends WAPage {
|
||||||
List<WAConfiguration> objList = getAllConfigs();
|
List<WAConfiguration> objList = getAllConfigs();
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
if (request.containsKey("action") && request.containsKey("id")) {
|
if (request.containsKey("action")) {
|
||||||
int id = Integer.parseInt(request.get("id"));
|
int id = -1;
|
||||||
|
if (request.containsKey("id"))
|
||||||
|
id = Integer.parseInt(request.get("id"));
|
||||||
WAConfiguration target = getConfig(id);
|
WAConfiguration target = getConfig(id);
|
||||||
if (target != null) {
|
|
||||||
switch (request.get("action")) {
|
switch (request.get("action")) {
|
||||||
case "create":
|
case "create":
|
||||||
|
target = newConfig();
|
||||||
case "modify":
|
case "modify":
|
||||||
new Configurator<WAConfiguration>(target).setValues(request).applyConfiguration();
|
if (target != null) {
|
||||||
|
new Configurator<WAConfiguration>(target)
|
||||||
|
.setValues(request).applyConfiguration();
|
||||||
target.saveConfiguration();
|
target.saveConfiguration();
|
||||||
target.save(db);
|
target.save(db);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "delete":
|
case "delete":
|
||||||
|
if (target != null) {
|
||||||
target.deleteConfiguration();
|
target.deleteConfiguration();
|
||||||
target.delete(db);
|
target.delete(db);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,6 +105,9 @@ public abstract class ConfigPage extends WAPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private WAConfiguration newConfig(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
private WAConfiguration getConfig(int id){
|
private WAConfiguration getConfig(int id){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue