From a13719f0081aae396d8b91e61baa377c8e5ebe9f Mon Sep 17 00:00:00 2001 From: Willem Cazander Date: Sun, 2 Mar 2014 19:45:22 +0100 Subject: [PATCH] Split backend to backend api. --- pom.xml | 1 + vasc-backend/pom.xml | 2 + vasc-backend/vasc-backend-api/.project | 23 +++ vasc-backend/vasc-backend-api/pom.xml | 18 +++ .../vasc/backend/AbstractVascBackend.java | 7 +- .../AbstractVascBackendControllerLocal.java | 0 .../backend/AbstractVascBackendState.java | 0 .../DefaultVascBackendController.java | 3 +- .../backend}/DefaultVascBackendState.java | 3 +- .../forwardfire/vasc/backend/VascBackend.java | 25 +-- .../vasc/backend/VascBackendController.java | 0 .../backend/VascBackendControllerLocal.java | 0 .../vasc/backend/VascBackendException.java | 40 ++--- .../vasc/backend/VascBackendState.java | 0 .../vasc/backend}/VascEntryFieldValue.java | 11 +- .../vasc/backend}/VascEntryRecordCreator.java | 8 +- .../backend/data/BeanVascEntryFieldValue.java | 50 +++--- .../data/BeanVascEntryRecordCreator.java | 12 +- .../backend/data/MapVascEntryFieldValue.java | 25 ++- .../data/MapVascEntryRecordCreator.java | 8 +- vasc-backend/vasc-backend-jdbc/pom.xml | 11 +- .../vasc/backend/jdbc/JdbcVascBackend.java | 23 ++- .../backend/jdbc/JdbcVascBackendXpql.java | 26 ++-- vasc-backend/vasc-backend-jpa/pom.xml | 11 +- .../jpa/AbstractHibernateVascBackend.java | 8 +- .../jpa/AbstractPersistenceVascBackend.java | 11 +- .../jpa/XpqlHibernateVascBackend.java | 24 ++- .../jpa/XpqlPersistanceVascBackend.java | 22 ++- vasc-backend/vasc-backend-ldap/pom.xml | 6 +- .../vasc/backend/ldap/LdapVascBackend.java | 35 ++--- vasc-backend/vasc-backend-metamodel/pom.xml | 6 +- .../metamodel/MetaModelVascBackend.java | 22 ++- .../metamodel/RowVascEntryFieldValue.java | 32 ++-- .../metamodel/RowVascEntryRecordCreator.java | 7 +- .../META-INF/vasc/vasc-backend-metamodel.eld | 5 - vasc-backend/vasc-backend-mongodb/pom.xml | 6 +- .../backend/mongodb/MongodbVascBackend.java | 21 ++- .../mongodb/MongodbVascEntryFieldValue.java | 16 +- .../MongodbVascEntryRecordCreator.java | 8 +- .../vasc/ejb3/VascServiceRemoteBackend.java | 105 ++++--------- vasc-core-ejb3-server/pom.xml | 2 +- vasc-core/pom.xml | 4 +- .../proxy/AbstractVascBackendProxy.java | 32 ++-- .../backend/proxy/VascBackendProxyCache.java | 10 +- .../proxy/VascBackendProxyEventExecutor.java | 14 +- .../backend/proxy/VascBackendProxyFilter.java | 13 +- .../backend/proxy/VascBackendProxyPaged.java | 4 +- .../backend/proxy/VascBackendProxySearch.java | 10 +- .../backend/proxy/VascBackendProxySort.java | 30 ++-- .../proxy/VascBackendProxyTimerLogger.java | 14 +- .../VascProxyFilter.java} | 6 +- .../core/AbstractVascEntryFieldLocal.java | 2 +- .../vasc/core/AbstractVascEntryLocal.java | 12 +- .../net/forwardfire/vasc/core/VascEntry.java | 4 +- .../forwardfire/vasc/core/VascEntryField.java | 2 +- .../vasc/core/VascEntryFieldLocal.java | 2 +- .../forwardfire/vasc/core/VascEntryLocal.java | 4 +- .../vasc/core/VascInterfaceLoader.java | 4 +- .../core/ui/VascColumnValueModelListener.java | 7 +- .../vasc/core/ui/VascValueModelListener.java | 2 - .../vasc/frontend/VascFrontendController.java | 4 +- .../frontend/VascFrontendControllerLocal.java | 4 +- ...ndPager.java => VascFrontendPageInfo.java} | 16 +- .../VascFrontendPageInfoNumber.java} | 35 +++-- .../DefaultVascEntryConfigController.java | 7 +- .../vasc/impl/DefaultVascFactory.java | 2 + .../vasc/impl/DefaultVascInterfaceLoader.java | 6 +- .../BeanPropertyVascEntryFieldValue.java | 108 ------------- .../frontend/DefaultVascFrontendActions.java | 86 +++++----- .../DefaultVascFrontendController.java | 12 +- .../frontend/DefaultVascFrontendHelper.java | 23 +-- .../frontend/DefaultVascFrontendPager.java | 32 ++-- .../impl/ui/VascSelectItemModelEntry.java | 16 +- .../resources/META-INF/vasc/vasc-lang.eld | 9 +- .../directory/conf/vasc.d/tech-server.xml | 11 +- vasc-demo/vasc-demo-client-swing/pom.xml | 2 +- vasc-demo/vasc-demo-server/pom.xml | 17 +- .../demo/server/core/VascTechDemoStartup.java | 18 +-- .../core/service/VascControllerService.java | 2 +- .../demo/server/ui/load/JLoadStepMetaCsv.java | 2 +- .../server/ui/load/LoadVascXmlWriter.java | 3 +- vasc-demo/vasc-demo-tech-web/pom.xml | 2 +- .../AbstractVascEntryExportWriter.java | 11 +- .../generic/VascEntryExportWriterCsv.java | 6 +- .../generic/VascEntryExportWriterXml.java | 8 +- .../jr4o/JRDynamicDataSourceVascEntry.java | 8 +- .../json/VascEntryExportWriterJson.java | 6 +- .../vasc/frontend/swing/SwingActionPanel.java | 14 +- .../vasc/frontend/swing/SwingPagerPanel.java | 34 ++-- .../frontend/swing/SwingVascEditDialog.java | 11 +- .../frontend/swing/SwingVascFrontend.java | 12 +- .../frontend/swing/SwingVascTableModel.java | 2 +- .../vasc/frontend/swt/SwtActionPanel.java | 14 +- .../vasc/frontend/swt/SwtPagerPanel.java | 2 +- .../vasc/frontend/swt/SwtVascEditDialog.java | 11 +- .../vasc/frontend/swt/SwtVascFrontend.java | 3 +- .../web/jsf/JSFVascEntryEventListener.java | 2 +- .../web/jsf/JSFVascEntrySupportBean.java | 32 ++-- .../frontend/web/jsf/JSFVascUIComponent.java | 9 +- .../frontend/web/jsf/VascDataBackendBean.java | 13 +- vasc-opt/.project | 17 ++ vasc-opt/pom.xml | 17 ++ vasc-opt/vasc-opt-editor/.project | 23 +++ vasc-opt/vasc-opt-editor/pom.xml | 18 +++ .../vasc/opt/editor}/VirtualVascBackend.java | 24 +-- .../vasc/opt/editor/package-info.java | 8 + .../resources/META-INF/vasc/vasc-modules.xml | 10 ++ .../META-INF/vasc/vasc-opt-editor.eld | 27 ++++ .../vasc/opt/editor/vasc-editor.xml | 147 ++++++++++++++++++ vasc-opt/vasc-opt-metamodel/.project | 23 +++ vasc-opt/vasc-opt-metamodel/pom.xml | 23 +++ .../metamodel/MetaModelSchemaAutoEntry.java | 5 +- .../SchemaAutoEntryElementConfigurator.java | 4 +- .../resources/META-INF/vasc/vasc-modules.xml | 10 ++ .../META-INF/vasc/vasc-opt-metamodel.eld | 24 +++ .../data/TestModelVascDataSource.java | 30 ++-- 116 files changed, 1029 insertions(+), 815 deletions(-) create mode 100644 vasc-backend/vasc-backend-api/.project create mode 100644 vasc-backend/vasc-backend-api/pom.xml rename {vasc-core => vasc-backend/vasc-backend-api}/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackend.java (97%) rename {vasc-core => vasc-backend/vasc-backend-api}/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendControllerLocal.java (100%) rename {vasc-core => vasc-backend/vasc-backend-api}/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendState.java (100%) rename {vasc-core/src/main/java/net/forwardfire/vasc/impl => vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend}/DefaultVascBackendController.java (93%) rename {vasc-core/src/main/java/net/forwardfire/vasc/impl => vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend}/DefaultVascBackendState.java (94%) rename {vasc-core => vasc-backend/vasc-backend-api}/src/main/java/net/forwardfire/vasc/backend/VascBackend.java (81%) rename {vasc-core => vasc-backend/vasc-backend-api}/src/main/java/net/forwardfire/vasc/backend/VascBackendController.java (100%) rename {vasc-core => vasc-backend/vasc-backend-api}/src/main/java/net/forwardfire/vasc/backend/VascBackendControllerLocal.java (100%) rename vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/BeanVascEntryRecordCreator.java => vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendException.java (58%) rename {vasc-core => vasc-backend/vasc-backend-api}/src/main/java/net/forwardfire/vasc/backend/VascBackendState.java (100%) rename {vasc-core/src/main/java/net/forwardfire/vasc/core/entry => vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend}/VascEntryFieldValue.java (79%) rename {vasc-core/src/main/java/net/forwardfire/vasc/core/entry => vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend}/VascEntryRecordCreator.java (88%) rename {vasc-core => vasc-backend/vasc-backend-api}/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryFieldValue.java (70%) rename {vasc-core => vasc-backend/vasc-backend-api}/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryRecordCreator.java (88%) rename {vasc-core => vasc-backend/vasc-backend-api}/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java (75%) rename {vasc-core => vasc-backend/vasc-backend-api}/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java (89%) rename vasc-core/src/main/java/net/forwardfire/vasc/backend/{VascBackendFilter.java => proxy/VascProxyFilter.java} (92%) rename vasc-core/src/main/java/net/forwardfire/vasc/frontend/{VascFrontendPager.java => VascFrontendPageInfo.java} (79%) rename vasc-core/src/main/java/net/forwardfire/vasc/{backend/VascBackendPageNumber.java => frontend/VascFrontendPageInfoNumber.java} (76%) delete mode 100644 vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/BeanPropertyVascEntryFieldValue.java create mode 100644 vasc-opt/.project create mode 100644 vasc-opt/pom.xml create mode 100644 vasc-opt/vasc-opt-editor/.project create mode 100644 vasc-opt/vasc-opt-editor/pom.xml rename {vasc-core/src/main/java/net/forwardfire/vasc/backend => vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor}/VirtualVascBackend.java (88%) create mode 100644 vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor/package-info.java create mode 100644 vasc-opt/vasc-opt-editor/src/main/resources/META-INF/vasc/vasc-modules.xml create mode 100644 vasc-opt/vasc-opt-editor/src/main/resources/META-INF/vasc/vasc-opt-editor.eld create mode 100644 vasc-opt/vasc-opt-editor/src/main/resources/net/forwardfire/vasc/opt/editor/vasc-editor.xml create mode 100644 vasc-opt/vasc-opt-metamodel/.project create mode 100644 vasc-opt/vasc-opt-metamodel/pom.xml rename {vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend => vasc-opt/vasc-opt-metamodel/src/main/java/net/forwardfire/vasc/opt}/metamodel/MetaModelSchemaAutoEntry.java (98%) rename {vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend => vasc-opt/vasc-opt-metamodel/src/main/java/net/forwardfire/vasc/opt}/metamodel/x4o/SchemaAutoEntryElementConfigurator.java (95%) create mode 100644 vasc-opt/vasc-opt-metamodel/src/main/resources/META-INF/vasc/vasc-modules.xml create mode 100644 vasc-opt/vasc-opt-metamodel/src/main/resources/META-INF/vasc/vasc-opt-metamodel.eld diff --git a/pom.xml b/pom.xml index c36f199..4f83bee 100644 --- a/pom.xml +++ b/pom.xml @@ -34,6 +34,7 @@ vasc-core-ejb3-client vasc-core-ejb3-server vasc-export + vasc-opt UTF-8 diff --git a/vasc-backend/pom.xml b/vasc-backend/pom.xml index 59a6942..2973ed4 100644 --- a/vasc-backend/pom.xml +++ b/vasc-backend/pom.xml @@ -6,6 +6,7 @@ 0.4.2-SNAPSHOT vasc-backend + net.forwardfire.vasc.backend pom vasc-backend vasc-backend @@ -15,5 +16,6 @@ vasc-backend-mongodb vasc-backend-jdbc vasc-backend-metamodel + vasc-backend-api diff --git a/vasc-backend/vasc-backend-api/.project b/vasc-backend/vasc-backend-api/.project new file mode 100644 index 0000000..350bacf --- /dev/null +++ b/vasc-backend/vasc-backend-api/.project @@ -0,0 +1,23 @@ + + + vasc-backend-api + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/vasc-backend/vasc-backend-api/pom.xml b/vasc-backend/vasc-backend-api/pom.xml new file mode 100644 index 0000000..db828d8 --- /dev/null +++ b/vasc-backend/vasc-backend-api/pom.xml @@ -0,0 +1,18 @@ + + 4.0.0 + + net.forwardfire.vasc.backend + vasc-backend + 0.4.2-SNAPSHOT + + vasc-backend-api + vasc-backend-api + vasc-backend-api + + + org.x4o + x4o-driver + ${x4o.version} + + + \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackend.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackend.java similarity index 97% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackend.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackend.java index ad61c35..117cc3c 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackend.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackend.java @@ -24,9 +24,6 @@ package net.forwardfire.vasc.backend; import java.util.Map; -import net.forwardfire.vasc.core.VascException; - - /** * * @author Willem Cazander @@ -110,14 +107,14 @@ abstract public class AbstractVascBackend implements VascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#doRecordMoveDownById(java.lang.Object) */ - public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException { + public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException { return 0l; } /** * @see net.forwardfire.vasc.backend.VascBackend#doRecordMoveUpById(java.lang.Object) */ - public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException { + public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascBackendException { return 0l; } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendControllerLocal.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendControllerLocal.java similarity index 100% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendControllerLocal.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendControllerLocal.java diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendState.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendState.java similarity index 100% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendState.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/AbstractVascBackendState.java diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascBackendController.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/DefaultVascBackendController.java similarity index 93% rename from vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascBackendController.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/DefaultVascBackendController.java index 76ea74f..f9a6b10 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascBackendController.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/DefaultVascBackendController.java @@ -20,9 +20,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.impl; +package net.forwardfire.vasc.backend; -import net.forwardfire.vasc.backend.AbstractVascBackendControllerLocal; /** * DefaultVascBackendController stores the vasc backends. diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascBackendState.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/DefaultVascBackendState.java similarity index 94% rename from vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascBackendState.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/DefaultVascBackendState.java index 9964a74..654ea8d 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascBackendState.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/DefaultVascBackendState.java @@ -20,9 +20,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.impl; +package net.forwardfire.vasc.backend; -import net.forwardfire.vasc.backend.AbstractVascBackendState; /** * Holds the state for the backend diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackend.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackend.java similarity index 81% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackend.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackend.java index 7280cd8..c522e5b 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackend.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackend.java @@ -25,13 +25,6 @@ package net.forwardfire.vasc.backend; import java.util.List; import java.util.Map; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; - - /** * * @author Willem Cazander @@ -45,32 +38,30 @@ public interface VascBackend { public void startBackend(); public void stopBackend(); - public List execute(VascBackendState state) throws VascException; + public List execute(VascBackendState state) throws VascBackendException; public boolean isReadOnly(); - public void persist(Object object) throws VascException; + public void persist(Object object) throws VascBackendException; - public Object merge(Object object) throws VascException; + public Object merge(Object object) throws VascBackendException; - public void delete(Object object) throws VascException; + public void delete(Object object) throws VascBackendException; /** * Creates a new Field acces obj the the given field entry. * note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle. - * @param field * @return */ - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field); + public VascEntryFieldValue provideVascEntryFieldValue(); /** * Creates a new RecordCreater obj the the given entry. * note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle. - * @param vascEntry * @return */ - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry); + public VascEntryRecordCreator provideVascEntryRecordCreator(); /** * Defines if the backend supports sorting @@ -101,8 +92,8 @@ public interface VascBackend { * @return */ public boolean isRecordMoveable(); - public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException; - public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException; + public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascBackendException; + public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException; public boolean isPageSummary(); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendController.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendController.java similarity index 100% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendController.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendController.java diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendControllerLocal.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendControllerLocal.java similarity index 100% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendControllerLocal.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendControllerLocal.java diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/BeanVascEntryRecordCreator.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendException.java similarity index 58% rename from vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/BeanVascEntryRecordCreator.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendException.java index e6c5a32..5183b78 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/BeanVascEntryRecordCreator.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendException.java @@ -20,44 +20,32 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.impl.entry; +package net.forwardfire.vasc.backend; + -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; /** - * BeanVascEntryRecordCreator creates an new instance Object from a defined objectClass. + * VascBackendException wraps the backend exception. * * @author Willem Cazander - * @version 1.0 Mar 21, 2007 + * @version 1.0 Nov 22, 2013 */ -public class BeanVascEntryRecordCreator implements VascEntryRecordCreator { - - private static final long serialVersionUID = 1L; - private Class objectClass = null; +@SuppressWarnings("serial") +public class VascBackendException extends Exception { - public BeanVascEntryRecordCreator() { + + public VascBackendException() { } - public BeanVascEntryRecordCreator(Class objectClass) { - setObjectClass(objectClass); + public VascBackendException(String message) { + super(message); } - public Object newRecord(VascEntry entry) throws VascException { - try { - return objectClass.newInstance(); - } catch (InstantiationException e) { - throw new VascException(e); - } catch (IllegalAccessException e) { - throw new VascException(e); - } + public VascBackendException(Exception e) { + super(e); } - public Class getObjectClass() { - return objectClass; - } - public void setObjectClass(Class objectClass) { - this.objectClass=objectClass; + public VascBackendException(String message,Exception e) { + super(message,e); } } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendState.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendState.java similarity index 100% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendState.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascBackendState.java diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryFieldValue.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascEntryFieldValue.java similarity index 79% rename from vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryFieldValue.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascEntryFieldValue.java index fdea4dd..3070e90 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryFieldValue.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascEntryFieldValue.java @@ -20,13 +20,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.core.entry; +package net.forwardfire.vasc.backend; import java.io.Serializable; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.VascException; - /** * VascEntryFieldValue @@ -36,9 +33,9 @@ import net.forwardfire.vasc.core.VascException; */ public interface VascEntryFieldValue extends Serializable { - public Object getValue(VascEntryField field,Object record) throws VascException; + public Object getValue(String backendName,Object record) throws VascBackendException; - public String getDisplayValue(VascEntryField field,Object record) throws VascException; + public String getDisplayValue(String backendName,Object record) throws VascBackendException; - public void setValue(VascEntryField field,Object record,Object value) throws VascException; + public void setValue(String backendName,Object record,Object value) throws VascBackendException; } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryRecordCreator.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascEntryRecordCreator.java similarity index 88% rename from vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryRecordCreator.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascEntryRecordCreator.java index 30742a2..8bd0359 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/entry/VascEntryRecordCreator.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/VascEntryRecordCreator.java @@ -20,14 +20,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.core.entry; +package net.forwardfire.vasc.backend; import java.io.Serializable; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.VascException; - - /** * @@ -36,7 +32,7 @@ import net.forwardfire.vasc.core.VascException; */ public interface VascEntryRecordCreator extends Serializable { - public Object newRecord(VascEntry entry) throws VascException; + public Object newRecord() throws VascBackendException; public Class getObjectClass(); } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryFieldValue.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryFieldValue.java similarity index 70% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryFieldValue.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryFieldValue.java index eeb2701..4df36eb 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryFieldValue.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryFieldValue.java @@ -22,9 +22,9 @@ package net.forwardfire.vasc.backend.data; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.VascException; + +import net.forwardfire.vasc.backend.VascBackendException; +import net.forwardfire.vasc.backend.VascEntryFieldValue; import org.x4o.xml.element.DefaultElementObjectPropertyValue; @@ -40,34 +40,34 @@ public class BeanVascEntryFieldValue implements VascEntryFieldValue { private DefaultElementObjectPropertyValue bean = new DefaultElementObjectPropertyValue(); /** - * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object) + * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(java.lang.String, java.lang.Object) */ - public Object getValue(VascEntryField field, Object record) throws VascException { - if (field==null) { - throw new NullPointerException("Can't get value of null field."); - } - if (field.getBackendName()==null) { - throw new NullPointerException("Can't get value of null backendName field."); + public Object getValue(String backendName, Object record) throws VascBackendException { + if (backendName==null) { + throw new NullPointerException("Can't get value of null backendName."); } if (record==null) { throw new NullPointerException("Can't get value of null object."); } try { - Object o = bean.getProperty(record,field.getBackendName()); + Object o = bean.getProperty(record,backendName); return o; } catch (Exception e) { - throw new VascException(e); + throw new VascBackendException(e); } } /** - * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object) + * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(java.lang.String, java.lang.Object) */ - public String getDisplayValue(VascEntryField field, Object record) throws VascException { - Object value = getValue(field,record); + public String getDisplayValue(String backendName, Object record) throws VascBackendException { + Object value = getValue(backendName,record); if (value==null) { return ""; } + return value.toString(); + + /* TODO: move if (field.getDisplayName()==null) { if (value instanceof String) { return (String)value; @@ -81,27 +81,25 @@ public class BeanVascEntryFieldValue implements VascEntryFieldValue { } return ""+result; } catch (Exception e) { - throw new VascException(e); - } + throw new VascBackendException(e); + } + */ } /** - * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object, java.lang.Object) + * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(java.lang.String, java.lang.Object, java.lang.Object) */ - public void setValue(VascEntryField field, Object record,Object value) throws VascException { - if (field==null) { - throw new NullPointerException("Can't set value of null field."); - } - if (field.getBackendName()==null) { - throw new NullPointerException("Can't set value of null backendName field."); + public void setValue(String backendName, Object record,Object value) throws VascBackendException { + if (backendName==null) { + throw new NullPointerException("Can't set value of null backendName."); } if (record==null) { throw new NullPointerException("Can't set value of null object."); } try { - bean.setProperty(record, field.getBackendName(), value); + bean.setProperty(record, backendName, value); } catch (Exception e) { - throw new VascException(e); + throw new VascBackendException(e); } } } diff --git a/vasc-core/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 similarity index 88% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryRecordCreator.java rename to vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/BeanVascEntryRecordCreator.java index 3d74804..a154d20 100644 --- a/vasc-core/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,9 +22,9 @@ package net.forwardfire.vasc.backend.data; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; +import net.forwardfire.vasc.backend.VascBackendException; +import net.forwardfire.vasc.backend.VascEntryRecordCreator; + /** * BeanVascEntryRecordCreator creates a new backend record based on class object. @@ -48,13 +48,13 @@ public class BeanVascEntryRecordCreator implements VascEntryRecordCreator { return resultClass; } - public Object newRecord(VascEntry entry) throws VascException { + public Object newRecord() throws VascBackendException { try { return resultClass.newInstance(); } catch (InstantiationException e) { - throw new VascException(e); + throw new VascBackendException(e); } catch (IllegalAccessException e) { - throw new VascException(e); + throw new VascBackendException(e); } } } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java similarity index 75% rename from vasc-core/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/MapVascEntryFieldValue.java index c10806a..13db03a 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryFieldValue.java @@ -24,9 +24,9 @@ package net.forwardfire.vasc.backend.data; import java.util.Map; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.VascException; +import net.forwardfire.vasc.backend.VascBackendException; +import net.forwardfire.vasc.backend.VascEntryFieldValue; + /** * MapVascEntryFieldValue provides get/set support on Map record object. @@ -39,28 +39,25 @@ public class MapVascEntryFieldValue implements VascEntryFieldValue { private static final long serialVersionUID = 1L; /** - * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object) + * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(java.lang.String, java.lang.Object) */ @SuppressWarnings("unchecked") - public Object getValue(VascEntryField field, Object record) throws VascException { - if (field==null) { - throw new NullPointerException("Can't get value of null field."); - } - if (field.getBackendName()==null) { + public Object getValue(String backendName, Object record) throws VascBackendException { + if (backendName==null) { throw new NullPointerException("Can't get value of null backendName field."); } if (record==null) { throw new NullPointerException("Can't get value of null object."); } Map map = (Map)record; - Object fieldValue = map.get(field.getBackendName()); + Object fieldValue = map.get(backendName); return fieldValue; } /** * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object) */ - public String getDisplayValue(VascEntryField field, Object record) throws VascException { + public String getDisplayValue(String field, Object record) throws VascBackendException { Object fieldValue = getValue(field,record); if (fieldValue==null) { fieldValue = ""; @@ -69,12 +66,12 @@ public class MapVascEntryFieldValue implements VascEntryFieldValue { } /** - * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object, java.lang.Object) + * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(java.lang.String, java.lang.Object, java.lang.Object) */ @SuppressWarnings("unchecked") - public void setValue(VascEntryField field, Object record,Object value) throws VascException { + public void setValue(String backendName, Object record,Object value) throws VascBackendException { Map map = (Map)record; - map.put(field.getBackendName(), value); + map.put(backendName, value); } } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java similarity index 89% rename from vasc-core/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/MapVascEntryRecordCreator.java index b63ad20..e47e270 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java +++ b/vasc-backend/vasc-backend-api/src/main/java/net/forwardfire/vasc/backend/data/MapVascEntryRecordCreator.java @@ -25,9 +25,9 @@ package net.forwardfire.vasc.backend.data; import java.util.HashMap; import java.util.Map; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; +import net.forwardfire.vasc.backend.VascBackendException; +import net.forwardfire.vasc.backend.VascEntryRecordCreator; + /** * MapVascEntryRecordCreator creates a new HashMap for Map based record backends. @@ -43,7 +43,7 @@ public class MapVascEntryRecordCreator implements VascEntryRecordCreator { return Map.class; } - public Object newRecord(VascEntry entry) throws VascException { + public Object newRecord() throws VascBackendException { return new HashMap(10); } } diff --git a/vasc-backend/vasc-backend-jdbc/pom.xml b/vasc-backend/vasc-backend-jdbc/pom.xml index 5f23602..a2ae83c 100644 --- a/vasc-backend/vasc-backend-jdbc/pom.xml +++ b/vasc-backend/vasc-backend-jdbc/pom.xml @@ -2,7 +2,7 @@ 4.0.0 vasc-backend - net.forwardfire.vasc + net.forwardfire.vasc.backend 0.4.2-SNAPSHOT .. @@ -11,8 +11,13 @@ vasc-backend-jdbc - net.forwardfire.vasc - vasc-core + net.forwardfire.vasc.backend + vasc-backend-api + ${project.version} + + + net.forwardfire.vasc.lib + vasc-lib-xpql ${project.version} 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 9bbcc28..cf85dc2 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 @@ -31,15 +31,12 @@ 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.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; - /** @@ -83,7 +80,7 @@ public class JdbcVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { JdbcConnectionProvider prov = getJdbcConnectionProvider(); List result = new ArrayList(50); Connection connection = null; @@ -103,7 +100,7 @@ public class JdbcVascBackend extends AbstractVascBackend { result.add(map); } } catch (Exception e) { - throw new VascException(e); + throw new VascBackendException(e); } finally { if (connection!=null) { try { @@ -118,33 +115,33 @@ public class JdbcVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object) */ - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { return object; } /** * @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object) */ - public void persist(Object object) throws VascException { + public void persist(Object object) throws VascBackendException { } /** * @see net.forwardfire.vasc.backend.VascBackend#delete(java.lang.Object) */ - public void delete(Object object) throws VascException { + public void delete(Object object) throws VascBackendException { } /** * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField) */ - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { + public VascEntryFieldValue provideVascEntryFieldValue() { return new MapVascEntryFieldValue(); } /** * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry) */ - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { + public VascEntryRecordCreator provideVascEntryRecordCreator() { return new MapVascEntryRecordCreator(); } 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 be18e4b..04c6b23 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 @@ -31,14 +31,12 @@ 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.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.xpql.query.QueryParameterValue; @@ -94,7 +92,7 @@ public class JdbcVascBackendXpql extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { // Copy parameters for (String key:state.getDataParameterKeys()) { Object value = state.getDataParameter(key); @@ -126,7 +124,7 @@ public class JdbcVascBackendXpql extends AbstractVascBackend { } return result; } catch (Exception e) { - throw new VascException(e); + throw new VascBackendException(e); } finally { if (c!=null) { try { @@ -140,33 +138,33 @@ public class JdbcVascBackendXpql extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object) */ - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { return object; } /** * @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object) */ - public void persist(Object object) throws VascException { + public void persist(Object object) throws VascBackendException { } /** * @see net.forwardfire.vasc.backend.VascBackend#delete(java.lang.Object) */ - public void delete(Object object) throws VascException { + public void delete(Object object) throws VascBackendException { } /** - * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField) + * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue() */ - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { + public VascEntryFieldValue provideVascEntryFieldValue() { return new MapVascEntryFieldValue(); } /** - * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry) + * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator() */ - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { + public VascEntryRecordCreator provideVascEntryRecordCreator() { return new MapVascEntryRecordCreator(); } } \ No newline at end of file diff --git a/vasc-backend/vasc-backend-jpa/pom.xml b/vasc-backend/vasc-backend-jpa/pom.xml index 16b2081..5a2efa9 100644 --- a/vasc-backend/vasc-backend-jpa/pom.xml +++ b/vasc-backend/vasc-backend-jpa/pom.xml @@ -2,7 +2,7 @@ 4.0.0 vasc-backend - net.forwardfire.vasc + net.forwardfire.vasc.backend 0.4.2-SNAPSHOT vasc-backend-jpa @@ -10,8 +10,13 @@ vasc-backend-jpa - net.forwardfire.vasc - vasc-core + net.forwardfire.vasc.backend + vasc-backend-api + ${project.version} + + + net.forwardfire.vasc.lib + vasc-lib-xpql ${project.version} 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 50045a3..90960d2 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 @@ -23,7 +23,7 @@ package net.forwardfire.vasc.backends.jpa; import net.forwardfire.vasc.backend.AbstractVascBackend; -import net.forwardfire.vasc.core.VascException; +import net.forwardfire.vasc.backend.VascBackendException; import org.hibernate.Session; @@ -41,7 +41,7 @@ abstract public class AbstractHibernateVascBackend extends AbstractVascBackend */ abstract Session getHibernateSession(); - public void persist(Object object) throws VascException { + public void persist(Object object) throws VascBackendException { Session s = getHibernateSession(); try { s.getTransaction().begin(); @@ -57,7 +57,7 @@ abstract public class AbstractHibernateVascBackend extends AbstractVascBackend } } - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { Session s = getHibernateSession(); try { s.getTransaction().begin(); @@ -74,7 +74,7 @@ abstract public class AbstractHibernateVascBackend extends AbstractVascBackend } } - public void delete(Object object) throws VascException { + public void delete(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 8d08865..0a29971 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,13 +22,10 @@ package net.forwardfire.vasc.backends.jpa; -import java.lang.reflect.Method; - import javax.persistence.EntityManager; import net.forwardfire.vasc.backend.AbstractVascBackend; -import net.forwardfire.vasc.core.VascException; - +import net.forwardfire.vasc.backend.VascBackendException; /** * @@ -41,7 +38,7 @@ abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend abstract EntityManager getEntityManager(); - public void persist(Object object) throws VascException { + public void persist(Object object) throws VascBackendException { EntityManager s = getEntityManager(); try { if (emTransaction) { @@ -58,7 +55,7 @@ abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend } } - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { EntityManager s = getEntityManager(); try { if (emTransaction) { @@ -76,7 +73,7 @@ abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend } } - public void delete(Object object) throws VascException { + public void delete(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 f293bc3..6d24648 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 @@ -24,14 +24,12 @@ package net.forwardfire.vasc.backends.jpa; import java.util.List; +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.BeanVascEntryFieldValue; import net.forwardfire.vasc.backend.data.BeanVascEntryRecordCreator; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.xpql.query.QueryParameterValue; import org.hibernate.Hibernate; @@ -75,11 +73,11 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend { } @SuppressWarnings("unchecked") - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { // Copy parameters for (String key:state.getDataParameterKeys()) { - Object value = state.getDataParameter(key); + Object value = state.getDataParameter(key); query.setQueryParameter(key, value); if (queryTotal!=null) { queryTotal.setQueryParameter(key, value); @@ -116,17 +114,17 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend { } /** - * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField) + * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue() */ - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { + public VascEntryFieldValue provideVascEntryFieldValue() { BeanVascEntryFieldValue result = new BeanVascEntryFieldValue(); return result; } /** - * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry) + * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator() */ - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { + public VascEntryRecordCreator provideVascEntryRecordCreator() { return new BeanVascEntryRecordCreator(resultClass); } @@ -230,7 +228,7 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend { * @see net.forwardfire.vasc.backend.AbstractVascBackend#doRecordMoveDownById(java.lang.Object) */ @Override - public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException { + public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException { long result = 0l; if (queryMoveDown!=null) { Session s = getHibernateSession(); @@ -299,7 +297,7 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend { * @see net.forwardfire.vasc.backend.AbstractVascBackend#doRecordMoveUpById(java.lang.Object) */ @Override - public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException { + public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascBackendException { long result = 0l; if (queryMoveUp!=null) { Session s = getHibernateSession(); 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 23ec150..cba9fc3 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 @@ -27,14 +27,12 @@ import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Query; +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.BeanVascEntryFieldValue; import net.forwardfire.vasc.backend.data.BeanVascEntryRecordCreator; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.xpql.query.QueryParameterValue; @@ -78,7 +76,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend @SuppressWarnings("unchecked") - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { // Copy parameters for (String key:state.getDataParameterKeys()) { @@ -121,17 +119,17 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend } /** - * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField) + * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue() */ - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { + public VascEntryFieldValue provideVascEntryFieldValue() { VascEntryFieldValue result = new BeanVascEntryFieldValue(); return result; } /** - * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry) + * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator() */ - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { + public VascEntryRecordCreator provideVascEntryRecordCreator() { VascEntryRecordCreator result = new BeanVascEntryRecordCreator(resultClass); return result; } @@ -236,7 +234,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend * @see net.forwardfire.vasc.core.AbstractVascBackend#doRecordMoveDownById(VascBackendState state,java.lang.Object) */ @Override - public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException { + public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException { long result = 0l; if (queryMoveDown!=null) { EntityManager em = getEntityManager(); @@ -299,7 +297,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend * @see net.forwardfire.vasc.core.AbstractVascBackend#doRecordMoveUpById(VascBackendState state,java.lang.Object) */ @Override - public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException { + public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascBackendException { long result = 0l; if (queryMoveUp!=null) { EntityManager em = getEntityManager(); diff --git a/vasc-backend/vasc-backend-ldap/pom.xml b/vasc-backend/vasc-backend-ldap/pom.xml index 78c5775..53989c8 100644 --- a/vasc-backend/vasc-backend-ldap/pom.xml +++ b/vasc-backend/vasc-backend-ldap/pom.xml @@ -2,7 +2,7 @@ 4.0.0 vasc-backend - net.forwardfire.vasc + net.forwardfire.vasc.backend 0.4.2-SNAPSHOT vasc-backend-ldap @@ -10,8 +10,8 @@ vasc-backend-ldap - net.forwardfire.vasc - vasc-core + net.forwardfire.vasc.backend + vasc-backend-api ${project.version} 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 52a0e77..1fdf788 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 @@ -29,15 +29,12 @@ 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.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; - import com.novell.ldap.LDAPAttribute; import com.novell.ldap.LDAPAttributeSet; @@ -53,7 +50,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 LdapConnectionProvider ldapConnectionProvider = null; @@ -81,7 +78,7 @@ public class LdapVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#execute() */ - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { LdapConnectionProvider prov = getLdapConnectionProvider(); LDAPConnection connection = prov.getLdapConnection(); List result = new ArrayList(50); @@ -125,7 +122,7 @@ public class LdapVascBackend extends AbstractVascBackend { result.add(map); } } catch (Exception e) { - throw new VascException(e); + throw new VascBackendException(e); } finally { if (connection!=null) { connection.clone(); @@ -137,7 +134,7 @@ public class LdapVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object) */ - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { LdapConnectionProvider prov = getLdapConnectionProvider(); LDAPConnection connection = prov.getLdapConnection(); try { @@ -209,7 +206,7 @@ public class LdapVascBackend extends AbstractVascBackend { return object; } catch (Exception e) { - throw new VascException(e); + throw new VascBackendException(e); } finally { if (connection!=null) { connection.clone(); @@ -220,7 +217,7 @@ public class LdapVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object) */ - public void persist(Object object) throws VascException { + public void persist(Object object) throws VascBackendException { Map map = (Map)object; LdapConnectionProvider prov = getLdapConnectionProvider(); LDAPConnection connection = prov.getLdapConnection(); @@ -246,7 +243,7 @@ public class LdapVascBackend extends AbstractVascBackend { } connection.add(entry); } catch (Exception e) { - throw new VascException(e); + throw new VascBackendException(e); } finally { if (connection!=null) { connection.clone(); @@ -257,7 +254,7 @@ public class LdapVascBackend extends AbstractVascBackend { /** * @see net.forwardfire.vasc.backend.VascBackend#delete(java.lang.Object) */ - public void delete(Object object) throws VascException { + public void delete(Object object) throws VascBackendException { LdapConnectionProvider prov = getLdapConnectionProvider(); LDAPConnection connection = prov.getLdapConnection(); try { @@ -280,7 +277,7 @@ public class LdapVascBackend extends AbstractVascBackend { LDAPEntry entry = searchResults.next(); connection.delete(entry.getDN()); } catch (Exception e) { - throw new VascException(e); + throw new VascBackendException(e); } finally { if (connection!=null) { connection.clone(); @@ -289,16 +286,16 @@ public class LdapVascBackend extends AbstractVascBackend { } /** - * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry) + * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator() */ - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { + public VascEntryRecordCreator provideVascEntryRecordCreator() { return new MapVascEntryRecordCreator(); } /** - * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField) + * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue() */ - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { + public VascEntryFieldValue provideVascEntryFieldValue() { return new MapVascEntryFieldValue(); } diff --git a/vasc-backend/vasc-backend-metamodel/pom.xml b/vasc-backend/vasc-backend-metamodel/pom.xml index a9721ef..c87e046 100644 --- a/vasc-backend/vasc-backend-metamodel/pom.xml +++ b/vasc-backend/vasc-backend-metamodel/pom.xml @@ -2,7 +2,7 @@ 4.0.0 vasc-backend - net.forwardfire.vasc + net.forwardfire.vasc.backend 0.4.2-SNAPSHOT .. @@ -11,8 +11,8 @@ vasc-backend-metamodel - net.forwardfire.vasc - vasc-core + net.forwardfire.vasc.backend + vasc-backend-api ${project.version} 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 27a5c12..1fe4a2c 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 @@ -43,16 +43,14 @@ import org.eobjects.metamodel.schema.Schema; import org.eobjects.metamodel.schema.Table; import net.forwardfire.vasc.backend.AbstractVascBackend; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; +import net.forwardfire.vasc.backend.VascEntryFieldValue; +import net.forwardfire.vasc.backend.VascEntryRecordCreator; import net.forwardfire.vasc.backend.metamodel.crud.CrudDataContext; import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRow; import net.forwardfire.vasc.backend.metamodel.crud.CrudDataContextImpl; import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRowMapImpl; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; /** * MetaModelVascBackend provides vasc backend for metamodel. @@ -212,11 +210,11 @@ public class MetaModelVascBackend extends AbstractVascBackend { return q; } - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { Schema schema = dataContext.getDefaultSchema(); Table t = schema.getTableByName(table); if (t==null) { - throw new VascException("Could not get meta table for: '"+table+"'."); + throw new VascBackendException("Could not get meta table for: '"+table+"'."); } Query q = createFilterQuery(state,t,false); if (isSortable() && state.getSortField() != null) { @@ -265,32 +263,32 @@ public class MetaModelVascBackend extends AbstractVascBackend { return result; } - public void persist(Object object) throws VascException { + public void persist(Object object) throws VascBackendException { if (crudDataContext==null) { return; } crudDataContext.persist((UpdateableRow) object); } - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { if (crudDataContext==null) { return object; } return crudDataContext.merge((UpdateableRow) object); } - public void delete(Object object) throws VascException { + public void delete(Object object) throws VascBackendException { if (crudDataContext==null) { return; } crudDataContext.delete((UpdateableRow) object); } - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { + public VascEntryFieldValue provideVascEntryFieldValue() { return new RowVascEntryFieldValue(); } - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { + 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/RowVascEntryFieldValue.java b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/RowVascEntryFieldValue.java index b03a237..9d9fca8 100644 --- a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/RowVascEntryFieldValue.java +++ b/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/RowVascEntryFieldValue.java @@ -3,34 +3,30 @@ package net.forwardfire.vasc.backend.metamodel; import org.eobjects.metamodel.data.Row; import org.eobjects.metamodel.query.SelectItem; +import net.forwardfire.vasc.backend.VascBackendException; +import net.forwardfire.vasc.backend.VascEntryFieldValue; import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRow; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.VascException; public class RowVascEntryFieldValue implements VascEntryFieldValue { private static final long serialVersionUID = -806674640688182132L; /** - * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object) + * @see net.forwardfire.vasc.backend.VascEntryFieldValue#getValue(java.lang.String, java.lang.Object) */ - public Object getValue(VascEntryField field, Object record) throws VascException { - if (field==null) { - throw new NullPointerException("Can't get value of null field."); - } - if (field.getBackendName()==null) { - throw new NullPointerException("Can't get value of null backendName field."); + public Object getValue(String backendName, Object record) throws VascBackendException { + if (backendName==null) { + throw new NullPointerException("Can't get value of null backendName."); } if (record==null) { throw new NullPointerException("Can't get value of null object."); } if (record instanceof UpdateableRow) { UpdateableRow row = (UpdateableRow)record; - return row.getValue(field.getBackendName()); + return row.getValue(backendName); } Row row = (Row)record; - Object fieldValue = row.getValue(indexOf(field.getBackendName(),row)); + Object fieldValue = row.getValue(indexOf(backendName,row)); return fieldValue; } @@ -49,10 +45,10 @@ public class RowVascEntryFieldValue implements VascEntryFieldValue { } /** - * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object) + * @see net.forwardfire.vasc.backend.VascEntryFieldValue#getDisplayValue(java.lang.String, java.lang.Object) */ - public String getDisplayValue(VascEntryField field, Object record) throws VascException { - Object fieldValue = getValue(field,record); + public String getDisplayValue(String backendName, Object record) throws VascBackendException { + Object fieldValue = getValue(backendName,record); if (fieldValue==null) { fieldValue = ""; } @@ -60,12 +56,12 @@ public class RowVascEntryFieldValue implements VascEntryFieldValue { } /** - * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object, java.lang.Object) + * @see net.forwardfire.vasc.backend.VascEntryFieldValue#setValue(java.lang.String, java.lang.Object, java.lang.Object) */ - public void setValue(VascEntryField field, Object record,Object value) throws VascException { + public void setValue(String backendName, Object record,Object value) throws VascBackendException { if (record instanceof UpdateableRow) { UpdateableRow row = (UpdateableRow)record; - row.setValue(field.getBackendName(), value); + row.setValue(backendName, value); } } } \ No newline at end of file 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 e19891d..5adec74 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 @@ -2,11 +2,10 @@ package net.forwardfire.vasc.backend.metamodel; 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; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; public class RowVascEntryRecordCreator implements VascEntryRecordCreator { @@ -23,7 +22,7 @@ public class RowVascEntryRecordCreator implements VascEntryRecordCreator { return UpdateableRow.class; } - public Object newRecord(VascEntry entry) throws VascException { + public Object newRecord() throws VascBackendException { return dataContext.createRow(table); } } \ No newline at end of file diff --git a/vasc-backend/vasc-backend-metamodel/src/main/resources/META-INF/vasc/vasc-backend-metamodel.eld b/vasc-backend/vasc-backend-metamodel/src/main/resources/META-INF/vasc/vasc-backend-metamodel.eld index 3a1059b..5f02a32 100644 --- a/vasc-backend/vasc-backend-metamodel/src/main/resources/META-INF/vasc/vasc-backend-metamodel.eld +++ b/vasc-backend/vasc-backend-metamodel/src/main/resources/META-INF/vasc/vasc-backend-metamodel.eld @@ -30,10 +30,5 @@ - - - - - diff --git a/vasc-backend/vasc-backend-mongodb/pom.xml b/vasc-backend/vasc-backend-mongodb/pom.xml index b0e138e..8967c56 100644 --- a/vasc-backend/vasc-backend-mongodb/pom.xml +++ b/vasc-backend/vasc-backend-mongodb/pom.xml @@ -2,7 +2,7 @@ 4.0.0 vasc-backend - net.forwardfire.vasc + net.forwardfire.vasc.backend 0.4.2-SNAPSHOT .. @@ -11,8 +11,8 @@ vasc-backend-mongodb - net.forwardfire.vasc - vasc-core + net.forwardfire.vasc.backend + vasc-backend-api ${project.version} diff --git a/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascBackend.java b/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascBackend.java index f407d5d..b976adb 100644 --- a/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascBackend.java +++ b/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascBackend.java @@ -27,13 +27,10 @@ import java.util.List; import java.util.logging.Logger; import net.forwardfire.vasc.backend.AbstractVascBackend; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; - +import net.forwardfire.vasc.backend.VascEntryFieldValue; +import net.forwardfire.vasc.backend.VascEntryRecordCreator; import com.mongodb.DB; import com.mongodb.DBCollection; @@ -108,7 +105,7 @@ public class MongodbVascBackend extends AbstractVascBackend { return query; } - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { DBCollection coll = getDBCollection(); DBObject query = createFilterQuery(state); DBCursor cur = coll.find(query); @@ -124,12 +121,12 @@ public class MongodbVascBackend extends AbstractVascBackend { return result; } - public void persist(Object object) throws VascException { + public void persist(Object object) throws VascBackendException { DBCollection coll = getDBCollection(); coll.insert((DBObject)object); } - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { DBCollection coll = getDBCollection(); DBObject row = (DBObject)object; DBObject query = new BasicDBObject(); @@ -139,18 +136,18 @@ public class MongodbVascBackend extends AbstractVascBackend { return object; } - public void delete(Object object) throws VascException { + public void delete(Object object) throws VascBackendException { DBCollection coll = getDBCollection(); DBObject query = new BasicDBObject(); query.put("_id",((DBObject)object).get("_id")); coll.remove(query); // remove by _id } - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { + public VascEntryFieldValue provideVascEntryFieldValue() { return new MongodbVascEntryFieldValue(); } - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { + public VascEntryRecordCreator provideVascEntryRecordCreator() { return new MongodbVascEntryRecordCreator(); } diff --git a/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascEntryFieldValue.java b/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascEntryFieldValue.java index 33ce947..5694914 100644 --- a/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascEntryFieldValue.java +++ b/vasc-backend/vasc-backend-mongodb/src/main/java/net/forwardfire/vasc/backend/mongodb/MongodbVascEntryFieldValue.java @@ -22,10 +22,8 @@ package net.forwardfire.vasc.backend.mongodb; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.VascException; - +import net.forwardfire.vasc.backend.VascBackendException; +import net.forwardfire.vasc.backend.VascEntryFieldValue; import com.mongodb.BasicDBObject; @@ -39,18 +37,18 @@ public class MongodbVascEntryFieldValue implements VascEntryFieldValue { private static final long serialVersionUID = -7371273796529818557L; - public Object getValue(VascEntryField field, Object record) throws VascException { + public Object getValue(String backendName, Object record) throws VascBackendException { BasicDBObject row = (BasicDBObject)record; - Object data = row.get(field.getBackendName()); + Object data = row.get(backendName); return data; } - public String getDisplayValue(VascEntryField field, Object record) throws VascException { + public String getDisplayValue(String field, Object record) throws VascBackendException { return ""+getValue(field,record); } - public void setValue(VascEntryField field, Object record, Object value) throws VascException { + public void setValue(String backendName, Object record, Object value) throws VascBackendException { BasicDBObject row = (BasicDBObject)record; - row.put(field.getBackendName(), value); + row.put(backendName, value); } } 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 b78bb59..a7caae4 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 @@ -23,10 +23,8 @@ package net.forwardfire.vasc.backend.mongodb; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; - +import net.forwardfire.vasc.backend.VascBackendException; +import net.forwardfire.vasc.backend.VascEntryRecordCreator; import com.mongodb.BasicDBObject; @@ -40,7 +38,7 @@ public class MongodbVascEntryRecordCreator implements VascEntryRecordCreator { private static final long serialVersionUID = -9213830731796787384L; - public Object newRecord(VascEntry entry) throws VascException { + public Object newRecord() throws VascBackendException { return new BasicDBObject(); } 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 7f5b80c..6aee68b 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,21 +22,14 @@ package net.forwardfire.vasc.ejb3; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectOutputStream; import java.util.List; import java.util.Map; import net.forwardfire.vasc.backend.VascBackend; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.VascEntryFieldLocal; -import net.forwardfire.vasc.core.VascEntryLocal; -import net.forwardfire.vasc.core.VascException; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; +import net.forwardfire.vasc.backend.VascEntryFieldValue; +import net.forwardfire.vasc.backend.VascEntryRecordCreator; /** * VascServiceRemoteBackend wraps VascBasckend to the ejb3 context. @@ -58,9 +51,8 @@ public class VascServiceRemoteBackend implements VascBackend { } this.vascManager=vascManager; this.backendId=backendId; - } - + public void startBackend() { } public void stopBackend() { @@ -74,151 +66,120 @@ public class VascServiceRemoteBackend implements VascBackend { // we cant change id } - public void delete(Object object) throws VascException { + public void delete(Object object) throws VascBackendException { Object[] args = new Object[1]; args[0]=object; vascManager.invokeBackendMethod(backendId, "delete", args); } - - public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException { + + public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException { Object[] args = new Object[2]; args[0]=state; args[1]=primaryId; Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveDownById", args); return (Long)result; } - - public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException { + + public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascBackendException { Object[] args = new Object[2]; args[0]=state; args[1]=primaryId; Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveUpById", args); return (Long)result; } - + @SuppressWarnings("unchecked") - public List execute(VascBackendState state) throws VascException { + 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; } - + public long fetchTotalExecuteSize(VascBackendState state) { Object[] args = new Object[1]; args[0]=state; Object result = vascManager.invokeBackendMethod(backendId, "fetchTotalExecuteSize", args); return (Long)result; } - + public boolean isPageable() { Object[] args = new Object[0]; Object result = vascManager.invokeBackendMethod(backendId, "isPageable", args); return (Boolean)result; } - + public boolean isRecordMoveable() { Object[] args = new Object[0]; Object result = vascManager.invokeBackendMethod(backendId, "isRecordMoveable", args); return (Boolean)result; } - + public boolean isSearchable() { Object[] args = new Object[0]; Object result = vascManager.invokeBackendMethod(backendId, "isSearchable", args); return (Boolean)result; } - + public boolean isSortable() { Object[] args = new Object[0]; Object result = vascManager.invokeBackendMethod(backendId, "isSortable", args); return (Boolean)result; } - - public Object merge(Object object) throws VascException { + + public Object merge(Object object) throws VascBackendException { Object[] args = new Object[1]; args[0]=object; Object result = vascManager.invokeBackendMethod(backendId, "merge", args); return result; } - - public void persist(Object object) throws VascException { + + public void persist(Object object) throws VascBackendException { Object[] args = new Object[1]; args[0]=object; vascManager.invokeBackendMethod(backendId, "delete", args); } - - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { - try { - field = ((VascEntryFieldLocal)field).clone(); // RM... - - ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed - ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray); - objOutstream.writeObject(field); - objOutstream.close(); - int objectSize = dataArray.size(); - System.out.println("Writing obj to field: "+objectSize); - } catch (Exception e) { - throw new RuntimeException(e); - } - Object[] args = new Object[1]; - args[0]=field; + + @Override + public VascEntryFieldValue provideVascEntryFieldValue() { + Object[] args = new Object[0]; Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryFieldValue", args); return (VascEntryFieldValue)result; } - - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { - VascEntryLocal clone = null; - try { - clone = ((VascEntryLocal)vascEntry).clone(); - clone.setVascFrontendController(null); - clone.setVascEntryFieldEventChannel(null); - } catch (CloneNotSupportedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - try { - ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed - ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray); - objOutstream.writeObject(clone); - objOutstream.close(); - //int objectSize = dataArray.size(); - //System.out.println("Writing obj to entry: "+objectSize); - } catch (IOException e) { - throw new RuntimeException(e); - } - Object[] args = new Object[1]; - args[0]=clone; + + @Override + public VascEntryRecordCreator provideVascEntryRecordCreator() { + Object[] args = new Object[0]; Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryRecordCreator", args); return (VascEntryRecordCreator)result; } - + @SuppressWarnings("unchecked") public Map executePageSummary() { Object[] args = new Object[0]; Object result = vascManager.invokeBackendMethod(backendId, "executePageSummary", args); return (Map)result; } - + @SuppressWarnings("unchecked") public Map executeTotalSummary() { Object[] args = new Object[0]; Object result = vascManager.invokeBackendMethod(backendId, "executeTotalSummary", args); return (Map)result; } - + public boolean isPageSummary() { Object[] args = new Object[0]; Object result = vascManager.invokeBackendMethod(backendId, "isPageSummary", args); return (Boolean)result; } - + public boolean isTotalSummary() { Object[] args = new Object[0]; Object result = vascManager.invokeBackendMethod(backendId, "isTotalSummary", args); return (Boolean)result; } - + public boolean isReadOnly() { Object[] args = new Object[0]; Object result = vascManager.invokeBackendMethod(backendId, "isReadOnly", args); diff --git a/vasc-core-ejb3-server/pom.xml b/vasc-core-ejb3-server/pom.xml index 379813e..7a679ff 100644 --- a/vasc-core-ejb3-server/pom.xml +++ b/vasc-core-ejb3-server/pom.xml @@ -15,7 +15,7 @@ ${project.version} - net.forwardfire.vasc + net.forwardfire.vasc.backend vasc-backend-jpa ${project.version} diff --git a/vasc-core/pom.xml b/vasc-core/pom.xml index d8ddca6..736adc0 100644 --- a/vasc-core/pom.xml +++ b/vasc-core/pom.xml @@ -20,8 +20,8 @@ ${x4o.version} - net.forwardfire.vasc.lib - vasc-lib-xpql + net.forwardfire.vasc.backend + vasc-backend-api ${project.version} 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 ae30f8f..ddfe740 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 @@ -26,13 +26,11 @@ import java.util.List; import java.util.Map; import net.forwardfire.vasc.backend.VascBackend; +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.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; - /** * VascBackendProxy to implement missing features of the backend. @@ -107,14 +105,14 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy { * @throws Exception * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ - public List execute(VascBackendState state) throws VascException { + 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 VascException { + public void delete(Object object) throws VascBackendException { backend.delete(object); } @@ -135,29 +133,29 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy { /** * @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object) */ - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { return backend.merge(object); } /** * @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object) */ - public void persist(Object object) throws VascException { + public void persist(Object object) throws VascBackendException { backend.persist(object); } /** - * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField) + * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue() */ - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { - return backend.provideVascEntryFieldValue(field); + public VascEntryFieldValue provideVascEntryFieldValue() { + return backend.provideVascEntryFieldValue(); } /** - * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry) + * @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator() */ - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { - return backend.provideVascEntryRecordCreator(vascEntry); + public VascEntryRecordCreator provideVascEntryRecordCreator() { + return backend.provideVascEntryRecordCreator(); } /** @@ -177,14 +175,14 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy { /** * @see net.forwardfire.vasc.core.VascBackend#doRecordMoveDownById(VascBackendState state,java.lang.Object) */ - public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException { + public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException { return backend.doRecordMoveDownById(state,primaryId); } /** * @see net.forwardfire.vasc.core.VascBackend#doRecordMoveUpById(VascBackendState state,java.lang.Object) */ - public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException { + public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascBackendException { return backend.doRecordMoveUpById(state,primaryId); } 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 2bded1f..fefc81d 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 @@ -26,8 +26,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; -import net.forwardfire.vasc.core.VascException; /** * Does simple caching for the data. @@ -130,7 +130,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ @Override - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { boolean changed = isStateChanged(state); if (data==null | changed) { data = backend.execute(state); @@ -151,7 +151,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object) */ @Override - public void delete(Object object) throws VascException { + public void delete(Object object) throws VascBackendException { requestFlush = true; super.delete(object); } @@ -160,7 +160,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object) */ @Override - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { requestFlush = true; return super.merge(object); } @@ -169,7 +169,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object) */ @Override - public void persist(Object object) throws VascException { + public void persist(Object 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 f70bb93..d8e7e3b 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 @@ -26,11 +26,11 @@ import java.util.ArrayList; import java.util.List; import net.forwardfire.vasc.backend.VascBackend; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener; import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener.VascBackendEventType; -import net.forwardfire.vasc.core.VascException; /** * Holds !! and fires the backend event listeners. @@ -105,7 +105,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object) */ @Override - public void delete(Object object) throws VascException { + public void delete(Object object) throws VascBackendException { fireVascEvent(VascBackendEventType.PRE_DELETE,object); super.delete(object); fireVascEvent(VascBackendEventType.POST_DELETE,object); @@ -115,7 +115,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveDownById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object) */ @Override - public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascException { + public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascBackendException { fireVascEvent(VascBackendEventType.PRE_MOVE_DOWN,primaryId); Long result = super.doRecordMoveDownById(state, primaryId); fireVascEvent(VascBackendEventType.POST_MOVE_DOWN,result); @@ -126,7 +126,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveUpById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object) */ @Override - public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException { + public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascBackendException { fireVascEvent(VascBackendEventType.PRE_MOVE_UP,primaryId); Long result = super.doRecordMoveUpById(state, primaryId); fireVascEvent(VascBackendEventType.POST_MOVE_UP,result); @@ -137,7 +137,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#execute(net.forwardfire.vasc.backend.VascBackendState) */ @Override - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { fireVascEvent(VascBackendEventType.PRE_EXECUTE,state); List result = super.execute(state); fireVascEvent(VascBackendEventType.POST_EXECUTE,result); @@ -159,7 +159,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object) */ @Override - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { fireVascEvent(VascBackendEventType.PRE_MERGE,object); Object result = super.merge(object); fireVascEvent(VascBackendEventType.POST_MERGE,result); @@ -170,7 +170,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object) */ @Override - public void persist(Object object) throws VascException { + public void persist(Object 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 b9dac6f..424701f 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 @@ -26,12 +26,9 @@ import java.util.ArrayList; import java.util.List; import net.forwardfire.vasc.backend.VascBackend; -import net.forwardfire.vasc.backend.VascBackendFilter; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.VascException; - - /** * Simple filter support @@ -42,7 +39,7 @@ import net.forwardfire.vasc.core.VascException; public class VascBackendProxyFilter extends AbstractVascBackendProxy { private long records = 0; - private List filters = null; + private List filters = null; /** * @see java.lang.Object#clone() @@ -59,7 +56,7 @@ public class VascBackendProxyFilter extends AbstractVascBackendProxy { public void initProxy(VascBackend backend, VascEntry entry) { super.initProxy(backend,entry); filters = entry.getVascBackendFilters(); - for (VascBackendFilter filter:filters) { + for (VascProxyFilter filter:filters) { filter.initFilter(entry); } } @@ -79,7 +76,7 @@ public class VascBackendProxyFilter extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ @Override - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { List result = backend.execute(state); if (filters==null) { return result; @@ -89,7 +86,7 @@ public class VascBackendProxyFilter extends AbstractVascBackendProxy { } List search = new ArrayList(result.size()/2); for (Object o:result) { - for (VascBackendFilter filter:filters) { + for (VascProxyFilter filter:filters) { Object 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 0fabb1b..48885ea 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 @@ -25,8 +25,8 @@ package net.forwardfire.vasc.backend.proxy; import java.util.ArrayList; import java.util.List; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; -import net.forwardfire.vasc.core.VascException; /** * Simulates a real pages backend. @@ -70,7 +70,7 @@ public class VascBackendProxyPaged extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ @Override - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { List allData = backend.execute(state); int pageSize = state.getPageSize(); if (pageSize==0) { 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 49cd49a..bc3a703 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 @@ -25,10 +25,10 @@ package net.forwardfire.vasc.backend.proxy; import java.util.ArrayList; import java.util.List; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; +import net.forwardfire.vasc.backend.VascEntryFieldValue; import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.VascException; /** * Simple text search @@ -70,7 +70,7 @@ public class VascBackendProxySearch extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ @Override - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { List result = backend.execute(state); if (state.getSearchString()==null) { return result; @@ -82,8 +82,8 @@ public class VascBackendProxySearch extends AbstractVascBackendProxy { List search = new ArrayList(result.size()/4); for (Object record:result) { for (VascEntryField field:entry.getVascEntryFields()) { - VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue(field); - Object value = fieldValue.getValue(field, record); + VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue(); + Object value = fieldValue.getValue(field.getBackendName(), record); if (value==null) { continue; // can't search null values. } 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 f797dd6..7b1067a 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 @@ -26,11 +26,10 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; +import net.forwardfire.vasc.backend.VascEntryFieldValue; import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.VascEntryFieldLocal; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.VascException; /** * Add an sortware sort an a backend @@ -74,14 +73,13 @@ public class VascBackendProxySort extends AbstractVascBackendProxy { */ @SuppressWarnings("unchecked") @Override - public List execute(final VascBackendState state) throws VascException { + public List execute(final VascBackendState state) throws VascBackendException { List result = backend.execute(state); if (state.getSortField()==null) { return result; } - try { - final VascEntryField field = getVascEntryFieldByBackendName(state.getSortField()); - final VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue(((VascEntryFieldLocal)field).clone()); // TODO fixme + final VascEntryField field = getVascEntryFieldByBackendName(state.getSortField()); + final VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue(); Collections.sort(result, new Comparator() { @SuppressWarnings("rawtypes") public int compare(Object o1, Object o2) { @@ -89,11 +87,11 @@ public class VascBackendProxySort extends AbstractVascBackendProxy { Comparable c1 = null; Comparable c2 = null; if (field.getDisplayName()!=null) { - c1 = fieldValue.getDisplayValue(field, o1); - c2 = fieldValue.getDisplayValue(field, o2); + c1 = fieldValue.getDisplayValue(field.getBackendName(), o1); + c2 = fieldValue.getDisplayValue(field.getBackendName(), o2); } else { - c1 = (Comparable)fieldValue.getValue(field, o1); - c2 = (Comparable)fieldValue.getValue(field, o2); + c1 = (Comparable)fieldValue.getValue(field.getBackendName(), o1); + c2 = (Comparable)fieldValue.getValue(field.getBackendName(), o2); } if (c1==null & c2==null) { return 0; @@ -122,20 +120,12 @@ public class VascBackendProxySort extends AbstractVascBackendProxy { } else { return c2.compareTo(c1); } - } catch (VascException e) { + } catch (VascBackendException e) { e.printStackTrace(); return 0; } } - - - }); - - } catch (CloneNotSupportedException e1) { - throw new VascException(e1); - } // TODO: check serialable stuff again - return result; } } \ No newline at end of file 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 4b60c85..db8d81a 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 @@ -26,8 +26,8 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; -import net.forwardfire.vasc.core.VascException; /** * Does simple timer logging for the backend actions. @@ -58,7 +58,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state) */ @Override - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { long t1 = System.currentTimeMillis(); try { return backend.execute(state); @@ -83,7 +83,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveDownById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object) */ @Override - public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascException { + public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascBackendException { long t1 = System.currentTimeMillis(); try { return backend.doRecordMoveDownById(state, primaryId); @@ -97,7 +97,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveUpById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object) */ @Override - public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException { + public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascBackendException { long t1 = System.currentTimeMillis(); try { return backend.doRecordMoveUpById(state, primaryId); @@ -111,7 +111,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object) */ @Override - public void delete(Object object) throws VascException { + public void delete(Object object) throws VascBackendException { long t1 = System.currentTimeMillis(); try { backend.delete(object); @@ -125,7 +125,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object) */ @Override - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { long t1 = System.currentTimeMillis(); try { return backend.merge(object); @@ -139,7 +139,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy { * @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object) */ @Override - public void persist(Object object) throws VascException { + public void persist(Object object) throws VascBackendException { long t1 = System.currentTimeMillis(); try { backend.persist(object); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendFilter.java b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascProxyFilter.java similarity index 92% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendFilter.java rename to vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascProxyFilter.java index 101b683..5221e00 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendFilter.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/backend/proxy/VascProxyFilter.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.backend; +package net.forwardfire.vasc.backend.proxy; import net.forwardfire.vasc.core.VascEntry; @@ -31,7 +31,7 @@ import net.forwardfire.vasc.core.VascEntry; * @author Willem Cazander * @version 1.0 Apr 28, 2009 */ -public interface VascBackendFilter { +public interface VascProxyFilter { /** * Inits the filter @@ -48,5 +48,5 @@ public interface VascBackendFilter { * @return * @throws CloneNotSupportedException */ - public VascBackendFilter clone() throws CloneNotSupportedException; + public VascProxyFilter clone() throws CloneNotSupportedException; } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryFieldLocal.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryFieldLocal.java index 3c5840f..69deb3e 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryFieldLocal.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryFieldLocal.java @@ -25,8 +25,8 @@ package net.forwardfire.vasc.core; import java.util.ArrayList; import java.util.List; +import net.forwardfire.vasc.backend.VascEntryFieldValue; import net.forwardfire.vasc.core.base.AbstractVascBaseIdRoleCrudOrderMetaLocal; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; import net.forwardfire.vasc.validators.VascValidator; /** diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryLocal.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryLocal.java index 65462f9..3abea07 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryLocal.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/AbstractVascEntryLocal.java @@ -28,7 +28,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import net.forwardfire.vasc.backend.VascBackendFilter; +import net.forwardfire.vasc.backend.proxy.VascProxyFilter; import net.forwardfire.vasc.core.actions.ColumnVascAction; import net.forwardfire.vasc.core.actions.ColumnVascActionLocal; import net.forwardfire.vasc.core.actions.GlobalVascAction; @@ -82,7 +82,7 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL private Map> eventEntryFrontendEventListeners = null; private List eventEntryBackendEventListeners = null; private List vascEntryListOptions = null; - private List backendFilters = null; + private List backendFilters = null; private Map> eventEntryFrontendActions = null; private String backendId = null; @@ -105,7 +105,7 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL eventEntryFrontendEventListeners = new HashMap>(10); eventEntryBackendEventListeners = new ArrayList(10); vascEntryListOptions = new ArrayList(10); - backendFilters = new ArrayList(3); + backendFilters = new ArrayList(3); } @Override @@ -175,7 +175,7 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL optionClone.setVascEntry(clone); clone.addVascEntryListOption(optionClone); } - for (VascBackendFilter filter:backendFilters) { + for (VascProxyFilter filter:backendFilters) { clone.addVascBackendFilter(filter.clone()); } for (String key:eventEntryFrontendActions.keySet()) { @@ -883,11 +883,11 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL } - public void addVascBackendFilter(VascBackendFilter filter) { + public void addVascBackendFilter(VascProxyFilter filter) { backendFilters.add(filter); } - public List getVascBackendFilters() { + public List getVascBackendFilters() { return backendFilters; } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntry.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntry.java index 5f8e79f..802a809 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntry.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntry.java @@ -25,7 +25,7 @@ package net.forwardfire.vasc.core; import java.util.Collection; import java.util.List; -import net.forwardfire.vasc.backend.VascBackendFilter; +import net.forwardfire.vasc.backend.proxy.VascProxyFilter; import net.forwardfire.vasc.core.actions.ColumnVascAction; import net.forwardfire.vasc.core.actions.GlobalVascAction; import net.forwardfire.vasc.core.actions.RowVascAction; @@ -229,7 +229,7 @@ public interface VascEntry extends VascBaseIdRoleCrud { public VascEntryListOption getVascEntryListOptionById(String listOptionId); - public List getVascBackendFilters(); + public List getVascBackendFilters(); public List getVascEntryFrontendActionsByType(String frontendType); } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryField.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryField.java index 21fe5af..97ae91b 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryField.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryField.java @@ -24,8 +24,8 @@ package net.forwardfire.vasc.core; import java.util.List; +import net.forwardfire.vasc.backend.VascEntryFieldValue; import net.forwardfire.vasc.core.base.VascBaseIdRoleCrudOrderMeta; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; import net.forwardfire.vasc.validators.VascValidator; /** diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryFieldLocal.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryFieldLocal.java index 1bc8eb0..5a373f4 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryFieldLocal.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryFieldLocal.java @@ -22,8 +22,8 @@ package net.forwardfire.vasc.core; +import net.forwardfire.vasc.backend.VascEntryFieldValue; import net.forwardfire.vasc.core.base.VascBaseIdRoleCrudOrderMetaLocal; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; import net.forwardfire.vasc.validators.VascValidator; /** diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryLocal.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryLocal.java index 38a9f56..2d9ab49 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryLocal.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascEntryLocal.java @@ -24,7 +24,7 @@ package net.forwardfire.vasc.core; import java.util.Collection; -import net.forwardfire.vasc.backend.VascBackendFilter; +import net.forwardfire.vasc.backend.proxy.VascProxyFilter; import net.forwardfire.vasc.core.actions.ColumnVascActionLocal; import net.forwardfire.vasc.core.actions.GlobalVascActionLocal; import net.forwardfire.vasc.core.actions.RowVascActionLocal; @@ -260,7 +260,7 @@ public interface VascEntryLocal extends VascEntry,VascBaseIdRoleCrudLocal { public Collection getVascEntryListOptionsLocal(); - public void addVascBackendFilter(VascBackendFilter filter); + public void addVascBackendFilter(VascProxyFilter filter); public void addVascEntryFrontendAction(String actionClass,String frontendType); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascInterfaceLoader.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascInterfaceLoader.java index 9c7b2f9..e438f49 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/VascInterfaceLoader.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/VascInterfaceLoader.java @@ -4,7 +4,7 @@ import net.forwardfire.vasc.backend.VascBackendState; import net.forwardfire.vasc.frontend.VascFrontendActions; import net.forwardfire.vasc.frontend.VascFrontendControllerLocal; import net.forwardfire.vasc.frontend.VascFrontendDataSelector; -import net.forwardfire.vasc.frontend.VascFrontendPager; +import net.forwardfire.vasc.frontend.VascFrontendPageInfo; import net.forwardfire.vasc.frontend.VascFrontendUserController; import net.forwardfire.vasc.frontend.VascFrontendUserSettingController; @@ -24,7 +24,7 @@ public interface VascInterfaceLoader { - public VascFrontendPager createVascFrontendPagerImpl(VascEntry entry); + public VascFrontendPageInfo createVascFrontendPagerImpl(VascEntry entry); public VascFrontendActions createVascFrontendActionsImpl(VascEntry entry); public VascFrontendDataSelector createVascFrontendDataSelectorImpl(VascEntry entry); public VascFrontendUserController createVascFrontendUserControllerImpl(VascEntry entry); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/ui/VascColumnValueModelListener.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/ui/VascColumnValueModelListener.java index dcaa0fd..11f4e38 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/ui/VascColumnValueModelListener.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/ui/VascColumnValueModelListener.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.core.ui; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascException; @@ -45,7 +46,11 @@ public class VascColumnValueModelListener implements VascValueModelListener { } public void valueUpdate(VascValueModel model) throws VascException { - vascEntryField.getVascEntryFieldValue().setValue(vascEntryField, bean, model.getValue()); + try { + vascEntryField.getVascEntryFieldValue().setValue(vascEntryField.getBackendName(), bean, model.getValue()); + } catch (VascBackendException e) { + throw new VascException(e); + } } /** diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/core/ui/VascValueModelListener.java b/vasc-core/src/main/java/net/forwardfire/vasc/core/ui/VascValueModelListener.java index b57c6d2..afa56c4 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/core/ui/VascValueModelListener.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/core/ui/VascValueModelListener.java @@ -27,8 +27,6 @@ import java.util.EventListener; import net.forwardfire.vasc.core.VascException; - - /** * * @author Willem Cazander diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendController.java b/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendController.java index ad2242e..e44dbfd 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendController.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendController.java @@ -65,9 +65,9 @@ public interface VascFrontendController { public VascFrontendActions getVascFrontendActions(); /** - * @return the vascFrontendPager + * @return the vascFrontendPageInfo */ - public VascFrontendPager getVascFrontendPager(); + public VascFrontendPageInfo getVascFrontendPageInfo(); /** * @return the VascFrontendHelper diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendControllerLocal.java b/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendControllerLocal.java index e1dd47c..fbc833c 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendControllerLocal.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendControllerLocal.java @@ -41,9 +41,9 @@ public interface VascFrontendControllerLocal extends VascFrontendController { public void setVascFrontendActions(VascFrontendActions vascFrontendActions); /** - * @param vascFrontendPager the vascFrontendPager to set + * @param vascFrontendPageInfo the vascFrontendPageInfo to set */ - public void setVascFrontendPager(VascFrontendPager vascFrontendPager); + public void setVascFrontendPageInfo(VascFrontendPageInfo vascFrontendPager); /** * @param vascEntryResourceResolver the vascEntryResourceResolver to set diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendPager.java b/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendPageInfo.java similarity index 79% rename from vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendPager.java rename to vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendPageInfo.java index b14abbd..ebc826a 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendPager.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendPageInfo.java @@ -24,17 +24,15 @@ package net.forwardfire.vasc.frontend; import java.util.List; -import net.forwardfire.vasc.backend.VascBackendPageNumber; - /** * VascFrontendPager has some info about the pageing data models * - * note all the get properties for different el parsers. + * TODO: fix all the get properties for different el parsers. * * @author Willem Cazander * @version 1.0 Jan 22, 2012 */ -public interface VascFrontendPager extends VascFrontendEntry { +public interface VascFrontendPageInfo extends VascFrontendEntry { public long getPageStartCount(); public long getPageStopCount(); @@ -47,9 +45,9 @@ public interface VascFrontendPager extends VascFrontendEntry { public boolean getHasExtendedPageMode(); public boolean getHasExtendedPageModeCenter(); - public List getTablePagesFromBackend(); - public List getTablePagesNormal(); - public List getTablePagesExtendedBegin(); - public List getTablePagesExtendedCenter(); - public List getTablePagesExtendedEnd(); + public List getTablePagesFromBackend(); + public List getTablePagesNormal(); + public List getTablePagesExtendedBegin(); + public List getTablePagesExtendedCenter(); + public List getTablePagesExtendedEnd(); } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendPageNumber.java b/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendPageInfoNumber.java similarity index 76% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendPageNumber.java rename to vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendPageInfoNumber.java index 1e5a431..e8476a3 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/VascBackendPageNumber.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/frontend/VascFrontendPageInfoNumber.java @@ -20,25 +20,40 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.backend; - +package net.forwardfire.vasc.frontend; import java.io.Serializable; /** - * Small class to wrap page number and the selected page number. - * note: this can be removed when JSF has the combined EL. + * Small class to wrap page number and the selected page number. note: this can + * be removed when JSF has the combined EL. * * @author Willem Cazander * @version 1.0 Apr 25, 2006 */ -public class VascBackendPageNumber implements Serializable { +public class VascFrontendPageInfoNumber implements Serializable { + private static final long serialVersionUID = 1L; private Integer pageNumber = null; private Boolean selected = false; - public VascBackendPageNumber(Integer pageNumber) { this.pageNumber=pageNumber; } - public Integer getPageNumber() { return pageNumber; } - public Boolean getSelected() { return selected; } - public Boolean getNotSelected() { return !selected; } - public void setSelected(Boolean selected) { this.selected=selected; } + + public VascFrontendPageInfoNumber(Integer pageNumber) { + this.pageNumber = pageNumber; + } + + public Integer getPageNumber() { + return pageNumber; + } + + public Boolean getSelected() { + return selected; + } + + public Boolean getNotSelected() { + return !selected; + } + + public void setSelected(Boolean selected) { + this.selected = selected; + } } \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryConfigController.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryConfigController.java index bfdbb3e..87ce115 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryConfigController.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascEntryConfigController.java @@ -29,8 +29,10 @@ import java.util.Locale; import java.util.Map; import java.util.ResourceBundle; +import net.forwardfire.vasc.backend.DefaultVascBackendState; import net.forwardfire.vasc.backend.VascBackend; import net.forwardfire.vasc.backend.VascBackendState; +import net.forwardfire.vasc.backend.VascEntryFieldValue; import net.forwardfire.vasc.backend.proxy.VascBackendProxy; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; @@ -45,7 +47,6 @@ import net.forwardfire.vasc.core.VascInterfaceKeyFrontend; import net.forwardfire.vasc.core.VascInterfaceLoader; import net.forwardfire.vasc.core.entry.VascEntryExport; import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.frontend.VascFrontendControllerLocal; import net.forwardfire.vasc.frontend.VascFrontendEntry; @@ -216,7 +217,7 @@ public class DefaultVascEntryConfigController implements VascEntryConfigControll entry.setVascFrontendController(controller); // <------ This is the end result. // Add some generic frontend impl code. - controller.setVascFrontendPager( loader.createVascFrontendPagerImpl(entry)); + controller.setVascFrontendPageInfo( loader.createVascFrontendPagerImpl(entry)); controller.setVascFrontendActions( loader.createVascFrontendActionsImpl(entry)); controller.setVascFrontendDataSelector( loader.createVascFrontendDataSelectorImpl(entry)); controller.setVascFrontendUserController( loader.createVascFrontendUserControllerImpl(entry)); @@ -253,7 +254,7 @@ public class DefaultVascEntryConfigController implements VascEntryConfigControll // Fetch all data field value impl for this backend. for (VascEntryField field:entry.getVascEntryFields()) { if (field.getVascEntryFieldValue()==null) { - VascEntryFieldValue v = backend.provideVascEntryFieldValue(field); + VascEntryFieldValue v = backend.provideVascEntryFieldValue(); ((VascEntryFieldLocal)field).setVascEntryFieldValue(v); } } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFactory.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFactory.java index f941e08..8b2d464 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFactory.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascFactory.java @@ -22,6 +22,8 @@ package net.forwardfire.vasc.impl; +import net.forwardfire.vasc.backend.DefaultVascBackendController; +import net.forwardfire.vasc.backend.DefaultVascBackendState; import net.forwardfire.vasc.backend.proxy.VascBackendProxyCache; import net.forwardfire.vasc.backend.proxy.VascBackendProxyEventExecutor; import net.forwardfire.vasc.backend.proxy.VascBackendProxyFilter; diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascInterfaceLoader.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascInterfaceLoader.java index 48e8c6b..183e90c 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascInterfaceLoader.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/DefaultVascInterfaceLoader.java @@ -36,7 +36,7 @@ import net.forwardfire.vasc.core.VascInterfaceLoader; import net.forwardfire.vasc.frontend.VascFrontendActions; import net.forwardfire.vasc.frontend.VascFrontendControllerLocal; import net.forwardfire.vasc.frontend.VascFrontendDataSelector; -import net.forwardfire.vasc.frontend.VascFrontendPager; +import net.forwardfire.vasc.frontend.VascFrontendPageInfo; import net.forwardfire.vasc.frontend.VascFrontendUserController; import net.forwardfire.vasc.frontend.VascFrontendUserSettingController; @@ -121,8 +121,8 @@ public class DefaultVascInterfaceLoader implements VascInterfaceLoader { /** * @see net.forwardfire.vasc.core.VascInterfaceLoader#createVascFrontendPagerImpl() */ - public VascFrontendPager createVascFrontendPagerImpl(VascEntry entry) { - return (VascFrontendPager)createImpl(VascInterfaceKeyFrontend.VASC_FRONTEND_PAGER,entry); + public VascFrontendPageInfo createVascFrontendPagerImpl(VascEntry entry) { + return (VascFrontendPageInfo)createImpl(VascInterfaceKeyFrontend.VASC_FRONTEND_PAGER,entry); } /** diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/BeanPropertyVascEntryFieldValue.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/BeanPropertyVascEntryFieldValue.java deleted file mode 100644 index 842247b..0000000 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/entry/BeanPropertyVascEntryFieldValue.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2007-2012 forwardfire.net All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted provided - * that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this list of conditions and the - * following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and - * the following disclaimer in the documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package net.forwardfire.vasc.impl.entry; - - -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.VascException; - -import org.x4o.xml.element.DefaultElementObjectPropertyValue; - -/** - * - * @author Willem Cazander - * @version 1.0 Mar 21, 2007 - */ -public class BeanPropertyVascEntryFieldValue implements VascEntryFieldValue { - - private static final long serialVersionUID = 1L; - private String property = null; - - private DefaultElementObjectPropertyValue helper = null; - - public BeanPropertyVascEntryFieldValue() { - helper = new DefaultElementObjectPropertyValue(); - } - public BeanPropertyVascEntryFieldValue(String property) { - this(); - setProperty(property); - } - - /** - * @see net.forwardfire.vasc.core.column.VascColumnValue#getValue(net.forwardfire.vasc.core.column.VascTableColumn, java.lang.Object) - */ - public Object getValue(VascEntryField column,Object record) throws VascException { - if(getProperty()==null) { - return null; - } - if(getProperty().equals("")) { - return ""; - } - try { - return helper.getProperty(record, getProperty()); - } catch (Exception e) { - throw new VascException(e); - } - } - - /** - * @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object) - */ - public String getDisplayValue(VascEntryField field, Object record) throws VascException { - return ""+getValue(field,record); // not supported - } - - /** - * @see net.forwardfire.vasc.core.column.VascColumnValue#setValue(net.forwardfire.vasc.core.column.VascTableColumn, java.lang.Object, java.lang.Object) - */ - public void setValue(VascEntryField column, Object record,Object value) throws VascException { - if(getProperty()==null) { - return; - } - if(getProperty().equals("")) { - return; - } - try { - helper.setProperty(record, getProperty(),value); - } catch (Exception e) { - throw new VascException(e); - } - } - - /** - * @return the property - */ - public String getProperty() { - return property; - } - - /** - * @param property the property to set - */ - public void setProperty(String property) { - this.property = property; - } - - -} \ No newline at end of file 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 852301d..03cfcb8 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 @@ -25,8 +25,9 @@ package net.forwardfire.vasc.impl.frontend; import java.util.Date; import java.util.logging.Logger; -import net.forwardfire.vasc.backend.VascBackendFilter; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; +import net.forwardfire.vasc.backend.proxy.VascProxyFilter; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascEntryLocal; @@ -58,10 +59,8 @@ public class DefaultVascFrontendActions implements VascFrontendActions { entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_CREATE, null); Object object; try { - object = entry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryRecordCreator(((VascEntryLocal)entry).clone()).newRecord(entry); - } catch (CloneNotSupportedException e) { - throw new VascFrontendException(e); - } catch (VascException e) { + object = entry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryRecordCreator().newRecord(); + } catch (VascBackendException e) { throw new VascFrontendException(e); } if (object==null) { @@ -72,7 +71,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions { continue; // no default value to set. } try { - Object value = field.getVascEntryFieldValue().getValue(field, object); + Object value = field.getVascEntryFieldValue().getValue(field.getBackendName(), object); if (value!=null) { continue; // value is already set by backend creator. } @@ -84,8 +83,8 @@ public class DefaultVascFrontendActions implements VascFrontendActions { } } logger.finer("Setting default value for: "+field.getName()+" def: "+defaultValue); - field.getVascEntryFieldValue().setValue(field, object, defaultValue); - } catch (VascException ve) { + field.getVascEntryFieldValue().setValue(field.getBackendName(), object, defaultValue); + } catch (VascBackendException ve) { throw new VascFrontendException(ve); } } @@ -93,7 +92,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions { return object; } - protected int removeObjectFromDataList(Object object) throws VascException { + protected int removeObjectFromDataList(Object object) throws VascBackendException { int indexOld = entry.getVascFrontendController().getVascEntryState().getEntryDataList().indexOf(object); if (entry.getVascFrontendController().getVascEntryState().getEntryDataList().remove(object)) { return indexOld; // java worked well for use @@ -102,14 +101,14 @@ public class DefaultVascFrontendActions implements VascFrontendActions { // remove only work on (jpa)beans with an overrided equals method. // we lets do the search ourselfs here because we should know the primary key value VascEntryField field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId()); - Object idObject = field.getVascEntryFieldValue().getValue(field, object); + Object idObject = field.getVascEntryFieldValue().getValue(field.getBackendName(), object); // is only null when creating objects if (idObject!=null) { int index = 0; for (Object o:entry.getVascFrontendController().getVascEntryState().getEntryDataList()) { field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId()); - Object id = field.getVascEntryFieldValue().getValue(field, o); + Object id = field.getVascEntryFieldValue().getValue(field.getBackendName(), o); if (idObject.equals(id)) { break; } @@ -146,32 +145,35 @@ public class DefaultVascFrontendActions implements VascFrontendActions { } protected Object saveObject(boolean persist) throws VascException { - Object object = entry.getVascFrontendController().getVascEntryState().getEntryDataObject(); - Object result = null; - - entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_UPDATE,object); - int index = removeObjectFromDataList(object); - - // save object on backend - if (persist) { - entry.getVascFrontendController().getVascEntryState().getVascBackend().persist(object); - result = object; // TODO: fix persist - entry.getVascFrontendController().getVascEntryState().setTotalBackendRecords(1+entry.getVascFrontendController().getVascEntryState().getTotalBackendRecords()); - } else { - result = entry.getVascFrontendController().getVascEntryState().getVascBackend().merge(object); + try { + Object object = entry.getVascFrontendController().getVascEntryState().getEntryDataObject(); + Object result = null; + + entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_UPDATE,object); + int index = removeObjectFromDataList(object); + + // save object on backend + if (persist) { + entry.getVascFrontendController().getVascEntryState().getVascBackend().persist(object); + result = object; // TODO: fix persist + entry.getVascFrontendController().getVascEntryState().setTotalBackendRecords(1+entry.getVascFrontendController().getVascEntryState().getTotalBackendRecords()); + } else { + result = entry.getVascFrontendController().getVascEntryState().getVascBackend().merge(object); + } + + // put object thrue the filters + for (VascProxyFilter filter:entry.getVascBackendFilters()) { + result = filter.filterObject(result); + } + + // put object back in list + entry.getVascFrontendController().getVascEntryState().getEntryDataList().add(index, result); + entry.getVascFrontendController().getVascEntryState().setEntryDataObject(null); + entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_UPDATE,result); + return result; + } catch (VascBackendException e) { + throw new VascException(e); } - - // put object thrue the filters - for (VascBackendFilter filter:entry.getVascBackendFilters()) { - result = filter.filterObject(result); - } - - // put object back in list - entry.getVascFrontendController().getVascEntryState().getEntryDataList().add(index, result); - entry.getVascFrontendController().getVascEntryState().setEntryDataObject(null); - entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_UPDATE,result); - - return result; } /** @@ -189,7 +191,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions { entry.getVascFrontendController().getVascEntryState().setEntryDataObject(null); entry.getVascFrontendController().getVascEntryState().setTotalBackendRecords(entry.getVascFrontendController().getVascEntryState().getTotalBackendRecords()-1); entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_DELETE, object); - } catch (VascException ve) { + } catch (VascBackendException ve) { throw new VascFrontendException(ve); } } @@ -234,7 +236,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions { // Fire event post read entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_READ, null); - } catch (VascException ve) { + } catch (VascBackendException ve) { throw new VascFrontendException(ve); } } @@ -285,9 +287,9 @@ public class DefaultVascFrontendActions implements VascFrontendActions { if (entry.getVascFrontendController().getVascEntryState().getVascBackend().isRecordMoveable()) { try { VascEntryField p = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId()); - Object primaryId = p.getVascEntryFieldValue().getValue(p, record); + Object primaryId = p.getVascEntryFieldValue().getValue(p.getBackendName(), record); entry.getVascFrontendController().getVascEntryState().getVascBackend().doRecordMoveUpById(entry.getVascFrontendController().getVascEntryState().getVascBackendState(),primaryId); - } catch (VascException ve) { + } catch (VascBackendException ve) { throw new VascFrontendException(ve); } @@ -303,9 +305,9 @@ public class DefaultVascFrontendActions implements VascFrontendActions { try { VascEntryField p = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId()); - Object primaryId = p.getVascEntryFieldValue().getValue(p, record); + Object primaryId = p.getVascEntryFieldValue().getValue(p.getBackendName(), record); entry.getVascFrontendController().getVascEntryState().getVascBackend().doRecordMoveDownById(entry.getVascFrontendController().getVascEntryState().getVascBackendState(),primaryId); - } catch (VascException ve) { + } catch (VascBackendException ve) { throw new VascFrontendException(ve); } diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendController.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendController.java index e40555e..ac794fc 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendController.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendController.java @@ -49,7 +49,7 @@ import net.forwardfire.vasc.frontend.VascFrontendActions; import net.forwardfire.vasc.frontend.VascFrontendControllerLocal; import net.forwardfire.vasc.frontend.VascFrontendDataSelector; import net.forwardfire.vasc.frontend.VascFrontendHelper; -import net.forwardfire.vasc.frontend.VascFrontendPager; +import net.forwardfire.vasc.frontend.VascFrontendPageInfo; import net.forwardfire.vasc.frontend.VascFrontendUserController; import net.forwardfire.vasc.frontend.VascFrontendUserSettingController; @@ -64,7 +64,7 @@ public class DefaultVascFrontendController implements VascFrontendControllerLoca private VascFrontend vascFrontend = null; private VascFrontendActions vascFrontendActions = null; - private VascFrontendPager vascFrontendPager = null; + private VascFrontendPageInfo vascFrontendPageInfo = null; private VascEntryConfigFinalizer vascEntryFinalizer = null; private VascFrontendHelper vascFrontendHelper = null; private VascEntryResourceResolver vascEntryResourceResolver = null; @@ -121,15 +121,15 @@ public class DefaultVascFrontendController implements VascFrontendControllerLoca /** * @return the vascFrontendPager */ - public VascFrontendPager getVascFrontendPager() { - return vascFrontendPager; + public VascFrontendPageInfo getVascFrontendPageInfo() { + return vascFrontendPageInfo; } /** * @param vascFrontendPager the vascFrontendPager to set */ - public void setVascFrontendPager(VascFrontendPager vascFrontendPager) { - this.vascFrontendPager = vascFrontendPager; + public void setVascFrontendPageInfo(VascFrontendPageInfo vascFrontendPageInfo) { + this.vascFrontendPageInfo = vascFrontendPageInfo; } /** diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendHelper.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendHelper.java index 85fb5b4..649d6fe 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendHelper.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendHelper.java @@ -26,13 +26,14 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; +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.VascEntryLink; import net.forwardfire.vasc.core.VascEntryLinkType; import net.forwardfire.vasc.core.actions.RowVascAction; import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; import net.forwardfire.vasc.core.ui.VascUIComponent; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.frontend.VascFrontendHelper; @@ -107,11 +108,15 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper { } Object objectSelected = entry.getVascFrontendController().getVascEntryState().getEntryDataObject(); - Object objectValue = field.getVascEntryFieldValue().getValue(field, objectSelected); - for (VascEntryFieldValidatorService s:entry.getVascFrontendController().getVascValidatorServices()) { - error.addAll(s.validateObjectField(field, objectSelected, objectValue)); + try { + Object objectValue = field.getVascEntryFieldValue().getValue(field.getBackendName(), objectSelected); + for (VascEntryFieldValidatorService s:entry.getVascFrontendController().getVascValidatorServices()) { + error.addAll(s.validateObjectField(field, objectSelected, objectValue)); + } + return error; + } catch (VascBackendException e) { + throw new VascException(e); } - return error; } /** @@ -192,8 +197,8 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper { VascEntryFieldValue ve = v.getVascEntryFieldValue(); String result = "no-data"; try { - result = ve.getDisplayValue(v, row); - } catch (VascException e) { + result = ve.getDisplayValue(v.getBackendName(), row); + } catch (VascBackendException e) { throw new RuntimeException("Could not get selected name DisplayValue: "+e.getMessage(),e); } return result; @@ -213,8 +218,8 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper { VascEntryFieldValue ve = v.getVascEntryFieldValue(); String result = "no-data"; try { - result = ve.getDisplayValue(v, row); - } catch (VascException e) { + result = ve.getDisplayValue(v.getBackendName(), row); + } catch (VascBackendException e) { throw new RuntimeException("Could not get parent name DisplayValue: "+e.getMessage(),e); } return result; diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendPager.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendPager.java index 92d1033..c8ec566 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendPager.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/frontend/DefaultVascFrontendPager.java @@ -25,11 +25,11 @@ package net.forwardfire.vasc.impl.frontend; import java.util.ArrayList; import java.util.List; -import net.forwardfire.vasc.backend.VascBackendPageNumber; import net.forwardfire.vasc.backend.VascBackendState; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener; -import net.forwardfire.vasc.frontend.VascFrontendPager; +import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber; +import net.forwardfire.vasc.frontend.VascFrontendPageInfo; /** @@ -38,15 +38,15 @@ import net.forwardfire.vasc.frontend.VascFrontendPager; * @author Willem Cazander * @version 1.0 Jan 22, 2012 */ -public class DefaultVascFrontendPager implements VascFrontendPager { +public class DefaultVascFrontendPager implements VascFrontendPageInfo { //private Logger logger = Logger.getLogger(DefaultVascFrontendPager.class.getName()); private VascEntry entry = null; - private List pagesAll = null; + private List pagesAll = null; public void init(VascEntry entry) { this.entry=entry; - pagesAll = new ArrayList(0); + pagesAll = new ArrayList(0); entry.getVascFrontendController().addVascEntryFrontendEventListener(new DefaultVascFrontendPagerEventListener()); } @@ -138,8 +138,8 @@ public class DefaultVascFrontendPager implements VascFrontendPager { return true; } - public List getTablePagesFromBackend() { - List result = new ArrayList(30); + public List getTablePagesFromBackend() { + List result = new ArrayList(30); VascBackendState state = entry.getVascFrontendController().getVascEntryState().getVascBackendState(); if (state.getPageSize()==0) { return result; // paging disabled @@ -150,7 +150,7 @@ public class DefaultVascFrontendPager implements VascFrontendPager { } int pages = new Long(total/state.getPageSize()).intValue(); for (int i=0;i<=pages;i++) { - VascBackendPageNumber pn = new VascBackendPageNumber(i); + VascFrontendPageInfoNumber pn = new VascFrontendPageInfoNumber(i); if (state.getPageIndex()==i) { pn.setSelected(true); } @@ -159,16 +159,16 @@ public class DefaultVascFrontendPager implements VascFrontendPager { return result; } - public List getTablePagesNormal() { + public List getTablePagesNormal() { if (getHasExtendedPageMode()) { - return new ArrayList(0); + return new ArrayList(0); } else { return pagesAll; } } - public List getTablePagesExtendedBegin() { - List result = new ArrayList(6); + public List getTablePagesExtendedBegin() { + List result = new ArrayList(6); if (pagesAll.size()>0) { result.add(pagesAll.get(0)); } @@ -200,8 +200,8 @@ public class DefaultVascFrontendPager implements VascFrontendPager { return result; } - public List getTablePagesExtendedEnd() { - List result = new ArrayList(6); + public List getTablePagesExtendedEnd() { + List result = new ArrayList(6); int pages = pagesAll.size(); int page = entry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageIndex(); int off = pages-page; @@ -224,8 +224,8 @@ public class DefaultVascFrontendPager implements VascFrontendPager { return result; } - public List getTablePagesExtendedCenter() { - List result = new ArrayList(3); + public List getTablePagesExtendedCenter() { + List result = new ArrayList(3); int page = entry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageIndex(); if (page>0 && pagesAll.size() > page-1) { result.add(pagesAll.get(page-1)); diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/impl/ui/VascSelectItemModelEntry.java b/vasc-core/src/main/java/net/forwardfire/vasc/impl/ui/VascSelectItemModelEntry.java index a1b1f12..1f84050 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/impl/ui/VascSelectItemModelEntry.java +++ b/vasc-core/src/main/java/net/forwardfire/vasc/impl/ui/VascSelectItemModelEntry.java @@ -27,17 +27,17 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import net.forwardfire.vasc.backend.DefaultVascBackendState; import net.forwardfire.vasc.backend.VascBackend; import net.forwardfire.vasc.backend.VascBackendState; +import net.forwardfire.vasc.backend.VascEntryFieldValue; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascEntryFieldLocal; import net.forwardfire.vasc.core.VascEntryLocal; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; import net.forwardfire.vasc.core.ui.VascSelectItem; import net.forwardfire.vasc.core.ui.VascSelectItemModel; import net.forwardfire.vasc.core.VascException; -import net.forwardfire.vasc.impl.DefaultVascBackendState; /** * The DefaultVascSelectItemModel @@ -135,14 +135,14 @@ public class VascSelectItemModelEntry implements VascSelectItemModel { } VascEntryField field = fieldOrg.clone(); field.getVascValidators().clear(); - VascEntryFieldValue v = fieldEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue(field); + VascEntryFieldValue v = fieldEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue(); Object record = fieldEntry.getVascFrontendController().getVascEntryState().getEntryDataObject(); if (record==null) { //System.out.println("could not get selected records from state."); continue; } - Object value = v.getValue(fieldOrg, record); + Object value = v.getValue(fieldOrg.getBackendName(), record); //System.out.println("Set entry paras name: "+paraName+" value: "+value+" class: "+value.getClass().getName()); state.setDataParameter(paraName, value); @@ -155,7 +155,7 @@ public class VascSelectItemModelEntry implements VascSelectItemModel { VascEntryField fieldClone = key.clone(); fieldClone.getVascValidators().clear(); - VascEntryFieldValue v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone); + VascEntryFieldValue v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue(); key.setVascEntryFieldValue(v); } if (dis.getVascEntryFieldValue()==null) { @@ -163,15 +163,15 @@ public class VascSelectItemModelEntry implements VascSelectItemModel { VascEntryField fieldClone = dis.clone(); fieldClone.getVascValidators().clear(); - VascEntryFieldValue v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone); + VascEntryFieldValue v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue(); dis.setVascEntryFieldValue(v); } // execute for (Object o:back.execute(state)) { - Object keyId = key.getVascEntryFieldValue().getValue(key, o); - String nameId = dis.getVascEntryFieldValue().getDisplayValue(dis, o); + Object keyId = key.getVascEntryFieldValue().getValue(key.getBackendName(), o); + String nameId = dis.getVascEntryFieldValue().getDisplayValue(dis.getBackendName(), o); if (returnKeyValue!=null && false==returnKeyValue) { VascSelectItem item = new VascSelectItem(nameId,o,""+keyId); result.add(item); diff --git a/vasc-core/src/main/resources/META-INF/vasc/vasc-lang.eld b/vasc-core/src/main/resources/META-INF/vasc/vasc-lang.eld index 231d1a7..a891a60 100644 --- a/vasc-core/src/main/resources/META-INF/vasc/vasc-lang.eld +++ b/vasc-core/src/main/resources/META-INF/vasc/vasc-lang.eld @@ -17,10 +17,11 @@ parentClass="net.forwardfire.vasc.core.VascEntryLocal" childClass="net.forwardfire.vasc.core.VascEntryLinkLocal" addMethod="addVascEntryLink" getMethod="getVascEntryLinksLocal" /> + - - - - - - \ No newline at end of file diff --git a/vasc-demo/vasc-demo-build/vasc-demo-build-server/src/main/directory/conf/vasc.d/tech-server.xml b/vasc-demo/vasc-demo-build/vasc-demo-build-server/src/main/directory/conf/vasc.d/tech-server.xml index 9eac388..a307e57 100644 --- a/vasc-demo/vasc-demo-build/vasc-demo-build-server/src/main/directory/conf/vasc.d/tech-server.xml +++ b/vasc-demo/vasc-demo-build/vasc-demo-build-server/src/main/directory/conf/vasc.d/tech-server.xml @@ -2,6 +2,7 @@ @@ -40,10 +41,10 @@ - - - - - + + + + + \ No newline at end of file diff --git a/vasc-demo/vasc-demo-client-swing/pom.xml b/vasc-demo/vasc-demo-client-swing/pom.xml index 5faca41..36a5ff7 100644 --- a/vasc-demo/vasc-demo-client-swing/pom.xml +++ b/vasc-demo/vasc-demo-client-swing/pom.xml @@ -14,7 +14,7 @@ ${project.version} - net.forwardfire.vasc + net.forwardfire.vasc.backend vasc-backend-metamodel ${project.version} diff --git a/vasc-demo/vasc-demo-server/pom.xml b/vasc-demo/vasc-demo-server/pom.xml index eb1ae7c..77ca431 100644 --- a/vasc-demo/vasc-demo-server/pom.xml +++ b/vasc-demo/vasc-demo-server/pom.xml @@ -103,22 +103,22 @@ ${project.version} - net.forwardfire.vasc + net.forwardfire.vasc.backend vasc-backend-ldap ${project.version} - net.forwardfire.vasc + net.forwardfire.vasc.backend vasc-backend-mongodb ${project.version} - net.forwardfire.vasc + net.forwardfire.vasc.backend vasc-backend-metamodel ${project.version} - net.forwardfire.vasc + net.forwardfire.vasc.backend vasc-backend-jdbc ${project.version} @@ -138,8 +138,13 @@ ${project.version} - net.forwardfire.vasc.lib - vasc-lib-editor + net.forwardfire.vasc.opt + vasc-opt-editor + ${project.version} + + + net.forwardfire.vasc.opt + vasc-opt-metamodel ${project.version} diff --git a/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/core/VascTechDemoStartup.java b/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/core/VascTechDemoStartup.java index 6562fe3..0e4b7e0 100644 --- a/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/core/VascTechDemoStartup.java +++ b/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/core/VascTechDemoStartup.java @@ -45,8 +45,9 @@ import net.forwardfire.vasc.demo.server.tomcat.TomcatService; * @author Willem Cazander * @version 1.0 May 3, 2012 */ -public class VascTechDemoStartup { +public enum VascTechDemoStartup { + INSTANCE; private Logger logger = null; private ServerConfigService serverConfigService = null; private DatabaseService databaseService = null; @@ -54,16 +55,15 @@ public class VascTechDemoStartup { private VascControllerService vascControllerService = null; private ServerGuiService swingGuiService = null; private VascTechDemoBuildInfo buildInfo = null; - static private VascTechDemoStartup instance = null; + private volatile boolean shutdownOnce = false; /** * Starts this VascTechDemo instance * @param args */ static public void main(String[] args) { - instance = new VascTechDemoStartup(); - instance.initialize(args); - instance.startup(); + INSTANCE.initialize(args); + INSTANCE.startup(); } /** @@ -220,10 +220,10 @@ public class VascTechDemoStartup { } public void shutdown() { - if (instance==null) { + if (shutdownOnce) { return; } - + shutdownOnce = true; Thread t = new Thread(new Runnable() { public void run() { try { @@ -238,8 +238,6 @@ public class VascTechDemoStartup { } catch (Exception e) { e.printStackTrace(); System.exit(1); - } finally { - instance = null; } } }); @@ -248,7 +246,7 @@ public class VascTechDemoStartup { } static public VascTechDemoStartup getInstance() { - return instance; + return INSTANCE; } public boolean isMavenRun() { 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 a4c1e0e..50e8b86 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 @@ -105,7 +105,7 @@ public class VascControllerService { VascDriver driver = VascDriver.getInstance(); X4OReader reader = driver.createReader(); driver.addVascController(reader, vascController); - reader.readResource("net/forwardfire/vasc/lib/editor/vasc-edit.xml"); + reader.readResource("net/forwardfire/vasc/opt/editor/vasc-editor.xml"); DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController); vascController.getVascEventChannelController().fireEvent(VascEventControllerType.LOAD_ENTRIES_AFTER, vascController); diff --git a/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/ui/load/JLoadStepMetaCsv.java b/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/ui/load/JLoadStepMetaCsv.java index 33528d8..f68bad2 100644 --- a/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/ui/load/JLoadStepMetaCsv.java +++ b/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/ui/load/JLoadStepMetaCsv.java @@ -36,7 +36,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv; -import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry; +import net.forwardfire.vasc.opt.metamodel.MetaModelSchemaAutoEntry; /** * JDialogMetaCsv Add and runs MetaModel Schema Auto Entry code. diff --git a/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/ui/load/LoadVascXmlWriter.java b/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/ui/load/LoadVascXmlWriter.java index 0d6935e..dc0183b 100644 --- a/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/ui/load/LoadVascXmlWriter.java +++ b/vasc-demo/vasc-demo-server/src/main/java/net/forwardfire/vasc/demo/server/ui/load/LoadVascXmlWriter.java @@ -24,7 +24,6 @@ package net.forwardfire.vasc.demo.server.ui.load; import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc; import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb; -import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry; import net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; @@ -33,6 +32,7 @@ import net.forwardfire.vasc.core.VascEntryFieldType; import net.forwardfire.vasc.core.VascEntryLink; import net.forwardfire.vasc.core.VascEntryLinkType; import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry; +import net.forwardfire.vasc.opt.metamodel.MetaModelSchemaAutoEntry; import org.x4o.xml.io.sax.ext.ContentWriterXml; import org.xml.sax.SAXException; @@ -68,7 +68,6 @@ public class LoadVascXmlWriter { autoEntry.setEntryPrefix(model.name); autoEntry.setDataContextProvider(model.dcProvider); autoEntry.getTables().addAll(model.tables); - autoEntry.autoFillResult(vc); xmlWriter.startDocument(); diff --git a/vasc-demo/vasc-demo-tech-web/pom.xml b/vasc-demo/vasc-demo-tech-web/pom.xml index 7928a14..1cb8443 100644 --- a/vasc-demo/vasc-demo-tech-web/pom.xml +++ b/vasc-demo/vasc-demo-tech-web/pom.xml @@ -28,7 +28,7 @@ provided - net.forwardfire.vasc + net.forwardfire.vasc.backend vasc-backend-metamodel ${project.version} provided diff --git a/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/AbstractVascEntryExportWriter.java b/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/AbstractVascEntryExportWriter.java index 2b52480..7576242 100644 --- a/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/AbstractVascEntryExportWriter.java +++ b/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/AbstractVascEntryExportWriter.java @@ -27,6 +27,7 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.List; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.entry.VascEntryExport; @@ -67,7 +68,11 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr for (int dataIndex=0;dataIndex fieldList = new ArrayList(getVascEntry().getVascEntryFields()); int fields = fieldList.size(); @@ -104,5 +109,5 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr } } - abstract protected void doExportRowField(Object row,VascEntryField field,boolean isLast) throws IOException,VascException; + abstract protected void doExportRowField(Object row,VascEntryField field,boolean isLast) throws IOException,VascBackendException; } \ No newline at end of file diff --git a/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/VascEntryExportWriterCsv.java b/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/VascEntryExportWriterCsv.java index 4ca2671..edf433b 100644 --- a/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/VascEntryExportWriterCsv.java +++ b/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/VascEntryExportWriterCsv.java @@ -25,8 +25,8 @@ package net.forwardfire.vasc.export.generic; import java.io.OutputStream; import java.io.PrintWriter; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.VascException; /** * VascEntryExporterCsv writes data to csv output format. @@ -132,9 +132,9 @@ public class VascEntryExportWriterCsv extends AbstractVascEntryExportWriter { } @Override - protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascException { + protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascBackendException { p.write(quoteChar.toCharType()); - p.write(c.getVascEntryFieldValue().getDisplayValue(c, o)); + p.write(c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o)); p.write(quoteChar.toCharType()); if (isLast==false) { p.write(separatorChar.toCharType()); diff --git a/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/VascEntryExportWriterXml.java b/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/VascEntryExportWriterXml.java index 9734b99..7b4ad31 100644 --- a/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/VascEntryExportWriterXml.java +++ b/vasc-export/vasc-export-generic/src/main/java/net/forwardfire/vasc/export/generic/VascEntryExportWriterXml.java @@ -25,8 +25,8 @@ package net.forwardfire.vasc.export.generic; import java.io.OutputStream; import java.io.PrintWriter; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.VascException; /** * VascEntryExportWriterXml writes entry data to xml format. @@ -74,14 +74,14 @@ public class VascEntryExportWriterXml extends AbstractVascEntryExportWriter { } @Override - protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascException { + protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascBackendException { if (xmlTree) { p.write("\t\t<"+c.getId()+">\n"); } else { p.write("\t\t\n"); } } diff --git a/vasc-export/vasc-export-jr4o/src/main/java/net/forwardfire/vasc/export/jr4o/JRDynamicDataSourceVascEntry.java b/vasc-export/vasc-export-jr4o/src/main/java/net/forwardfire/vasc/export/jr4o/JRDynamicDataSourceVascEntry.java index f996c7e..0f39c60 100644 --- a/vasc-export/vasc-export-jr4o/src/main/java/net/forwardfire/vasc/export/jr4o/JRDynamicDataSourceVascEntry.java +++ b/vasc-export/vasc-export-jr4o/src/main/java/net/forwardfire/vasc/export/jr4o/JRDynamicDataSourceVascEntry.java @@ -27,9 +27,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import net.forwardfire.vasc.backend.VascBackendException; 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; import net.forwardfire.vasc.lib.jr4o.data.AbstractJRDynamicDataSource; import net.sf.jasperreports.engine.JRException; @@ -75,13 +75,13 @@ public class JRDynamicDataSourceVascEntry extends AbstractJRDynamicDataSource { for (Object o:vascEntry.getVascFrontendController().getVascEntryState().getEntryDataList()) { List row = new ArrayList(30); for (VascEntryField c:fields) { - row.add(c.getVascEntryFieldValue().getDisplayValue(c, o)); + row.add(c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o)); } data.add(row); } } - } catch (VascException ve) { - throw new RuntimeException(ve); + } catch (VascBackendException ve) { + throw new RuntimeException(ve); // TODO: replace me } } diff --git a/vasc-export/vasc-export-json/src/main/java/net/forwardfire/vasc/export/json/VascEntryExportWriterJson.java b/vasc-export/vasc-export-json/src/main/java/net/forwardfire/vasc/export/json/VascEntryExportWriterJson.java index 7a215e3..3629466 100644 --- a/vasc-export/vasc-export-json/src/main/java/net/forwardfire/vasc/export/json/VascEntryExportWriterJson.java +++ b/vasc-export/vasc-export-json/src/main/java/net/forwardfire/vasc/export/json/VascEntryExportWriterJson.java @@ -31,8 +31,8 @@ import java.util.Map; import org.json.simple.JSONObject; import org.json.simple.JSONValue; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.export.generic.AbstractVascEntryExportWriter; /** @@ -107,9 +107,9 @@ public class VascEntryExportWriterJson extends AbstractVascEntryExportWriter { } @Override - protected void doExportRowField(Object row, VascEntryField field,boolean isLast) throws VascException { + protected void doExportRowField(Object row, VascEntryField field,boolean isLast) throws VascBackendException { String key = field.getId(); - Object data = field.getVascEntryFieldValue().getValue(field, row); + Object data = field.getVascEntryFieldValue().getValue(field.getBackendName(), row); rowData.put(key, data); } } diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingActionPanel.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingActionPanel.java index 6ed343e..a50045b 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingActionPanel.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingActionPanel.java @@ -34,11 +34,11 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.ListCellRenderer; -import net.forwardfire.vasc.backend.VascBackendPageNumber; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.core.actions.GlobalVascAction; import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener; +import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber; import net.forwardfire.vasc.frontend.VascFrontendException; /** @@ -162,10 +162,10 @@ public class SwingActionPanel extends JPanel implements VascEntryFrontendEventLi init = true; - long pageSize = entry.getVascFrontendController().getVascFrontendPager().getPageSize(); - long pageStart = entry.getVascFrontendController().getVascFrontendPager().getPageStartCount(); - long pageStop = entry.getVascFrontendController().getVascFrontendPager().getPageStopCount(); - long pageTotalCount = entry.getVascFrontendController().getVascFrontendPager().getPageTotalRecordCount(); + long pageSize = entry.getVascFrontendController().getVascFrontendPageInfo().getPageSize(); + long pageStart = entry.getVascFrontendController().getVascFrontendPageInfo().getPageStartCount(); + long pageStop = entry.getVascFrontendController().getVascFrontendPageInfo().getPageStopCount(); + long pageTotalCount = entry.getVascFrontendController().getVascFrontendPageInfo().getPageTotalRecordCount(); String format = "Results %1$d-%2$d from %3$d rows"; resultLabel.setText(String.format(format, pageStart, pageStop, pageTotalCount)); rowNumberField.setText(""+pageSize); @@ -173,9 +173,9 @@ public class SwingActionPanel extends JPanel implements VascEntryFrontendEventLi gotoDirectPage.removeAllItems(); gotoDirectPage.addItem("Goto..."); - List pages = vascEntry.getVascFrontendController().getVascFrontendPager().getTablePagesFromBackend(); + List pages = vascEntry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesFromBackend(); int i=0; - for (VascBackendPageNumber page:pages) { + for (VascFrontendPageInfoNumber page:pages) { //pages.setRowIndex(i); //VascBackendPageNumber page = (VascBackendPageNumber)getTablePagesDataModel().getRowData(); // = new SelectItem(); diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPagerPanel.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPagerPanel.java index ef0df5b..a53adff 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPagerPanel.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingPagerPanel.java @@ -31,9 +31,9 @@ import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; -import net.forwardfire.vasc.backend.VascBackendPageNumber; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener; +import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber; /** * SwingPagerPanel renders dynamic pager for swing. @@ -70,11 +70,11 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis public void actionPerformed(ActionEvent e) { int pageIndex = vascEntry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageIndex(); if (next) { - if (vascEntry.getVascFrontendController().getVascFrontendPager().getHasPageNextAction()) { + if (vascEntry.getVascFrontendController().getVascFrontendPageInfo().getHasPageNextAction()) { vascEntry.getVascFrontendController().getVascFrontendActions().pageAction(pageIndex+1); } } else { - if (vascEntry.getVascFrontendController().getVascFrontendPager().getHasPagePreviousAction()) { + if (vascEntry.getVascFrontendController().getVascFrontendPageInfo().getHasPagePreviousAction()) { vascEntry.getVascFrontendController().getVascFrontendActions().pageAction(pageIndex-1); } } @@ -91,13 +91,13 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis result.removeAll(); - if (entry.getVascFrontendController().getVascFrontendPager().getHasExtendedPageMode()) { + if (entry.getVascFrontendController().getVascFrontendPageInfo().getHasExtendedPageMode()) { JButton prev = new JButton("Previous"); prev.addActionListener(new NextAction(false)); - prev.setEnabled(entry.getVascFrontendController().getVascFrontendPager().getHasPagePreviousAction()); + prev.setEnabled(entry.getVascFrontendController().getVascFrontendPageInfo().getHasPagePreviousAction()); result.add(prev); - List pages = entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedBegin(); - for(VascBackendPageNumber page:pages) { + List pages = entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedBegin(); + for(VascFrontendPageInfoNumber page:pages) { JButton but = new JButton(""+page.getPageNumber()); but.addActionListener(this); if (page.getSelected()!=null && page.getSelected()) { @@ -106,9 +106,9 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis result.add(but); } result.add(new JLabel("...")); - if (entry.getVascFrontendController().getVascFrontendPager().getHasExtendedPageModeCenter()) { - pages = entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedCenter(); - for(VascBackendPageNumber page:pages) { + if (entry.getVascFrontendController().getVascFrontendPageInfo().getHasExtendedPageModeCenter()) { + pages = entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedCenter(); + for(VascFrontendPageInfoNumber page:pages) { JButton but = new JButton(""+page.getPageNumber()); but.addActionListener(this); if (page.getSelected()!=null && page.getSelected()) { @@ -118,8 +118,8 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis } result.add(new JLabel("...")); } - pages = entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedEnd(); - for(VascBackendPageNumber page:pages) { + pages = entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedEnd(); + for(VascFrontendPageInfoNumber page:pages) { JButton but = new JButton(""+page.getPageNumber()); but.addActionListener(this); if (page.getSelected()!=null && page.getSelected()) { @@ -128,16 +128,16 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis result.add(but); } JButton next = new JButton("Next"); - next.setEnabled(entry.getVascFrontendController().getVascFrontendPager().getHasPageNextAction()); + next.setEnabled(entry.getVascFrontendController().getVascFrontendPageInfo().getHasPageNextAction()); next.addActionListener(new NextAction(true)); result.add(next); } else { JButton prev = new JButton("Previous"); prev.addActionListener(new NextAction(false)); - prev.setEnabled(entry.getVascFrontendController().getVascFrontendPager().getHasPagePreviousAction()); + prev.setEnabled(entry.getVascFrontendController().getVascFrontendPageInfo().getHasPagePreviousAction()); result.add(prev); - List pages = entry.getVascFrontendController().getVascFrontendPager().getTablePagesNormal(); - for(VascBackendPageNumber page:pages) { + List pages = entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesNormal(); + for(VascFrontendPageInfoNumber page:pages) { JButton but = new JButton(""+page.getPageNumber()); but.addActionListener(this); if (page.getSelected()!=null && page.getSelected()) { @@ -146,7 +146,7 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis result.add(but); } JButton next = new JButton("Next"); - next.setEnabled(entry.getVascFrontendController().getVascFrontendPager().getHasPageNextAction()); + next.setEnabled(entry.getVascFrontendController().getVascFrontendPageInfo().getHasPageNextAction()); next.addActionListener(new NextAction(true)); result.add(next); } 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 5613ffc..2ac3bd2 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 @@ -34,6 +34,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SpringLayout; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; @@ -115,7 +116,7 @@ public class SwingVascEditDialog extends JPanel { //System.out.println("Could not get VascEntryFieldValue for fieldID: "+fieldId); continue; } - Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected); + Object selectedValue = v.getVascEntryFieldValue().getValue(v.getBackendName(), selected); // set data parameter on new vasc entry ee.getVascFrontendController().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue); @@ -127,7 +128,7 @@ public class SwingVascEditDialog extends JPanel { Object selectedValue = selected; if (selectedfieldId!=null) { VascEntryField v = ee.getVascEntryFieldById(selectedfieldId); - selectedValue = v.getVascEntryFieldValue().getValue(v, selected); + selectedValue = v.getVascEntryFieldValue().getValue(v.getBackendName(), selected); } // create listener for new objects @@ -172,7 +173,11 @@ public class SwingVascEditDialog extends JPanel { VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c); model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c)); - model.setValue(c.getVascEntryFieldValue().getValue(c, bean)); + try { + model.setValue(c.getVascEntryFieldValue().getValue(c.getBackendName(), bean)); + } catch (VascBackendException e) { + throw new VascException(e); + } model.addListener(new VascColumnValueModelListener(c,bean)); Object g = editor.createComponent(entry,c,model,body); 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 04f439a..167a265 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 @@ -61,6 +61,7 @@ import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascEntryListOption; import net.forwardfire.vasc.core.actions.GlobalVascAction; @@ -71,7 +72,6 @@ import net.forwardfire.vasc.core.ui.VascOptionValueModelListener; import net.forwardfire.vasc.core.ui.VascUIComponent; import net.forwardfire.vasc.core.ui.VascValueModel; import net.forwardfire.vasc.core.VascException; - import net.forwardfire.vasc.frontend.AbstractVascFrontend; import net.forwardfire.vasc.frontend.VascFrontendController; import net.forwardfire.vasc.frontend.VascFrontendException; @@ -161,7 +161,7 @@ public class SwingVascFrontend extends AbstractVascFrontend { if (entry.getDisplayNameFieldId()!=null) { VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId()); - Object vv = v.getVascEntryFieldValue().getValue(v, rowBean); + Object vv = v.getVascEntryFieldValue().getValue(v.getBackendName(), rowBean); if (vv==null) { beanValue=""; } else { @@ -177,7 +177,9 @@ public class SwingVascFrontend extends AbstractVascFrontend { entry.getVascFrontendController().getVascFrontendHelper().editReadOnlyUIComponents(entry); panels.openVascView(editPanel,entry); - + + } catch (VascBackendException ve) { + throw new VascFrontendException(ve); } catch (VascException ve) { throw new VascFrontendException(ve); } @@ -189,11 +191,11 @@ public class SwingVascFrontend extends AbstractVascFrontend { try { VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId()); - beanValue = ""+v.getVascEntryFieldValue().getValue(v, rowBean); + beanValue = ""+v.getVascEntryFieldValue().getValue(v.getBackendName(), rowBean); if (beanValue.length()>30) { beanValue=beanValue.substring(0, 30); } - } catch (VascException ve) { + } catch (VascBackendException ve) { throw new VascFrontendException(ve); } diff --git a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascTableModel.java b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascTableModel.java index 8732161..51d6dd9 100644 --- a/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascTableModel.java +++ b/vasc-frontend/vasc-frontend-swing/src/main/java/net/forwardfire/vasc/frontend/swing/SwingVascTableModel.java @@ -96,7 +96,7 @@ public class SwingVascTableModel extends AbstractTableModel implements VascEntry //if (vtc.getVascColumnRenderer()!=null) { // return vtc.getVascColumnRenderer().rendererColumn(vtc,bean); //} else { - return ""+vtc.getVascEntryFieldValue().getValue(vtc,bean); + return ""+vtc.getVascEntryFieldValue().getValue(vtc.getBackendName(),bean); // } } catch (Exception e) { return "Error"; diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtActionPanel.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtActionPanel.java index 5e68ca3..9cbc30f 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtActionPanel.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtActionPanel.java @@ -24,11 +24,11 @@ package net.forwardfire.vasc.frontend.swt; import java.util.List; -import net.forwardfire.vasc.backend.VascBackendPageNumber; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.actions.GlobalVascAction; import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener; import net.forwardfire.vasc.core.ui.VascSelectItem; +import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; @@ -128,10 +128,10 @@ public class SwtActionPanel implements VascEntryFrontendEventListener { public void vascEvent(VascEntry entry,Object dataNotUsed) { vascEvent = true; - long pageSize = entry.getVascFrontendController().getVascFrontendPager().getPageSize(); - long pageStart = entry.getVascFrontendController().getVascFrontendPager().getPageStartCount(); - long pageStop = entry.getVascFrontendController().getVascFrontendPager().getPageStopCount(); - long pageTotalCount = entry.getVascFrontendController().getVascFrontendPager().getPageTotalRecordCount(); + long pageSize = entry.getVascFrontendController().getVascFrontendPageInfo().getPageSize(); + long pageStart = entry.getVascFrontendController().getVascFrontendPageInfo().getPageStartCount(); + long pageStop = entry.getVascFrontendController().getVascFrontendPageInfo().getPageStopCount(); + long pageTotalCount = entry.getVascFrontendController().getVascFrontendPageInfo().getPageTotalRecordCount(); String format = "Results %1$d-%2$d from %3$d rows"; resultLabel.setText(String.format(format, pageStart, pageStop, pageTotalCount)); resultLabel.redraw(); @@ -140,9 +140,9 @@ public class SwtActionPanel implements VascEntryFrontendEventListener { pageBox.removeAll(); pageBox.add("Goto..."); - List pages = entry.getVascFrontendController().getVascFrontendPager().getTablePagesFromBackend(); + List pages = entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesFromBackend(); int i=0; - for (VascBackendPageNumber page:pages) { + for (VascFrontendPageInfoNumber page:pages) { pageBox.add("page: "+page.getPageNumber()+" "+(i*pageSize)+"-"+((i*pageSize)+pageSize)); i++; } diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtPagerPanel.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtPagerPanel.java index 6f191ce..0e07675 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtPagerPanel.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtPagerPanel.java @@ -24,11 +24,11 @@ package net.forwardfire.vasc.frontend.swt; import java.util.List; -import net.forwardfire.vasc.backend.VascBackendPageNumber; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.actions.GlobalVascAction; import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener; import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType; +import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; diff --git a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascEditDialog.java b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascEditDialog.java index 23ad9e9..04df7a9 100644 --- a/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascEditDialog.java +++ b/vasc-frontend/vasc-frontend-swt/src/main/java/net/forwardfire/vasc/frontend/swt/SwtVascEditDialog.java @@ -22,6 +22,7 @@ package net.forwardfire.vasc.frontend.swt; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.ui.VascColumnValueModelListener; @@ -125,8 +126,8 @@ public class SwtVascEditDialog extends Dialog { String name = null; try { Object bean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject(); - name = dis.getVascEntryFieldValue().getDisplayValue(dis, bean); - } catch (VascException e) { + name = dis.getVascEntryFieldValue().getDisplayValue(dis.getBackendName(), bean); + } catch (VascBackendException e) { throw new RuntimeException("Could not display value from "+entry.getId(),e); } @@ -174,7 +175,11 @@ public class SwtVascEditDialog extends Dialog { VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c); model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c)); - model.setValue(c.getVascEntryFieldValue().getValue(c, bean)); + try { + model.setValue(c.getVascEntryFieldValue().getValue(c.getBackendName(), bean)); + } catch (VascBackendException e) { + throw new VascException(e); + } model.addListener(new VascColumnValueModelListener(c,bean)); Control edit = (Control )editor.createComponent(entry,c,model,body); 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 5b513ec..5958005 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 @@ -28,6 +28,7 @@ import java.io.OutputStream; import java.util.logging.Level; import java.util.logging.Logger; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascEntryListOption; @@ -636,7 +637,7 @@ public class SwtVascFrontend extends AbstractVascFrontend { //if (vtc.getVascColumnRenderer()==null) { try { - return vtc.getVascEntryFieldValue().getDisplayValue(vtc,bean); + return vtc.getVascEntryFieldValue().getDisplayValue(vtc.getBackendName(),bean); } catch (Exception e) { logger.log(Level.WARNING,"Error in get value: '"+vtc.getVascEntryFieldValue()+"' error: "+e.getMessage(),e); return "Err"; 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 d2617d9..8a721fb 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 @@ -90,6 +90,6 @@ public class JSFVascEntryEventListener implements VascEntryFrontendEventListener ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".tableDataModel.wrappedData}", Object.class); ve2.setValue(FacesContext.getCurrentInstance().getELContext(), result); ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".tablePagesDataModel.wrappedData}", Object.class); - ve3.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendController().getVascFrontendPager().getTablePagesFromBackend()); + ve3.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesFromBackend()); } } 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 d63a118..67ff5dd 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 @@ -49,7 +49,6 @@ import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import net.forwardfire.vasc.backend.VascBackend; -import net.forwardfire.vasc.backend.VascBackendPageNumber; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; import net.forwardfire.vasc.core.VascEntryState; @@ -60,6 +59,7 @@ import net.forwardfire.vasc.core.actions.GlobalVascAction; import net.forwardfire.vasc.core.actions.RowVascAction; import net.forwardfire.vasc.core.entry.VascEntryExport; import net.forwardfire.vasc.core.entry.VascEntryExportWriter; +import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber; import net.forwardfire.vasc.frontend.VascFrontendException; import net.forwardfire.vasc.impl.actions.AddRowAction; import net.forwardfire.vasc.impl.actions.DeleteRowAction; @@ -198,14 +198,14 @@ public class JSFVascEntrySupportBean implements Serializable { public long getPageTotalRecordCount() { - return entry.getVascFrontendController().getVascFrontendPager().getPageTotalRecordCount(); + return entry.getVascFrontendController().getVascFrontendPageInfo().getPageTotalRecordCount(); } public long getPageStartCount() { - return entry.getVascFrontendController().getVascFrontendPager().getPageStartCount(); + return entry.getVascFrontendController().getVascFrontendPageInfo().getPageStartCount(); } public long getPageStopCount() { - return entry.getVascFrontendController().getVascFrontendPager().getPageStopCount(); + return entry.getVascFrontendController().getVascFrontendPageInfo().getPageStopCount(); } public List getGlobalExportItems() { @@ -237,7 +237,7 @@ public class JSFVascEntrySupportBean implements Serializable { int pageSize = getVascEntry().getVascFrontendController().getVascEntryState().getVascBackendState().getPageSize(); for (int i=0;i getTablePagesExtendedBegin() { - return entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedBegin(); + public List getTablePagesExtendedBegin() { + return entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedBegin(); } - public List getTablePagesExtendedEnd() { - return entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedEnd(); + public List getTablePagesExtendedEnd() { + return entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedEnd(); } - public List getTablePagesExtendedCenter() { - return entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedCenter(); + public List getTablePagesExtendedCenter() { + return entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedCenter(); } private String getComponentType(UIComponent comp) { @@ -507,11 +507,11 @@ public class JSFVascEntrySupportBean implements Serializable { } public boolean getHasPageNextAction() { - return entry.getVascFrontendController().getVascFrontendPager().getHasPageNextAction(); + return entry.getVascFrontendController().getVascFrontendPageInfo().getHasPageNextAction(); } public boolean getHasPagePreviousAction() { - return entry.getVascFrontendController().getVascFrontendPager().getHasPagePreviousAction(); + return entry.getVascFrontendController().getVascFrontendPageInfo().getHasPagePreviousAction(); } 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 83d2624..dc98dfb 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 @@ -33,6 +33,7 @@ import javax.faces.component.UIComponent; import javax.faces.component.UIComponentBase; import javax.faces.context.FacesContext; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryField; @@ -349,7 +350,7 @@ public class JSFVascUIComponent extends UIComponentBase { logger.warning("Could not get VascEntryFieldValue for fieldID: "+fieldId); continue; } - Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected); + Object selectedValue = v.getVascEntryFieldValue().getValue(v.getBackendName(), selected); // set data parameter on new vasc entry //was; entry.getVascFrontendController().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue); @@ -362,7 +363,7 @@ public class JSFVascUIComponent extends UIComponentBase { Object selectedValue = selected; if (selectedfieldId!=null) { VascEntryField v = getVascEntry().getVascEntryFieldById(selectedfieldId); - selectedValue = v.getVascEntryFieldValue().getValue(v, selected); + selectedValue = v.getVascEntryFieldValue().getValue(v.getBackendName(), selected); } // create listener for new objects @@ -398,8 +399,8 @@ public class JSFVascUIComponent extends UIComponentBase { public void vascEvent(VascEntry entry,Object data) { VascEntryField field = entry.getVascEntryFieldById(fieldId); try { - field.getVascEntryFieldValue().setValue(field, data, value); - } catch (VascException e) { + field.getVascEntryFieldValue().setValue(field.getBackendName(), data, value); + } catch (VascBackendException e) { throw new VascFrontendException(e); } } 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 23712c9..26f0856 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 @@ -25,9 +25,10 @@ package net.forwardfire.vasc.frontend.web.jsf; import java.io.Serializable; +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.entry.VascEntryFieldValue; import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.frontend.VascFrontendDataSelector.EntryFieldSelectType; @@ -83,10 +84,10 @@ public class VascDataBackendBean implements Serializable { VascEntryField field = getFieldIdByIndex(entry,index); VascEntryFieldValue value = field.getVascEntryFieldValue(); if (isRealValue()) { - return value.getValue(field, record); + return value.getValue(field.getBackendName(), record); } - return value.getDisplayValue(field, record); - } catch (VascException e) { + return value.getDisplayValue(field.getBackendName(), record); + } catch (Exception e) { return "Error: "+e.getMessage(); } } @@ -95,8 +96,8 @@ public class VascDataBackendBean implements Serializable { try { VascEntryField field = getFieldIdByIndex(entry,index); VascEntryFieldValue value = field.getVascEntryFieldValue(); - value.setValue(field, record,valueObject); - } catch (VascException e) { + value.setValue(field.getBackendName(), record,valueObject); + } catch (VascBackendException e) { throw new RuntimeException("Could not set value on record.",e); } } diff --git a/vasc-opt/.project b/vasc-opt/.project new file mode 100644 index 0000000..4ce8eeb --- /dev/null +++ b/vasc-opt/.project @@ -0,0 +1,17 @@ + + + vasc-opt + + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + + diff --git a/vasc-opt/pom.xml b/vasc-opt/pom.xml new file mode 100644 index 0000000..6c5683f --- /dev/null +++ b/vasc-opt/pom.xml @@ -0,0 +1,17 @@ + + 4.0.0 + + net.forwardfire.vasc + vasc + 0.4.2-SNAPSHOT + + vasc-opt + net.forwardfire.vasc.opt + pom + vasc-opt + vasc-opt module for optional modules. + + vasc-opt-metamodel + vasc-opt-editor + + \ No newline at end of file diff --git a/vasc-opt/vasc-opt-editor/.project b/vasc-opt/vasc-opt-editor/.project new file mode 100644 index 0000000..3dce69d --- /dev/null +++ b/vasc-opt/vasc-opt-editor/.project @@ -0,0 +1,23 @@ + + + vasc-opt-editor + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/vasc-opt/vasc-opt-editor/pom.xml b/vasc-opt/vasc-opt-editor/pom.xml new file mode 100644 index 0000000..449adbf --- /dev/null +++ b/vasc-opt/vasc-opt-editor/pom.xml @@ -0,0 +1,18 @@ + + 4.0.0 + + net.forwardfire.vasc.opt + vasc-opt + 0.4.2-SNAPSHOT + + vasc-opt-editor + vasc-opt-editor + vasc-opt-editor + + + net.forwardfire.vasc + vasc-core + ${project.version} + + + \ No newline at end of file diff --git a/vasc-core/src/main/java/net/forwardfire/vasc/backend/VirtualVascBackend.java b/vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor/VirtualVascBackend.java similarity index 88% rename from vasc-core/src/main/java/net/forwardfire/vasc/backend/VirtualVascBackend.java rename to vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor/VirtualVascBackend.java index 63df435..44efde9 100644 --- a/vasc-core/src/main/java/net/forwardfire/vasc/backend/VirtualVascBackend.java +++ b/vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor/VirtualVascBackend.java @@ -1,8 +1,13 @@ -package net.forwardfire.vasc.backend; +package net.forwardfire.vasc.opt.editor; import java.util.ArrayList; import java.util.List; +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.BeanVascEntryFieldValue; import net.forwardfire.vasc.backend.data.BeanVascEntryRecordCreator; import net.forwardfire.vasc.core.VascController; @@ -17,9 +22,6 @@ import net.forwardfire.vasc.core.VascEntryListOption; import net.forwardfire.vasc.core.VascEntryListOptionLocal; import net.forwardfire.vasc.core.VascEntryLocal; import net.forwardfire.vasc.core.VascEntryLink; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; import net.forwardfire.vasc.impl.DefaultVascEntry; import net.forwardfire.vasc.impl.DefaultVascEntryField; import net.forwardfire.vasc.impl.DefaultVascEntryFieldSet; @@ -31,7 +33,7 @@ public class VirtualVascBackend extends AbstractVascBackend { private String vascType = "entry"; private String entryId = null; - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { List result = new ArrayList(100); entryId = (String)state.getDataParameter("entry_id"); if ("entry".equals(vascType)) { @@ -63,19 +65,19 @@ public class VirtualVascBackend extends AbstractVascBackend { return result; } - public void persist(Object object) throws VascException { + public void persist(Object object) throws VascBackendException { edit(object,false,true); } - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { return edit(object,true,true); } - public void delete(Object object) throws VascException { + public void delete(Object object) throws VascBackendException { edit(object,true,false); } - public Object edit(Object object,boolean removeReal,boolean addEdit) throws VascException { + public Object edit(Object object,boolean removeReal,boolean addEdit) throws VascBackendException { if (object instanceof VascEntry) { entryId = ((VascEntry)object).getId(); @@ -125,11 +127,11 @@ public class VirtualVascBackend extends AbstractVascBackend { } - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { + public VascEntryFieldValue provideVascEntryFieldValue() { return new BeanVascEntryFieldValue(); } - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { + public VascEntryRecordCreator provideVascEntryRecordCreator() { if ("entry".equals(vascType)) { return new BeanVascEntryRecordCreator(DefaultVascEntry.class); } else if ("field".equals(vascType)) { diff --git a/vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor/package-info.java b/vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor/package-info.java new file mode 100644 index 0000000..db49c75 --- /dev/null +++ b/vasc-opt/vasc-opt-editor/src/main/java/net/forwardfire/vasc/opt/editor/package-info.java @@ -0,0 +1,8 @@ +/** + * + */ +/** + * @author willemc + * + */ +package net.forwardfire.vasc.opt.editor; \ No newline at end of file diff --git a/vasc-opt/vasc-opt-editor/src/main/resources/META-INF/vasc/vasc-modules.xml b/vasc-opt/vasc-opt-editor/src/main/resources/META-INF/vasc/vasc-modules.xml new file mode 100644 index 0000000..d07ed38 --- /dev/null +++ b/vasc-opt/vasc-opt-editor/src/main/resources/META-INF/vasc/vasc-modules.xml @@ -0,0 +1,10 @@ + + + + vasc-opt-editor.eld + + diff --git a/vasc-opt/vasc-opt-editor/src/main/resources/META-INF/vasc/vasc-opt-editor.eld b/vasc-opt/vasc-opt-editor/src/main/resources/META-INF/vasc/vasc-opt-editor.eld new file mode 100644 index 0000000..15a65af --- /dev/null +++ b/vasc-opt/vasc-opt-editor/src/main/resources/META-INF/vasc/vasc-opt-editor.eld @@ -0,0 +1,27 @@ + + + Provides Vasc entry editing entries. + + Provides vasc entie editing support. + + + + + + + + diff --git a/vasc-opt/vasc-opt-editor/src/main/resources/net/forwardfire/vasc/opt/editor/vasc-editor.xml b/vasc-opt/vasc-opt-editor/src/main/resources/net/forwardfire/vasc/opt/editor/vasc-editor.xml new file mode 100644 index 0000000..f965503 --- /dev/null +++ b/vasc-opt/vasc-opt-editor/src/main/resources/net/forwardfire/vasc/opt/editor/vasc-editor.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vasc-opt/vasc-opt-metamodel/.project b/vasc-opt/vasc-opt-metamodel/.project new file mode 100644 index 0000000..4b0304e --- /dev/null +++ b/vasc-opt/vasc-opt-metamodel/.project @@ -0,0 +1,23 @@ + + + vasc-opt-metamodel + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/vasc-opt/vasc-opt-metamodel/pom.xml b/vasc-opt/vasc-opt-metamodel/pom.xml new file mode 100644 index 0000000..136934e --- /dev/null +++ b/vasc-opt/vasc-opt-metamodel/pom.xml @@ -0,0 +1,23 @@ + + 4.0.0 + + net.forwardfire.vasc.opt + vasc-opt + 0.4.2-SNAPSHOT + + vasc-opt-metamodel + vasc-opt-metamodel + vasc-opt-metamodel + + + net.forwardfire.vasc + vasc-core + ${project.version} + + + net.forwardfire.vasc.backend + vasc-backend-metamodel + ${project.version} + + + \ No newline at end of file diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelSchemaAutoEntry.java b/vasc-opt/vasc-opt-metamodel/src/main/java/net/forwardfire/vasc/opt/metamodel/MetaModelSchemaAutoEntry.java similarity index 98% rename from vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelSchemaAutoEntry.java rename to vasc-opt/vasc-opt-metamodel/src/main/java/net/forwardfire/vasc/opt/metamodel/MetaModelSchemaAutoEntry.java index 5cc39ce..9077c31 100644 --- a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/MetaModelSchemaAutoEntry.java +++ b/vasc-opt/vasc-opt-metamodel/src/main/java/net/forwardfire/vasc/opt/metamodel/MetaModelSchemaAutoEntry.java @@ -20,7 +20,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.backend.metamodel; +package net.forwardfire.vasc.opt.metamodel; import java.util.ArrayList; import java.util.Collections; @@ -38,6 +38,8 @@ import org.eobjects.metamodel.schema.Table; import net.forwardfire.vasc.backend.VascBackend; import net.forwardfire.vasc.backend.VascBackendControllerLocal; +import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextProvider; +import net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.core.VascEntry; import net.forwardfire.vasc.core.VascEntryAccessType; @@ -47,7 +49,6 @@ import net.forwardfire.vasc.core.VascEntryFieldLocal; import net.forwardfire.vasc.core.VascEntryGroupLocal; import net.forwardfire.vasc.core.VascEntryLinkType; import net.forwardfire.vasc.core.VascEntryLocal; - import net.forwardfire.vasc.impl.DefaultVascEntry; import net.forwardfire.vasc.impl.DefaultVascEntryField; import net.forwardfire.vasc.impl.DefaultVascEntryLink; diff --git a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/x4o/SchemaAutoEntryElementConfigurator.java b/vasc-opt/vasc-opt-metamodel/src/main/java/net/forwardfire/vasc/opt/metamodel/x4o/SchemaAutoEntryElementConfigurator.java similarity index 95% rename from vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/x4o/SchemaAutoEntryElementConfigurator.java rename to vasc-opt/vasc-opt-metamodel/src/main/java/net/forwardfire/vasc/opt/metamodel/x4o/SchemaAutoEntryElementConfigurator.java index e396e69..c03916d 100644 --- a/vasc-backend/vasc-backend-metamodel/src/main/java/net/forwardfire/vasc/backend/metamodel/x4o/SchemaAutoEntryElementConfigurator.java +++ b/vasc-opt/vasc-opt-metamodel/src/main/java/net/forwardfire/vasc/opt/metamodel/x4o/SchemaAutoEntryElementConfigurator.java @@ -20,11 +20,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.forwardfire.vasc.backend.metamodel.x4o; +package net.forwardfire.vasc.opt.metamodel.x4o; -import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry; import net.forwardfire.vasc.core.VascController; import net.forwardfire.vasc.impl.x4o.VascDriver; +import net.forwardfire.vasc.opt.metamodel.MetaModelSchemaAutoEntry; import org.x4o.xml.element.AbstractElementConfigurator; import org.x4o.xml.element.Element; diff --git a/vasc-opt/vasc-opt-metamodel/src/main/resources/META-INF/vasc/vasc-modules.xml b/vasc-opt/vasc-opt-metamodel/src/main/resources/META-INF/vasc/vasc-modules.xml new file mode 100644 index 0000000..e70be57 --- /dev/null +++ b/vasc-opt/vasc-opt-metamodel/src/main/resources/META-INF/vasc/vasc-modules.xml @@ -0,0 +1,10 @@ + + + + vasc-opt-metamodel.eld + + diff --git a/vasc-opt/vasc-opt-metamodel/src/main/resources/META-INF/vasc/vasc-opt-metamodel.eld b/vasc-opt/vasc-opt-metamodel/src/main/resources/META-INF/vasc/vasc-opt-metamodel.eld new file mode 100644 index 0000000..edd1534 --- /dev/null +++ b/vasc-opt/vasc-opt-metamodel/src/main/resources/META-INF/vasc/vasc-opt-metamodel.eld @@ -0,0 +1,24 @@ + + + Provides Dynamic MetaModel vasc entries. + + Provides backend and data context provider support. + + + + + 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 02f97c4..faae5be 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 @@ -30,14 +30,12 @@ import org.x4o.xml.element.DefaultElementObjectPropertyValue; import org.x4o.xml.element.ElementObjectPropertyValueException; import net.forwardfire.vasc.backend.AbstractVascBackend; +import net.forwardfire.vasc.backend.VascBackendException; import net.forwardfire.vasc.backend.VascBackendState; -import net.forwardfire.vasc.core.VascEntry; -import net.forwardfire.vasc.core.VascEntryField; -import net.forwardfire.vasc.core.entry.VascEntryFieldValue; -import net.forwardfire.vasc.core.entry.VascEntryRecordCreator; -import net.forwardfire.vasc.core.VascException; -import net.forwardfire.vasc.impl.entry.BeanPropertyVascEntryFieldValue; -import net.forwardfire.vasc.impl.entry.BeanVascEntryRecordCreator; +import net.forwardfire.vasc.backend.VascEntryFieldValue; +import net.forwardfire.vasc.backend.VascEntryRecordCreator; +import net.forwardfire.vasc.backend.data.BeanVascEntryFieldValue; +import net.forwardfire.vasc.backend.data.BeanVascEntryRecordCreator; /** * @@ -103,7 +101,7 @@ public class TestModelVascDataSource { return modelList; } - public List execute(VascBackendState state) throws VascException { + public List execute(VascBackendState state) throws VascBackendException { if (state.getDataParameterKeys().isEmpty()==false) { List result = new ArrayList(modelList.size()/2); DefaultElementObjectPropertyValue helper = new DefaultElementObjectPropertyValue(); @@ -139,26 +137,28 @@ public class TestModelVascDataSource { } } - public void persist(Object object) throws VascException { + public void persist(Object object) throws VascBackendException { modelList.add(object); } - public Object merge(Object object) throws VascException { + public Object merge(Object object) throws VascBackendException { if(modelList.contains(object)==false) { modelList.add(object); } return object; } - public void delete(Object object) throws VascException { + public void delete(Object object) throws VascBackendException { modelList.remove(object); } - - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { - return new BeanPropertyVascEntryFieldValue(field.getBackendName()); + + @Override + public VascEntryFieldValue provideVascEntryFieldValue() { + return new BeanVascEntryFieldValue(); } - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { + @Override + public VascEntryRecordCreator provideVascEntryRecordCreator() { return new BeanVascEntryRecordCreator(modelClass); }