diff --git a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackend.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackend.java index cfa6d45..7d8ebc3 100644 --- a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackend.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackend.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backend; +import java.io.Serializable; import java.util.Map; /** @@ -29,7 +30,7 @@ import java.util.Map; * @author Willem Cazander * @version 1.0 Aug 2, 2007 */ -abstract public class AbstractVascBackend implements VascBackend { +abstract public class AbstractVascBackend implements VascBackend { private String id = null; diff --git a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackend.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackend.java index 644e8c5..3b412e6 100644 --- a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackend.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackend.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backend; +import java.io.Serializable; import java.util.List; import java.util.Map; @@ -31,7 +32,7 @@ import java.util.Map; * @author Willem Cazander * @version 1.0 Mar 21, 2007 */ -public interface VascBackend { +public interface VascBackend { public String getId(); public void setId(String id); @@ -39,15 +40,15 @@ public interface VascBackend { public void startBackend(); public void stopBackend(); - public List execute(VascBackendState state) throws VascBackendException; + public List execute(VascBackendState state) throws VascBackendException; public boolean isReadOnly(); - public void persist(Object object) throws VascBackendException; + public void persist(DATA_OBJECT object) throws VascBackendException; - public Object merge(Object object) throws VascBackendException; + public DATA_OBJECT merge(DATA_OBJECT object) throws VascBackendException; - public void delete(Object object) throws VascBackendException; + public void delete(DATA_OBJECT object) throws VascBackendException; /** * Creates a new Field acces obj the the given field entry. @@ -61,7 +62,7 @@ public interface VascBackend { * note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle. * @return */ - public VascEntryRecordCreator provideVascEntryRecordCreator(); + public VascEntryRecordCreator provideVascEntryRecordCreator(); /** * Defines if the backend supports sorting diff --git a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascEntryRecordCreator.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascEntryRecordCreator.java index 8bd0359..2224bed 100644 --- a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascEntryRecordCreator.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascEntryRecordCreator.java @@ -30,9 +30,7 @@ import java.io.Serializable; * @author Willem Cazander * @version 1.0 Mar 21, 2007 */ -public interface VascEntryRecordCreator extends Serializable { +public interface VascEntryRecordCreator extends Serializable { - public Object newRecord() throws VascBackendException; - - public Class getObjectClass(); + public DATA_OBJECT newRecord() throws VascBackendException; } \ No newline at end of file diff --git a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryRecordCreator.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryRecordCreator.java index a154d20..3f64f91 100644 --- a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryRecordCreator.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryRecordCreator.java @@ -22,6 +22,8 @@ package net.forwardfire.vasc.backend.data; +import java.io.Serializable; + import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascEntryRecordCreator; @@ -32,7 +34,7 @@ import net.forwardfire.vasc.backend.VascEntryRecordCreator; * @author Willem Cazander * @version 1.0 Dec 05, 2009 */ -public class BeanVascEntryRecordCreator implements VascEntryRecordCreator { +public class BeanVascEntryRecordCreator implements VascEntryRecordCreator { private static final long serialVersionUID = 1L; private Class resultClass = null; @@ -43,14 +45,11 @@ public class BeanVascEntryRecordCreator implements VascEntryRecordCreator { } this.resultClass=resultClass; } - - public Class getObjectClass() { - return resultClass; - } - public Object newRecord() throws VascBackendException { + @SuppressWarnings("unchecked") + public DATA_OBJECT newRecord() throws VascBackendException { try { - return resultClass.newInstance(); + return (DATA_OBJECT)resultClass.newInstance(); } catch (InstantiationException e) { throw new VascBackendException(e); } catch (IllegalAccessException e) { diff --git a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/HashMapVascEntryFieldValue.java similarity index 97% rename from vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/HashMapVascEntryFieldValue.java index 13db03a..6b03d12 100644 --- a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/HashMapVascEntryFieldValue.java @@ -34,7 +34,7 @@ import net.forwardfire.vasc.backend.VascEntryFieldValue; * @author Willem Cazander * @version 1.0 Dec 05, 2009 */ -public class MapVascEntryFieldValue implements VascEntryFieldValue { +public class HashMapVascEntryFieldValue implements VascEntryFieldValue { private static final long serialVersionUID = 1L; diff --git a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/HashMapVascEntryRecordCreator.java similarity index 89% rename from vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/HashMapVascEntryRecordCreator.java index e47e270..e09f63e 100644 --- a/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/HashMapVascEntryRecordCreator.java @@ -23,27 +23,21 @@ package net.forwardfire.vasc.backend.data; import java.util.HashMap; -import java.util.Map; import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascEntryRecordCreator; - /** * MapVascEntryRecordCreator creates a new HashMap for Map based record backends. * * @author Willem Cazander * @version 1.0 Dec 05, 2009 */ -public class MapVascEntryRecordCreator implements VascEntryRecordCreator { +public class HashMapVascEntryRecordCreator implements VascEntryRecordCreator> { private static final long serialVersionUID = 1L; - public Class getObjectClass() { - return Map.class; - } - - public Object newRecord() throws VascBackendException { + public HashMap newRecord() throws VascBackendException { return new HashMap(10); } } diff --git a/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackend.java b/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackend.java index cf85dc2..966ae52 100644 --- a/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackend.java +++ b/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackend.java @@ -24,20 +24,19 @@ package net.forwardfire.vasc.backend.jdbc; import java.sql.Connection; import java.sql.ResultSet; +import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map; 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.data.MapVascEntryFieldValue; -import net.forwardfire.vasc.backend.data.MapVascEntryRecordCreator; - +import net.forwardfire.vasc.backend.data.HashMapVascEntryFieldValue; +import net.forwardfire.vasc.backend.data.HashMapVascEntryRecordCreator; /** * JdbcVascBackend Simple jdbc vasc backend. @@ -45,7 +44,7 @@ import net.forwardfire.vasc.backend.data.MapVascEntryRecordCreator; * @author Willem Cazander * @version 1.0 Sep 5, 2008 */ -public class JdbcVascBackend extends AbstractVascBackend { +public class JdbcVascBackend extends AbstractVascBackend> { private JdbcConnectionProvider jdbcConnectionProvider = null; private String sqlList = null; @@ -80,9 +79,9 @@ public class JdbcVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ - public List execute(VascBackendState state) throws VascBackendException { + public List> execute(VascBackendState state) throws VascBackendException { JdbcConnectionProvider prov = getJdbcConnectionProvider(); - List result = new ArrayList(50); + List> result = new ArrayList>(50); Connection connection = null; try { connection = prov.getJdbcConnection(); @@ -91,7 +90,7 @@ public class JdbcVascBackend extends AbstractVascBackend { ResultSet rs = s.getResultSet(); int cols = rs.getMetaData().getColumnCount(); while (rs.next()) { - Map map = new HashMap(cols); + HashMap map = new HashMap(cols); for (int i=1;i<=cols;i++) { String columnName = rs.getMetaData().getColumnName(i); Object columnObject = rs.getObject(i); @@ -99,7 +98,7 @@ public class JdbcVascBackend extends AbstractVascBackend { } result.add(map); } - } catch (Exception e) { + } catch (SQLException e) { throw new VascBackendException(e); } finally { if (connection!=null) { @@ -115,34 +114,34 @@ public class JdbcVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object) */ - public Object merge(Object object) throws VascBackendException { + public HashMap merge(HashMap object) throws VascBackendException { return object; } /** * @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object) */ - public void persist(Object object) throws VascBackendException { + public void persist(HashMap object) throws VascBackendException { } /** * @see net.forwardfire.vasc.backend.VascBackend#delete(java.lang.Object) */ - public void delete(Object object) throws VascBackendException { + public void delete(HashMap object) throws VascBackendException { } /** * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField) */ public VascEntryFieldValue provideVascEntryFieldValue() { - return new MapVascEntryFieldValue(); + return new HashMapVascEntryFieldValue(); } /** * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry) */ public VascEntryRecordCreator provideVascEntryRecordCreator() { - return new MapVascEntryRecordCreator(); + return new HashMapVascEntryRecordCreator(); } /** diff --git a/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackendXpql.java b/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackendXpql.java index 04c6b23..c96b43a 100644 --- a/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackendXpql.java +++ b/vasc-backend/vasc-backend-jdbc/src/main/java/net/forwardfire/vasc/backend/jdbc/JdbcVascBackendXpql.java @@ -25,29 +25,27 @@ package net.forwardfire.vasc.backend.jdbc; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; +import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Map; 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.data.MapVascEntryFieldValue; -import net.forwardfire.vasc.backend.data.MapVascEntryRecordCreator; +import net.forwardfire.vasc.backend.data.HashMapVascEntryFieldValue; +import net.forwardfire.vasc.backend.data.HashMapVascEntryRecordCreator; import net.forwardfire.vasc.xpql.query.QueryParameterValue; - - /** * JdbcVascBackendXpql jdbc vasc backend with xpql query support. * * @author Willem Cazander * @version 1.0 Sep 5, 2008 */ -public class JdbcVascBackendXpql extends AbstractVascBackend { +public class JdbcVascBackendXpql extends AbstractVascBackend> { private JdbcConnectionProvider jdbcConnectionProvider = null; @@ -92,7 +90,7 @@ public class JdbcVascBackendXpql extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ - public List execute(VascBackendState state) throws VascBackendException { + public List> execute(VascBackendState state) throws VascBackendException { // Copy parameters for (String key:state.getDataParameterKeys()) { Object value = state.getDataParameter(key); @@ -112,9 +110,9 @@ public class JdbcVascBackendXpql extends AbstractVascBackend { q.execute(); ResultSet rs = q.getResultSet(); int cols = rs.getMetaData().getColumnCount(); - List result = new ArrayList(50); + List> result = new ArrayList>(50); while (rs.next()) { - Map map = new HashMap(cols); + HashMap map = new HashMap(cols); for (int i=1;i<=cols;i++) { String columnName = rs.getMetaData().getColumnName(i); Object columnObject = rs.getObject(i); @@ -123,7 +121,7 @@ public class JdbcVascBackendXpql extends AbstractVascBackend { result.add(map); } return result; - } catch (Exception e) { + } catch (SQLException e) { throw new VascBackendException(e); } finally { if (c!=null) { @@ -138,33 +136,33 @@ public class JdbcVascBackendXpql extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object) */ - public Object merge(Object object) throws VascBackendException { + public HashMap merge(HashMap object) throws VascBackendException { return object; } /** * @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object) */ - public void persist(Object object) throws VascBackendException { + public void persist(HashMap object) throws VascBackendException { } /** * @see net.forwardfire.vasc.backend.VascBackend#delete(java.lang.Object) */ - public void delete(Object object) throws VascBackendException { + public void delete(HashMap object) throws VascBackendException { } /** * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue() */ public VascEntryFieldValue provideVascEntryFieldValue() { - return new MapVascEntryFieldValue(); + return new HashMapVascEntryFieldValue(); } /** * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator() */ public VascEntryRecordCreator provideVascEntryRecordCreator() { - return new MapVascEntryRecordCreator(); + return new HashMapVascEntryRecordCreator(); } } \ No newline at end of file diff --git a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/AbstractHibernateVascBackend.java b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/AbstractHibernateVascBackend.java index 90960d2..9f8ecd9 100644 --- a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/AbstractHibernateVascBackend.java +++ b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/AbstractHibernateVascBackend.java @@ -22,6 +22,8 @@ package net.forwardfire.vasc.backends.jpa; +import java.io.Serializable; + import net.forwardfire.vasc.backend.AbstractVascBackend; import net.forwardfire.vasc.backend.VascBackendException; @@ -33,7 +35,7 @@ import org.hibernate.Session; * @author Willem Cazander * @version 1.0 Mar 21, 2007 */ -abstract public class AbstractHibernateVascBackend extends AbstractVascBackend { +abstract public class AbstractHibernateVascBackend extends AbstractVascBackend { /** * Provides a hibernate session which is closed !! when transaction is compleeted. @@ -41,7 +43,7 @@ abstract public class AbstractHibernateVascBackend extends AbstractVascBackend */ abstract Session getHibernateSession(); - public void persist(Object object) throws VascBackendException { + public void persist(DATA_OBJECT object) throws VascBackendException { Session s = getHibernateSession(); try { s.getTransaction().begin(); @@ -57,11 +59,11 @@ abstract public class AbstractHibernateVascBackend extends AbstractVascBackend } } - public Object merge(Object object) throws VascBackendException { + public DATA_OBJECT merge(DATA_OBJECT object) throws VascBackendException { Session s = getHibernateSession(); try { s.getTransaction().begin(); - Object result = s.merge(object); + DATA_OBJECT result = (DATA_OBJECT)s.merge(object); s.getTransaction().commit(); return result; } finally { @@ -74,7 +76,7 @@ abstract public class AbstractHibernateVascBackend extends AbstractVascBackend } } - public void delete(Object object) throws VascBackendException { + public void delete(DATA_OBJECT object) throws VascBackendException { Session s = getHibernateSession(); try { s.getTransaction().begin(); diff --git a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/AbstractPersistenceVascBackend.java b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/AbstractPersistenceVascBackend.java index 0a29971..a7cb166 100644 --- a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/AbstractPersistenceVascBackend.java +++ b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/AbstractPersistenceVascBackend.java @@ -22,6 +22,8 @@ package net.forwardfire.vasc.backends.jpa; +import java.io.Serializable; + import javax.persistence.EntityManager; import net.forwardfire.vasc.backend.AbstractVascBackend; @@ -32,13 +34,13 @@ import net.forwardfire.vasc.backend.VascBackendException; * @author Willem Cazander * @version 1.0 Mar 21, 2007 */ -abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend { +abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend { protected boolean emTransaction = true; abstract EntityManager getEntityManager(); - public void persist(Object object) throws VascBackendException { + public void persist(DATA_OBJECT object) throws VascBackendException { EntityManager s = getEntityManager(); try { if (emTransaction) { @@ -55,13 +57,13 @@ abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend } } - public Object merge(Object object) throws VascBackendException { + public DATA_OBJECT merge(DATA_OBJECT object) throws VascBackendException { EntityManager s = getEntityManager(); try { if (emTransaction) { s.getTransaction().begin(); } - Object result = s.merge(object); + DATA_OBJECT result = (DATA_OBJECT)s.merge(object); if (emTransaction) { s.getTransaction().commit(); } @@ -73,7 +75,7 @@ abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend } } - public void delete(Object object) throws VascBackendException { + public void delete(DATA_OBJECT object) throws VascBackendException { EntityManager s = getEntityManager(); try { if (emTransaction) { diff --git a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlHibernateVascBackend.java b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlHibernateVascBackend.java index 6d24648..3098926 100644 --- a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlHibernateVascBackend.java +++ b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlHibernateVascBackend.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backends.jpa; +import java.io.Serializable; import java.util.List; import net.forwardfire.vasc.backend.VascBackendException; @@ -43,7 +44,7 @@ import org.hibernate.Session; * @author Willem Cazander * @version 1.0 Mar 17, 2009 */ -public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend { +public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend { private HibernateSessionProvider hibernateSessionProvider = null; @@ -73,7 +74,7 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend { } @SuppressWarnings("unchecked") - public List execute(VascBackendState state) throws VascBackendException { + public List execute(VascBackendState state) throws VascBackendException { // Copy parameters for (String key:state.getDataParameterKeys()) { @@ -103,7 +104,7 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend { q.setFirstResult(state.getPageIndex()*state.getPageSize()); q.setMaxResults(state.getPageSize()); } - List data = q.list(); + List data = q.list(); s.getTransaction().commit(); return data; } finally { diff --git a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlPersistanceVascBackend.java b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlPersistanceVascBackend.java index cba9fc3..b98b343 100644 --- a/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlPersistanceVascBackend.java +++ b/vasc-backend/vasc-backend-jpa/src/main/java/net/forwardfire/vasc/backends/jpa/XpqlPersistanceVascBackend.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backends.jpa; +import java.io.Serializable; import java.util.List; import javax.persistence.EntityManager; @@ -43,7 +44,7 @@ import net.forwardfire.vasc.xpql.query.QueryParameterValue; * @author Willem Cazander * @version 1.0 Mar 17, 2009 */ -public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend { +public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend { private EntityManagerProvider entityManagerProvider = null; @@ -76,7 +77,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend @SuppressWarnings("unchecked") - public List execute(VascBackendState state) throws VascBackendException { + public List execute(VascBackendState state) throws VascBackendException { // Copy parameters for (String key:state.getDataParameterKeys()) { @@ -84,7 +85,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend //System.out.println("Set para pame: "+key+" value: "+value); query.setQueryParameter(key, value); if (queryTotal!=null) { - queryTotal.setQueryParameter(key, value); + queryTotal.setQueryParameter(key, value); } } @@ -106,7 +107,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend if (emTransaction) { em.getTransaction().begin(); } - List data = q.getResultList(); + List data = q.getResultList(); if (emTransaction) { em.getTransaction().commit(); } diff --git a/vasc-backend/vasc-backend-ldap/src/main/java/net/forwardfire/vasc/backend/ldap/LdapVascBackend.java b/vasc-backend/vasc-backend-ldap/src/main/java/net/forwardfire/vasc/backend/ldap/LdapVascBackend.java index 1c57216..400353b 100644 --- a/vasc-backend/vasc-backend-ldap/src/main/java/net/forwardfire/vasc/backend/ldap/LdapVascBackend.java +++ b/vasc-backend/vasc-backend-ldap/src/main/java/net/forwardfire/vasc/backend/ldap/LdapVascBackend.java @@ -34,8 +34,8 @@ 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.data.MapVascEntryFieldValue; -import net.forwardfire.vasc.backend.data.MapVascEntryRecordCreator; +import net.forwardfire.vasc.backend.data.HashMapVascEntryFieldValue; +import net.forwardfire.vasc.backend.data.HashMapVascEntryRecordCreator; import com.novell.ldap.LDAPAttribute; import com.novell.ldap.LDAPAttributeSet; @@ -52,7 +52,7 @@ import com.novell.ldap.LDAPSearchResults; * @author Willem Cazander * @version 1.0 Sep 4, 2008 */ -public class LdapVascBackend extends AbstractVascBackend { +public class LdapVascBackend extends AbstractVascBackend> { private Logger logger = Logger.getLogger(LdapVascBackend.class.getName()); private LdapConnectionProvider ldapConnectionProvider = null; @@ -80,10 +80,10 @@ public class LdapVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#execute() */ - public List execute(VascBackendState state) throws VascBackendException { + public List> execute(VascBackendState state) throws VascBackendException { LdapConnectionProvider prov = getLdapConnectionProvider(); LDAPConnection connection = prov.getLdapConnection(); - List result = new ArrayList(50); + List> result = new ArrayList>(50); try { LDAPSearchConstraints cons = new LDAPSearchConstraints(); @@ -104,7 +104,7 @@ public class LdapVascBackend extends AbstractVascBackend { while (searchResults.hasMore()) { LDAPEntry entry = searchResults.next(); - Map map = new HashMap(10); + HashMap map = new HashMap(10); LDAPAttributeSet attributeSet = entry.getAttributeSet(); Iterator i = attributeSet.iterator(); @@ -134,11 +134,10 @@ public class LdapVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object) */ - public Object merge(Object object) throws VascBackendException { + public HashMap merge(HashMap map) throws VascBackendException { LdapConnectionProvider prov = getLdapConnectionProvider(); LDAPConnection connection = prov.getLdapConnection(); try { - Map map = (Map)object; String keyValue = (String)map.get(keyAttribute); LDAPSearchConstraints cons = new LDAPSearchConstraints(); cons.setBatchSize( 0 ); @@ -157,7 +156,7 @@ public class LdapVascBackend extends AbstractVascBackend { if (searchResults.hasMore()==false) { // no result to mod - return object; + return map; } LDAPEntry entry = searchResults.next(); List mods = new ArrayList(20); @@ -204,7 +203,7 @@ public class LdapVascBackend extends AbstractVascBackend { m = mods.toArray(m); connection.modify(entry.getDN(), m); - return object; + return map; } catch (LDAPException e) { throw new VascBackendException(e); } finally { @@ -215,8 +214,7 @@ public class LdapVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object) */ - public void persist(Object object) throws VascBackendException { - Map map = (Map)object; + public void persist(HashMap map) throws VascBackendException { LdapConnectionProvider prov = getLdapConnectionProvider(); LDAPConnection connection = prov.getLdapConnection(); try { @@ -250,11 +248,10 @@ public class LdapVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#delete(java.lang.Object) */ - public void delete(Object object) throws VascBackendException { + public void delete(HashMap map) throws VascBackendException { LdapConnectionProvider prov = getLdapConnectionProvider(); LDAPConnection connection = prov.getLdapConnection(); try { - Map map = (Map)object; String keyValue = (String)map.get(keyAttribute); int searchScope = LDAPConnection.SCOPE_ONE; String searchBase = baseDN; @@ -294,14 +291,14 @@ public class LdapVascBackend extends AbstractVascBackend { * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator() */ public VascEntryRecordCreator provideVascEntryRecordCreator() { - return new MapVascEntryRecordCreator(); + return new HashMapVascEntryRecordCreator(); } /** * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue() */ public VascEntryFieldValue provideVascEntryFieldValue() { - return new MapVascEntryFieldValue(); + return new HashMapVascEntryFieldValue(); } /** diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java index 1fe4a2c..0a17573 100644 --- a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java +++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelVascBackend.java @@ -58,7 +58,7 @@ import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRowMapImpl; * @author Willem Cazander * @version 1.0 Dec 31, 2011 */ -public class MetaModelVascBackend extends AbstractVascBackend { +public class MetaModelVascBackend extends AbstractVascBackend { private Logger logger = Logger.getLogger(MetaModelVascBackend.class.getName()); private MetaModelDataContextProvider dataContextProvider = null; @@ -210,7 +210,7 @@ public class MetaModelVascBackend extends AbstractVascBackend { return q; } - public List execute(VascBackendState state) throws VascBackendException { + public List execute(VascBackendState state) throws VascBackendException { Schema schema = dataContext.getDefaultSchema(); Table t = schema.getTableByName(table); if (t==null) { @@ -236,16 +236,15 @@ public class MetaModelVascBackend extends AbstractVascBackend { } q.setMaxRows(state.getPageSize()); } + List result = new ArrayList(50); if (crudDataContext!=null) { DataSet ds = crudDataContext.executeQuery(q); - List result = new ArrayList(50); result.addAll(ds.toRows()); ds.close(); return result; } DataSet ds = dataContext.executeQuery(q); - List result = new ArrayList(50); while (ds.next()) { Row row = ds.getRow(); SelectItem[] cols = row.getSelectItems(); @@ -263,21 +262,21 @@ public class MetaModelVascBackend extends AbstractVascBackend { return result; } - public void persist(Object object) throws VascBackendException { + public void persist(Row object) throws VascBackendException { if (crudDataContext==null) { return; } crudDataContext.persist((UpdateableRow) object); } - public Object merge(Object object) throws VascBackendException { + public Row merge(Row object) throws VascBackendException { if (crudDataContext==null) { return object; } return crudDataContext.merge((UpdateableRow) object); } - public void delete(Object object) throws VascBackendException { + public void delete(Row object) throws VascBackendException { if (crudDataContext==null) { return; } @@ -288,7 +287,7 @@ public class MetaModelVascBackend extends AbstractVascBackend { return new RowVascEntryFieldValue(); } - public VascEntryRecordCreator provideVascEntryRecordCreator() { + public VascEntryRecordCreator provideVascEntryRecordCreator() { return new RowVascEntryRecordCreator(crudDataContext,crudDataContext.getDefaultSchema().getTableByName(table)); } diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/RowVascEntryRecordCreator.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/RowVascEntryRecordCreator.java index 5adec74..6e2753e 100644 --- a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/RowVascEntryRecordCreator.java +++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/RowVascEntryRecordCreator.java @@ -1,13 +1,13 @@ package net.forwardfire.vasc.backend.metamodel; +import org.eobjects.metamodel.data.Row; import org.eobjects.metamodel.schema.Table; import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascEntryRecordCreator; import net.forwardfire.vasc.backend.metamodel.crud.CrudDataContext; -import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRow; -public class RowVascEntryRecordCreator implements VascEntryRecordCreator { +public class RowVascEntryRecordCreator implements VascEntryRecordCreator { private static final long serialVersionUID = -1182678362367989090L; private CrudDataContext dataContext = null; @@ -17,12 +17,8 @@ public class RowVascEntryRecordCreator implements VascEntryRecordCreator { this.dataContext=dataContext; this.table=table; } - - public Class getObjectClass() { - return UpdateableRow.class; - } - public Object newRecord() throws VascBackendException { + public Row newRecord() throws VascBackendException { return dataContext.createRow(table); } } \ No newline at end of file diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/crud/AbstractCrudDataContext.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/crud/AbstractCrudDataContext.java index 9396060..944ecec 100644 --- a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/crud/AbstractCrudDataContext.java +++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/crud/AbstractCrudDataContext.java @@ -48,6 +48,9 @@ abstract public class AbstractCrudDataContext implements CrudDataContext { RowInsertionBuilder query = backendImpl.insertInto(row.getTable()); for (int i=0;i { private Logger logger = null; private MongodbConnectionProvider connectionProvider = null; @@ -105,7 +105,7 @@ public class MongodbVascBackend extends AbstractVascBackend { return query; } - public List execute(VascBackendState state) throws VascBackendException { + public List execute(VascBackendState state) throws VascBackendException { DBCollection coll = getDBCollection(); DBObject query = createFilterQuery(state); DBCursor cur = coll.find(query); @@ -113,33 +113,32 @@ public class MongodbVascBackend extends AbstractVascBackend { cur.limit(state.getPageSize()); cur.skip(state.getPageIndex()); } - List result = new ArrayList(cur.count()); + List result = new ArrayList(cur.count()); while (cur.hasNext()) { DBObject row = cur.next(); - result.add(row); + result.add((BasicDBObject)row); } return result; } - public void persist(Object object) throws VascBackendException { + public void persist(BasicDBObject object) throws VascBackendException { DBCollection coll = getDBCollection(); - coll.insert((DBObject)object); + coll.insert(object); } - public Object merge(Object object) throws VascBackendException { + public BasicDBObject merge(BasicDBObject row) throws VascBackendException { DBCollection coll = getDBCollection(); - DBObject row = (DBObject)object; DBObject query = new BasicDBObject(); query.put("_id",row.get("_id")); WriteResult wr = coll.update(query,row,false,false,WriteConcern.SAFE); logger.info("WriteResult: "+wr); - return object; + return row; } - public void delete(Object object) throws VascBackendException { + public void delete(BasicDBObject object) throws VascBackendException { DBCollection coll = getDBCollection(); DBObject query = new BasicDBObject(); - query.put("_id",((DBObject)object).get("_id")); + query.put("_id",object.get("_id")); coll.remove(query); // remove by _id } @@ -147,7 +146,7 @@ public class MongodbVascBackend extends AbstractVascBackend { return new MongodbVascEntryFieldValue(); } - public VascEntryRecordCreator provideVascEntryRecordCreator() { + public VascEntryRecordCreator provideVascEntryRecordCreator() { return new MongodbVascEntryRecordCreator(); } diff --git a/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascEntryRecordCreator.java b/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascEntryRecordCreator.java index a7caae4..195aed5 100644 --- a/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascEntryRecordCreator.java +++ b/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascEntryRecordCreator.java @@ -34,15 +34,11 @@ import com.mongodb.BasicDBObject; * @author Willem Cazander * @version 1.0 Dec 30, 2011 */ -public class MongodbVascEntryRecordCreator implements VascEntryRecordCreator { +public class MongodbVascEntryRecordCreator implements VascEntryRecordCreator { private static final long serialVersionUID = -9213830731796787384L; - - public Object newRecord() throws VascBackendException { + + public BasicDBObject newRecord() throws VascBackendException { return new BasicDBObject(); } - - public Class getObjectClass() { - return BasicDBObject.class; - } } diff --git a/vasc-core-ejb3-client/src/main/java/net/forwardfire/vasc/ejb3/VascServiceRemoteBackend.java b/vasc-core-ejb3-client/src/main/java/net/forwardfire/vasc/ejb3/VascServiceRemoteBackend.java index a72480a..e382f42 100644 --- a/vasc-core-ejb3-client/src/main/java/net/forwardfire/vasc/ejb3/VascServiceRemoteBackend.java +++ b/vasc-core-ejb3-client/src/main/java/net/forwardfire/vasc/ejb3/VascServiceRemoteBackend.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.ejb3; +import java.io.Serializable; import java.util.List; import java.util.Map; @@ -37,7 +38,7 @@ import net.forwardfire.vasc.backend.VascEntryRecordCreator; * @author Willem Cazander * @version 1.0 18 Nov 2012 */ -public class VascServiceRemoteBackend implements VascBackend { +public class VascServiceRemoteBackend implements VascBackend { private String backendId = null; private VascServiceManager vascManager = null; @@ -66,7 +67,7 @@ public class VascServiceRemoteBackend implements VascBackend { // we cant change id } - public void delete(Object object) throws VascBackendException { + public void delete(DATA_OBJECT object) throws VascBackendException { Object[] args = new Object[1]; args[0]=object; vascManager.invokeBackendMethod(backendId, "delete", args); @@ -89,11 +90,11 @@ public class VascServiceRemoteBackend implements VascBackend { } @SuppressWarnings("unchecked") - public List execute(VascBackendState state) throws VascBackendException { + public List execute(VascBackendState state) throws VascBackendException { Object[] args = new Object[1]; args[0]=state; Object result = vascManager.invokeBackendMethod(backendId, "execute", args); - return (List)result; + return (List)result; } public long fetchTotalExecuteSize(VascBackendState state) { @@ -127,14 +128,15 @@ public class VascServiceRemoteBackend implements VascBackend { return (Boolean)result; } - public Object merge(Object object) throws VascBackendException { + @SuppressWarnings("unchecked") + public DATA_OBJECT merge(DATA_OBJECT object) throws VascBackendException { Object[] args = new Object[1]; args[0]=object; Object result = vascManager.invokeBackendMethod(backendId, "merge", args); - return result; + return (DATA_OBJECT)result; } - public void persist(Object object) throws VascBackendException { + public void persist(DATA_OBJECT object) throws VascBackendException { Object[] args = new Object[1]; args[0]=object; vascManager.invokeBackendMethod(backendId, "delete", args); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/AbstractVascBackendProxy.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/AbstractVascBackendProxy.java index 4047bc6..08d0422 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/AbstractVascBackendProxy.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/AbstractVascBackendProxy.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backend.proxy; +import java.io.Serializable; import java.util.List; import java.util.Map; @@ -40,7 +41,7 @@ import net.forwardfire.vasc.core.VascEntry; */ abstract public class AbstractVascBackendProxy implements VascBackendProxy { - protected VascBackend backend = null; + protected VascBackend backend = null; protected VascEntry entry = null; abstract public VascBackendProxy clone() throws CloneNotSupportedException; @@ -48,7 +49,7 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy { /** * @see net.forwardfire.vasc.backend.proxy.VascBackendProxy#initProxy(net.forwardfire.vasc.backend.VascBackend, net.forwardfire.vasc.core.VascEntry) */ - public void initProxy(VascBackend backend, VascEntry entry) { + public void initProxy(VascBackend backend, VascEntry entry) { if (backend==null) { throw new NullPointerException("backend object may not be null."); } @@ -105,14 +106,14 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy { * @throws Exception * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ - public List execute(VascBackendState state) throws VascBackendException { + public List execute(VascBackendState state) throws VascBackendException { return backend.execute(state); } /** * @see net.forwardfire.vasc.backend.VascBackend#delete(java.lang.Object) */ - public void delete(Object object) throws VascBackendException { + public void delete(Serializable object) throws VascBackendException { backend.delete(object); } @@ -133,14 +134,14 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy { /** * @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object) */ - public Object merge(Object object) throws VascBackendException { + public Serializable merge(Serializable object) throws VascBackendException { return backend.merge(object); } /** * @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object) */ - public void persist(Object object) throws VascBackendException { + public void persist(Serializable object) throws VascBackendException { backend.persist(object); } @@ -154,7 +155,7 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy { /** * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator() */ - public VascEntryRecordCreator provideVascEntryRecordCreator() { + public VascEntryRecordCreator provideVascEntryRecordCreator() { return backend.provideVascEntryRecordCreator(); } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxy.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxy.java index bdb10aa..90e1af4 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxy.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxy.java @@ -22,6 +22,8 @@ package net.forwardfire.vasc.backend.proxy; +import java.io.Serializable; + import net.forwardfire.vasc.backend.VascBackend; import net.forwardfire.vasc.core.VascEntry; @@ -31,9 +33,9 @@ import net.forwardfire.vasc.core.VascEntry; * @author Willem Cazander * @version 1.0 May 9, 2012 */ -public interface VascBackendProxy extends VascBackend,Cloneable { +public interface VascBackendProxy extends VascBackend,Cloneable { - public void initProxy(VascBackend backend,VascEntry entry); + public void initProxy(VascBackend backend,VascEntry entry); public boolean isProxyNeeded(); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyCache.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyCache.java index fefc81d..1daecfe 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyCache.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyCache.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backend.proxy; +import java.io.Serializable; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -38,7 +39,7 @@ import net.forwardfire.vasc.backend.VascBackendState; public class VascBackendProxyCache extends AbstractVascBackendProxy { private Long records = null; - private List data = null; + private List data = null; private String searchString = null; private Map dataState = null; private int pageIndex = 0; @@ -130,7 +131,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ @Override - public List execute(VascBackendState state) throws VascBackendException { + public List execute(VascBackendState state) throws VascBackendException { boolean changed = isStateChanged(state); if (data==null | changed) { data = backend.execute(state); @@ -151,7 +152,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object) */ @Override - public void delete(Object object) throws VascBackendException { + public void delete(Serializable object) throws VascBackendException { requestFlush = true; super.delete(object); } @@ -160,7 +161,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object) */ @Override - public Object merge(Object object) throws VascBackendException { + public Serializable merge(Serializable object) throws VascBackendException { requestFlush = true; return super.merge(object); } @@ -169,7 +170,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object) */ @Override - public void persist(Object object) throws VascBackendException { + public void persist(Serializable object) throws VascBackendException { requestFlush = true; super.persist(object); } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyEventExecutor.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyEventExecutor.java index d8e7e3b..c122e14 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyEventExecutor.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyEventExecutor.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backend.proxy; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -51,7 +52,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { return result; } - public void initProxy(VascBackend backend,VascEntry entry) { + public void initProxy(VascBackend backend,VascEntry entry) { super.initProxy(backend, entry); this.entry=entry; this.listeners=new ArrayList(10); @@ -95,7 +96,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { for (int t=0;t execute(VascBackendState state) throws VascBackendException { + public List execute(VascBackendState state) throws VascBackendException { fireVascEvent(VascBackendEventType.PRE_EXECUTE,state); - List result = super.execute(state); + List result = super.execute(state); fireVascEvent(VascBackendEventType.POST_EXECUTE,result); return result; } @@ -159,9 +160,9 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object) */ @Override - public Object merge(Object object) throws VascBackendException { + public Serializable merge(Serializable object) throws VascBackendException { fireVascEvent(VascBackendEventType.PRE_MERGE,object); - Object result = super.merge(object); + Serializable result = super.merge(object); fireVascEvent(VascBackendEventType.POST_MERGE,result); return result; } @@ -170,7 +171,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object) */ @Override - public void persist(Object object) throws VascBackendException { + public void persist(Serializable object) throws VascBackendException { fireVascEvent(VascBackendEventType.PRE_PERSIST,object); super.persist(object); fireVascEvent(VascBackendEventType.POST_PERSIST,object); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyFilter.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyFilter.java index 424701f..94a3bfd 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyFilter.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyFilter.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backend.proxy; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -53,7 +54,7 @@ public class VascBackendProxyFilter extends AbstractVascBackendProxy { /** * @see net.forwardfire.vasc.backend.proxy.VascBackendProxy#initProxy(net.forwardfire.vasc.backend.VascBackend, net.forwardfire.vasc.core.VascEntry) */ - public void initProxy(VascBackend backend, VascEntry entry) { + public void initProxy(VascBackend backend, VascEntry entry) { super.initProxy(backend,entry); filters = entry.getVascBackendFilters(); for (VascProxyFilter filter:filters) { @@ -76,18 +77,18 @@ public class VascBackendProxyFilter extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ @Override - public List execute(VascBackendState state) throws VascBackendException { - List result = backend.execute(state); + public List execute(VascBackendState state) throws VascBackendException { + List result = backend.execute(state); if (filters==null) { return result; } if (filters.isEmpty()) { return result; } - List search = new ArrayList(result.size()/2); - for (Object o:result) { + List search = new ArrayList(result.size()/2); + for (Serializable o:result) { for (VascProxyFilter filter:filters) { - Object r = filter.filterObject(o); + Serializable r = filter.filterObject(o); if (r!=null) { search.add(r); } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyPaged.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyPaged.java index 48885ea..d68657a 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyPaged.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyPaged.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backend.proxy; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -70,21 +71,21 @@ public class VascBackendProxyPaged extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ @Override - public List execute(VascBackendState state) throws VascBackendException { - List allData = backend.execute(state); + public List execute(VascBackendState state) throws VascBackendException { + List allData = backend.execute(state); int pageSize = state.getPageSize(); if (pageSize==0) { records = allData.size(); return allData; } - List paged = new ArrayList(state.getPageSize()); + List paged = new ArrayList(state.getPageSize()); int off = state.getPageIndex()*pageSize; int offMax = off+state.getPageSize(); for (int i=off;i=allData.size()) { break; } - Object o = allData.get(i); + Serializable o = allData.get(i); paged.add(o); } records = allData.size(); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySearch.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySearch.java index bc3a703..57336bb 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySearch.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySearch.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backend.proxy; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -70,8 +71,8 @@ public class VascBackendProxySearch extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ @Override - public List execute(VascBackendState state) throws VascBackendException { - List result = backend.execute(state); + public List execute(VascBackendState state) throws VascBackendException { + List result = backend.execute(state); if (state.getSearchString()==null) { return result; } @@ -79,8 +80,8 @@ public class VascBackendProxySearch extends AbstractVascBackendProxy { return result; } String searchString = state.getSearchString().toLowerCase(); - List search = new ArrayList(result.size()/4); - for (Object record:result) { + List search = new ArrayList(result.size()/4); + for (Serializable record:result) { for (VascEntryField field:entry.getVascEntryFields()) { VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue(); Object value = fieldValue.getValue(field.getBackendName(), record); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySort.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySort.java index 7b1067a..ed3a7dc 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySort.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxySort.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backend.proxy; +import java.io.Serializable; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -73,8 +74,8 @@ public class VascBackendProxySort extends AbstractVascBackendProxy { */ @SuppressWarnings("unchecked") @Override - public List execute(final VascBackendState state) throws VascBackendException { - List result = backend.execute(state); + public List execute(final VascBackendState state) throws VascBackendException { + List result = backend.execute(state); if (state.getSortField()==null) { return result; } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyTimerLogger.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyTimerLogger.java index db8d81a..87e1d8d 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyTimerLogger.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascBackendProxyTimerLogger.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.backend.proxy; +import java.io.Serializable; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -58,7 +59,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ @Override - public List execute(VascBackendState state) throws VascBackendException { + public List execute(VascBackendState state) throws VascBackendException { long t1 = System.currentTimeMillis(); try { return backend.execute(state); @@ -111,7 +112,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object) */ @Override - public void delete(Object object) throws VascBackendException { + public void delete(Serializable object) throws VascBackendException { long t1 = System.currentTimeMillis(); try { backend.delete(object); @@ -125,7 +126,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object) */ @Override - public Object merge(Object object) throws VascBackendException { + public Serializable merge(Serializable object) throws VascBackendException { long t1 = System.currentTimeMillis(); try { return backend.merge(object); @@ -139,7 +140,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object) */ @Override - public void persist(Object object) throws VascBackendException { + public void persist(Serializable object) throws VascBackendException { long t1 = System.currentTimeMillis(); try { backend.persist(object); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascProxyFilter.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascProxyFilter.java index 5221e00..4d15598 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascProxyFilter.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascProxyFilter.java @@ -22,6 +22,8 @@ package net.forwardfire.vasc.backend.proxy; +import java.io.Serializable; + import net.forwardfire.vasc.core.VascEntry; @@ -41,7 +43,7 @@ public interface VascProxyFilter { /** * Only filters 1 object. */ - public Object filterObject(Object object); + public Serializable filterObject(Serializable object); /** * Force impl to have public clone methode diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryState.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryState.java index 4c668cb..8adf42e 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryState.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryState.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.core; +import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -39,46 +40,46 @@ import net.forwardfire.vasc.backend.VascBackendState; @SuppressWarnings("serial") abstract public class AbstractVascEntryState implements VascEntryState { - private List entryDataList = null; - private Object entryDataObject = null; + private List entryDataList = null; + private Serializable entryDataObject = null; private Long totalBackendRecords = null; private VascBackendState vascBackendState = null; private VascEntryState state = null; private Map multiActionSelection = null; private boolean isEditCreate = false; - private VascBackend vascBackend = null; + private VascBackend vascBackend = null; private VascEntry vascEntry = null; public AbstractVascEntryState() { - entryDataList = new ArrayList(0); + entryDataList = new ArrayList(0); multiActionSelection = new HashMap(200); } /** * @return the entryDataList */ - public List getEntryDataList() { + public List getEntryDataList() { return entryDataList; } /** * @param entryDataList the entryDataList to set */ - public void setEntryDataList(List entryDataList) { + public void setEntryDataList(List entryDataList) { this.entryDataList = entryDataList; } /** * @return the entryDataObject */ - public Object getEntryDataObject() { + public Serializable getEntryDataObject() { return entryDataObject; } /** * @param entryDataObject the entryDataObject to set */ - public void setEntryDataObject(Object entryDataObject) { + public void setEntryDataObject(Serializable entryDataObject) { this.entryDataObject = entryDataObject; } @@ -128,14 +129,14 @@ abstract public class AbstractVascEntryState implements VascEntryState { /** * @return the vascBackend */ - public VascBackend getVascBackend() { + public VascBackend getVascBackend() { return vascBackend; } /** * @param vascBackend the vascBackend to set */ - public void setVascBackend(VascBackend vascBackend) { + public void setVascBackend(VascBackend vascBackend) { this.vascBackend = vascBackend; } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryConfigController.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryConfigController.java index ca5cbb0..aa0dc63 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryConfigController.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryConfigController.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.core; +import java.io.Serializable; import java.util.List; import net.forwardfire.vasc.backend.VascBackend; @@ -45,9 +46,9 @@ public interface VascEntryConfigController { public void configVascEntry(VascController vascController,VascEntryLocal vascEntry) throws VascException; - public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry) throws VascException; + public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry) throws VascException; - public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry,VascBackend realBackend) throws VascException; + public VascBackend configVascBackendProxied(VascController vascController,VascEntry vascEntry,VascBackend realBackend) throws VascException; public List getVascEntryExporterIds(); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryState.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryState.java index 939b8e9..0d82807 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryState.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryState.java @@ -41,22 +41,22 @@ public interface VascEntryState extends Serializable { /** * @return the entryDataList */ - public List getEntryDataList(); + public List getEntryDataList(); /** * @param entryDataList the entryDataList to set */ - public void setEntryDataList(List entryDataList); + public void setEntryDataList(List entryDataList); /** * @return the entryDataObject */ - public Object getEntryDataObject(); + public Serializable getEntryDataObject(); /** * @param entryDataObject the entryDataObject to set */ - public void setEntryDataObject(Object entryDataObject); + public void setEntryDataObject(Serializable entryDataObject); /** * @return the vascBackendState @@ -97,12 +97,12 @@ public interface VascEntryState extends Serializable { /** * @return the vascBackend */ - public VascBackend getVascBackend(); + public VascBackend getVascBackend(); /** * @param vascBackend the vascBackend to set */ - public void setVascBackend(VascBackend vascBackend); + public void setVascBackend(VascBackend vascBackend); /** * @return the isEditCreate diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/actions/RowVascAction.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/actions/RowVascAction.java index 0388745..111a12f 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/actions/RowVascAction.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/actions/RowVascAction.java @@ -22,6 +22,8 @@ package net.forwardfire.vasc.core.actions; +import java.io.Serializable; + import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascException; @@ -34,6 +36,6 @@ public interface RowVascAction extends VascAction { public boolean isMultiRowAction(); - public void doRowAction(VascEntry vascEntry,Object rowObject) throws VascException; + public void doRowAction(VascEntry vascEntry,Serializable rowObject) throws VascException; } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendActions.java b/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendActions.java index abce664..85fd79a 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendActions.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendActions.java @@ -22,6 +22,8 @@ package net.forwardfire.vasc.frontend; +import java.io.Serializable; + import net.forwardfire.vasc.core.VascEntryField; /** @@ -34,7 +36,7 @@ public interface VascFrontendActions extends VascFrontendEntry { public void refreshData() throws VascFrontendException; - public Object createObject() throws VascFrontendException; + public Serializable createObject() throws VascFrontendException; public void deleteObject() throws VascFrontendException; diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/AddRowAction.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/AddRowAction.java index 639a25b..087610a 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/AddRowAction.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/AddRowAction.java @@ -22,6 +22,8 @@ package net.forwardfire.vasc.impl.actions; +import java.io.Serializable; + import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.actions.AbstractVascRowActionLocal; @@ -42,9 +44,9 @@ public class AddRowAction extends AbstractVascRowActionLocal { } - public void doRowAction(VascEntry entry,Object rowObject) throws VascException { + public void doRowAction(VascEntry entry,Serializable rowObject) throws VascException { entry.getVascFrontendController().getVascEntryState().setEditCreate(true); - Object object = entry.getVascFrontendController().getVascFrontendActions().createObject(); + Serializable object = entry.getVascFrontendController().getVascFrontendActions().createObject(); entry.getVascFrontendController().getVascEntryState().setEntryDataObject(object); entry.getVascFrontendController().getVascFrontend().renderEdit(); } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/DeleteRowAction.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/DeleteRowAction.java index 7512380..2af6969 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/DeleteRowAction.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/DeleteRowAction.java @@ -22,6 +22,8 @@ package net.forwardfire.vasc.impl.actions; +import java.io.Serializable; + import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.actions.AbstractVascRowActionLocal; @@ -41,7 +43,7 @@ public class DeleteRowAction extends AbstractVascRowActionLocal { return ACTION_ID; } - public void doRowAction(VascEntry entry,Object rowObject) throws VascException { + public void doRowAction(VascEntry entry,Serializable rowObject) throws VascException { if (rowObject==null) { return; // nothing selected } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/EditRowAction.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/EditRowAction.java index e1b14a9..cd9ea64 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/EditRowAction.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/actions/EditRowAction.java @@ -22,6 +22,8 @@ package net.forwardfire.vasc.impl.actions; +import java.io.Serializable; + import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.actions.AbstractVascRowActionLocal; @@ -43,7 +45,7 @@ public class EditRowAction extends AbstractVascRowActionLocal { } - public void doRowAction(VascEntry entry,Object rowObject) throws VascException { + public void doRowAction(VascEntry entry,Serializable rowObject) throws VascException { if (rowObject==null) { return; // nothing selected } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendActions.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendActions.java index 03cfcb8..f71d0ab 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendActions.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendActions.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.impl.frontend; +import java.io.Serializable; import java.util.Date; import java.util.logging.Logger; @@ -55,9 +56,9 @@ public class DefaultVascFrontendActions implements VascFrontendActions { /** * @see net.forwardfire.vasc.frontend.VascFrontendHelper#initEditObject(net.forwardfire.vasc.core.VascEntry) */ - public Object createObject() throws VascFrontendException { + public Serializable createObject() throws VascFrontendException { entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_CREATE, null); - Object object; + Serializable object; try { object = entry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryRecordCreator().newRecord(); } catch (VascBackendException e) { @@ -146,8 +147,8 @@ public class DefaultVascFrontendActions implements VascFrontendActions { protected Object saveObject(boolean persist) throws VascException { try { - Object object = entry.getVascFrontendController().getVascEntryState().getEntryDataObject(); - Object result = null; + Serializable object = entry.getVascFrontendController().getVascEntryState().getEntryDataObject(); + Serializable result = null; entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_UPDATE,object); int index = removeObjectFromDataList(object); @@ -183,7 +184,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions { */ public void deleteObject() throws VascFrontendException { try { - Object object = entry.getVascFrontendController().getVascEntryState().getEntryDataObject(); + Serializable object = entry.getVascFrontendController().getVascEntryState().getEntryDataObject(); entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_DELETE, object); entry.getVascFrontendController().getVascEntryState().getVascBackend().delete(object); diff --git a/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/core/service/VascControllerService.java b/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/core/service/VascControllerService.java index 40fb060..c3ee5c8 100644 --- a/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/core/service/VascControllerService.java +++ b/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/core/service/VascControllerService.java @@ -156,7 +156,11 @@ public class VascControllerService { @Override public void controllerEvent(VascEventControllerType type,Object eventObject) { - generateRequest = System.currentTimeMillis(); + if (bootDone > 0) { + generateRequest = System.currentTimeMillis(); + } else { + generateBundle(); + } } public void generateBundle() { diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascEditDialog.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascEditDialog.java index 2ac3bd2..9d46cdf 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascEditDialog.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascEditDialog.java @@ -27,6 +27,7 @@ import java.awt.FlowLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.Serializable; import javax.swing.BoxLayout; import javax.swing.JButton; @@ -56,14 +57,14 @@ public class SwingVascEditDialog extends JPanel { private static final long serialVersionUID = 10L; private String headerText = null; private String headerTextValue = null; - private Object result = null; - private Object bean = null; + private Serializable result = null; + private Serializable bean = null; private VascEntry entry = null; private SwingVascFrontend swingFrontend = null; private SwingPanelIntegration panels = null; private JPanel editView = null; - public SwingVascEditDialog(SwingVascFrontend swingFrontend,JPanel editView,VascEntry entry,Object bean,String beanValue,SwingPanelIntegration panels) throws VascException { + public SwingVascEditDialog(SwingVascFrontend swingFrontend,JPanel editView,VascEntry entry,Serializable bean,String beanValue,SwingPanelIntegration panels) throws VascException { super(); this.headerText = "vasc.dialog.edit.message"; this.headerTextValue = beanValue; diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascFrontend.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascFrontend.java index 167a265..c7629d8 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascFrontend.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascFrontend.java @@ -33,6 +33,7 @@ import java.awt.event.MouseEvent; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.logging.Logger; @@ -156,7 +157,7 @@ public class SwingVascFrontend extends AbstractVascFrontend { public void renderEdit() throws VascFrontendException { logger.fine("Rending Edit View"); try { - Object rowBean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject(); + Serializable rowBean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject(); String beanValue = rowBean.toString(); if (entry.getDisplayNameFieldId()!=null) { VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId()); @@ -503,7 +504,7 @@ public class SwingVascFrontend extends AbstractVascFrontend { if (rowIndex!=-1) { // temp; gets index by sorter //rowIndex = tableSorter.modelIndex(rowIndex); - Object data = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(rowIndex); + Serializable data = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(rowIndex); entry.getVascFrontendController().getVascEntryState().setEntryDataObject(data); } else { entry.getVascFrontendController().getVascEntryState().setEntryDataObject(null); diff --git a/vasc-frontend/vasc-frontend-swt/pom.xml b/vasc-frontend/vasc-frontend-swt/pom.xml index 992dd47..3262944 100644 --- a/vasc-frontend/vasc-frontend-swt/pom.xml +++ b/vasc-frontend/vasc-frontend-swt/pom.xml @@ -45,19 +45,19 @@ test - net.forwardfire.vasc + net.forwardfire.vasc.backend vasc-backend-ldap ${project.version} test - net.forwardfire.vasc + net.forwardfire.vasc.backend vasc-backend-mongodb ${project.version} test - net.forwardfire.vasc + net.forwardfire.vasc.backend vasc-backend-jdbc ${project.version} test diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascFrontend.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascFrontend.java index 5958005..9d90675 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascFrontend.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascFrontend.java @@ -25,6 +25,7 @@ package net.forwardfire.vasc.frontend.swt; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.io.Serializable; import java.util.logging.Level; import java.util.logging.Logger; @@ -440,7 +441,7 @@ public class SwtVascFrontend extends AbstractVascFrontend { * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ public void widgetSelected(SelectionEvent e) { - Object data = e.item.getData(); + Serializable data = (Serializable) e.item.getData(); logger.fine("Slecting data: "+data); entry.getVascFrontendController().getVascEntryState().setEntryDataObject(data); } diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerBase.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerBase.java index 922a3e7..f0785f3 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerBase.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/AbstractJSFVascFacesControllerBase.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.frontend.web.jsf; +import java.io.Serializable; import java.util.List; import java.util.Map; @@ -50,7 +51,7 @@ public abstract class AbstractJSFVascFacesControllerBase { /** * */ - public List executeVascList(String entryId,Map para) { + public List executeVascList(String entryId,Map para) { try { // plug all object VascEntryLocal entry = (VascEntryLocal)getVascController().getVascEntryController().getVascEntryById(entryId); diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntryEventListener.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntryEventListener.java index 8a721fb..5b1a484 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntryEventListener.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntryEventListener.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.frontend.web.jsf; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -78,10 +79,10 @@ public class JSFVascEntryEventListener implements VascEntryFrontendEventListener throw new RuntimeException(e); } */ - List data = entry.getVascFrontendController().getVascEntryState().getEntryDataList(); + List data = entry.getVascFrontendController().getVascEntryState().getEntryDataList(); List result = new ArrayList(data.size()); int index = 0; - for (Object o:data) { + for (Serializable o:data) { VascDataBackendBean b = new VascDataBackendBean(entry,o,index); result.add(b); index++; diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntrySupportBean.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntrySupportBean.java index 67ff5dd..b666577 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntrySupportBean.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascEntrySupportBean.java @@ -318,7 +318,7 @@ public class JSFVascEntrySupportBean implements Serializable { VascEntry parent = entry.getVascFrontendController().getVascEntryState().getParent().getVascEntry(); RowVascAction action = parent.getRowActionById(actionIdString); - Object parentSelected = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject(); + Serializable parentSelected = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject(); logger.fine("parentCustomRowaction do on: "+action+" parentSelection: "+parentSelected); try { action.doRowAction(parent,parentSelected); @@ -401,7 +401,7 @@ public class JSFVascEntrySupportBean implements Serializable { Boolean value = state.getMultiActionSelection().get(rowId); logger.fine("multiRow selected: "+rowId+" value: "+value); if (value!=null && value==true) { - Object row = state.getEntryDataList().get(rowId); + Serializable row = state.getEntryDataList().get(rowId); logger.finer("row: "+row); action.doRowAction(vascEntry, row); if (action.getId().equals(DeleteRowAction.ACTION_ID)) { @@ -468,7 +468,7 @@ public class JSFVascEntrySupportBean implements Serializable { VascEntry entry = getVascEntry(); // select record to edit - Object rowObject = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject(); + Serializable rowObject = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject(); comp.initGoto(entry.getVascFrontendController().getVascEntryState().getParent(),rowObject); } @@ -613,7 +613,7 @@ public class JSFVascEntrySupportBean implements Serializable { VascEntryLink link = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getVascEntry().getVascEntryLinkById(linkId); comp.initGoto(link,comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent()); - Object o = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getEntryDataObject(); + Serializable o = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getEntryDataObject(); int index = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getEntryDataList().indexOf(o); VascDataBackendBean selected = new VascDataBackendBean(entry,o,index); this.selected=selected; @@ -668,17 +668,17 @@ public class JSFVascEntrySupportBean implements Serializable { VascEntry entry = comp.getVascEntry(); VascEntryState state = entry.getVascFrontendController().getVascEntryState(); - List sels = new ArrayList(5); + List sels = new ArrayList(5); for (Integer rowId:state.getMultiActionSelection().keySet()) { Boolean value = state.getMultiActionSelection().get(rowId); logger.fine("multiRow delete: "+rowId+" value: "+value); if (value!=null && value==true) { - Object row = state.getEntryDataList().get(rowId); + Serializable row = state.getEntryDataList().get(rowId); sels.add(row); } } if (sels.isEmpty()==false) { - for (Object row:sels) { + for (Serializable row:sels) { entry.getVascFrontendController().getVascEntryState().setEntryDataObject(row); entry.getVascFrontendController().getVascFrontendActions().deleteObject(); } diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponent.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponent.java index dc98dfb..666a3d1 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponent.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/JSFVascUIComponent.java @@ -23,6 +23,7 @@ package net.forwardfire.vasc.frontend.web.jsf; import java.io.IOException; +import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -72,7 +73,7 @@ public class JSFVascUIComponent extends UIComponentBase { private VascEntryLink link = null; private VascEntryState linkState = null; private VascEntryState state = null; - private Object stateEditId = null; + private Serializable stateEditId = null; private Logger logger = null; private Boolean initClear = null; private String injectTableOptionOnChange = null; @@ -182,7 +183,7 @@ public class JSFVascUIComponent extends UIComponentBase { this.state=state; } - protected void initGoto(VascEntryState state,Object stateEditId) { + protected void initGoto(VascEntryState state,Serializable stateEditId) { logger.fine("init goto "+state); this.state=state; this.stateEditId=stateEditId; @@ -218,7 +219,7 @@ public class JSFVascUIComponent extends UIComponentBase { } if (stateEditId!=null) { - Object rowObject = stateEditId; + Serializable rowObject = stateEditId; // setup for renderEdit() of frontend List list = new ArrayList(1); diff --git a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascDataBackendBean.java b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascDataBackendBean.java index 26f0856..4e1b2bd 100644 --- a/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascDataBackendBean.java +++ b/vasc-frontend/vasc-frontend-web-jsf/src/main/java/net/forwardfire/vasc/frontend/web/jsf/VascDataBackendBean.java @@ -29,11 +29,8 @@ import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascEntryFieldValue; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.frontend.VascFrontendDataSelector.EntryFieldSelectType; - - /** * * @@ -44,11 +41,11 @@ public class VascDataBackendBean implements Serializable { private static final long serialVersionUID = 3881688974089760074L; private VascEntry entry = null; - private Object record = null; + private Serializable record = null; private boolean realValue = false; private int recordId = 0; - public VascDataBackendBean(VascEntry entry,Object record,int recordId) { + public VascDataBackendBean(VascEntry entry,Serializable record,int recordId) { this.entry=entry; this.record=record; this.recordId=recordId; @@ -102,7 +99,7 @@ public class VascDataBackendBean implements Serializable { } } - public Object getRecord() { + public Serializable getRecord() { return record; } diff --git a/vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor/VirtualVascBackend.java b/vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor/VirtualVascBackend.java index 44efde9..9f01d86 100644 --- a/vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor/VirtualVascBackend.java +++ b/vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor/VirtualVascBackend.java @@ -1,5 +1,6 @@ package net.forwardfire.vasc.opt.editor; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -27,14 +28,14 @@ import net.forwardfire.vasc.impl.DefaultVascEntryField; import net.forwardfire.vasc.impl.DefaultVascEntryFieldSet; import net.forwardfire.vasc.impl.DefaultVascEntryLink; -public class VirtualVascBackend extends AbstractVascBackend { +public class VirtualVascBackend extends AbstractVascBackend { private VascController vascController = null; private String vascType = "entry"; private String entryId = null; - public List execute(VascBackendState state) throws VascBackendException { - List result = new ArrayList(100); + public List execute(VascBackendState state) throws VascBackendException { + List result = new ArrayList(100); entryId = (String)state.getDataParameter("entry_id"); if ("entry".equals(vascType)) { for (String id:vascController.getVascEntryController().getVascEntryIds()) { @@ -65,19 +66,19 @@ public class VirtualVascBackend extends AbstractVascBackend { return result; } - public void persist(Object object) throws VascBackendException { + public void persist(Serializable object) throws VascBackendException { edit(object,false,true); } - public Object merge(Object object) throws VascBackendException { + public Serializable merge(Serializable object) throws VascBackendException { return edit(object,true,true); } - public void delete(Object object) throws VascBackendException { + public void delete(Serializable object) throws VascBackendException { edit(object,true,false); } - public Object edit(Object object,boolean removeReal,boolean addEdit) throws VascBackendException { + public Serializable edit(Serializable object,boolean removeReal,boolean addEdit) throws VascBackendException { if (object instanceof VascEntry) { entryId = ((VascEntry)object).getId(); diff --git a/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelOrder.java b/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelOrder.java index 516feb8..c17ba6c 100644 --- a/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelOrder.java +++ b/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelOrder.java @@ -23,6 +23,7 @@ package net.forwardfire.vasc.test.frontend.data; +import java.io.Serializable; import java.util.Date; import net.forwardfire.vasc.annotations.VascDefaultValue; @@ -41,8 +42,9 @@ import net.forwardfire.vasc.validators.VascStringLength; * @author Willem Cazander * @version 1.0 Mar 28, 2007 */ +@SuppressWarnings("serial") @VascEntry(headerName="En een tooltip op het model") -public class TestModelOrder { +public class TestModelOrder implements Serializable { private Integer id = null; private String name = null; diff --git a/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelOrderLine.java b/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelOrderLine.java index 4e0ca2a..232141f 100644 --- a/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelOrderLine.java +++ b/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelOrderLine.java @@ -23,6 +23,7 @@ package net.forwardfire.vasc.test.frontend.data; +import java.io.Serializable; import java.util.Date; import net.forwardfire.vasc.annotations.VascDefaultValue; @@ -41,8 +42,9 @@ import net.forwardfire.vasc.validators.VascStringLength; * @author Willem Cazander * @version 1.0 Feb 7, 2012 */ +@SuppressWarnings("serial") @VascEntry(headerName="OrderLine") -public class TestModelOrderLine { +public class TestModelOrderLine implements Serializable { private TestModelOrder order = null; private String name = null; diff --git a/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelVascDataSource.java b/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelVascDataSource.java index faae5be..958c343 100644 --- a/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelVascDataSource.java +++ b/vasc-test/vasc-test-frontend/src/main/java/net/forwardfire/vasc/test/frontend/data/TestModelVascDataSource.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.test.frontend.data; +import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -45,8 +46,8 @@ import net.forwardfire.vasc.backend.data.BeanVascEntryRecordCreator; public class TestModelVascDataSource { //private List testModels = null; - public ListObjectVascDataSource orderModel = null; - public ListObjectVascDataSource orderLineModel = null; + public ListObjectVascDataSource orderModel = null; + public ListObjectVascDataSource orderLineModel = null; public TestModelVascDataSource() { this(new ArrayList(200),new ArrayList(200)); @@ -86,26 +87,26 @@ public class TestModelVascDataSource { } } - class ListObjectVascDataSource extends AbstractVascBackend { + class ListObjectVascDataSource extends AbstractVascBackend { private Class modelClass = null; - private List modelList = null; + private List modelList = null; private String nullLabel = null; private String nullKeyValue = null; - public ListObjectVascDataSource(Class modelClass,List modelList) { + public ListObjectVascDataSource(Class modelClass,List modelList) { this.modelClass=modelClass; this.modelList=modelList; } - public List getObjectList() { + public List getObjectList() { return modelList; } - public List execute(VascBackendState state) throws VascBackendException { + public List execute(VascBackendState state) throws VascBackendException { if (state.getDataParameterKeys().isEmpty()==false) { - List result = new ArrayList(modelList.size()/2); + List result = new ArrayList(modelList.size()/2); DefaultElementObjectPropertyValue helper = new DefaultElementObjectPropertyValue(); - for (Object row:modelList) { + for (DATA_OBJECT row:modelList) { boolean addRow = true; for (String key:state.getDataParameterKeys()) { Object keyValue = state.getDataParameter(key); @@ -129,26 +130,26 @@ public class TestModelVascDataSource { } return result; } else { - List result = new ArrayList(modelList.size()); - for (Object row:modelList) { + List result = new ArrayList(modelList.size()); + for (DATA_OBJECT row:modelList) { result.add(row); } return result; } } - public void persist(Object object) throws VascBackendException { + public void persist(DATA_OBJECT object) throws VascBackendException { modelList.add(object); } - public Object merge(Object object) throws VascBackendException { + public DATA_OBJECT merge(DATA_OBJECT object) throws VascBackendException { if(modelList.contains(object)==false) { modelList.add(object); } return object; } - public void delete(Object object) throws VascBackendException { + public void delete(DATA_OBJECT object) throws VascBackendException { modelList.remove(object); }