From 5ef8615a54803216a470ee3ce66b9aeeb47d7036 Mon Sep 17 00:00:00 2001 From: Purodha Date: Wed, 20 Feb 2013 12:37:14 +0000 Subject: [PATCH] Parameter table creation restrictions (READONLY, WRITEONCE) better distinguish between create/insert, and update. --- hsarweb/src/de/hsadmin/web/AbstractModule.java | 2 +- hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java | 4 ++-- hsarweb/src/de/hsadmin/web/vaadin/TableComponentFactory.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hsarweb/src/de/hsadmin/web/AbstractModule.java b/hsarweb/src/de/hsadmin/web/AbstractModule.java index e76f7ab..8a12075 100644 --- a/hsarweb/src/de/hsadmin/web/AbstractModule.java +++ b/hsarweb/src/de/hsadmin/web/AbstractModule.java @@ -83,7 +83,7 @@ public abstract class AbstractModule implements Module, Serializable { application.getMainWindow().removeWindow(childWindow); try { Map map = new HashMap(); - genericForm.transferToHash(map, form); + genericForm.transferToHash(map, form,false); ((InsertAble) thisModule).insertRow(map); componentFactory.loadData(); } catch (HsarwebException e) { diff --git a/hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java b/hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java index 9cf0a27..56af54a 100644 --- a/hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java +++ b/hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java @@ -141,7 +141,7 @@ public class GenericForm { return idKey; } - public void transferToHash(Map map, Form form) throws HsarwebException { + public void transferToHash(Map map, Form form, boolean update) throws HsarwebException { Iterator iterator = form.getLayout().getComponentIterator(); Object formData = form.getData(); if (formData != null && formData instanceof Long) { @@ -154,7 +154,7 @@ public class GenericForm { String propName = (String) data; PropertyConfig property = module.getModuleConfig().getProperty(propName); PropertyFieldFactory fieldFactory = property.getPropFieldFactory(); - if (!fieldFactory.isReadOnly() && !fieldFactory.isWriteOnce()) { + if (!fieldFactory.isReadOnly() && (!update || !fieldFactory.isWriteOnce())) { map.put(propName, property.getPropFieldFactory().getValue(property, component)); } } diff --git a/hsarweb/src/de/hsadmin/web/vaadin/TableComponentFactory.java b/hsarweb/src/de/hsadmin/web/vaadin/TableComponentFactory.java index a6c7df8..566dc6a 100644 --- a/hsarweb/src/de/hsadmin/web/vaadin/TableComponentFactory.java +++ b/hsarweb/src/de/hsadmin/web/vaadin/TableComponentFactory.java @@ -231,7 +231,7 @@ public class TableComponentFactory implements ComponentFactory, Serializable { application.getMainWindow().removeWindow(childWindow); try { Map map = new HashMap(); - genericForm.transferToHash(map, form); + genericForm.transferToHash(map, form,true); ((UpdateAble) module).updateRow(map); loadData(); } catch (HsarwebException e) {