Parameter table creation restrictions (READONLY, WRITEONCE) better

distinguish between create/insert, and update.
This commit is contained in:
Purodha 2013-02-20 12:37:14 +00:00
parent 35ebbe6d4f
commit 5ef8615a54
3 changed files with 4 additions and 4 deletions

View File

@ -83,7 +83,7 @@ public abstract class AbstractModule implements Module, Serializable {
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) {

View File

@ -141,7 +141,7 @@ public class GenericForm {
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 @@ 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));
}
}

View File

@ -231,7 +231,7 @@ public class TableComponentFactory implements ComponentFactory, Serializable {
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) {