From 5ef8615a54803216a470ee3ce66b9aeeb47d7036 Mon Sep 17 00:00:00 2001
From: Purodha <bli00@hostsharing.net>
Date: Wed, 20 Feb 2013 13:37:14 +0100
Subject: [PATCH] Parameter table creation restrictions (READONLY, WRITEONCE) better distinguish between create/insert, and update.

---
 hsarweb/src/de/hsadmin/web/vaadin/TableComponentFactory.java |    2 +-
 hsarweb/src/de/hsadmin/web/AbstractModule.java               |    2 +-
 hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java           |    4 ++--
 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 @@
 								application.getMainWindow().removeWindow(childWindow);
 								try {
 									Map<String, XmlrpcProperty> map = new HashMap<String, XmlrpcProperty>();
-									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 @@
 		return idKey;
 	}
 
-	public void transferToHash(Map<String, XmlrpcProperty> map, Form form) throws HsarwebException {
+	public void transferToHash(Map<String, XmlrpcProperty> map, Form form, boolean update) throws HsarwebException {
 		Iterator<Component> iterator = form.getLayout().getComponentIterator();
 		Object formData = form.getData();
 		if (formData != null && formData instanceof Long) {
@@ -154,7 +154,7 @@
 				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 @@
 						application.getMainWindow().removeWindow(childWindow);
 						try {
 							Map<String, XmlrpcProperty> map = new HashMap<String, XmlrpcProperty>();
-							genericForm.transferToHash(map, form);
+							genericForm.transferToHash(map, form,true);
 							((UpdateAble) module).updateRow(map);
 							loadData();
 						} catch (HsarwebException e) {

--
Gitblit v1.9.0-SNAPSHOT