2
0
Fork 0

Moved all data objects to Serializable and some generics bits.

This commit is contained in:
Willem Cazander 2014-05-28 15:15:12 +02:00
parent 1b3e65fa83
commit 3bf185ad48
73 changed files with 228 additions and 181 deletions

View file

@ -55,7 +55,7 @@ public interface VascBackend<DATA_OBJECT extends Serializable> {
* note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle.
* @return
*/
public VascEntryFieldValue provideVascEntryFieldValue();
public VascEntryFieldValue<DATA_OBJECT> provideVascEntryFieldValue();
/**
* Creates a new RecordCreater obj the the given entry.

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.backend;
import java.io.Serializable;
import java.util.List;
@ -32,7 +33,7 @@ import java.util.List;
*/
public interface VascBackendController {
public VascBackend getVascBackendById(String id);
public VascBackend<Serializable> getVascBackendById(String id);
public List<String> getVascBackendIds();
}

View file

@ -31,11 +31,11 @@ import java.io.Serializable;
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryFieldValue extends Serializable {
public interface VascEntryFieldValue<DATA_OBJECT extends Serializable> extends Serializable {
public Object getValue(String backendName,Object record) throws VascBackendException;
public Serializable getValue(String backendName,DATA_OBJECT record) throws VascBackendException;
public String getDisplayValue(String backendName,Object record) throws VascBackendException;
public String getDisplayValue(String backendName,DATA_OBJECT record) throws VascBackendException;
public void setValue(String backendName,Object record,Object value) throws VascBackendException;
public void setValue(String backendName,DATA_OBJECT record,Serializable value) throws VascBackendException;
}

View file

@ -23,6 +23,8 @@
package net.forwardfire.vasc.backend.data;
import java.io.Serializable;
import net.forwardfire.vasc.backend.VascBackendException;
import net.forwardfire.vasc.backend.VascEntryFieldValue;
@ -34,7 +36,7 @@ import org.x4o.xml.element.DefaultElementObjectPropertyValue;
* @author Willem Cazander
* @version 1.0 Dec 05, 2009
*/
public class BeanVascEntryFieldValue implements VascEntryFieldValue {
public class BeanVascEntryFieldValue<DATA_OBJECT extends Serializable> implements VascEntryFieldValue<DATA_OBJECT> {
private static final long serialVersionUID = 1L;
private DefaultElementObjectPropertyValue bean = new DefaultElementObjectPropertyValue();
@ -42,7 +44,7 @@ public class BeanVascEntryFieldValue implements VascEntryFieldValue {
/**
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(java.lang.String, java.lang.Object)
*/
public Object getValue(String backendName, Object record) throws VascBackendException {
public Serializable getValue(String backendName, DATA_OBJECT record) throws VascBackendException {
if (backendName==null) {
throw new NullPointerException("Can't get value of null backendName.");
}
@ -50,7 +52,7 @@ public class BeanVascEntryFieldValue implements VascEntryFieldValue {
throw new NullPointerException("Can't get value of null object.");
}
try {
Object o = bean.getProperty(record,backendName);
Serializable o = (Serializable)bean.getProperty(record,backendName);
return o;
} catch (Exception e) {
throw new VascBackendException(e);
@ -60,8 +62,8 @@ public class BeanVascEntryFieldValue implements VascEntryFieldValue {
/**
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(java.lang.String, java.lang.Object)
*/
public String getDisplayValue(String backendName, Object record) throws VascBackendException {
Object value = getValue(backendName,record);
public String getDisplayValue(String backendName, DATA_OBJECT record) throws VascBackendException {
Serializable value = getValue(backendName,record);
if (value==null) {
return "";
}
@ -89,7 +91,7 @@ public class BeanVascEntryFieldValue implements VascEntryFieldValue {
/**
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(java.lang.String, java.lang.Object, java.lang.Object)
*/
public void setValue(String backendName, Object record,Object value) throws VascBackendException {
public void setValue(String backendName, DATA_OBJECT record,Serializable value) throws VascBackendException {
if (backendName==null) {
throw new NullPointerException("Can't set value of null backendName.");
}

View file

@ -22,43 +22,41 @@
package net.forwardfire.vasc.backend.data;
import java.util.Map;
import java.io.Serializable;
import java.util.HashMap;
import net.forwardfire.vasc.backend.VascBackendException;
import net.forwardfire.vasc.backend.VascEntryFieldValue;
/**
* MapVascEntryFieldValue provides get/set support on Map record object.
*
* @author Willem Cazander
* @version 1.0 Dec 05, 2009
*/
public class HashMapVascEntryFieldValue implements VascEntryFieldValue {
public class HashMapVascEntryFieldValue implements VascEntryFieldValue<HashMap<String,Serializable>> {
private static final long serialVersionUID = 1L;
/**
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(java.lang.String, java.lang.Object)
*/
@SuppressWarnings("unchecked")
public Object getValue(String backendName, Object record) throws VascBackendException {
public Serializable getValue(String backendName,HashMap<String,Serializable> map) throws VascBackendException {
if (backendName==null) {
throw new NullPointerException("Can't get value of null backendName field.");
}
if (record==null) {
if (map==null) {
throw new NullPointerException("Can't get value of null object.");
}
Map<String,Object> map = (Map<String,Object>)record;
Object fieldValue = map.get(backendName);
Serializable fieldValue = map.get(backendName);
return fieldValue;
}
/**
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object)
*/
public String getDisplayValue(String field, Object record) throws VascBackendException {
Object fieldValue = getValue(field,record);
public String getDisplayValue(String field, HashMap<String,Serializable> record) throws VascBackendException {
Serializable fieldValue = getValue(field,record);
if (fieldValue==null) {
fieldValue = "";
}
@ -68,10 +66,7 @@ public class HashMapVascEntryFieldValue implements VascEntryFieldValue {
/**
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(java.lang.String, java.lang.Object, java.lang.Object)
*/
@SuppressWarnings("unchecked")
public void setValue(String backendName, Object record,Object value) throws VascBackendException {
Map<String,Object> map = (Map<String,Object>)record;
public void setValue(String backendName, HashMap<String,Serializable> map,Serializable value) throws VascBackendException {
map.put(backendName, value);
}
}

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.backend.data;
import java.io.Serializable;
import java.util.HashMap;
import net.forwardfire.vasc.backend.VascBackendException;
@ -33,11 +34,11 @@ import net.forwardfire.vasc.backend.VascEntryRecordCreator;
* @author Willem Cazander
* @version 1.0 Dec 05, 2009
*/
public class HashMapVascEntryRecordCreator implements VascEntryRecordCreator<HashMap<String,Object>> {
public class HashMapVascEntryRecordCreator implements VascEntryRecordCreator<HashMap<String,Serializable>> {
private static final long serialVersionUID = 1L;
public HashMap<String,Object> newRecord() throws VascBackendException {
return new HashMap<String,Object>(10);
public HashMap<String,Serializable> newRecord() throws VascBackendException {
return new HashMap<String,Serializable>(10);
}
}

View file

@ -45,7 +45,6 @@ import org.eobjects.metamodel.schema.Table;
import net.forwardfire.vasc.backend.AbstractVascBackend;
import net.forwardfire.vasc.backend.VascBackendException;
import net.forwardfire.vasc.backend.VascBackendState;
import net.forwardfire.vasc.backend.VascEntryFieldValue;
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
import net.forwardfire.vasc.backend.metamodel.crud.CrudDataContext;
import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRow;
@ -283,7 +282,7 @@ public class MetaModelVascBackend extends AbstractVascBackend<Row> {
crudDataContext.delete((UpdateableRow) object);
}
public VascEntryFieldValue provideVascEntryFieldValue() {
public RowVascEntryFieldValue provideVascEntryFieldValue() {
return new RowVascEntryFieldValue();
}

View file

@ -1,5 +1,7 @@
package net.forwardfire.vasc.backend.metamodel;
import java.io.Serializable;
import org.eobjects.metamodel.data.Row;
import org.eobjects.metamodel.query.SelectItem;
@ -7,14 +9,14 @@ import net.forwardfire.vasc.backend.VascBackendException;
import net.forwardfire.vasc.backend.VascEntryFieldValue;
import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRow;
public class RowVascEntryFieldValue implements VascEntryFieldValue {
public class RowVascEntryFieldValue implements VascEntryFieldValue<Row> {
private static final long serialVersionUID = -806674640688182132L;
/**
* @see net.forwardfire.vasc.backend.VascEntryFieldValue#getValue(java.lang.String, java.lang.Object)
*/
public Object getValue(String backendName, Object record) throws VascBackendException {
public Serializable getValue(String backendName, Row record) throws VascBackendException {
if (backendName==null) {
throw new NullPointerException("Can't get value of null backendName.");
}
@ -23,10 +25,9 @@ public class RowVascEntryFieldValue implements VascEntryFieldValue {
}
if (record instanceof UpdateableRow) {
UpdateableRow row = (UpdateableRow)record;
return row.getValue(backendName);
return (Serializable) row.getValue(backendName);
}
Row row = (Row)record;
Object fieldValue = row.getValue(indexOf(backendName,row));
Serializable fieldValue = (Serializable) record.getValue(indexOf(backendName,record));
return fieldValue;
}
@ -47,7 +48,7 @@ public class RowVascEntryFieldValue implements VascEntryFieldValue {
/**
* @see net.forwardfire.vasc.backend.VascEntryFieldValue#getDisplayValue(java.lang.String, java.lang.Object)
*/
public String getDisplayValue(String backendName, Object record) throws VascBackendException {
public String getDisplayValue(String backendName, Row record) throws VascBackendException {
Object fieldValue = getValue(backendName,record);
if (fieldValue==null) {
fieldValue = "";
@ -58,7 +59,7 @@ public class RowVascEntryFieldValue implements VascEntryFieldValue {
/**
* @see net.forwardfire.vasc.backend.VascEntryFieldValue#setValue(java.lang.String, java.lang.Object, java.lang.Object)
*/
public void setValue(String backendName, Object record,Object value) throws VascBackendException {
public void setValue(String backendName, Row record,Serializable value) throws VascBackendException {
if (record instanceof UpdateableRow) {
UpdateableRow row = (UpdateableRow)record;
row.setValue(backendName, value);

View file

@ -29,7 +29,6 @@ import java.util.logging.Logger;
import net.forwardfire.vasc.backend.AbstractVascBackend;
import net.forwardfire.vasc.backend.VascBackendException;
import net.forwardfire.vasc.backend.VascBackendState;
import net.forwardfire.vasc.backend.VascEntryFieldValue;
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
import com.mongodb.DB;
@ -142,7 +141,7 @@ public class MongodbVascBackend extends AbstractVascBackend<BasicDBObject> {
coll.remove(query); // remove by _id
}
public VascEntryFieldValue provideVascEntryFieldValue() {
public MongodbVascEntryFieldValue provideVascEntryFieldValue() {
return new MongodbVascEntryFieldValue();
}

View file

@ -22,6 +22,8 @@
package net.forwardfire.vasc.backend.mongodb;
import java.io.Serializable;
import net.forwardfire.vasc.backend.VascBackendException;
import net.forwardfire.vasc.backend.VascEntryFieldValue;
@ -33,22 +35,20 @@ import com.mongodb.BasicDBObject;
* @author Willem Cazander
* @version 1.0 Dec 30, 2011
*/
public class MongodbVascEntryFieldValue implements VascEntryFieldValue {
public class MongodbVascEntryFieldValue implements VascEntryFieldValue<BasicDBObject> {
private static final long serialVersionUID = -7371273796529818557L;
public Object getValue(String backendName, Object record) throws VascBackendException {
BasicDBObject row = (BasicDBObject)record;
Object data = row.get(backendName);
public Serializable getValue(String backendName, BasicDBObject row) throws VascBackendException {
Serializable data = (Serializable) row.get(backendName);
return data;
}
public String getDisplayValue(String field, Object record) throws VascBackendException {
return ""+getValue(field,record);
public String getDisplayValue(String field, BasicDBObject row) throws VascBackendException {
return ""+getValue(field,row);
}
public void setValue(String backendName, Object record, Object value) throws VascBackendException {
BasicDBObject row = (BasicDBObject)record;
public void setValue(String backendName, BasicDBObject row, Serializable value) throws VascBackendException {
row.put(backendName, value);
}
}

View file

@ -85,10 +85,10 @@ public class VascChoicesSelectItemModel implements VascSelectItemModel,Serializa
name = entry.getVascFrontendController().getVascEntryResourceResolver().getTextValue(key);
}
item.setLabel(name);
Object value = vascChoices.choisesValues()[index];
Serializable value = vascChoices.choisesValues()[index];
if (vascChoices.choisesType().equals(String.class)==false) {
try {
value = vascChoices.choisesType().getConstructor(String.class).newInstance(key);
value = (Serializable) vascChoices.choisesType().getConstructor(String.class).newInstance(key);
} catch (Exception e) {
}
}

View file

@ -148,7 +148,7 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy {
/**
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue()
*/
public VascEntryFieldValue provideVascEntryFieldValue() {
public VascEntryFieldValue<Serializable> provideVascEntryFieldValue() {
return backend.provideVascEntryFieldValue();
}

View file

@ -83,8 +83,8 @@ public class VascBackendProxySearch extends AbstractVascBackendProxy {
List<Serializable> search = new ArrayList<Serializable>(result.size()/4);
for (Serializable record:result) {
for (VascEntryField field:entry.getVascEntryFields()) {
VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue();
Object value = fieldValue.getValue(field.getBackendName(), record);
VascEntryFieldValue<Serializable> fieldValue = backend.provideVascEntryFieldValue();
Serializable value = fieldValue.getValue(field.getBackendName(), record);
if (value==null) {
continue; // can't search null values.
}

View file

@ -80,10 +80,10 @@ public class VascBackendProxySort extends AbstractVascBackendProxy {
return result;
}
final VascEntryField field = getVascEntryFieldByBackendName(state.getSortField());
final VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue();
Collections.sort(result, new Comparator<Object>() {
final VascEntryFieldValue<Serializable> fieldValue = backend.provideVascEntryFieldValue();
Collections.sort(result, new Comparator<Serializable>() {
@SuppressWarnings("rawtypes")
public int compare(Object o1, Object o2) {
public int compare(Serializable o1, Serializable o2) {
try {
Comparable c1 = null;
Comparable c2 = null;

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.core;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@ -42,9 +43,9 @@ abstract public class AbstractVascEntryFieldLocal extends AbstractVascBaseIdRole
private String backendName = null;
private String displayName = null;
private VascEntryFieldType vascEntryFieldType = null;
private VascEntryFieldValue vascEntryFieldValue = null;
private VascEntryFieldValue<Serializable> vascEntryFieldValue = null;
private List<VascValidator> vascValidators = null;
private Object defaultValue = null;
private Serializable defaultValue = null;
private Integer sizeList = null;
private Integer sizeEdit = null;
private String styleList = null;
@ -142,14 +143,14 @@ abstract public class AbstractVascEntryFieldLocal extends AbstractVascBaseIdRole
/**
* @return the vascEntryFieldValue
*/
public VascEntryFieldValue getVascEntryFieldValue() {
public VascEntryFieldValue<Serializable> getVascEntryFieldValue() {
return vascEntryFieldValue;
}
/**
* @param vascEntryFieldValue the vascEntryFieldValue to set
*/
public void setVascEntryFieldValue(VascEntryFieldValue vascEntryFieldValue) {
public void setVascEntryFieldValue(VascEntryFieldValue<Serializable> vascEntryFieldValue) {
this.vascEntryFieldValue = vascEntryFieldValue;
}
@ -178,14 +179,14 @@ abstract public class AbstractVascEntryFieldLocal extends AbstractVascBaseIdRole
/**
* @return the defaultValue
*/
public Object getDefaultValue() {
public Serializable getDefaultValue() {
return defaultValue;
}
/**
* @param defaultValue the defaultValue to set
*/
public void setDefaultValue(Object defaultValue) {
public void setDefaultValue(Serializable defaultValue) {
this.defaultValue = defaultValue;
}

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.core;
import java.io.Serializable;
import java.util.List;
import net.forwardfire.vasc.backend.VascEntryFieldValue;
@ -55,7 +56,7 @@ public interface VascEntryField extends VascBaseIdRoleCrudOrderMeta {
/**
* @return the vascEntryFieldValue
*/
public VascEntryFieldValue getVascEntryFieldValue();
public VascEntryFieldValue<Serializable> getVascEntryFieldValue();
/**
* @return the vascValidators
@ -65,7 +66,7 @@ public interface VascEntryField extends VascBaseIdRoleCrudOrderMeta {
/**
* @return the defaultValue
*/
public Object getDefaultValue();
public Serializable getDefaultValue();
/**
* @return the sizeList

View file

@ -22,6 +22,8 @@
package net.forwardfire.vasc.core;
import java.io.Serializable;
import net.forwardfire.vasc.backend.VascEntryFieldValue;
import net.forwardfire.vasc.core.base.VascBaseIdRoleCrudOrderMetaLocal;
import net.forwardfire.vasc.validators.VascValidator;
@ -53,7 +55,7 @@ public interface VascEntryFieldLocal extends VascEntryField,VascBaseIdRoleCrudOr
/**
* @param vascEntryFieldValue the vascEntryFieldValue to set
*/
public void setVascEntryFieldValue(VascEntryFieldValue vascEntryFieldValue);
public void setVascEntryFieldValue(VascEntryFieldValue<Serializable> vascEntryFieldValue);
/**
* @param vascValidator the vascValidator to add
@ -68,7 +70,7 @@ public interface VascEntryFieldLocal extends VascEntryField,VascBaseIdRoleCrudOr
/**
* @param defaultValue the defaultValue to set
*/
public void setDefaultValue(Object defaultValue);
public void setDefaultValue(Serializable defaultValue);
/**
* @param sizeList the sizeList to set

View file

@ -63,5 +63,5 @@ public interface VascEntryFrontendEventListener extends Serializable {
* @param type
* @param data
*/
public void vascEvent(VascEntry entry,Object data);
public void vascEvent(VascEntry entry,Serializable data);
}

View file

@ -22,6 +22,8 @@
package net.forwardfire.vasc.core.ui;
import java.io.Serializable;
import net.forwardfire.vasc.backend.VascBackendException;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascException;
@ -35,12 +37,12 @@ import net.forwardfire.vasc.core.VascException;
public class VascColumnValueModelListener implements VascValueModelListener {
private VascEntryField vascEntryField = null;
private Object bean = null;
private Serializable bean = null;
public VascColumnValueModelListener() {
}
public VascColumnValueModelListener(VascEntryField vascEntryField,Object bean) {
public VascColumnValueModelListener(VascEntryField vascEntryField,Serializable bean) {
setVascEntryField(vascEntryField);
setBean(bean);
}
@ -70,14 +72,14 @@ public class VascColumnValueModelListener implements VascValueModelListener {
/**
* @return the bean
*/
public Object getBean() {
public Serializable getBean() {
return bean;
}
/**
* @param bean the bean to set
*/
public void setBean(Object bean) {
public void setBean(Serializable bean) {
this.bean = bean;
}
}

View file

@ -22,6 +22,8 @@
package net.forwardfire.vasc.core.ui;
import java.io.Serializable;
/**
*
* @author Willem Cazander
@ -30,18 +32,18 @@ package net.forwardfire.vasc.core.ui;
public class VascSelectItem {
private String label = null;
private Object value = null;
private Serializable value = null;
private String keyValue = null;
private boolean disabled = false;
public VascSelectItem() {
}
public VascSelectItem(String label,Object value) {
public VascSelectItem(String label,Serializable value) {
setLabel(label);
setValue(value);
}
public VascSelectItem(String label,Object value,String keyValue) {
public VascSelectItem(String label,Serializable value,String keyValue) {
setLabel(label);
setValue(value);
setKeyValue(keyValue);
@ -64,14 +66,14 @@ public class VascSelectItem {
/**
* @return the value
*/
public Object getValue() {
public Serializable getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(Object value) {
public void setValue(Serializable value) {
this.value = value;
}

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.core.ui;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@ -37,7 +38,7 @@ import net.forwardfire.vasc.core.VascException;
*/
public class VascValueModel {
private Object value = null;
private Serializable value = null;
private List<VascValueModelListener> listeners = null;
private VascValueModel parentModel = null;
@ -49,14 +50,14 @@ public class VascValueModel {
this.parentModel=parentModel;
}
public Object getValue() throws VascException {
public Serializable getValue() throws VascException {
if (parentModel!=null) {
return parentModel.getValue();
}
return value;
}
public void setValue(Object value) throws VascException {
public void setValue(Serializable value) throws VascException {
if (parentModel!=null) {
parentModel.setValue(value);
} else {

View file

@ -42,7 +42,7 @@ public interface VascFrontendActions extends VascFrontendEntry {
public void persistObject() throws VascFrontendException;
public Object mergeObject() throws VascFrontendException;
public Serializable mergeObject() throws VascFrontendException;
public void sortAction(VascEntryField field) throws VascFrontendException;
@ -50,7 +50,7 @@ public interface VascFrontendActions extends VascFrontendEntry {
public void pageAction(Integer page) throws VascFrontendException;
public void moveUpAction(Object object) throws VascFrontendException;
public void moveUpAction(Serializable object) throws VascFrontendException;
public void moveDownAction(Object object) throws VascFrontendException;
public void moveDownAction(Serializable object) throws VascFrontendException;
}

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.frontend;
import java.io.Serializable;
import java.util.List;
import net.forwardfire.vasc.core.VascController;
@ -115,7 +116,7 @@ public interface VascFrontendController {
public void initFrontendListeners(VascEntryLocal entry,String frontendType) throws InstantiationException, IllegalAccessException;
public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener);
public List<VascEntryFrontendEventListener> getVascEntryFrontendEventListener(VascEntryFrontendEventListener.VascFrontendEventType type);
public void fireVascFrontendEvent(VascEntry entry,VascFrontendEventType type,Object data);
public void fireVascFrontendEvent(VascEntry entry,VascFrontendEventType type,Serializable data);
/**

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -169,8 +170,8 @@ public class DefaultVascEntryConfigController implements VascEntryConfigControll
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#configVascBackendProxied(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry)
*/
public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry) throws VascException {
VascBackend realBackend = vascController.getVascBackendController().getVascBackendById(vascEntry.getBackendId());
public VascBackend<Serializable> configVascBackendProxied(VascController vascController,VascEntry vascEntry) throws VascException {
VascBackend<Serializable> realBackend = vascController.getVascBackendController().getVascBackendById(vascEntry.getBackendId());
if (realBackend==null) {
throw new VascException("Could not find backend: "+vascEntry.getBackendId());
}
@ -180,8 +181,8 @@ public class DefaultVascEntryConfigController implements VascEntryConfigControll
/**
* @see net.forwardfire.vasc.core.VascEntryConfigController#configVascBackendProxied(net.forwardfire.vasc.core.VascController, net.forwardfire.vasc.core.VascEntry, net.forwardfire.vasc.backend.VascBackend)
*/
public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry, VascBackend realBackend) throws VascException {
VascBackend backend = realBackend;
public VascBackend<Serializable> configVascBackendProxied(VascController vascController,VascEntry vascEntry, VascBackend<Serializable> realBackend) throws VascException {
VascBackend<Serializable> backend = realBackend;
for (VascBackendProxy proxy:backendProxies) {
VascBackendProxy proxyClone;
try {
@ -247,14 +248,14 @@ public class DefaultVascEntryConfigController implements VascEntryConfigControll
}
// Add backend to entry
VascBackend backend = vascController.getVascEntryConfigController().configVascBackendProxied(vascController, entry);
VascBackend<Serializable> backend = vascController.getVascEntryConfigController().configVascBackendProxied(vascController, entry);
controller.getVascEntryState().setVascBackend(backend);
controller.getVascEntryState().setVascEntry(entry);
// Fetch all data field value impl for this backend.
for (VascEntryField field:entry.getVascEntryFields()) {
if (field.getVascEntryFieldValue()==null) {
VascEntryFieldValue v = backend.provideVascEntryFieldValue();
VascEntryFieldValue<Serializable> v = backend.provideVascEntryFieldValue();
((VascEntryFieldLocal)field).setVascEntryFieldValue(v);
}
}

View file

@ -122,7 +122,7 @@ public class HibernateValidatorService implements VascEntryFieldValidatorService
//do not resolve the property eagerly to allow validator.apply to work wo interpolator
}
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public String interpolate(String message, Validator validator, MessageInterpolator defaultInterpolator) {
if ( annotationMessage!=null && annotationMessage.equals( message ) ) {
//short cut

View file

@ -23,7 +23,6 @@
package net.forwardfire.vasc.impl.entry.config;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryConfigFinalizer;
import net.forwardfire.vasc.core.VascEntryLocal;
import net.forwardfire.vasc.core.VascException;

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.impl.entry.config;
import java.io.Serializable;
import java.util.Locale;
import org.x4o.xml.conv.ObjectConverterException;
@ -57,7 +58,7 @@ public class VascDefaultsFinalizer implements VascEntryConfigFinalizer {
}
// Check if backendId is valid
VascBackend back = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
VascBackend<Serializable> back = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
if (back==null) {
throw new IllegalArgumentException("The VascEntry backend is not found in backends: '"+entry.getBackendId()+"' in entryId: "+id);
}
@ -161,9 +162,9 @@ public class VascDefaultsFinalizer implements VascEntryConfigFinalizer {
if (vef.getDefaultValue()!=null && vef.getDefaultValue() instanceof String) {
if (vef.getVascEntryFieldType().getObjectConverter() != null) {
Object value;
Serializable value;
try {
value = vef.getVascEntryFieldType().getObjectConverter().convertTo(vef.getDefaultValue(), Locale.getDefault());
value = (Serializable) vef.getVascEntryFieldType().getObjectConverter().convertTo(vef.getDefaultValue(), Locale.getDefault());
} catch (ObjectConverterException e) {
throw new VascException(e);
}
@ -237,9 +238,9 @@ public class VascDefaultsFinalizer implements VascEntryConfigFinalizer {
if (vef.getDefaultValue()!=null && vef.getDefaultValue() instanceof String) {
if (vef.getVascEntryFieldType()!=null && vef.getVascEntryFieldType().getObjectConverter() != null) {
Object value;
Serializable value;
try {
value = vef.getVascEntryFieldType().getObjectConverter().convertTo(vef.getDefaultValue(), Locale.getDefault());
value = (Serializable) vef.getVascEntryFieldType().getObjectConverter().convertTo(vef.getDefaultValue(), Locale.getDefault());
} catch (ObjectConverterException e) {
throw new VascException(e);
}

View file

@ -22,6 +22,8 @@
package net.forwardfire.vasc.impl.entry.config;
import java.io.Serializable;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.core.VascController;
import net.forwardfire.vasc.core.VascEntryField;
@ -65,7 +67,7 @@ public class VascIdCheckFinalizer implements VascEntryConfigFinalizer {
}
// Check if backendId is valid
VascBackend back = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
VascBackend<Serializable> back = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
if (back==null) {
throw new IllegalArgumentException("The VascEntry backend is not found in backends: '"+entry.getBackendId()+"' in entryId: "+id);
}

View file

@ -31,13 +31,11 @@ import net.forwardfire.vasc.backend.VascBackendState;
import net.forwardfire.vasc.backend.proxy.VascProxyFilter;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascEntryLocal;
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
import net.forwardfire.vasc.core.VascException;
import net.forwardfire.vasc.frontend.VascFrontendActions;
import net.forwardfire.vasc.frontend.VascFrontendException;
/**
* Default impl of default frontend actions
*
@ -72,11 +70,11 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
continue; // no default value to set.
}
try {
Object value = field.getVascEntryFieldValue().getValue(field.getBackendName(), object);
Serializable value = field.getVascEntryFieldValue().getValue(field.getBackendName(), object);
if (value!=null) {
continue; // value is already set by backend creator.
}
Object defaultValue = field.getDefaultValue();
Serializable defaultValue = field.getDefaultValue();
if (defaultValue instanceof String) {
String def = (String)defaultValue;
if (def.equals("now()")) { // TODO: add default string parsers
@ -93,7 +91,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
return object;
}
protected int removeObjectFromDataList(Object object) throws VascBackendException {
protected int removeObjectFromDataList(Serializable object) throws VascBackendException {
int indexOld = entry.getVascFrontendController().getVascEntryState().getEntryDataList().indexOf(object);
if (entry.getVascFrontendController().getVascEntryState().getEntryDataList().remove(object)) {
return indexOld; // java worked well for use
@ -107,7 +105,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
// is only null when creating objects
if (idObject!=null) {
int index = 0;
for (Object o:entry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
for (Serializable o:entry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
Object id = field.getVascEntryFieldValue().getValue(field.getBackendName(), o);
if (idObject.equals(id)) {
@ -137,7 +135,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
/**
* @see net.forwardfire.vasc.frontend.VascFrontendActions#mergeObject()
*/
public Object mergeObject() throws VascFrontendException {
public Serializable mergeObject() throws VascFrontendException {
try {
return saveObject(false);
} catch (VascException e) {
@ -145,7 +143,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
}
}
protected Object saveObject(boolean persist) throws VascException {
protected Serializable saveObject(boolean persist) throws VascException {
try {
Serializable object = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
Serializable result = null;
@ -284,7 +282,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
entry.getVascFrontendController().getVascFrontend().renderView();
}
public void moveUpAction(Object record) throws VascFrontendException {
public void moveUpAction(Serializable record) throws VascFrontendException {
if (entry.getVascFrontendController().getVascEntryState().getVascBackend().isRecordMoveable()) {
try {
VascEntryField p = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
@ -301,7 +299,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
entry.getVascFrontendController().getVascFrontend().renderView();
}
public void moveDownAction(Object record) throws VascFrontendException {
public void moveDownAction(Serializable record) throws VascFrontendException {
if (entry.getVascFrontendController().getVascEntryState().getVascBackend().isRecordMoveable()) {
try {

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.impl.frontend;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -362,7 +363,7 @@ public class DefaultVascFrontendController implements VascFrontendControllerLoca
return list;
}
public void fireVascFrontendEvent(VascEntry entry,VascFrontendEventType type, Object data) {
public void fireVascFrontendEvent(VascEntry entry,VascFrontendEventType type, Serializable data) {
List<VascEntryFrontendEventListener> list = getVascEntryFrontendEventListener(type);
for (VascEntryFrontendEventListener l:list) {
l.vascEvent(entry, data);

View file

@ -31,8 +31,6 @@ import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.actions.VascAction;
import net.forwardfire.vasc.frontend.VascFrontendDataSelector;
import net.forwardfire.vasc.frontend.VascFrontendDataSelector.EntryFieldSelectType;
/**
* DefaultVascFrontendDataSelector orders and filters out vasc data.

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.impl.frontend;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
@ -107,7 +108,7 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
return error;
}
Object objectSelected = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
Serializable objectSelected = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
try {
Object objectValue = field.getVascEntryFieldValue().getValue(field.getBackendName(), objectSelected);
for (VascEntryFieldValidatorService s:entry.getVascFrontendController().getVascValidatorServices()) {
@ -189,12 +190,12 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
}
public String getSelectedDisplayName(VascEntry entry) {
Object row = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
Serializable row = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
if (row==null) {
return "no-selection";
}
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
VascEntryFieldValue ve = v.getVascEntryFieldValue();
VascEntryFieldValue<Serializable> ve = v.getVascEntryFieldValue();
String result = "no-data";
try {
result = ve.getDisplayValue(v.getBackendName(), row);
@ -210,12 +211,12 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
}
VascEntry parent = entry.getVascFrontendController().getVascEntryState().getParent().getVascEntry();
Object row = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
Serializable row = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
if (row==null) {
return "no-selection";
}
VascEntryField v = parent.getVascEntryFieldById(parent.getDisplayNameFieldId());
VascEntryFieldValue ve = v.getVascEntryFieldValue();
VascEntryFieldValue<Serializable> ve = v.getVascEntryFieldValue();
String result = "no-data";
try {
result = ve.getDisplayValue(v.getBackendName(), row);

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.impl.frontend;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@ -56,7 +57,7 @@ public class DefaultVascFrontendPager implements VascFrontendPageInfo {
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ};
return result;
}
public void vascEvent(VascEntry entry, Object data) {
public void vascEvent(VascEntry entry, Serializable data) {
pagesAll = getTablePagesFromBackend();
}
}

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.impl.jndi;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
@ -126,7 +127,7 @@ public class JndiVascControllerFactory implements ObjectFactory {
public List<String> getVascBackendIds() {
return backendController.getVascBackendIds();
}
public VascBackend getVascBackendById(String id) {
public VascBackend<Serializable> getVascBackendById(String id) {
return backendController.getVascBackendById(id);
}
});

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.impl.type;
import java.io.Serializable;
import java.util.List;
import net.forwardfire.vasc.core.VascEntryField;
@ -139,8 +140,8 @@ public class MultiTextVascEntryFieldType extends DefaultVascEntryFieldType {
}
}
class MultiVascValueModel extends VascValueModel {
public Object getValue() throws VascException {
Object value = super.getValue();
public Serializable getValue() throws VascException {
Serializable value = super.getValue();
//System.out.println("value: "+value+" type: "+value.getClass());
StringBuffer buf = new StringBuffer(100);
if (value instanceof List<?>) {
@ -164,7 +165,7 @@ class MultiVascValueModel extends VascValueModel {
}
@SuppressWarnings("unchecked")
public void setValue(Object editValueObj) throws VascException {
public void setValue(Serializable editValueObj) throws VascException {
if (super.getValue()==null) {
super.setValue(editValueObj);
@ -178,7 +179,7 @@ class MultiVascValueModel extends VascValueModel {
String[] editList = editValue.split(",|\t|\n");
Object value = super.getValue();
Serializable value = super.getValue();
if (value instanceof List<?>) {
((List<?>)value).clear();
for (String o:editList) {

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.impl.ui;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -83,7 +84,7 @@ public class VascSelectItemModelEntry implements VascSelectItemModel {
// set frontend data for new clone, we need te get better lifecycle management for stats/entry/etc
entry.setVascFrontendController(currentEntry.getVascFrontendController());
VascBackend back = currentEntry.getVascFrontendController().getVascController().getVascEntryConfigController().configVascBackendProxied(currentEntry.getVascFrontendController().getVascController(), entry);
VascBackend<Serializable> back = currentEntry.getVascFrontendController().getVascController().getVascEntryConfigController().configVascBackendProxied(currentEntry.getVascFrontendController().getVascController(), entry);
try {
if (nullLabel!=null) {
if (nullKeyValue==null) {
@ -135,9 +136,9 @@ public class VascSelectItemModelEntry implements VascSelectItemModel {
}
VascEntryField field = fieldOrg.clone();
field.getVascValidators().clear();
VascEntryFieldValue v = fieldEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue();
VascEntryFieldValue<Serializable> v = fieldEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue();
Object record = fieldEntry.getVascFrontendController().getVascEntryState().getEntryDataObject();
Serializable record = fieldEntry.getVascFrontendController().getVascEntryState().getEntryDataObject();
if (record==null) {
//System.out.println("could not get selected records from state.");
continue;
@ -155,7 +156,7 @@ public class VascSelectItemModelEntry implements VascSelectItemModel {
VascEntryField fieldClone = key.clone();
fieldClone.getVascValidators().clear();
VascEntryFieldValue v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue();
VascEntryFieldValue<Serializable> v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue();
key.setVascEntryFieldValue(v);
}
if (dis.getVascEntryFieldValue()==null) {
@ -163,14 +164,14 @@ public class VascSelectItemModelEntry implements VascSelectItemModel {
VascEntryField fieldClone = dis.clone();
fieldClone.getVascValidators().clear();
VascEntryFieldValue v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue();
VascEntryFieldValue<Serializable> v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue();
dis.setVascEntryFieldValue(v);
}
// execute
for (Object o:back.execute(state)) {
Object keyId = key.getVascEntryFieldValue().getValue(key.getBackendName(), o);
for (Serializable o:back.execute(state)) {
Serializable keyId = key.getVascEntryFieldValue().getValue(key.getBackendName(), o);
String nameId = dis.getVascEntryFieldValue().getDisplayValue(dis.getBackendName(), o);
if (returnKeyValue!=null && false==returnKeyValue) {
VascSelectItem item = new VascSelectItem(nameId,o,""+keyId);

View file

@ -23,6 +23,7 @@
package net.forwardfire.vasc.impl.x4o;
import java.io.IOException;
import java.io.Serializable;
import java.io.StringReader;
import java.lang.reflect.Method;
import java.util.Calendar;
@ -33,7 +34,6 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
import net.forwardfire.vasc.annotations.VascAnnotationParser;
import net.forwardfire.vasc.annotations.VascChoices;
import net.forwardfire.vasc.annotations.VascChoicesSelectItemModel;
@ -377,13 +377,13 @@ public class AnnotationParserElement extends AbstractElement {
Class<?> retType = methodCall.getReturnType();
try {
//System.out.println("creating real def value of: "+defValue+" for: "+retType.getName());
Object defObject = null;
Serializable defObject = null;
if (Date.class.equals(retType)) {
defObject = new Date();
} else if (Calendar.class.equals(retType)) {
defObject = Calendar.getInstance();
} else {
defObject = retType.getConstructor(String.class).newInstance(defValue);
defObject = (Serializable) retType.getConstructor(String.class).newInstance(defValue);
}
//System.out.println("real object: "+defObject);
field.setDefaultValue(defObject);

View file

@ -23,10 +23,7 @@
package net.forwardfire.vasc.impl.x4o;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.VascEntryFieldLocal;
import net.forwardfire.vasc.core.VascEntryFieldType;
import net.forwardfire.vasc.core.VascEntryListOptionLocal;
import net.forwardfire.vasc.core.VascEntryLocal;
import net.forwardfire.vasc.core.ui.VascSelectItemModel;
import org.x4o.xml.element.AbstractElementBindingHandler;

View file

@ -23,6 +23,8 @@
package net.forwardfire.vasc.impl.x4o;
import java.io.Serializable;
import net.forwardfire.vasc.backend.VascBackend;
import net.forwardfire.vasc.backend.VascBackendController;
import net.forwardfire.vasc.backend.VascBackendControllerLocal;
@ -46,7 +48,8 @@ public class VascBackendElementConfigurator extends AbstractElementConfigurator
*/
public void doConfigElement(Element element) throws ElementConfiguratorException {
VascBackend backend = (VascBackend)element.getElementObject();
@SuppressWarnings("unchecked")
VascBackend<Serializable> backend = (VascBackend<Serializable>)element.getElementObject();
VascController vascController = VascDriver.getVascController(element.getLanguageSession());
VascBackendController backendController = vascController.getVascBackendController();

View file

@ -32,6 +32,8 @@ import java.util.Date;
* @version 1.0 Sep 5, 2008
*/
public class VascDateFutureValidator implements VascValidator {
private static final long serialVersionUID = -8779126994191323884L;
/**
* @see net.forwardfire.vasc.validators.VascValidator#isObjectValid(java.lang.Object)

View file

@ -32,7 +32,9 @@ import java.util.Date;
* @version 1.0 Sep 5, 2008
*/
public class VascDatePastValidator implements VascValidator {
private static final long serialVersionUID = 74015638500286753L;
/**
* @see net.forwardfire.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/

View file

@ -31,7 +31,8 @@ import java.lang.annotation.Annotation;
* @version 1.0 Sep 5, 2008
*/
public class VascIntSizeValidator implements VascValidator {
private static final long serialVersionUID = 5208748030708077917L;
private int max = Integer.MAX_VALUE;
private int min = Integer.MIN_VALUE;

View file

@ -32,6 +32,7 @@ import java.lang.annotation.Annotation;
*/
public class VascLongSizeValidator implements VascValidator {
private static final long serialVersionUID = -4030130692127481134L;
private long max = Long.MAX_VALUE;
private long min = Long.MIN_VALUE;

View file

@ -31,7 +31,9 @@ import java.lang.annotation.Annotation;
* @version 1.0 Sep 5, 2008
*/
public class VascObjectNotNullValidator implements VascValidator {
private static final long serialVersionUID = 224078383059443142L;
/**
* @see net.forwardfire.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/

View file

@ -31,7 +31,9 @@ import java.lang.annotation.Annotation;
* @version 1.0 Sep 5, 2008
*/
public class VascObjectNullValidator implements VascValidator {
private static final long serialVersionUID = 150805733891675721L;
/**
* @see net.forwardfire.vasc.validators.VascValidator#isObjectValid(java.lang.Object)
*/

View file

@ -36,6 +36,7 @@ import java.util.regex.Pattern;
*/
public class VascObjectUrlValidator implements VascValidator {
private static final long serialVersionUID = -1539950641644630956L;
private Pattern pattern = null;
/**

View file

@ -35,6 +35,7 @@ package net.forwardfire.vasc.validators;
*/
public class VascStringEmailValidator extends VascStringRegexValidator {
private static final long serialVersionUID = 6441424565202039568L;
static private final String EMAIL_REGEX = "(\\w+)@(\\w+\\.)(\\w+)(\\.\\w+)*";
/**

View file

@ -32,6 +32,7 @@ import java.lang.annotation.Annotation;
*/
public class VascStringLengthValidator implements VascValidator {
private static final long serialVersionUID = 7676298359239607685L;
private Integer minLenght = 0;
private Integer maxLenght = Integer.MAX_VALUE;
private boolean nullable = false;

View file

@ -33,7 +33,8 @@ import java.util.regex.Pattern;
* @version 1.0 Sep 5, 2008
*/
public class VascStringRegexValidator implements VascValidator {
private static final long serialVersionUID = -7077554409967479437L;
private Pattern pattern = null;
/**

View file

@ -46,6 +46,7 @@ package net.forwardfire.vasc.validators;
*/
public class VascStringZipCodeValidator extends VascStringRegexValidator {
private static final long serialVersionUID = -8625655465308689744L;
static private final String ZIP_REGEX = "^[0-9]{4}\\s*[a-zA-Z]{2}$";
/**

View file

@ -24,6 +24,7 @@ package net.forwardfire.vasc.export.generic;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@ -66,7 +67,7 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
int dataSize = entry.getVascFrontendController().getVascEntryState().getEntryDataList().size();
for (int dataIndex=0;dataIndex<dataSize;dataIndex++) {
Object o = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(dataIndex);
Serializable o = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(dataIndex);
doExportRowStart(o);
try {
doExportRowFields(o);
@ -96,10 +97,10 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
abstract protected void doExportStart() throws IOException;
abstract protected void doExportEnd() throws IOException;
abstract protected void doExportRowStart(Object row) throws IOException;
abstract protected void doExportRowEnd(Object row,boolean isLast) throws IOException;
abstract protected void doExportRowStart(Serializable row) throws IOException;
abstract protected void doExportRowEnd(Serializable row,boolean isLast) throws IOException;
protected void doExportRowFields(Object row) throws IOException,VascBackendException {
protected void doExportRowFields(Serializable row) throws IOException,VascBackendException {
// todo: rm me and use data selector
List<VascEntryField> fieldList = new ArrayList<VascEntryField>(getVascEntry().getVascEntryFields());
int fields = fieldList.size();
@ -109,5 +110,5 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
}
}
abstract protected void doExportRowField(Object row,VascEntryField field,boolean isLast) throws IOException,VascBackendException;
abstract protected void doExportRowField(Serializable row,VascEntryField field,boolean isLast) throws IOException,VascBackendException;
}

View file

@ -24,6 +24,7 @@ package net.forwardfire.vasc.export.generic;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Serializable;
import net.forwardfire.vasc.backend.VascBackendException;
import net.forwardfire.vasc.core.VascEntryField;
@ -122,17 +123,17 @@ public class VascEntryExportWriterCsv extends AbstractVascEntryExportWriter {
}
@Override
protected void doExportRowStart(Object row) {
protected void doExportRowStart(Serializable row) {
}
@Override
protected void doExportRowEnd(Object row,boolean isLast) {
protected void doExportRowEnd(Serializable row,boolean isLast) {
p.write(lineEnd.toCharType());
p.flush();
}
@Override
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascBackendException {
protected void doExportRowField(Serializable o, VascEntryField c,boolean isLast) throws VascBackendException {
p.write(quoteChar.toCharType());
p.write(c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
p.write(quoteChar.toCharType());

View file

@ -24,6 +24,7 @@ package net.forwardfire.vasc.export.generic;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Serializable;
import net.forwardfire.vasc.backend.VascBackendException;
import net.forwardfire.vasc.core.VascEntryField;
@ -63,18 +64,18 @@ public class VascEntryExportWriterXml extends AbstractVascEntryExportWriter {
}
@Override
protected void doExportRowStart(Object row) {
protected void doExportRowStart(Serializable row) {
p.write("\t<row>\n");
}
@Override
protected void doExportRowEnd(Object row,boolean isLast) {
protected void doExportRowEnd(Serializable row,boolean isLast) {
p.write("\t</row>\n");
p.flush();
}
@Override
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascBackendException {
protected void doExportRowField(Serializable o, VascEntryField c,boolean isLast) throws VascBackendException {
if (xmlTree) {
p.write("\t\t<"+c.getId()+"><![CDATA[");
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.export.jr4o;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -72,7 +73,7 @@ public class JRDynamicDataSourceVascEntry extends AbstractJRDynamicDataSource {
for (int page=0;page<=pages;page++) {
vascEntry.getVascFrontendController().getVascEntryState().getVascBackendState().setPageIndex(page);
vascEntry.getVascFrontendController().getVascFrontendActions().refreshData();
for (Object o:vascEntry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
for (Serializable o:vascEntry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
List<String> row = new ArrayList<String>(30);
for (VascEntryField c:fields) {
row.add(c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));

View file

@ -25,6 +25,7 @@ package net.forwardfire.vasc.export.json;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
@ -92,12 +93,12 @@ public class VascEntryExportWriterJson extends AbstractVascEntryExportWriter {
}
@Override
protected void doExportRowStart(Object row) {
protected void doExportRowStart(Serializable row) {
rowData.clear();
}
@Override
protected void doExportRowEnd(Object row,boolean isLast) throws IOException {
protected void doExportRowEnd(Serializable row,boolean isLast) throws IOException {
JSONObject.writeJSONString(rowData, p);
if (isLast==false) {
p.write(",");
@ -107,7 +108,7 @@ public class VascEntryExportWriterJson extends AbstractVascEntryExportWriter {
}
@Override
protected void doExportRowField(Object row, VascEntryField field,boolean isLast) throws VascBackendException {
protected void doExportRowField(Serializable row, VascEntryField field,boolean isLast) throws VascBackendException {
String key = field.getId();
Object data = field.getVascEntryFieldValue().getValue(field.getBackendName(), row);
rowData.put(key, data);

View file

@ -25,6 +25,7 @@ package net.forwardfire.vasc.frontend.swing;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import java.util.List;
import javax.swing.JComboBox;
@ -158,7 +159,7 @@ public class SwingActionPanel extends JPanel implements VascEntryFrontendEventLi
return result;
}
public void vascEvent(VascEntry entry,Object dataNotUsed) {
public void vascEvent(VascEntry entry,Serializable dataNotUsed) {
init = true;

View file

@ -25,6 +25,7 @@ package net.forwardfire.vasc.frontend.swing;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import java.util.List;
import javax.swing.JButton;
@ -81,7 +82,7 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis
}
}
public void vascEvent(VascEntry entry, Object data) {
public void vascEvent(VascEntry entry, Serializable data) {
for(Component c:result.getComponents()) {
if (c instanceof JButton) {

View file

@ -24,6 +24,7 @@ package net.forwardfire.vasc.frontend.swing;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
@ -69,7 +70,7 @@ public class SwingPanelFrame implements SwingPanelIntegration {
entry.getVascFrontendController().addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() {
private static final long serialVersionUID = -6801954395965101748L;
public void vascEvent(VascEntry entry, Object data) {
public void vascEvent(VascEntry entry, Serializable data) {
if (data instanceof Exception) {
Exception e = (Exception)data;
e.printStackTrace();

View file

@ -22,6 +22,8 @@
package net.forwardfire.vasc.frontend.swing;
import java.io.Serializable;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
@ -56,7 +58,7 @@ public class SwingPanelTabbed implements SwingPanelIntegration {
entry.getVascFrontendController().addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() {
private static final long serialVersionUID = -6801954395965101748L;
public void vascEvent(VascEntry entry, Object data) {
public void vascEvent(VascEntry entry, Serializable data) {
if (data instanceof Exception) {
Exception e = (Exception)data;
e.printStackTrace();

View file

@ -105,7 +105,7 @@ public class SwingVascEditDialog extends JPanel {
// Set parameters
try {
Object selected = bean;
Serializable selected = bean;
for (String parameterName:vle.getEntryParameterFieldIdKeys()) {
String fieldId = vle.getEntryParameterFieldId(parameterName);
VascEntryField v = entry.getVascEntryFieldById(fieldId);

View file

@ -187,7 +187,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
}
public void renderDelete() throws VascFrontendException {
Object rowBean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
Serializable rowBean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
String beanValue = rowBean.toString();
try {

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.frontend.swing;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@ -47,7 +48,7 @@ public class SwingVascTableModel extends AbstractTableModel implements VascEntry
entry.getVascFrontendController().addVascEntryFrontendEventListener(this);
}
public void vascEvent(VascEntry entry,Object o) {
public void vascEvent(VascEntry entry,Serializable o) {
fireTableDataChanged();
}
@ -79,7 +80,7 @@ public class SwingVascTableModel extends AbstractTableModel implements VascEntry
* @see javax.swing.entry.entryModel#getValueAt(int, int)
*/
public Object getValueAt(int rowIndex, int columnIndex) {
Object bean = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(rowIndex);
Serializable bean = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(rowIndex);
// TODO: this is slowing....
List<VascEntryField> list = new ArrayList<VascEntryField>();

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.frontend.swt;
import java.io.Serializable;
import java.util.List;
import net.forwardfire.vasc.core.VascEntry;
@ -125,7 +126,7 @@ public class SwtActionPanel implements VascEntryFrontendEventListener {
return result;
}
public void vascEvent(VascEntry entry,Object dataNotUsed) {
public void vascEvent(VascEntry entry,Serializable dataNotUsed) {
vascEvent = true;
long pageSize = entry.getVascFrontendController().getVascFrontendPageInfo().getPageSize();

View file

@ -22,6 +22,7 @@
package net.forwardfire.vasc.frontend.swt;
import java.io.Serializable;
import java.util.List;
import net.forwardfire.vasc.core.VascEntry;
@ -76,7 +77,7 @@ public class SwtPagerPanel implements VascEntryFrontendEventListener {
return result;
}
public void vascEvent(VascEntry entry,Object dataNotUsed) {
public void vascEvent(VascEntry entry,Serializable dataNotUsed) {
}
}

View file

@ -22,6 +22,8 @@
package net.forwardfire.vasc.frontend.swt;
import java.io.Serializable;
import net.forwardfire.vasc.backend.VascBackendException;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
@ -125,7 +127,7 @@ public class SwtVascEditDialog extends Dialog {
}
String name = null;
try {
Object bean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
Serializable bean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
name = dis.getVascEntryFieldValue().getDisplayValue(dis.getBackendName(), bean);
} catch (VascBackendException e) {
throw new RuntimeException("Could not display value from "+entry.getId(),e);
@ -156,7 +158,7 @@ public class SwtVascEditDialog extends Dialog {
public void createBody(Composite body) throws VascException {
body.setLayout(new GridLayout(2, true));
body.setLayoutData(new GridData(GridData.FILL_BOTH));
Object bean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
Serializable bean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
entry.getVascFrontendController().clearFieldRenderObjects(); // only needed for swt use

View file

@ -478,7 +478,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ};
return result;
}
public void vascEvent(VascEntry entry,Object data) {
public void vascEvent(VascEntry entry,Serializable data) {
tableViewer.refresh();
table2.deselectAll();
}
@ -638,7 +638,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
//if (vtc.getVascColumnRenderer()==null) {
try {
return vtc.getVascEntryFieldValue().getDisplayValue(vtc.getBackendName(),bean);
return vtc.getVascEntryFieldValue().getDisplayValue(vtc.getBackendName(),(Serializable) bean);
} catch (Exception e) {
logger.log(Level.WARNING,"Error in get value: '"+vtc.getVascEntryFieldValue()+"' error: "+e.getMessage(),e);
return "Err";

View file

@ -22,6 +22,8 @@
package net.forwardfire.vasc.frontend.swt.ui;
import java.io.Serializable;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.ui.VascUIComponent;
@ -72,7 +74,7 @@ public class SwtText implements VascUIComponent {
}
public void modifyText(ModifyEvent e) {
Object value = text.getText();
Serializable value = text.getText();
try {
model.setValue(value);
} catch (VascException ve) {

View file

@ -22,6 +22,8 @@
package net.forwardfire.vasc.frontend.swt.ui;
import java.io.Serializable;
import net.forwardfire.vasc.core.VascEntry;
import net.forwardfire.vasc.core.VascEntryField;
import net.forwardfire.vasc.core.ui.VascUIComponent;
@ -96,7 +98,7 @@ public class SwtTextArea implements VascUIComponent {
}
public void modifyText(ModifyEvent e) {
Object value = text.getText();
Serializable value = text.getText();
try {
model.setValue(value);
} catch (VascException ve) {

View file

@ -62,7 +62,7 @@ public class JSFVascEntryEventListener implements VascEntryFrontendEventListener
public void vascEvent(VascEntry entry,Object dataNotUsed) {
public void vascEvent(VascEntry entry,Serializable dataNotUsed) {
/* moved to fillVascEntryFrontend
try {
for (VascEntryField field:entry.getVascEntryFields()) {

View file

@ -584,7 +584,7 @@ public class JSFVascEntrySupportBean implements Serializable {
logger.fine("moveAction");
String moveAction = getComponentType(event.getComponent());
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
Object selected = comp.getSupportBean().getSelectedTableRecord().getRecord();
Serializable selected = comp.getSupportBean().getSelectedTableRecord().getRecord();
if ("up".equals(moveAction)) {
entry.getVascFrontendController().getVascFrontendActions().moveUpAction(selected);
}

View file

@ -339,7 +339,7 @@ public class JSFVascUIComponent extends UIComponentBase {
// Set parameters
try {
Object selected = getSupportBean().getSelected().getRecord();
Serializable selected = getSupportBean().getSelected().getRecord();
for (String parameterName:link.getEntryParameterFieldIdKeys()) {
String fieldId = link.getEntryParameterFieldId(parameterName);
VascEntryField v = getVascEntry().getVascEntryFieldById(fieldId);
@ -361,7 +361,7 @@ public class JSFVascUIComponent extends UIComponentBase {
for (String fieldId:link.getEntryCreateFieldValueKeys()) {
String selectedfieldId = link.getEntryParameterFieldId(fieldId);
Object selectedValue = selected;
Serializable selectedValue = selected;
if (selectedfieldId!=null) {
VascEntryField v = getVascEntry().getVascEntryFieldById(selectedfieldId);
selectedValue = v.getVascEntryFieldValue().getValue(v.getBackendName(), selected);
@ -385,8 +385,8 @@ public class JSFVascUIComponent extends UIComponentBase {
class CreateEntryFieldValuesListener2 implements VascEntryFrontendEventListener {
private static final long serialVersionUID = 1L;
private String fieldId = null;
private Object value = null;
public CreateEntryFieldValuesListener2(String fieldId,Object value) {
private Serializable value = null;
public CreateEntryFieldValuesListener2(String fieldId,Serializable value) {
if (fieldId==null) {
throw new NullPointerException("fieldId may not be null");
}
@ -397,7 +397,7 @@ public class JSFVascUIComponent extends UIComponentBase {
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.PRE_CREATE};
return result;
}
public void vascEvent(VascEntry entry,Object data) {
public void vascEvent(VascEntry entry,Serializable data) {
VascEntryField field = entry.getVascEntryFieldById(fieldId);
try {
field.getVascEntryFieldValue().setValue(field.getBackendName(), data, value);

View file

@ -346,7 +346,7 @@ public class JSFVascUIComponentRenderer extends Renderer {
}
public void processValueChange(ValueChangeEvent event) throws AbortProcessingException {
try {
model.setValue(event.getNewValue());
model.setValue((Serializable)event.getNewValue());
} catch (VascException e) {
throw new AbortProcessingException(e);
}

View file

@ -92,8 +92,8 @@ public class VascDataBackendBean implements Serializable {
private void setValue(int index,Object valueObject) {
try {
VascEntryField field = getFieldIdByIndex(entry,index);
VascEntryFieldValue value = field.getVascEntryFieldValue();
value.setValue(field.getBackendName(), record,valueObject);
VascEntryFieldValue<Serializable> value = field.getVascEntryFieldValue();
value.setValue(field.getBackendName(), record,(Serializable)valueObject); // TODO: rm cast
} catch (VascBackendException e) {
throw new RuntimeException("Could not set value on record.",e);
}