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) {
|
||||
//super(WAServicePage.NAVIGATION_NAME +"/"+ serviceName +"/"+ name);
|
||||
this.configClass = configClass;
|
||||
}
|
||||
|
||||
|
|
@ -69,23 +68,29 @@ public abstract class ConfigPage extends WAPage {
|
|||
List<WAConfiguration> objList = getAllConfigs();
|
||||
|
||||
// Actions
|
||||
if (request.containsKey("action") && request.containsKey("id")) {
|
||||
int id = Integer.parseInt(request.get("id"));
|
||||
if (request.containsKey("action")) {
|
||||
int id = -1;
|
||||
if (request.containsKey("id"))
|
||||
id = Integer.parseInt(request.get("id"));
|
||||
WAConfiguration target = getConfig(id);
|
||||
if (target != null) {
|
||||
switch (request.get("action")) {
|
||||
case "create":
|
||||
target = newConfig();
|
||||
case "modify":
|
||||
new Configurator<WAConfiguration>(target).setValues(request).applyConfiguration();
|
||||
target.saveConfiguration();
|
||||
target.save(db);
|
||||
if (target != null) {
|
||||
new Configurator<WAConfiguration>(target)
|
||||
.setValues(request).applyConfiguration();
|
||||
target.saveConfiguration();
|
||||
target.save(db);
|
||||
}
|
||||
break;
|
||||
case "delete":
|
||||
target.deleteConfiguration();
|
||||
target.delete(db);
|
||||
if (target != null) {
|
||||
target.deleteConfiguration();
|
||||
target.delete(db);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare Output
|
||||
|
|
@ -100,6 +105,9 @@ public abstract class ConfigPage extends WAPage {
|
|||
}
|
||||
|
||||
|
||||
private WAConfiguration newConfig(){
|
||||
return null;
|
||||
}
|
||||
private WAConfiguration getConfig(int id){
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue