diff --git a/vasc-backend-jpa/.classpath b/vasc-backend-jpa/.classpath
new file mode 100644
index 0000000..f42fb64
--- /dev/null
+++ b/vasc-backend-jpa/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/vasc-backend-jpa/.project b/vasc-backend-jpa/.project
new file mode 100644
index 0000000..360d79e
--- /dev/null
+++ b/vasc-backend-jpa/.project
@@ -0,0 +1,23 @@
+
+
+ vasc-backend-jpa
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.maven.ide.eclipse.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.maven.ide.eclipse.maven2Nature
+
+
diff --git a/vasc-backend-jpa/.settings/org.eclipse.jdt.core.prefs b/vasc-backend-jpa/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..bbcbec6
--- /dev/null
+++ b/vasc-backend-jpa/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,6 @@
+#Mon Aug 30 21:55:23 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/vasc-backend-jpa/.settings/org.maven.ide.eclipse.prefs b/vasc-backend-jpa/.settings/org.maven.ide.eclipse.prefs
new file mode 100644
index 0000000..116bf53
--- /dev/null
+++ b/vasc-backend-jpa/.settings/org.maven.ide.eclipse.prefs
@@ -0,0 +1,9 @@
+#Mon Aug 30 21:55:22 CEST 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
diff --git a/vasc-backend-jpa/pom.xml b/vasc-backend-jpa/pom.xml
new file mode 100644
index 0000000..e8952e5
--- /dev/null
+++ b/vasc-backend-jpa/pom.xml
@@ -0,0 +1,30 @@
+
+ 4.0.0
+
+ vasc-base
+ com.idcanet.vasc
+ 0.3-SNAPSHOT
+
+ com.idcanet.vasc
+ vasc-backend-jpa
+ 0.3-SNAPSHOT
+
+
+ com.idcanet.vasc
+ vasc-core
+ ${project.version}
+
+
+ javax.persistence
+ persistence-api
+ 1.0
+ provided
+
+
+ org.hibernate
+ hibernate-annotations
+ 3.4.0.GA
+ provided
+
+
+
\ No newline at end of file
diff --git a/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/AbstractHibernateVascBackend.java b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/AbstractHibernateVascBackend.java
new file mode 100644
index 0000000..173373d
--- /dev/null
+++ b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/AbstractHibernateVascBackend.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.backends.jpa;
+
+import org.hibernate.Session;
+
+import com.idcanet.vasc.core.AbstractVascBackend;
+import com.idcanet.vasc.core.VascException;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+abstract public class AbstractHibernateVascBackend extends AbstractVascBackend {
+
+ /**
+ * Provides a hibernate session which is closed !! when transaction is compleeted.
+ * @return
+ */
+ abstract Session getHibernateSession();
+
+ public void persist(Object object) throws VascException {
+ Session s = getHibernateSession();
+ try {
+ s.getTransaction().begin();
+ s.persist(object);
+ s.getTransaction().commit();
+ } finally {
+ if (s!=null && s.isOpen()) {
+ if (s.getTransaction().isActive()) {
+ s.getTransaction().rollback();
+ }
+ //s.close();
+ }
+ }
+ }
+
+ public Object merge(Object object) throws VascException {
+ Session s = getHibernateSession();
+ try {
+ s.getTransaction().begin();
+ Object result = s.merge(object);
+ s.getTransaction().commit();
+ return result;
+ } finally {
+ if (s!=null && s.isOpen()) {
+ if (s.getTransaction().isActive()) {
+ s.getTransaction().rollback();
+ }
+ //s.close();
+ }
+ }
+ }
+
+ public void delete(Object object) throws VascException {
+ Session s = getHibernateSession();
+ try {
+ s.getTransaction().begin();
+ Object newObject = s.merge(object);
+ s.delete(newObject);
+ s.getTransaction().commit();
+ } finally {
+ if (s!=null && s.isOpen()) {
+ if (s.getTransaction().isActive()) {
+ s.getTransaction().rollback();
+ }
+ //s.close();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/AbstractPersistenceVascBackend.java b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/AbstractPersistenceVascBackend.java
new file mode 100644
index 0000000..ac57e7c
--- /dev/null
+++ b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/AbstractPersistenceVascBackend.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.backends.jpa;
+
+import java.lang.reflect.Method;
+
+import javax.persistence.EntityManager;
+
+import com.idcanet.vasc.core.AbstractVascBackend;
+import com.idcanet.vasc.core.VascException;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend {
+
+ protected boolean emTransaction = true;
+
+ abstract EntityManager getEntityManager();
+
+ public void persist(Object object) throws VascException {
+ EntityManager s = getEntityManager();
+ try {
+ if (emTransaction) {
+ s.getTransaction().begin();
+ }
+ s.persist(object);
+ if (emTransaction) {
+ s.getTransaction().commit();
+ }
+ } finally {
+ if (s!=null) {
+ //s.close();
+ }
+ }
+ }
+
+ public Object merge(Object object) throws VascException {
+ EntityManager s = getEntityManager();
+ try {
+ if (emTransaction) {
+ s.getTransaction().begin();
+ }
+ Object result = s.merge(object);
+ if (emTransaction) {
+ s.getTransaction().commit();
+ }
+ return result;
+ } finally {
+ if (s!=null) {
+ //s.close();
+ }
+ }
+ }
+
+ public void delete(Object object) throws VascException {
+ EntityManager s = getEntityManager();
+ try {
+ if (emTransaction) {
+ s.getTransaction().begin();
+ }
+ Object newObject = s.merge(object);
+ s.remove(newObject);
+ if (emTransaction) {
+ s.getTransaction().commit();
+ }
+ } finally {
+ if (s!=null) {
+ //s.close();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/EntityManagerProvider.java b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/EntityManagerProvider.java
new file mode 100644
index 0000000..16b08b0
--- /dev/null
+++ b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/EntityManagerProvider.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.backends.jpa;
+
+import javax.persistence.EntityManager;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2009
+ */
+public interface EntityManagerProvider {
+
+ public EntityManager getEntityManager();
+
+ public boolean hasEntityManagerTransaction();
+}
\ No newline at end of file
diff --git a/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/HibernateSessionProvider.java b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/HibernateSessionProvider.java
new file mode 100644
index 0000000..f9f4173
--- /dev/null
+++ b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/HibernateSessionProvider.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.backends.jpa;
+
+import org.hibernate.Session;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2009
+ */
+public interface HibernateSessionProvider {
+
+ public Session getHibernateSession();
+}
\ No newline at end of file
diff --git a/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/XpqlHibernateVascBackend.java b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/XpqlHibernateVascBackend.java
new file mode 100644
index 0000000..f241dac
--- /dev/null
+++ b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/XpqlHibernateVascBackend.java
@@ -0,0 +1,433 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.backends.jpa;
+
+import java.util.List;
+
+import org.hibernate.Hibernate;
+import org.hibernate.Query;
+import org.hibernate.Session;
+
+import com.idcanet.vasc.backends.BeanVascEntryFieldValue;
+import com.idcanet.vasc.backends.BeanVascEntryRecordCreator;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.entry.VascEntryFieldValue;
+import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
+import com.idcanet.xtes.xpql.query.QueryParameterValue;
+
+/**
+ * Manages persistance with xpql queries
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 17, 2009
+ */
+public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
+
+ private HibernateSessionProvider hibernateSessionProvider = null;
+
+ private com.idcanet.xtes.xpql.query.Query query = null;
+
+ private com.idcanet.xtes.xpql.query.Query queryTotal = null;
+
+ private com.idcanet.xtes.xpql.query.Query queryMoveUp = null;
+
+ private com.idcanet.xtes.xpql.query.Query queryMoveUpDown = null;
+
+ private com.idcanet.xtes.xpql.query.Query queryMoveDown = null;
+
+ private com.idcanet.xtes.xpql.query.Query queryMoveDownUp = null;
+
+ private Class> resultClass = null;
+
+ public XpqlHibernateVascBackend() {
+ }
+
+ /**
+ * @see com.idcanet.vasc.backends.jpa.AbstractPersistenceVascBackend#getEntityManager()
+ */
+ @Override
+ Session getHibernateSession() {
+ return hibernateSessionProvider.getHibernateSession();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List execute(VascBackendState state) throws VascException {
+
+ // Copy parameters
+ for (String key:state.getDataParameterKeys()) {
+ Object value = state.getDataParameter(key);
+ query.setQueryParameter(key, value);
+ if (queryTotal!=null) {
+ queryTotal.setQueryParameter(key, value);
+ }
+ }
+
+ Session s = getHibernateSession();
+ try {
+ s.getTransaction().begin();
+ Query q = s.createQuery(query.toPreparedSQL(query));
+ List values = query.getOrderQueryParameterValues();
+ int i = 0;
+ for (QueryParameterValue value:values) {
+ Object valueObject = value.getValue();
+ if (valueObject!=null) {
+ q.setParameter(i,valueObject);
+ } else {
+ q.setParameter(i,valueObject,Hibernate.INTEGER);
+ }
+ i++;
+ }
+ if (isPageable()) {
+ q.setFirstResult(state.getPageIndex());
+ q.setMaxResults(state.getPageSize());
+ }
+ List data = q.list();
+ s.getTransaction().commit();
+ return data;
+ } finally {
+ if (s!=null) {
+ //em.close();
+ }
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
+ */
+ public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
+ BeanVascEntryFieldValue result = new BeanVascEntryFieldValue();
+ return result;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
+ */
+ public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
+ return new BeanVascEntryRecordCreator(resultClass);
+ }
+
+ /**
+ * @return the query
+ */
+ public com.idcanet.xtes.xpql.query.Query getQuery() {
+ return query;
+ }
+
+ /**
+ * @param query the query to set
+ */
+ public void setQuery(com.idcanet.xtes.xpql.query.Query query) {
+ this.query = query;
+ }
+
+ /**
+ * @return the queryTotal
+ */
+ public com.idcanet.xtes.xpql.query.Query getQueryTotal() {
+ return queryTotal;
+ }
+
+ /**
+ * @param queryTotal the queryTotal to set
+ */
+ public void setQueryTotal(com.idcanet.xtes.xpql.query.Query queryTotal) {
+ this.queryTotal = queryTotal;
+ }
+
+ /**
+ * @return the resultClass
+ */
+ public Class> getResultClass() {
+ return resultClass;
+ }
+
+ /**
+ * @param resultClass the resultClass to set
+ */
+ public void setResultClass(Class> resultClass) {
+ this.resultClass = resultClass;
+ }
+
+ /**
+ * @return the hibernateSessionProvider
+ */
+ public HibernateSessionProvider getHibernateSessionProvider() {
+ return hibernateSessionProvider;
+ }
+
+ /**
+ * @param hibernateSessionProvider the hibernateSessionProvider to set
+ */
+ public void setHibernateSessionProvider(HibernateSessionProvider hibernateSessionProvider) {
+ this.hibernateSessionProvider = hibernateSessionProvider;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackend#isPageable()
+ */
+ @Override
+ public boolean isPageable() {
+ if (queryTotal==null) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
+ */
+ public long fetchTotalExecuteSize(VascBackendState state) {
+ Session s = getHibernateSession();
+ try {
+ s.getTransaction().begin();
+ Query q = s.createQuery(queryTotal.toPreparedSQL(queryTotal));
+ List values = queryTotal.getOrderQueryParameterValues();
+ int i = 0;
+ for (QueryParameterValue value:values) {
+ Object valueObject = value.getValue();
+ if (valueObject!=null) {
+ q.setParameter(i,valueObject);
+ } else {
+ q.setParameter(i,valueObject,Hibernate.INTEGER);
+ }
+ i++;
+ }
+ Long resultTotal = (Long)q.uniqueResult();
+ s.getTransaction().commit();
+ return resultTotal;
+ } finally {
+ if (s!=null) {
+ //em.close();
+ }
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackend#doRecordMoveDownById(java.lang.Object)
+ */
+ @Override
+ public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
+ long result = 0l;
+ if (queryMoveDown!=null) {
+ Session s = getHibernateSession();
+ try {
+ s.getTransaction().begin();
+
+ // Copy parameters
+ for (String key:state.getDataParameterKeys()) {
+ Object value = state.getDataParameter(key);
+ queryMoveDown.setQueryParameter(key, value);
+ }
+
+ // set id
+ queryMoveDown.setQueryParameter("id", primaryId);
+
+ // execute update
+ Query q = s.createQuery(queryMoveDown.toPreparedSQL(queryMoveDown));
+ List values = queryMoveDown.getOrderQueryParameterValues();
+ int i = 0;
+ for (QueryParameterValue value:values) {
+ Object valueObject = value.getValue();
+ if (valueObject!=null) {
+ q.setParameter(i,valueObject);
+ } else {
+ q.setParameter(i,valueObject,Hibernate.INTEGER);
+ }
+ i++;
+ }
+ result+=q.executeUpdate();
+
+ // Copy parameters
+ for (String key:state.getDataParameterKeys()) {
+ Object value = state.getDataParameter(key);
+ queryMoveDownUp.setQueryParameter(key, value);
+ }
+
+ // set id
+ queryMoveDownUp.setQueryParameter("id", primaryId);
+
+ // execute update
+ q = s.createQuery(queryMoveDownUp.toPreparedSQL(queryMoveDownUp));
+ values = queryMoveDownUp.getOrderQueryParameterValues();
+ i = 0;
+ for (QueryParameterValue value:values) {
+ Object valueObject = value.getValue();
+ if (valueObject!=null) {
+ q.setParameter(i,valueObject);
+ } else {
+ q.setParameter(i,valueObject,Hibernate.INTEGER);
+ }
+ i++;
+ }
+ result+=q.executeUpdate();
+
+ s.getTransaction().commit();
+ } finally {
+ if (s!=null) {
+ //em.close();
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackend#doRecordMoveUpById(java.lang.Object)
+ */
+ @Override
+ public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
+ long result = 0l;
+ if (queryMoveUp!=null) {
+ Session s = getHibernateSession();
+ try {
+ s.getTransaction().begin();
+
+ // Copy parameters
+ for (String key:state.getDataParameterKeys()) {
+ Object value = state.getDataParameter(key);
+ queryMoveUp.setQueryParameter(key, value);
+ }
+
+ // set id
+ queryMoveUp.setQueryParameter("id", primaryId);
+
+ // execute update
+ Query q = s.createQuery(queryMoveUp.toPreparedSQL(queryMoveUp));
+ List values = queryMoveUp.getOrderQueryParameterValues();
+ int i = 0;
+ for (QueryParameterValue value:values) {
+ Object valueObject = value.getValue();
+ if (valueObject!=null) {
+ q.setParameter(i,valueObject);
+ } else {
+ q.setParameter(i,valueObject,Hibernate.INTEGER);
+ }
+ i++;
+ }
+ result+=q.executeUpdate();
+
+ // Copy parameters
+ for (String key:state.getDataParameterKeys()) {
+ Object value = state.getDataParameter(key);
+ queryMoveUpDown.setQueryParameter(key, value);
+ }
+
+ // set id
+ queryMoveUpDown.setQueryParameter("id", primaryId);
+
+ // execute update
+ q = s.createQuery(queryMoveUpDown.toPreparedSQL(queryMoveUpDown));
+ values = queryMoveUpDown.getOrderQueryParameterValues();
+ i = 0;
+ for (QueryParameterValue value:values) {
+ Object valueObject = value.getValue();
+ if (valueObject!=null) {
+ q.setParameter(i,valueObject);
+ } else {
+ q.setParameter(i,valueObject,Hibernate.INTEGER);
+ }
+ i++;
+ }
+ result+=q.executeUpdate();
+
+ s.getTransaction().commit();
+ } finally {
+ if (s!=null) {
+ //em.close();
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackend#isRecordMoveable()
+ */
+ @Override
+ public boolean isRecordMoveable() {
+ return queryMoveUp!=null & queryMoveDown!=null;
+ }
+
+ /**
+ * @return the queryMoveUp
+ */
+ public com.idcanet.xtes.xpql.query.Query getQueryMoveUp() {
+ return queryMoveUp;
+ }
+
+ /**
+ * @param queryMoveUp the queryMoveUp to set
+ */
+ public void setQueryMoveUp(com.idcanet.xtes.xpql.query.Query queryMoveUp) {
+ this.queryMoveUp = queryMoveUp;
+ }
+
+ /**
+ * @return the queryMoveDown
+ */
+ public com.idcanet.xtes.xpql.query.Query getQueryMoveDown() {
+ return queryMoveDown;
+ }
+
+ /**
+ * @param queryMoveDown the queryMoveDown to set
+ */
+ public void setQueryMoveDown(com.idcanet.xtes.xpql.query.Query queryMoveDown) {
+ this.queryMoveDown = queryMoveDown;
+ }
+
+ /**
+ * @return the queryMoveUpDown
+ */
+ public com.idcanet.xtes.xpql.query.Query getQueryMoveUpDown() {
+ return queryMoveUpDown;
+ }
+
+ /**
+ * @param queryMoveUpDown the queryMoveUpDown to set
+ */
+ public void setQueryMoveUpDown(com.idcanet.xtes.xpql.query.Query queryMoveUpDown) {
+ this.queryMoveUpDown = queryMoveUpDown;
+ }
+
+ /**
+ * @return the queryMoveDownUp
+ */
+ public com.idcanet.xtes.xpql.query.Query getQueryMoveDownUp() {
+ return queryMoveDownUp;
+ }
+
+ /**
+ * @param queryMoveDownUp the queryMoveDownUp to set
+ */
+ public void setQueryMoveDownUp(com.idcanet.xtes.xpql.query.Query queryMoveDownUp) {
+ this.queryMoveDownUp = queryMoveDownUp;
+ }
+}
\ No newline at end of file
diff --git a/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/XpqlPersistanceVascBackend.java b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/XpqlPersistanceVascBackend.java
new file mode 100644
index 0000000..94497c8
--- /dev/null
+++ b/vasc-backend-jpa/src/main/java/com/idcanet/vasc/backends/jpa/XpqlPersistanceVascBackend.java
@@ -0,0 +1,437 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.backends.jpa;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import com.idcanet.vasc.backends.BeanVascEntryFieldValue;
+import com.idcanet.vasc.backends.BeanVascEntryRecordCreator;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.entry.VascEntryFieldValue;
+import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
+import com.idcanet.xtes.xpql.query.QueryParameterValue;
+
+/**
+ * Manages persistance with xpql queries
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 17, 2009
+ */
+public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend {
+
+ private EntityManagerProvider entityManagerProvider = null;
+
+ private com.idcanet.xtes.xpql.query.Query query = null;
+
+ private com.idcanet.xtes.xpql.query.Query queryTotal = null;
+
+ private com.idcanet.xtes.xpql.query.Query queryMoveUp = null;
+
+ private com.idcanet.xtes.xpql.query.Query queryMoveUpDown = null;
+
+ private com.idcanet.xtes.xpql.query.Query queryMoveDown = null;
+
+ private com.idcanet.xtes.xpql.query.Query queryMoveDownUp = null;
+
+ private Class> resultClass = null;
+
+ public XpqlPersistanceVascBackend() {
+ }
+
+ /**
+ * @see com.idcanet.vasc.backends.jpa.AbstractPersistenceVascBackend#getEntityManager()
+ */
+ @Override
+ EntityManager getEntityManager() {
+ emTransaction=entityManagerProvider.hasEntityManagerTransaction();
+ return entityManagerProvider.getEntityManager();
+ }
+
+
+
+ @SuppressWarnings("unchecked")
+ public List execute(VascBackendState state) throws VascException {
+
+ // Copy parameters
+ for (String key:state.getDataParameterKeys()) {
+ Object value = state.getDataParameter(key);
+ //System.out.println("Set para pame: "+key+" value: "+value);
+ query.setQueryParameter(key, value);
+ if (queryTotal!=null) {
+ queryTotal.setQueryParameter(key, value);
+ }
+ }
+
+ EntityManager em = getEntityManager();
+ try {
+ Query q = em.createQuery(query.toPreparedSQL(query));
+ List values = query.getOrderQueryParameterValues();
+ int i = 1;
+ for (QueryParameterValue value:values) {
+ Object valueObject = value.getValue();
+ q.setParameter(i,valueObject);
+ //System.out.println("Set para index: "+i+" value: "+valueObject+" valueClass: "+valueObject.getClass()+" valueType: "+value.getValueType());
+ i++;
+ }
+ if (isPageable()) {
+ q.setFirstResult(state.getPageIndex());
+ q.setMaxResults(state.getPageSize());
+ }
+ if (emTransaction) {
+ em.getTransaction().begin();
+ }
+ List data = q.getResultList();
+ if (emTransaction) {
+ em.getTransaction().commit();
+ }
+ return data;
+ } finally {
+ if (em!=null) {
+ //em.close();
+ }
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
+ */
+ public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
+ VascEntryFieldValue result = new BeanVascEntryFieldValue();
+ return result;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
+ */
+ public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
+ VascEntryRecordCreator result = new BeanVascEntryRecordCreator(resultClass);
+ return result;
+ }
+
+ /**
+ * @return the query
+ */
+ public com.idcanet.xtes.xpql.query.Query getQuery() {
+ return query;
+ }
+
+ /**
+ * @param query the query to set
+ */
+ public void setQuery(com.idcanet.xtes.xpql.query.Query query) {
+ this.query = query;
+ }
+
+ /**
+ * @return the queryTotal
+ */
+ public com.idcanet.xtes.xpql.query.Query getQueryTotal() {
+ return queryTotal;
+ }
+
+ /**
+ * @param queryTotal the queryTotal to set
+ */
+ public void setQueryTotal(com.idcanet.xtes.xpql.query.Query queryTotal) {
+ this.queryTotal = queryTotal;
+ }
+
+ /**
+ * @return the resultClass
+ */
+ public Class> getResultClass() {
+ return resultClass;
+ }
+
+ /**
+ * @param resultClass the resultClass to set
+ */
+ public void setResultClass(Class> resultClass) {
+ this.resultClass = resultClass;
+ }
+
+ /**
+ * @return the entityManagerProvider
+ */
+ public EntityManagerProvider getEntityManagerProvider() {
+ return entityManagerProvider;
+ }
+
+ /**
+ * @param entityManagerProvider the entityManagerProvider to set
+ */
+ public void setEntityManagerProvider(EntityManagerProvider entityManagerProvider) {
+ this.entityManagerProvider = entityManagerProvider;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackend#isPageable()
+ */
+ @Override
+ public boolean isPageable() {
+ if (queryTotal==null) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
+ */
+ public long fetchTotalExecuteSize(VascBackendState state) {
+ EntityManager em = getEntityManager();
+ try {
+ Query q = em.createQuery(queryTotal.toPreparedSQL(queryTotal));
+ List values = queryTotal.getOrderQueryParameterValues();
+ int i = 1;
+ for (QueryParameterValue value:values) {
+ q.setParameter(i,value.getValue());
+ i++;
+ }
+ if (emTransaction) {
+ em.getTransaction().begin();
+ }
+ Long resultTotal = (Long)q.getSingleResult();
+ if (emTransaction) {
+ em.getTransaction().commit();
+ }
+ return resultTotal;
+ } finally {
+ if (em!=null) {
+ //em.close();
+ }
+ }
+ }
+
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackend#doRecordMoveDownById(VascBackendState state,java.lang.Object)
+ */
+ @Override
+ public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
+ long result = 0l;
+ if (queryMoveDown!=null) {
+ EntityManager em = getEntityManager();
+ try {
+ if (emTransaction) {
+ em.getTransaction().begin();
+ }
+
+ // Copy parameters
+ for (String key:state.getDataParameterKeys()) {
+ Object value = state.getDataParameter(key);
+ queryMoveDown.setQueryParameter(key, value);
+ }
+
+ // set id
+ queryMoveDown.setQueryParameter("id", primaryId);
+
+ // execute update
+ Query q = em.createQuery(queryMoveDown.toPreparedSQL(queryMoveDown));
+ List values = queryMoveDown.getOrderQueryParameterValues();
+ int i = 1;
+ for (QueryParameterValue value:values) {
+ q.setParameter(i,value.getValue());
+ i++;
+ }
+ result+=q.executeUpdate();
+
+ // Copy parameters
+ for (String key:state.getDataParameterKeys()) {
+ Object value = state.getDataParameter(key);
+ queryMoveDownUp.setQueryParameter(key, value);
+ }
+
+ // set id
+ queryMoveDownUp.setQueryParameter("id", primaryId);
+
+ // execute update
+ q = em.createQuery(queryMoveDownUp.toPreparedSQL(queryMoveDownUp));
+ values = queryMoveDownUp.getOrderQueryParameterValues();
+ i = 1;
+ for (QueryParameterValue value:values) {
+ q.setParameter(i,value.getValue());
+ i++;
+ }
+ result+=q.executeUpdate();
+
+ if (emTransaction) {
+ em.getTransaction().commit();
+ }
+ } finally {
+ if (em!=null) {
+ //em.close();
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackend#doRecordMoveUpById(VascBackendState state,java.lang.Object)
+ */
+ @Override
+ public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
+ long result = 0l;
+ if (queryMoveUp!=null) {
+ EntityManager em = getEntityManager();
+ try {
+ if (emTransaction) {
+ em.getTransaction().begin();
+ }
+
+ // Copy parameters
+ for (String key:state.getDataParameterKeys()) {
+ Object value = state.getDataParameter(key);
+ queryMoveUp.setQueryParameter(key, value);
+ }
+
+ // set id
+ queryMoveUp.setQueryParameter("id", primaryId);
+
+ // execute update
+ Query q = em.createQuery(queryMoveUp.toPreparedSQL(queryMoveUp));
+ List values = queryMoveUp.getOrderQueryParameterValues();
+ int i = 1;
+ for (QueryParameterValue value:values) {
+ q.setParameter(i,value.getValue());
+ i++;
+ }
+ result+=q.executeUpdate();
+
+ // Copy parameters
+ for (String key:state.getDataParameterKeys()) {
+ Object value = state.getDataParameter(key);
+ queryMoveUpDown.setQueryParameter(key, value);
+ }
+
+ // set id
+ queryMoveUpDown.setQueryParameter("id", primaryId);
+
+ // execute update
+ q = em.createQuery(queryMoveUpDown.toPreparedSQL(queryMoveUpDown));
+ values = queryMoveUpDown.getOrderQueryParameterValues();
+ i = 1;
+ for (QueryParameterValue value:values) {
+ q.setParameter(i,value.getValue());
+ i++;
+ }
+ result+=q.executeUpdate();
+
+ if (emTransaction) {
+ em.getTransaction().commit();
+ }
+ } finally {
+ if (em!=null) {
+ //em.close();
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackend#isRecordMoveable()
+ */
+ @Override
+ public boolean isRecordMoveable() {
+ return queryMoveUp!=null & queryMoveDown!=null;
+ }
+
+ /**
+ * @return the queryMoveUp
+ */
+ public com.idcanet.xtes.xpql.query.Query getQueryMoveUp() {
+ return queryMoveUp;
+ }
+
+ /**
+ * @param queryMoveUp the queryMoveUp to set
+ */
+ public void setQueryMoveUp(com.idcanet.xtes.xpql.query.Query queryMoveUp) {
+ this.queryMoveUp = queryMoveUp;
+ }
+
+ /**
+ * @return the queryMoveDown
+ */
+ public com.idcanet.xtes.xpql.query.Query getQueryMoveDown() {
+ return queryMoveDown;
+ }
+
+ /**
+ * @param queryMoveDown the queryMoveDown to set
+ */
+ public void setQueryMoveDown(com.idcanet.xtes.xpql.query.Query queryMoveDown) {
+ this.queryMoveDown = queryMoveDown;
+ }
+
+ /**
+ * @return the queryMoveUpDown
+ */
+ public com.idcanet.xtes.xpql.query.Query getQueryMoveUpDown() {
+ return queryMoveUpDown;
+ }
+
+ /**
+ * @param queryMoveUpDown the queryMoveUpDown to set
+ */
+ public void setQueryMoveUpDown(com.idcanet.xtes.xpql.query.Query queryMoveUpDown) {
+ this.queryMoveUpDown = queryMoveUpDown;
+ }
+
+ /**
+ * @return the queryMoveDownUp
+ */
+ public com.idcanet.xtes.xpql.query.Query getQueryMoveDownUp() {
+ return queryMoveDownUp;
+ }
+
+ /**
+ * @param queryMoveDownUp the queryMoveDownUp to set
+ */
+ public void setQueryMoveDownUp(com.idcanet.xtes.xpql.query.Query queryMoveDownUp) {
+ this.queryMoveDownUp = queryMoveDownUp;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isSearchable()
+ */
+ public boolean isSearchable() {
+ if (query.getQueryParameterValue("text_search")==null) {
+ return false;
+ }
+ //return true;
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/vasc-backend-ldap/.classpath b/vasc-backend-ldap/.classpath
new file mode 100644
index 0000000..f42fb64
--- /dev/null
+++ b/vasc-backend-ldap/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/vasc-backend-ldap/.project b/vasc-backend-ldap/.project
new file mode 100644
index 0000000..a227e5c
--- /dev/null
+++ b/vasc-backend-ldap/.project
@@ -0,0 +1,23 @@
+
+
+ vasc-backend-ldap
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.maven.ide.eclipse.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.maven.ide.eclipse.maven2Nature
+
+
diff --git a/vasc-backend-ldap/.settings/org.eclipse.jdt.core.prefs b/vasc-backend-ldap/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..f908acb
--- /dev/null
+++ b/vasc-backend-ldap/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,6 @@
+#Mon Aug 30 21:55:41 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/vasc-backend-ldap/.settings/org.maven.ide.eclipse.prefs b/vasc-backend-ldap/.settings/org.maven.ide.eclipse.prefs
new file mode 100644
index 0000000..71b266b
--- /dev/null
+++ b/vasc-backend-ldap/.settings/org.maven.ide.eclipse.prefs
@@ -0,0 +1,9 @@
+#Mon Aug 30 21:55:40 CEST 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
diff --git a/vasc-backend-ldap/pom.xml b/vasc-backend-ldap/pom.xml
new file mode 100644
index 0000000..9c963ae
--- /dev/null
+++ b/vasc-backend-ldap/pom.xml
@@ -0,0 +1,24 @@
+
+ 4.0.0
+
+ vasc-base
+ com.idcanet.vasc
+ 0.3-SNAPSHOT
+
+ com.idcanet.vasc
+ vasc-backend-ldap
+ 0.3-SNAPSHOT
+
+
+
+ com.idcanet.vasc
+ vasc-core
+ ${project.version}
+
+
+ com.novell.ldap
+ jldap
+ ${jldap.version}
+
+
+
\ No newline at end of file
diff --git a/vasc-backend-ldap/src/main/java/com/idcanet/vasc/backends/ldap/LdapConnectionProvider.java b/vasc-backend-ldap/src/main/java/com/idcanet/vasc/backends/ldap/LdapConnectionProvider.java
new file mode 100644
index 0000000..a519c76
--- /dev/null
+++ b/vasc-backend-ldap/src/main/java/com/idcanet/vasc/backends/ldap/LdapConnectionProvider.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.backends.ldap;
+
+import com.novell.ldap.LDAPConnection;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 4, 2008
+ */
+public interface LdapConnectionProvider {
+
+ public LDAPConnection getLdapConnection();
+}
\ No newline at end of file
diff --git a/vasc-backend-ldap/src/main/java/com/idcanet/vasc/backends/ldap/LdapVascBackend.java b/vasc-backend-ldap/src/main/java/com/idcanet/vasc/backends/ldap/LdapVascBackend.java
new file mode 100644
index 0000000..12eee3d
--- /dev/null
+++ b/vasc-backend-ldap/src/main/java/com/idcanet/vasc/backends/ldap/LdapVascBackend.java
@@ -0,0 +1,331 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.backends.ldap;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.idcanet.vasc.backends.MapVascEntryFieldValue;
+import com.idcanet.vasc.backends.MapVascEntryRecordCreator;
+import com.idcanet.vasc.core.AbstractVascBackend;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.entry.VascEntryFieldValue;
+import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
+import com.novell.ldap.LDAPAttribute;
+import com.novell.ldap.LDAPAttributeSet;
+import com.novell.ldap.LDAPConnection;
+import com.novell.ldap.LDAPEntry;
+import com.novell.ldap.LDAPModification;
+import com.novell.ldap.LDAPSearchConstraints;
+import com.novell.ldap.LDAPSearchResults;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 4, 2008
+ */
+public class LdapVascBackend extends AbstractVascBackend {
+
+
+ private LdapConnectionProvider ldapConnectionProvider = null;
+ private String baseDN = null;
+ private String keyAttribute = null;
+ private String ldapFilter = null;
+
+
+ /**
+ * @return the ldapConnectionProvider
+ */
+ public LdapConnectionProvider getLdapConnectionProvider() {
+ return ldapConnectionProvider;
+ }
+
+ /**
+ * @param ldapConnectionProvider the ldapConnectionProvider to set
+ */
+ public void setLdapConnectionProvider(LdapConnectionProvider ldapConnectionProvider) {
+ this.ldapConnectionProvider = ldapConnectionProvider;
+ }
+
+
+
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#execute()
+ */
+ public List execute(VascBackendState state) throws VascException {
+ LdapConnectionProvider prov = getLdapConnectionProvider();
+ LDAPConnection connection = prov.getLdapConnection();
+ List result = new ArrayList(50);
+ try {
+
+
+ LDAPSearchConstraints cons = new LDAPSearchConstraints();
+ cons.setBatchSize( 0 );
+ cons.setTimeLimit( 10000 ) ;
+ cons.setReferralFollowing(true);
+ connection.setConstraints(cons);
+
+ int searchScope = LDAPConnection.SCOPE_ONE;
+ String searchBase = baseDN;
+
+ //System.out.println("Reading object :" + searchBase + " with filter: " + ldapFilter);
+ LDAPSearchResults searchResults = connection.search(
+ searchBase, // object to read
+ searchScope, // scope - read single object
+ ldapFilter, // search filter
+ null, // return all attributes
+ false); // return attrs and values
+
+ while (searchResults.hasMore()) {
+ LDAPEntry entry = searchResults.next();
+ Map map = new HashMap(10);
+
+ LDAPAttributeSet attributeSet = entry.getAttributeSet();
+ Iterator i = attributeSet.iterator();
+ while (i.hasNext()) {
+ LDAPAttribute attr = i.next();
+ //System.out.println("ATTR: "+attr.getName()+" value: "+attr.getStringValue());
+ String[] s = attr.getStringValueArray();
+ if (s.length==1) {
+ map.put(attr.getName(), attr.getStringValue());
+ } else {
+ List multiValue = new ArrayList(s.length);
+ for (String ss:s) {
+ multiValue.add(ss);
+ }
+ map.put(attr.getName(), multiValue );
+ }
+ }
+ result.add(map);
+ }
+ } catch (Exception e) {
+ throw new VascException(e);
+ } finally {
+ if (connection!=null) {
+ connection.clone();
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#merge(java.lang.Object)
+ */
+ public Object merge(Object object) throws VascException {
+ LdapConnectionProvider prov = getLdapConnectionProvider();
+ LDAPConnection connection = prov.getLdapConnection();
+ try {
+ Map map = (Map)object;
+ String keyValue = (String)map.get(keyAttribute);
+ LDAPSearchConstraints cons = new LDAPSearchConstraints();
+ cons.setBatchSize( 0 );
+ cons.setTimeLimit( 10000 ) ;
+ cons.setReferralFollowing(true);
+ connection.setConstraints(cons);
+
+ int searchScope = LDAPConnection.SCOPE_ONE;
+ String searchBase = baseDN;
+ String filter = "(&("+keyAttribute+"="+keyValue+"))";
+ System.out.println("ldap filter: "+filter);
+ LDAPSearchResults searchResults = connection.search(
+ searchBase, // object to read
+ searchScope, // scope - read single object
+ filter, // search filter
+ null, // return all attributes
+ false); // return attrs and values
+
+ if (searchResults.hasMore()==false) {
+ // no result to mod
+ return object;
+ }
+ LDAPEntry entry = searchResults.next();
+ List mods = new ArrayList(20);
+ for (String key:map.keySet()) {
+ Object value = map.get(key);
+ LDAPAttribute attr = entry.getAttribute(key);
+
+ String[] s = attr.getStringValueArray();
+ if (s.length==1) {
+ String v = (String)value;
+ if (attr.getStringValue().equals(v)==false) {
+ LDAPModification mod = new LDAPModification(LDAPModification.REPLACE,new LDAPAttribute(key,v));
+ mods.add(mod);
+ }
+ map.put(attr.getName(), attr.getStringValue());
+ } else {
+ List multiValue = new ArrayList(s.length);
+ for (String ss:s) {
+ multiValue.add(ss);
+ }
+ List v = null;
+ if (value instanceof String) {
+ v = new ArrayList(1);
+ v.add((String)value);
+ } else {
+ v = (List)value;
+ }
+ if (v.equals(multiValue)==false) {
+ LDAPAttribute a = new LDAPAttribute(key);
+ for (String vv:v) {
+ a.addValue(vv);
+ }
+ LDAPModification mod = new LDAPModification(LDAPModification.REPLACE,a);
+ mods.add(mod);
+ }
+ }
+ }
+
+ LDAPModification[] m = new LDAPModification[mods.size()];
+ mods.toArray(m);
+ connection.modify(entry.getDN(), m);
+ return object;
+ } catch (Exception e) {
+ throw new VascException(e);
+ } finally {
+ if (connection!=null) {
+ connection.clone();
+ }
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#persist(java.lang.Object)
+ */
+ public void persist(Object object) throws VascException {
+ LdapConnectionProvider prov = getLdapConnectionProvider();
+ LDAPConnection connection = prov.getLdapConnection();
+ try {
+ LDAPEntry entry = new LDAPEntry();
+ // entry.getAttributeSet().
+
+ connection.add(entry);
+ } catch (Exception e) {
+ throw new VascException(e);
+ } finally {
+ if (connection!=null) {
+ connection.clone();
+ }
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#delete(java.lang.Object)
+ */
+ public void delete(Object object) throws VascException {
+ LdapConnectionProvider prov = getLdapConnectionProvider();
+ LDAPConnection connection = prov.getLdapConnection();
+ try {
+ Map map = (Map)object;
+ String keyValue = (String)map.get(keyAttribute);
+ int searchScope = LDAPConnection.SCOPE_ONE;
+ String searchBase = baseDN;
+ String filter = "(&("+ldapFilter+")("+keyAttribute+"="+keyValue+"))";
+ LDAPSearchResults searchResults = connection.search(
+ searchBase, // object to read
+ searchScope, // scope - read single object
+ filter, // search filter
+ null, // return all attributes
+ false); // return attrs and values
+
+ if (searchResults.hasMore()==false) {
+ // no result to mod
+ return;
+ }
+ LDAPEntry entry = searchResults.next();
+ connection.delete(entry.getDN());
+ } catch (Exception e) {
+ throw new VascException(e);
+ } finally {
+ if (connection!=null) {
+ connection.clone();
+ }
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
+ */
+ public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
+ return new MapVascEntryRecordCreator();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
+ */
+ public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
+ return new MapVascEntryFieldValue();
+ }
+
+ /**
+ * @return the baseDN
+ */
+ public String getBaseDN() {
+ return baseDN;
+ }
+
+ /**
+ * @param baseDN the baseDN to set
+ */
+ public void setBaseDN(String baseDN) {
+ this.baseDN = baseDN;
+ }
+
+ /**
+ * @return the keyAttribute
+ */
+ public String getKeyAttribute() {
+ return keyAttribute;
+ }
+
+ /**
+ * @param keyAttribute the keyAttribute to set
+ */
+ public void setKeyAttribute(String keyAttribute) {
+ this.keyAttribute = keyAttribute;
+ }
+
+ /**
+ * @return the ldapFilter
+ */
+ public String getLdapFilter() {
+ return ldapFilter;
+ }
+
+ /**
+ * @param ldapFilter the ldapFilter to set
+ */
+ public void setLdapFilter(String ldapFilter) {
+ this.ldapFilter = ldapFilter;
+ }
+}
\ No newline at end of file
diff --git a/vasc-backend-ldap/src/main/java/com/idcanet/vasc/backends/ldap/SimpleLdapConnectionProvider.java b/vasc-backend-ldap/src/main/java/com/idcanet/vasc/backends/ldap/SimpleLdapConnectionProvider.java
new file mode 100644
index 0000000..b14df75
--- /dev/null
+++ b/vasc-backend-ldap/src/main/java/com/idcanet/vasc/backends/ldap/SimpleLdapConnectionProvider.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.backends.ldap;
+
+import com.novell.ldap.LDAPConnection;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 4, 2008
+ */
+public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
+
+ private String ldapHost = "localhost";
+ private int ldapPort = LDAPConnection.DEFAULT_PORT;
+ private int ldapVersion = LDAPConnection.LDAP_V3;
+ private String bindUser = null;
+ private String bindPass = null;
+
+ /**
+ * @see com.idcanet.vasc.backends.ldap.LdapConnectionProvider#getLdapConnection()
+ */
+ public LDAPConnection getLdapConnection() {
+ try {
+
+ // if ssl;
+ //Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
+ //System.setProperty("javax.net.ssl.trustStore", "/tmp/somewhere/ldap.root.crt");
+ //LDAPSocketFactory ssf = new LDAPJSSESecureSocketFactory();
+ // Set the socket factory as the default for all future connections
+ //LDAPConnection.setSocketFactory(ssf);
+
+ LDAPConnection lc = new LDAPConnection();
+ lc.connect( ldapHost, ldapPort );
+ if (bindUser!=null && bindPass!=null) {
+ lc.bind( ldapVersion, bindUser, bindPass.getBytes("UTF8") );
+ }
+ return lc;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * @return the ldapHost
+ */
+ public String getLdapHost() {
+ return ldapHost;
+ }
+
+ /**
+ * @param ldapHost the ldapHost to set
+ */
+ public void setLdapHost(String ldapHost) {
+ this.ldapHost = ldapHost;
+ }
+
+ /**
+ * @return the ldapPort
+ */
+ public int getLdapPort() {
+ return ldapPort;
+ }
+
+ /**
+ * @param ldapPort the ldapPort to set
+ */
+ public void setLdapPort(int ldapPort) {
+ this.ldapPort = ldapPort;
+ }
+
+ /**
+ * @return the ldapVersion
+ */
+ public int getLdapVersion() {
+ return ldapVersion;
+ }
+
+ /**
+ * @param ldapVersion the ldapVersion to set
+ */
+ public void setLdapVersion(int ldapVersion) {
+ this.ldapVersion = ldapVersion;
+ }
+
+ /**
+ * @return the bindUser
+ */
+ public String getBindUser() {
+ return bindUser;
+ }
+
+ /**
+ * @param bindUser the bindUser to set
+ */
+ public void setBindUser(String bindUser) {
+ this.bindUser = bindUser;
+ }
+
+
+ /**
+ * @return the bindPass
+ */
+ public String getBindPass() {
+ return bindPass;
+ }
+
+ /**
+ * @param bindPass the bindPass to set
+ */
+ public void setBindPass(String bindPass) {
+ this.bindPass = bindPass;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/.classpath b/vasc-core/.classpath
new file mode 100644
index 0000000..f42fb64
--- /dev/null
+++ b/vasc-core/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/vasc-core/.project b/vasc-core/.project
new file mode 100644
index 0000000..fe68099
--- /dev/null
+++ b/vasc-core/.project
@@ -0,0 +1,23 @@
+
+
+ vasc-core
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.maven.ide.eclipse.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.maven.ide.eclipse.maven2Nature
+
+
diff --git a/vasc-core/.settings/org.eclipse.jdt.core.prefs b/vasc-core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..c43663a
--- /dev/null
+++ b/vasc-core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,6 @@
+#Mon Aug 30 22:00:13 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/vasc-core/.settings/org.maven.ide.eclipse.prefs b/vasc-core/.settings/org.maven.ide.eclipse.prefs
new file mode 100644
index 0000000..311bf6b
--- /dev/null
+++ b/vasc-core/.settings/org.maven.ide.eclipse.prefs
@@ -0,0 +1,9 @@
+#Mon Aug 30 22:00:12 CEST 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
diff --git a/vasc-core/pom.xml b/vasc-core/pom.xml
new file mode 100644
index 0000000..23913af
--- /dev/null
+++ b/vasc-core/pom.xml
@@ -0,0 +1,35 @@
+
+ 4.0.0
+
+ vasc-base
+ com.idcanet.vasc
+ 0.3-SNAPSHOT
+
+ com.idcanet.vasc
+ vasc-core
+ 0.3-SNAPSHOT
+
+
+ com.idcanet.x4o
+ x4o-core
+ ${x4o-core.version}
+
+
+ com.idcanet.xtes
+ xtes-xpql
+ ${xtes-xpql.version}
+
+
+ javax.persistence
+ persistence-api
+ 1.0
+ provided
+
+
+ org.hibernate
+ hibernate-validator
+ 3.1.0.CR1
+ provided
+
+
+
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascBackend.java b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascBackend.java
new file mode 100644
index 0000000..f745a75
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascBackend.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.Map;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Aug 2, 2007
+ */
+abstract public class AbstractVascBackend implements VascBackend {
+
+ private String id = null;
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#setId(java.lang.String)
+ */
+ public void setId(String id) {
+ if (id==null) {
+ throw new IllegalArgumentException("id may not be null");
+ }
+ this.id=id;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isPageable()
+ */
+ public boolean isPageable() {
+ return false;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
+ */
+ public long fetchTotalExecuteSize(VascBackendState state) {
+ return 0;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isSearchable()
+ */
+ public boolean isSearchable() {
+ return false;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isSortable()
+ */
+ public boolean isSortable() {
+ return false;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isRecordMoveable()
+ */
+ public boolean isRecordMoveable() {
+ return false;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#doRecordMoveDownById(java.lang.Object)
+ */
+ public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
+ return 0l;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#doRecordMoveUpById(java.lang.Object)
+ */
+ public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
+ return 0l;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#executePageSummary()
+ */
+ public Map executePageSummary() {
+ return null;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#executeTotalSummary()
+ */
+ public Map executeTotalSummary() {
+ return null;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isPageSummary()
+ */
+ public boolean isPageSummary() {
+ return false;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isTotalSummary()
+ */
+ public boolean isTotalSummary() {
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascBackendProxy.java b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascBackendProxy.java
new file mode 100644
index 0000000..78894d7
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascBackendProxy.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.List;
+import java.util.Map;
+
+import com.idcanet.vasc.core.entry.VascEntryFieldValue;
+import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Apr 1, 2009
+ */
+abstract public class AbstractVascBackendProxy implements VascBackend {
+
+ protected VascBackend backend = null;
+
+ public AbstractVascBackendProxy(VascBackend backend) {
+ if (backend==null) {
+ throw new NullPointerException("backend object mey not be null.");
+ }
+ this.backend=backend;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
+ */
+ public long fetchTotalExecuteSize(VascBackendState state) {
+ return backend.fetchTotalExecuteSize(state);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isSortable()
+ */
+ public boolean isSortable() {
+ return backend.isSortable();
+ }
+
+ /**
+ * @throws Exception
+ * @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
+ */
+ public List execute(VascBackendState state) throws VascException {
+ return backend.execute(state);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#delete(java.lang.Object)
+ */
+ public void delete(Object object) throws VascException {
+ backend.delete(object);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isPageable()
+ */
+ public boolean isPageable() {
+ return backend.isPageable();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isSearchable()
+ */
+ public boolean isSearchable() {
+ return backend.isSearchable();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#merge(java.lang.Object)
+ */
+ public Object merge(Object object) throws VascException {
+ return backend.merge(object);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#persist(java.lang.Object)
+ */
+ public void persist(Object object) throws VascException {
+ backend.persist(object);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#provideVascEntryFieldValue(com.idcanet.vasc.core.VascEntryField)
+ */
+ public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
+ return backend.provideVascEntryFieldValue(field);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#provideVascEntryRecordCreator(com.idcanet.vasc.core.VascEntry)
+ */
+ public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
+ return backend.provideVascEntryRecordCreator(vascEntry);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#getId()
+ */
+ public String getId() {
+ return backend.getId();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#setId(java.lang.String)
+ */
+ public void setId(String id) {
+ backend.setId(id);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#doRecordMoveDownById(VascBackendState state,java.lang.Object)
+ */
+ public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
+ return backend.doRecordMoveDownById(state,primaryId);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#doRecordMoveUpById(VascBackendState state,java.lang.Object)
+ */
+ public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
+ return backend.doRecordMoveUpById(state,primaryId);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isRecordMoveable()
+ */
+ public boolean isRecordMoveable() {
+ return backend.isRecordMoveable();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#executePageSummary()
+ */
+ public Map executePageSummary() {
+ return backend.executePageSummary();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#executeTotalSummary()
+ */
+ public Map executeTotalSummary() {
+ return backend.executeTotalSummary();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isPageSummary()
+ */
+ public boolean isPageSummary() {
+ return backend.isPageSummary();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isTotalSummary()
+ */
+ public boolean isTotalSummary() {
+ return backend.isTotalSummary();
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascBackendState.java b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascBackendState.java
new file mode 100644
index 0000000..e4fc903
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascBackendState.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 26, 2009
+ */
+abstract public class AbstractVascBackendState implements VascBackendState {
+
+ private static final long serialVersionUID = 1L;
+ protected Map parameters = null;
+ private int pageIndex = 0;
+ private int pageSize = 0;
+ private int pageSizeMax = 0;
+ private String sortField = null;
+ private String searchString = null;
+ private boolean ascending = true;
+ //private long pagesTotalRecords = 0;
+
+ public AbstractVascBackendState() {
+ parameters = new HashMap(10);
+ }
+
+ public void setDataParameter(String key,Object data) {
+ parameters.put(key,data);
+ }
+
+ public Object getDataParameter(String key) {
+ return parameters.get(key);
+ }
+
+ public Set getDataParameterKeys() {
+ return parameters.keySet();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#getPageIndex()
+ */
+ public int getPageIndex() {
+ return pageIndex;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#setPageIndex(int)
+ */
+ public void setPageIndex(int pageIndex) {
+ this.pageIndex=pageIndex;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#getPageSize()
+ */
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#setPageSize(int)
+ */
+ public void setPageSize(int pageSize) {
+ this.pageSize=pageSize;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#getSearchString()
+ */
+ public String getSearchString() {
+ return searchString;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#setSearchString(java.lang.String)
+ */
+ public void setSearchString(String searchString) {
+ this.searchString=searchString;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isSortAscending()
+ */
+ public boolean isSortAscending() {
+ return ascending;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#setSortAscending(boolean)
+ */
+ public void setSortAscending(boolean ascending) {
+ this.ascending=ascending;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#getSortField()
+ */
+ public String getSortField() {
+ return sortField;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#setSortField(java.lang.String)
+ */
+ public void setSortField(String sortField) {
+ this.sortField=sortField;
+ }
+
+ /**
+ * @return the pageSizeMax
+ */
+ public int getPageSizeMax() {
+ return pageSizeMax;
+ }
+
+ /**
+ * @param pageSizeMax the pageSizeMax to set
+ */
+ public void setPageSizeMax(int pageSizeMax) {
+ this.pageSizeMax = pageSizeMax;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascEntryFieldType.java b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascEntryFieldType.java
new file mode 100644
index 0000000..1167f14
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascEntryFieldType.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.idcanet.vasc.core.ui.VascUIComponent;
+import com.idcanet.vasc.core.ui.VascValueModel;
+import com.idcanet.vasc.validators.VascValidator;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Aug 2, 2007
+ */
+abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
+
+ private static final long serialVersionUID = 1L;
+ protected String id = null;
+ protected Class> autoDetectClass = null;
+ protected List vascValidators = null;
+ protected Map properties = null;
+
+ protected Object dataObject = null;
+ protected String uiComponentId = null;
+ protected String inputMask = null;
+
+ public AbstractVascEntryFieldType() {
+ vascValidators = new ArrayList(4);
+ properties = new HashMap();
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ abstract public VascEntryFieldType clone() throws CloneNotSupportedException;
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#setId(java.lang.String)
+ */
+ public void setId(String id) {
+ this.id=id;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#getProperty(java.lang.String)
+ */
+ public String getProperty(String name) {
+ return properties.get(name);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#setProperty(java.lang.String, java.lang.String)
+ */
+ public void setProperty(String name, String value) {
+ properties.put(name, value);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#getPropertyNames()
+ */
+ public List getPropertyNames() {
+ return new ArrayList(properties.keySet());
+ }
+
+ /**
+ * @return the dataObject
+ */
+ public Object getDataObject() {
+ return dataObject;
+ }
+
+ /**
+ * @param dataObject the dataObject to set
+ */
+ public void setDataObject(Object dataObject) {
+ this.dataObject = dataObject;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#getVascValidators()
+ */
+ public List getVascValidators() {
+ return vascValidators;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#addVascValidator(com.idcanet.vasc.validators.VascValidator)
+ */
+ public void addVascValidator(VascValidator vascValidator) {
+ vascValidators.add(vascValidator);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#removeVascValidator(com.idcanet.vasc.validators.VascValidator)
+ */
+ public void removeVascValidator(VascValidator vascValidator) {
+ vascValidators.remove(vascValidator);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#getAutoDetectClass()
+ */
+ public Class> getAutoDetectClass() {
+ return autoDetectClass;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#setAutoDetectClass(java.lang.Class)
+ */
+ public void setAutoDetectClass(Class> autoDetectClass) {
+ this.autoDetectClass=autoDetectClass;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#getInputMask()
+ */
+ public String getInputMask() {
+ return inputMask;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#setInputMask(java.lang.String)
+ */
+ public void setInputMask(String inputMask) {
+ this.inputMask=inputMask;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#getUIComponentId()
+ */
+ public String getUIComponentId() {
+ return uiComponentId;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#setUIComponentId(java.lang.String)
+ */
+ public void setUIComponentId(String uiComponentId) {
+ this.uiComponentId=uiComponentId;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#getUIComponentCount()
+ */
+ public int getUIComponentCount(VascEntryField entryField) throws VascException {
+ return 1;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#provideEditorUIComponent(int)
+ */
+ public VascUIComponent provideEditorUIComponent(int index,VascEntryField entryField) throws VascException {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null) {
+ cl = entryField.getClass().getClassLoader(); // fallback
+ }
+ String compId = getUIComponentId();
+ if (compId==null) {
+ compId = VascUIComponent.VASC_TEXT;
+ }
+ return entryField.getVascEntry().getVascFrontendData().getVascUIComponent(compId);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#provideLabelUIComponent(int)
+ */
+ public VascUIComponent provideLabelUIComponent(int index,VascEntryField entryField) throws VascException {
+ return entryField.getVascEntry().getVascFrontendData().getVascUIComponent(VascUIComponent.VASC_LABEL);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldType#provideEditorVascValueModel()
+ */
+ public VascValueModel provideEditorVascValueModel(int index,VascEntryField entryField) throws VascException {
+ if (index>0) {
+ throw new IllegalArgumentException("You have to override provideEditorVascValueModel if multi editor support is needed");
+ }
+ VascValueModel model = new VascValueModel();
+ return model;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascEntryState.java b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascEntryState.java
new file mode 100644
index 0000000..cb88124
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascEntryState.java
@@ -0,0 +1,142 @@
+/**
+ *
+ */
+package com.idcanet.vasc.core;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Holds all default state values
+ *
+ * @author Willem Cazander
+ * @version 1.0 Dec 15, 2009
+ */
+abstract public class AbstractVascEntryState implements VascEntryState {
+
+ private static final long serialVersionUID = 1L;
+ private List entryDataList = null;
+ private Object entryDataObject = null;
+ private Long totalBackendRecords = null;
+ private VascBackendState vascBackendState = null;
+ private VascEntryState state = null;
+ private Map multiActionSelection = null;
+ private boolean isEditCreate = false;
+ private VascBackend vascBackend = null;
+ private VascEntry vascEntry = null;
+
+ public AbstractVascEntryState() {
+ entryDataList = new ArrayList(0);
+ multiActionSelection = new HashMap(200);
+ }
+
+ /**
+ * @return the entryDataList
+ */
+ public List getEntryDataList() {
+ return entryDataList;
+ }
+
+ /**
+ * @param entryDataList the entryDataList to set
+ */
+ public void setEntryDataList(List entryDataList) {
+ this.entryDataList = entryDataList;
+ }
+
+ /**
+ * @return the entryDataObject
+ */
+ public Object getEntryDataObject() {
+ return entryDataObject;
+ }
+
+ /**
+ * @param entryDataObject the entryDataObject to set
+ */
+ public void setEntryDataObject(Object entryDataObject) {
+ this.entryDataObject = entryDataObject;
+ }
+
+ /**
+ * @return the vascBackendState
+ */
+ public VascBackendState getVascBackendState() {
+ return vascBackendState;
+ }
+
+ /**
+ * @param vascBackendState the vascBackendState to set
+ */
+ public void setVascBackendState(VascBackendState vascBackendState) {
+ this.vascBackendState = vascBackendState;
+ }
+
+ /**
+ * @return the totalBackendRecords
+ */
+ public Long getTotalBackendRecords() {
+ return totalBackendRecords;
+ }
+
+ /**
+ * @param totalBackendRecords the totalBackendRecords to set
+ */
+ public void setTotalBackendRecords(Long totalBackendRecords) {
+ this.totalBackendRecords = totalBackendRecords;
+ }
+
+ public void setParent(VascEntryState state) {
+ this.state=state;
+ }
+
+ public VascEntryState getParent() {
+ return state;
+ }
+
+ public void setMultiActionSelection(Map multiActionSelection) {
+ this.multiActionSelection=multiActionSelection;
+ }
+ public Map getMultiActionSelection() {
+ return multiActionSelection;
+ }
+
+ /**
+ * @return the vascBackend
+ */
+ public VascBackend getVascBackend() {
+ return vascBackend;
+ }
+
+ /**
+ * @param vascBackend the vascBackend to set
+ */
+ public void setVascBackend(VascBackend vascBackend) {
+ this.vascBackend = vascBackend;
+ }
+
+
+ /**
+ * @return the isEditCreate
+ */
+ public boolean isEditCreate() {
+ return isEditCreate;
+ }
+
+ /**
+ * @param isEditCreate the isEditCreate to set
+ */
+ public void setEditCreate(boolean isEditCreate) {
+ this.isEditCreate = isEditCreate;
+ }
+
+ public void setVascEntry(VascEntry vascEntry) {
+ this.vascEntry=vascEntry;
+ }
+ public VascEntry getVascEntry() {
+ return vascEntry;
+ }
+
+}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascFrontend.java b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascFrontend.java
new file mode 100644
index 0000000..ca2ea20
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/AbstractVascFrontend.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Aug 2, 2007
+ */
+abstract public class AbstractVascFrontend implements VascFrontend {
+
+ private String id = null;
+ protected VascEntry entry = null;
+
+ protected String i18n(String key,Object...params) {
+ return entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(key,params);
+ }
+
+ protected Object i18nImage(String key) {
+ return entry.getVascFrontendData().getVascEntryResourceImageResolver().getImageValue(entry,key);
+ }
+
+
+ public VascEntry getVascEntry() {
+ return entry;
+ }
+
+ abstract protected void addUiComponents();
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontend#initEntry(com.idcanet.vasc.core.VascEntry)
+ */
+ public void initEntry(VascEntry entry) throws Exception {
+ if (entry.getVascFrontendData().getVascFrontend()==null) {
+ entry.getVascFrontendData().setVascFrontend(this);
+ } else {
+ if (entry.getVascFrontendData().getVascFrontend()!=this) {
+ throw new IllegalArgumentException("VascEntry has already a differtent VascFrontend attected");
+ }
+ }
+ this.entry=entry;
+ addUiComponents();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontend#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontend#setId(java.lang.String)
+ */
+ public void setId(String id) {
+ this.id=id;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackend.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackend.java
new file mode 100644
index 0000000..925bf2a
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackend.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.List;
+import java.util.Map;
+
+import com.idcanet.vasc.core.entry.VascEntryFieldValue;
+import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface VascBackend {
+
+ public String getId();
+ public void setId(String id);
+
+ public List execute(VascBackendState state) throws VascException;
+
+ public void persist(Object object) throws VascException;
+
+ public Object merge(Object object) throws VascException;
+
+ public void delete(Object object) throws VascException;
+
+
+ /**
+ * 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);
+
+ /**
+ * 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);
+
+ /**
+ * Defines if the backend supports sorting
+ * @return
+ */
+ public boolean isSortable();
+
+ /**
+ * Defines if the backend supports pageing
+ * @return
+ */
+ public boolean isPageable();
+
+ /**
+ * Returns the total amount of records.
+ * @return
+ */
+ public long fetchTotalExecuteSize(VascBackendState state);
+
+ /**
+ * Defines if the backend supports pageing
+ * @return
+ */
+ public boolean isSearchable();
+
+ /**
+ * Defines if the backend supports moveing an record up or down.
+ * @return
+ */
+ public boolean isRecordMoveable();
+ public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException;
+ public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException;
+
+
+ public boolean isPageSummary();
+ public Map executePageSummary();
+
+ public boolean isTotalSummary();
+ public Map executeTotalSummary();
+
+ /*
+ public boolean hasSettings();
+ public Map getSettings();
+ public void putSetting(String key,String value);
+ */
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendController.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendController.java
new file mode 100644
index 0000000..6a05d43
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendController.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 4, 2008
+ */
+public interface VascBackendController {
+
+ public VascBackend getVascBackendById(String id);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendControllerLocal.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendControllerLocal.java
new file mode 100644
index 0000000..2249590
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendControllerLocal.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Nov 17, 2008
+ */
+public interface VascBackendControllerLocal extends VascBackendController {
+
+ public void addVascBackend(VascBackend backend);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendFilter.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendFilter.java
new file mode 100644
index 0000000..ee4cbd8
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendFilter.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+
+/**
+ * Can filter the data
+ *
+ * @author Willem Cazander
+ * @version 1.0 Apr 28, 2009
+ */
+public interface VascBackendFilter {
+
+ /**
+ * Inits the filter
+ */
+ public void initFilter(VascEntry entry);
+
+ /**
+ * Only filters 1 object.
+ */
+ public Object filterObject(Object object);
+
+ /**
+ * Force impl to have public clone methode
+ * @return
+ * @throws CloneNotSupportedException
+ */
+ public VascBackendFilter clone() throws CloneNotSupportedException;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendPageNumber.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendPageNumber.java
new file mode 100644
index 0000000..c86e947
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendPageNumber.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+
+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.
+ *
+ * @author Willem Cazander
+ * @version 1.0 Apr 25, 2006
+ */
+public class VascBackendPageNumber 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; }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendState.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendState.java
new file mode 100644
index 0000000..cb48a78
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascBackendState.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+ * Holds all the data the backend needs to know to execute its work.
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 26, 2009
+ */
+public interface VascBackendState extends Serializable {
+
+ public void setDataParameter(String key,Object data);
+ public Object getDataParameter(String key);
+ public Set getDataParameterKeys();
+
+ public String getSortField();
+ public void setSortField(String name);
+ public boolean isSortAscending();
+ public void setSortAscending(boolean ascending);
+
+ public void setPageSize(int size);
+ public int getPageSize();
+
+ public void setPageSizeMax(int size);
+ public int getPageSizeMax();
+
+ public void setPageIndex(int index);
+ public int getPageIndex();
+
+ public void setSearchString(String searchString);
+ public String getSearchString();
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascController.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascController.java
new file mode 100644
index 0000000..b202c13
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascController.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+
+/**
+ * Resolvs all the resolvers.
+ * These resolved often point to an external locations.
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 11, 2008
+ */
+public interface VascController {
+
+ /**
+ * @return Returns the VascBackendController
+ */
+ public VascBackendController getVascBackendController();
+
+ /**
+ *
+ * @return Returns the VascEntryController
+ */
+ public VascEntryController getVascEntryController();
+
+ /**
+ *
+ * @return Returns the VascEntryFieldController
+ */
+ public VascEntryFieldTypeController getVascEntryFieldTypeController();
+
+ /**
+ *
+ * @return Returns the VascEventChannelController
+ */
+ public VascEventChannelController getVascEventChannelController();
+
+ /**
+ *
+ * @return Returns the VascUserRoleController
+ */
+ public VascUserRoleController getVascUserRoleController();
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntry.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntry.java
new file mode 100644
index 0000000..70cff2d
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntry.java
@@ -0,0 +1,420 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.idcanet.vasc.core.actions.ColumnVascAction;
+import com.idcanet.vasc.core.actions.GlobalVascAction;
+import com.idcanet.vasc.core.actions.RowVascAction;
+import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
+import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
+import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
+
+/**
+ * The main vasc entry
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface VascEntry extends Cloneable,Serializable {
+
+ /**
+ * @return the id
+ */
+ public String getId();
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id);
+
+ /**
+ * @return the name
+ */
+ public String getName();
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name);
+
+ /**
+ * @return the helpId
+ */
+ public String getHelpId();
+
+ /**
+ * @param helpId the helpId to set
+ */
+ public void setHelpId(String helpId);
+
+ /**
+ * @return the image
+ */
+ public String getImage();
+
+ /**
+ * @param image the image to set
+ */
+ public void setImage(String image);
+
+
+ /**
+ * @return the listDescription
+ */
+ public String getListDescription();
+
+ /**
+ * @param listDescription the listDescription to set
+ */
+ public void setListDescription(String listDescription);
+
+ /**
+ * @return the listImage
+ */
+ public String getListImage();
+
+ /**
+ * @param listImage the listImage to set
+ */
+ public void setListImage(String listImage);
+
+ /**
+ * @return the editDescription
+ */
+ public String getEditDescription();
+
+ /**
+ * @param editDescription the editDescription to set
+ */
+ public void setEditDescription(String editDescription);
+
+ /**
+ * @return the editImage
+ */
+ public String getEditImage();
+
+ /**
+ * @param editImage the editImage to set
+ */
+ public void setEditImage(String editImage);
+
+ /**
+ * @return the deleteDescription
+ */
+ public String getDeleteDescription();
+
+ /**
+ * @param deleteDescription the deleteDescription to set
+ */
+ public void setDeleteDescription(String deleteDescription);
+
+ /**
+ * @return the deleteImage
+ */
+ public String getDeleteImage();
+
+ /**
+ * @param deleteImage the deleteImage to set
+ */
+ public void setDeleteImage(String deleteImage);
+
+ /**
+ * @return the createDescription
+ */
+ public String getCreateDescription();
+
+ /**
+ * @param createDescription the createDescription to set
+ */
+ public void setCreateDescription(String createDescription);
+
+ /**
+ * @return the createImage
+ */
+ public String getCreateImage();
+
+ /**
+ * @param createImage the createImage to set
+ */
+ public void setCreateImage(String createImage);
+
+ /**
+ * @return the primaryKeyField
+ */
+ public String getPrimaryKeyFieldId();
+
+ /**
+ * @param primaryKeyField the primaryKeyField to set
+ */
+ public void setPrimaryKeyFieldId(String primaryKeyField);
+
+ /**
+ * @return the displayNameField
+ */
+ public String getDisplayNameFieldId();
+
+ /**
+ * @param displayNameField the displayNameField to set
+ */
+ public void setDisplayNameFieldId(String displayNameField);
+
+ /**
+ * @return the vascAdminList
+ */
+ public boolean isVascAdminList();
+
+ /**
+ * @param vascAdminList the vascAdminList to set
+ */
+ public void setVascAdminList(boolean vascAdminList);
+
+ /**
+ * @return the vascAdminEdit
+ */
+ public boolean isVascAdminEdit();
+
+ /**
+ * @param vascAdminEdit the vascAdminEdit to set
+ */
+ public void setVascAdminEdit(boolean vascAdminEdit);
+
+ /**
+ * @return the vascAdminCreate
+ */
+ public boolean isVascAdminCreate();
+
+ /**
+ * @param vascAdminCreate the vascAdminCreate to set
+ */
+ public void setVascAdminCreate(boolean vascAdminCreate);
+
+ /**
+ * @return the vascAdminDelete
+ */
+ public boolean isVascAdminDelete();
+
+ /**
+ * @param vascAdminDelete the vascAdminDelete to set
+ */
+ public void setVascAdminDelete(boolean vascAdminDelete);
+
+ /**
+ * @return the vascFields
+ */
+ public List getVascEntryFields();
+
+ /**
+ * @param vascField the vascField to add
+ */
+ public void addVascEntryField(VascEntryField vascField);
+
+ /**
+ * @param vascField the vascField to remove
+ */
+ public void removeVascEntryField(VascEntryField vascField);
+
+ /**
+ * @return the vascField
+ */
+ public VascEntryField getVascEntryFieldById(String id);
+
+ /**
+ * @return the rowActions
+ */
+ public List getRowActions();
+
+ /**
+ * @return the RowVascAction
+ */
+ public RowVascAction getRowActionById(String actionId);
+
+ /**
+ * @param rowAction the rowAction to add
+ */
+ public void addRowAction(RowVascAction rowAction);
+
+ /**
+ * @param rowAction the rowAction to remove
+ */
+ public void removeRowAction(RowVascAction rowAction);
+
+ /**
+ * @return the columnActions
+ */
+ public List getColumnActions();
+
+ /**
+ * @return the ColumnVascAction
+ */
+ public ColumnVascAction getColumnActionById(String actionId);
+
+ /**
+ * @param columnAction the columnAction to add
+ */
+ public void addColumnAction(ColumnVascAction columnAction);
+
+ /**
+ * @param columnAction the columnAction to remove
+ */
+ public void removeColumnAction(ColumnVascAction columnAction);
+
+ /**
+ * @return the globalActions
+ */
+ public List getGlobalActions();
+
+ /**
+ * @return the GlobalVascAction
+ */
+ public GlobalVascAction getGlobalActionById(String actionId);
+
+ /**
+ * @param globalAction the globalAction to add
+ */
+ public void addGlobalAction(GlobalVascAction globalAction);
+
+ /**
+ * @param globalAction the globalAction to remove
+ */
+ public void removeGlobalAction(GlobalVascAction globalAction);
+
+ /**
+ * @return the vascEntryFieldSets
+ */
+ public List getVascEntryFieldSets();
+
+ /**
+ * @return the VascEntryFieldSet
+ */
+ public VascEntryFieldSet getVascEntryFieldSetById(String actionId);
+
+ /**
+ * @param vascEntryFieldSet the vascEntryFieldSet to add
+ */
+ public void addVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet);
+
+ /**
+ * @param vascEntryFieldSet the vascEntryFieldSet to remove
+ */
+ public void removeVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet);
+
+ /**
+ * @return the vascLinkEntries
+ */
+ public List getVascLinkEntries();
+
+ /**
+ * @return the VascLinkEntry
+ */
+ public VascLinkEntry getVascLinkEntryById(String actionId);
+
+ /**
+ * @param vascLinkEntry the vascLinkEntry to add
+ */
+ public void addVascLinkEntry(VascLinkEntry vascLinkEntry);
+
+ /**
+ * @param vascLinkEntry the vascLinkEntry to remover
+ */
+ public void removeVascLinkEntry(VascLinkEntry vascLinkEntry);
+
+ public Object getEntryParameter(String key);
+ public void setEntryParameter(String key,Object value);
+ public List getEntryParameterKeys();
+
+ public VascFrontendData getVascFrontendData();
+ public void setVascFrontendData(VascFrontendData vascFrontendData);
+
+ public String getBackendId();
+ public void setBackendId(String backendId);
+
+
+
+ /**
+ * @return the vascDisplayOnly
+ */
+ public boolean isVascDisplayOnly();
+
+ /**
+ * @param vascDisplayOnly the vascDisplayOnly to set
+ */
+ public void setVascDisplayOnly(boolean vascDisplayOnly);
+
+
+ /**
+ * @return the vascEntryFieldEventChannel
+ */
+ public VascEntryFieldEventChannel getVascEntryFieldEventChannel();
+
+ /**
+ * @param vascEntryFieldEventChannel the vascEntryFieldEventChannel to set
+ */
+ public void setVascEntryFieldEventChannel(VascEntryFieldEventChannel vascEntryFieldEventChannel);
+
+ /**
+ * Added an VascEntryBackendEventListener
+ * @param listener The class of the event listener.
+ */
+ public void addVascEntryBackendEventListener(Class listener);
+
+ /**
+ * Returns the list of VascEntryBackendEventListener
+ * @return
+ */
+ public List> getVascEntryBackendEventListeners();
+
+ /**
+ * Added an VascEntryFrontendEventListener
+ * @param listener The class of the event listener.
+ */
+ public void addVascEntryFrontendEventListener(Class listener);
+
+ /**
+ * Returns the list of VascEntryFrontendEventListener
+ * @return
+ */
+ public List> getVascEntryFrontendEventListeners();
+
+
+ public void addListOption(VascEntryField listOption);
+ public List getListOptions();
+
+
+ public void addVascBackendFilter(VascBackendFilter filter);
+ public List getVascBackendFilters();
+
+ /**
+ * Force impl to have public clone methode
+ * @return
+ * @throws CloneNotSupportedException
+ */
+ public VascEntry clone() throws CloneNotSupportedException;
+}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryController.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryController.java
new file mode 100644
index 0000000..16bd5fe
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryController.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.List;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 4, 2008
+ */
+public interface VascEntryController {
+
+ public VascEntry getVascEntryById(String id);
+
+ public List getVascEntryIds();
+
+ public List getVascEntryAdminIds();
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryControllerLocal.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryControllerLocal.java
new file mode 100644
index 0000000..3c38f4f
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryControllerLocal.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+
+/**
+ * The local interface which is not used in controllers.
+ * But is needed to be able to add entry in a safe way.
+ *
+ * @author Willem Cazander
+ * @version 1.0 Nov 16, 2008
+ */
+public interface VascEntryControllerLocal extends VascEntryController {
+
+ public void addVascEntry(VascEntry entry,VascController vascController) throws VascException;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryField.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryField.java
new file mode 100644
index 0000000..b8e9733
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryField.java
@@ -0,0 +1,387 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.idcanet.vasc.core.entry.VascEntryFieldValue;
+import com.idcanet.vasc.validators.VascValidator;
+
+/**
+ * Defines an VascEntryField
+ *
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface VascEntryField extends Cloneable,Serializable {
+
+ /**
+ * @return the VascEntry
+ */
+ public VascEntry getVascEntry();
+
+ /**
+ * @param entry the VascEntry to set
+ */
+ public void setVascEntry(VascEntry entry);
+
+ /**
+ * @return the id
+ */
+ public String getId();
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id);
+
+ /**
+ * @return the vascEntryFieldType
+ */
+ public VascEntryFieldType getVascEntryFieldType();
+
+ /**
+ * @param vascEntryFieldType the vascEntryFieldType to set
+ */
+ public void setVascEntryFieldType(VascEntryFieldType vascEntryFieldType);
+
+ /**
+ * @return the backendName
+ */
+ public String getBackendName();
+
+ /**
+ * @param backendName the backendName to set
+ */
+ public void setBackendName(String backendName);
+
+ /**
+ * @return the vascEntryFieldValue
+ */
+ public VascEntryFieldValue getVascEntryFieldValue();
+
+ /**
+ * @param vascEntryFieldValue the vascEntryFieldValue to set
+ */
+ public void setVascEntryFieldValue(VascEntryFieldValue vascEntryFieldValue);
+
+ /**
+ * @return the vascValidators
+ */
+ public List getVascValidators();
+
+ /**
+ * @param vascValidator the vascValidator to add
+ */
+ public void addVascValidator(VascValidator vascValidator);
+
+ /**
+ * @param vascValidator the vascValidator to remove
+ */
+ public void removeVascValidator(VascValidator vascValidator);
+
+ /**
+ * @return the name
+ */
+ public String getName();
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name);
+
+ /**
+ * @return the description
+ */
+ public String getDescription();
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description);
+
+ /**
+ * @return the helpId
+ */
+ public String getHelpId();
+
+ /**
+ * @param helpId the helpId to set
+ */
+ public void setHelpId(String helpId);
+
+ /**
+ * @return the image
+ */
+ public String getImage();
+
+ /**
+ * @param image the image to set
+ */
+ public void setImage(String image);
+
+ /**
+ * @return the defaultValue
+ */
+ public Object getDefaultValue();
+
+ /**
+ * @param defaultValue the defaultValue to set
+ */
+ public void setDefaultValue(Object defaultValue);
+
+ /**
+ * @return the sizeList
+ */
+ public Integer getSizeList();
+
+ /**
+ * @param sizeList the sizeList to set
+ */
+ public void setSizeList(Integer sizeList);
+
+ /**
+ * @return the sizeEdit
+ */
+ public Integer getSizeEdit();
+
+ /**
+ * @param sizeEdit the sizeEdit to set
+ */
+ public void setSizeEdit(Integer sizeEdit);
+
+ /**
+ * @return the styleList
+ */
+ public String getStyleList();
+
+ /**
+ * @param styleList the styleList to set
+ */
+ public void setStyleList(String styleList);
+
+ /**
+ * @return the styleEdit
+ */
+ public String getStyleEdit();
+
+ /**
+ * @param styleEdit the styleEdit to set
+ */
+ public void setStyleEdit(String styleEdit);
+
+ /**
+ * @return the choices
+ */
+ public String getChoices();
+
+ /**
+ * @param choices the choices to set
+ */
+ public void setChoices(String choices);
+
+ /**
+ * @return the view
+ */
+ public Boolean getView();
+
+ /**
+ * @param view the view to set
+ */
+ public void setView(Boolean view);
+
+ /**
+ * @return the optional
+ */
+ public Boolean getOptional();
+
+ /**
+ * @param optional the optional to set
+ */
+ public void setOptional(Boolean optional);
+
+ /**
+ * @return the create
+ */
+ public Boolean getCreate();
+
+ /**
+ * @param create the create to set
+ */
+ public void setCreate(Boolean create);
+
+ /**
+ * @return the edit
+ */
+ public Boolean getEdit();
+
+ /**
+ * @param edit the edit to set
+ */
+ public void setEdit(Boolean edit);
+
+ /**
+ * @return the editReadOnly
+ */
+ public Boolean getEditReadOnly();
+
+ /**
+ * @param editReadOnly the editReadOnly to set
+ */
+ public void setEditReadOnly(Boolean editReadOnly);
+
+ /**
+ * @return the list
+ */
+ public Boolean getList();
+
+ /**
+ * @param list the list to set
+ */
+ public void setList(Boolean list);
+
+ /**
+ * @return the rolesCreate
+ */
+ public String getRolesCreate();
+
+ /**
+ * @param rolesCreate the rolesCreate to set
+ */
+ public void setRolesCreate(String rolesCreate);
+
+ /**
+ * @return the rolesEdit
+ */
+ public String getRolesEdit();
+
+ /**
+ * @param rolesEdit the rolesEdit to set
+ */
+ public void setRolesEdit(String rolesEdit);
+
+ /**
+ * @return the rolesEditReadOnly
+ */
+ public String getRolesEditReadOnly();
+
+ /**
+ * @param rolesEditReadOnly the rolesEditReadOnly to set
+ */
+ public void setRolesEditReadOnly(String rolesEditReadOnly);
+
+ /**
+ * @return the rolesList
+ */
+ public String getRolesList();
+
+ /**
+ * @param rolesList the rolesList to set
+ */
+ public void setRolesList(String rolesList);
+
+
+ /**
+ * @return the choicesAsRadio
+ */
+ public Boolean getChoicesAsRadio();
+
+ /**
+ * @param choicesAsRadio the choicesAsRadio to set
+ */
+ public void setChoicesAsRadio(Boolean choicesAsRadio);
+
+ /**
+ * @return the editBlank
+ */
+ public Boolean getEditBlank();
+
+ /**
+ * @param editBlank the editBlank to set
+ */
+ public void setEditBlank(Boolean editBlank);
+
+ /**
+ * @return the displayName
+ */
+ public String getDisplayName();
+
+ /**
+ * @param displayName the displayName to set
+ */
+ public void setDisplayName(String displayName);
+
+ /**
+ * @return the orderIndex
+ */
+ public Integer getOrderIndex();
+
+ /**
+ * @param orderIndex the orderIndex to set
+ */
+ public void setOrderIndex(Integer orderIndex);
+
+ /**
+ * @return the sortable
+ */
+ public Boolean getSortable();
+
+ /**
+ * @param sortable the sortable to set
+ */
+ public void setSortable(Boolean sortable);
+
+ /**
+ * @return the sumable
+ */
+ public Boolean getSumable();
+
+ /**
+ * @param sumable the sumable to set
+ */
+ public void setSumable(Boolean sumable);
+
+ /**
+ * @return the graphable
+ */
+ public Boolean getGraphable();
+
+ /**
+ * @param graphable the graphable to set
+ */
+ public void setGraphable(Boolean graphable);
+
+ /**
+ * Force impl to have public clone methode
+ * @return
+ * @throws CloneNotSupportedException
+ */
+ public VascEntryField clone() throws CloneNotSupportedException;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldSet.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldSet.java
new file mode 100644
index 0000000..3fce41f
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldSet.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.List;
+
+/**
+ * Orgenisess Fields
+ *
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 56, 2008
+ */
+public interface VascEntryFieldSet extends Cloneable {
+
+ /**
+ * @return the id
+ */
+ public String getId();
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id);
+
+ /**
+ * @return the name
+ */
+ public String getName();
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name);
+
+ /**
+ * @return the description
+ */
+ public String getDescription();
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description);
+
+ /**
+ * @return the helpId
+ */
+ public String getHelpId();
+
+ /**
+ * @param helpId the helpId to set
+ */
+ public void setHelpId(String helpId);
+
+ /**
+ * @return the image
+ */
+ public String getImage();
+
+ /**
+ * @param image the image to set
+ */
+ public void setImage(String image);
+
+ /**
+ * @return the styleList
+ */
+ public String getStyleList();
+
+ /**
+ * @param styleList the styleList to set
+ */
+ public void setStyleList(String styleList);
+
+ /**
+ * @return the styleEdit
+ */
+ public String getStyleEdit();
+
+ /**
+ * @param styleEdit the styleEdit to set
+ */
+ public void setStyleEdit(String styleEdit);
+
+ /**
+ * @return the collapsed
+ */
+ public boolean isCollapsed();
+
+ /**
+ * @param collapsed the collapsed to set
+ */
+ public void setCollapsed(boolean collapsed);
+
+ /**
+ * @return the optional
+ */
+ public boolean isOptional();
+
+ /**
+ * @param optional the optional to set
+ */
+ public void setOptional(boolean optional);
+
+ /**
+ * @return the vascEntryFieldIds
+ */
+ public List getVascEntryFieldIds();
+
+ /**
+ * Add and VascEntryFieldId
+ * @param vascEntryFieldIds the vascEntryFieldIds to add
+ */
+ public void addVascEntryFieldId(String vascEntryFieldId);
+
+ /**
+ * Removes and VascEntryFieldId
+ * @param vascEntryFieldIds the vascEntryFieldIds to remove
+ */
+ public void removeVascEntryFieldId(String vascEntryFieldId);
+
+ /**
+ * Force impl to have public clone methode
+ * @return
+ * @throws CloneNotSupportedException
+ */
+ public VascEntryFieldSet clone() throws CloneNotSupportedException;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldType.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldType.java
new file mode 100644
index 0000000..32698c4
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldType.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.idcanet.vasc.core.ui.VascUIComponent;
+import com.idcanet.vasc.core.ui.VascValueModel;
+import com.idcanet.vasc.validators.VascValidator;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface VascEntryFieldType extends Serializable {
+
+ public String getId();
+ public void setId(String id);
+
+ public String getUIComponentId();
+ public void setUIComponentId(String uiComponentId);
+
+ public String getInputMask();
+ public void setInputMask(String inputMask);
+
+ public Class> getAutoDetectClass();
+ public void setAutoDetectClass(Class> classObject);
+
+ public void addVascValidator(VascValidator vascValidator);
+ public void removeVascValidator(VascValidator vascValidator);
+ public List getVascValidators();
+
+ public void setProperty(String name,String value);
+ public String getProperty(String name);
+ public List getPropertyNames();
+
+ public void setDataObject(Object data);
+ public Object getDataObject();
+
+ public int getUIComponentCount(VascEntryField entryField) throws VascException;
+ public VascUIComponent provideLabelUIComponent(int index,VascEntryField entryField) throws VascException;
+ public VascUIComponent provideEditorUIComponent(int index,VascEntryField entryField) throws VascException;
+ public VascValueModel provideEditorVascValueModel(int index,VascEntryField entryField) throws VascException;
+
+ /**
+ * Force impl to have public clone methode
+ * @return
+ * @throws CloneNotSupportedException
+ */
+ public VascEntryFieldType clone() throws CloneNotSupportedException;
+}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeController.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeController.java
new file mode 100644
index 0000000..115067a
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeController.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.List;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 4, 2008
+ */
+public interface VascEntryFieldTypeController {
+
+ public VascEntryFieldType getVascEntryFieldTypeById(String id);
+
+ public List getVascEntryFieldTypeIds();
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeControllerLocal.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeControllerLocal.java
new file mode 100644
index 0000000..d019818
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeControllerLocal.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Dec 19, 2008
+ */
+public interface VascEntryFieldTypeControllerLocal extends VascEntryFieldTypeController {
+
+ public void addVascEntryFieldType(VascEntryFieldType vascEntryFieldType);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFinalizer.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFinalizer.java
new file mode 100644
index 0000000..af2f5c5
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryFinalizer.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 9, 2008
+ */
+public interface VascEntryFinalizer {
+
+ public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryState.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryState.java
new file mode 100644
index 0000000..04529ad
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEntryState.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Holds all the data for state.
+ * So we can jump forward or back to a state.
+ *
+ * @author Willem Cazander
+ * @version 1.0 Dec 15, 2009
+ */
+public interface VascEntryState extends Serializable {
+
+ /**
+ * @return the entryDataList
+ */
+ public List getEntryDataList();
+
+ /**
+ * @param entryDataList the entryDataList to set
+ */
+ public void setEntryDataList(List entryDataList);
+
+ /**
+ * @return the entryDataObject
+ */
+ public Object getEntryDataObject();
+
+ /**
+ * @param entryDataObject the entryDataObject to set
+ */
+ public void setEntryDataObject(Object entryDataObject);
+
+ /**
+ * @return the vascBackendState
+ */
+ public VascBackendState getVascBackendState();
+
+ /**
+ * @param vascBackendState the vascBackendState to set
+ */
+ public void setVascBackendState(VascBackendState vascBackendState);
+
+ /**
+ * @return the totalBackendRecords
+ */
+ public Long getTotalBackendRecords();
+
+ /**
+ * @param totalBackendRecords the totalBackendRecords to set
+ */
+ public void setTotalBackendRecords(Long totalBackendRecords);
+
+ /**
+ * @param state The previous state we come from.
+ */
+ public void setParent(VascEntryState state);
+
+ /**
+ * @return The previous state we come from.
+ */
+ public VascEntryState getParent();
+
+ public void setMultiActionSelection(Map multiActionSelection);
+ public Map getMultiActionSelection();
+
+ public void setVascEntry(VascEntry vascEntry);
+ public VascEntry getVascEntry();
+
+ /**
+ * @return the vascBackend
+ */
+ public VascBackend getVascBackend();
+
+ /**
+ * @param vascBackend the vascBackend to set
+ */
+ public void setVascBackend(VascBackend vascBackend);
+
+ /**
+ * @return the isEditCreate
+ */
+ public boolean isEditCreate();
+
+ /**
+ * @param isEditCreate the isEditCreate to set
+ */
+ public void setEditCreate(boolean isEditCreate);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEventChannelController.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEventChannelController.java
new file mode 100644
index 0000000..58b6dc5
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEventChannelController.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Oct 27, 2008
+ */
+public interface VascEventChannelController {
+
+ public void publishEntryEvent(String entryId);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascEventChannelControllerLocal.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEventChannelControllerLocal.java
new file mode 100644
index 0000000..16691c4
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascEventChannelControllerLocal.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Dec 19, 2008
+ */
+public interface VascEventChannelControllerLocal extends VascEventChannelController {
+
+
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascException.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascException.java
new file mode 100644
index 0000000..2a26e34
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascException.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 18, 2008
+ */
+@SuppressWarnings("serial")
+public class VascException extends Exception {
+
+
+ public VascException() {
+ }
+
+ public VascException(String message) {
+ super(message);
+ }
+
+ public VascException(Exception e) {
+ super(e);
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontend.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontend.java
new file mode 100644
index 0000000..562a733
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontend.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import com.idcanet.vasc.core.entry.VascEntryExporter;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface VascFrontend {
+
+ public void setId(String name);
+
+ public String getId();
+
+ public void initEntry(VascEntry entry) throws Exception;
+
+ public void renderView() throws Exception;
+
+ public void renderEdit() throws Exception;
+
+ public void renderDelete() throws Exception;
+
+ public void renderExport(VascEntryExporter exporter) throws Exception;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontendData.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontendData.java
new file mode 100644
index 0000000..02b5d07
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontendData.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.List;
+
+import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
+import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
+import com.idcanet.vasc.core.entry.VascEntryResourceImageResolver;
+import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
+import com.idcanet.vasc.core.ui.VascUIComponent;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface VascFrontendData {
+
+ /**
+ * @return the vascFrontend
+ */
+ public VascFrontend getVascFrontend();
+
+ /**
+ * @param vascFrontend the vascFrontend to set
+ */
+ public void setVascFrontend(VascFrontend vascFrontend);
+
+ /**
+ * @return the VascFrontendHelper
+ */
+ public VascFrontendHelper getVascFrontendHelper();
+
+ /**
+ * @param vascFrontendHelper The VascFrontendHelper to set.
+ */
+ public void setVascFrontendHelper(VascFrontendHelper vascFrontendHelper);
+
+ /**
+ * @return the vascEntryResourceResolver
+ */
+ public VascEntryResourceResolver getVascEntryResourceResolver();
+
+ /**
+ * @param vascEntryResourceResolver the vascEntryResourceResolver to set
+ */
+ public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver);
+
+
+ public void putVascUIComponent(String rendererId,String uiComponentClass);
+
+ public VascUIComponent getVascUIComponent(String rendererId) throws VascException;
+ public String getVascUIComponentClass(String rendererId);
+
+ public void setVascController(VascController vascController);
+
+ public VascController getVascController();
+
+ public void addFieldVascUIComponents(VascEntryField field,VascUIComponent uiComponent,Object editor);
+ public VascUIComponent getFieldVascUIComponent(VascEntryField field);
+ public Object getFieldRealRenderer(VascEntryField field);
+ public void clearFieldRenderObjects();
+
+ /**
+ * @return the vascEntryResourceImageResolver
+ */
+ public VascEntryResourceImageResolver getVascEntryResourceImageResolver();
+
+ /**
+ * @param vascEntryResourceImageResolver the vascEntryResourceImageResolver to set
+ */
+ public void setVascEntryResourceImageResolver(VascEntryResourceImageResolver vascEntryResourceImageResolver);
+
+ public void addVascValidatorService(VascEntryFieldValidatorService validatorService);
+ public List getVascValidatorServices();
+
+ public VascEntryState getVascEntryState();
+ public void setVascEntryState(VascEntryState state);
+
+ public void initFrontendListeners(VascEntry entry) throws InstantiationException, IllegalAccessException;
+ public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener);
+ public List getVascEntryFrontendEventListener(VascEntryFrontendEventListener.VascFrontendEventType type);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontendExceptionHandler.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontendExceptionHandler.java
new file mode 100644
index 0000000..f7810df
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontendExceptionHandler.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.EventListener;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Aug 12, 2007
+ */
+public interface VascFrontendExceptionHandler extends EventListener {
+
+ public void handleException(Exception e,VascFrontend vascFrontend,VascEntry entry);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontendHelper.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontendHelper.java
new file mode 100644
index 0000000..6dacda2
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascFrontendHelper.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.List;
+
+import com.idcanet.vasc.core.actions.GlobalVascAction;
+import com.idcanet.vasc.core.actions.RowVascAction;
+import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Apr 28, 2007
+ */
+public interface VascFrontendHelper {
+
+ public boolean renderView(VascEntryField field);
+ public boolean renderList(VascEntryField field);
+ public boolean renderEdit(VascEntryField field);
+ public boolean renderEditReadOnly(VascEntryField field);
+ public boolean renderCreate(VascEntryField field);
+ public boolean renderGlobalVascAction(GlobalVascAction action);
+ public boolean renderRowVascAction(RowVascAction action);
+
+ public Integer getTotalColumnsWidth(VascEntry entry);
+
+ public List getVascLinkEntryByType(VascEntry entry,VascLinkEntryType type);
+
+ /**
+ * Returns the total amount of pages
+ * @return
+ */
+ public List getVascBackendPageNumbers(VascEntry entry);
+
+ public void refreshData(VascEntry entry);
+
+ public Object createObject(VascEntry entry);
+
+ public void deleteObject(VascEntry entry);
+
+ public Object mergeObject(VascEntry entry);
+
+ public List validateObjectField(VascEntryField field);
+
+ public boolean validateAndSetErrorText(VascEntry entry);
+
+ public void headerOptionsCreatedFillData(VascEntry entry);
+
+ public void editReadOnlyUIComponents(VascEntry entry);
+
+ public void handleException(VascEntry entry,Exception exception);
+
+ public void fireVascEvent(VascEntry entry,VascFrontendEventType type,Object data);
+
+ public void sortAction(VascEntry entry,VascEntryField field);
+
+ public void searchAction(VascEntry entry,String searchString);
+
+ public void pageAction(VascEntry entry,Integer page);
+
+ public void moveAction(VascEntry entry,Object object,boolean moveUp);
+
+ public List getMultiRowActions(VascEntry entry);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascLinkEntry.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascLinkEntry.java
new file mode 100644
index 0000000..53f0441
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascLinkEntry.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 7, 2008
+ */
+public interface VascLinkEntry extends Cloneable,Serializable {
+
+ public String getId();
+ public void setId(String id);
+
+ public String getVascEntryId();
+ public void setVascEntryId(String vascEntryId);
+
+ public String getEntryParameterFieldId(String parameterName);
+ public void addEntryParameterFieldId(String parameterName,String valueFieldId);
+ public List getEntryParameterFieldIdKeys();
+
+ public String getEntryCreateFieldValue(String valueFieldId);
+ public void addEntryCreateFieldValue(String valueFieldId,String selectedFieldId);
+ public List getEntryCreateFieldValueKeys();
+
+ /**
+ * @return the vascLinkEntryType
+ */
+ public VascLinkEntryType getVascLinkEntryType();
+
+ /**
+ * @param vascLinkEntryType the vascLinkEntryType to set
+ */
+ public void setVascLinkEntryType(VascLinkEntryType vascLinkEntryType);
+
+ /**
+ * @return the doActionId
+ */
+ public String getDoActionId();
+
+ /**
+ * @param doActionId the doActionId to set
+ */
+ public void setDoActionId(String doActionId);
+
+ /**
+ * @return the name
+ */
+ public String getName();
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name);
+
+ /**
+ * Force impl to have public clone methode
+ * @return
+ * @throws CloneNotSupportedException
+ */
+ public VascLinkEntry clone() throws CloneNotSupportedException;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascLinkEntryType.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascLinkEntryType.java
new file mode 100644
index 0000000..79db136
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascLinkEntryType.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.io.Serializable;
+
+/**
+ * The type of a VascLinkEntry
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mrt 16, 2010
+ */
+public enum VascLinkEntryType implements Serializable {
+
+ EDIT_INLINE,
+ EDIT_TAB,
+ LIST;
+
+ public static VascLinkEntryType DEFAULT_TYPE = VascLinkEntryType.EDIT_TAB;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/VascUserRoleController.java b/vasc-core/src/main/java/com/idcanet/vasc/core/VascUserRoleController.java
new file mode 100644
index 0000000..93cca4e
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/VascUserRoleController.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core;
+
+import java.util.List;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Nov 19, 2008
+ */
+public interface VascUserRoleController {
+
+ public Long getUserId();
+
+ public String getUserName();
+
+ public List getUserRoles();
+
+ public boolean hasRole(String roles);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/actions/AbstractVascAction.java b/vasc-core/src/main/java/com/idcanet/vasc/core/actions/AbstractVascAction.java
new file mode 100644
index 0000000..d82fe4b
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/actions/AbstractVascAction.java
@@ -0,0 +1,135 @@
+
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.actions;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 30, 2007
+ */
+abstract public class AbstractVascAction implements VascAction {
+
+ private static final long serialVersionUID = 1L;
+ private String id = null;
+ private String name = null;
+ private String description = null;
+ private String image = null;
+ private String helpId = null;
+
+ public AbstractVascAction() {
+ setId(getActionId());
+ }
+
+ abstract protected String getActionId();
+
+ public VascAction clone() throws CloneNotSupportedException {
+ VascAction action;
+ try {
+ action = this.getClass().newInstance();
+ } catch (Exception e) {
+ throw new CloneNotSupportedException("Could not create action from myClass: "+e.getMessage());
+ }
+ action.setId(id);
+ action.setName(name);
+ action.setDescription(description);
+ action.setImage(image);
+ action.setHelpId(helpId);
+ return action;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.actions.VascAction#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.actions.VascAction#setId(java.lang.String)
+ */
+ public void setId(String id) {
+ this.id=id;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description description toolTip to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the helpId
+ */
+ public String getHelpId() {
+ return helpId;
+ }
+
+ /**
+ * @param helpId the helpId to set
+ */
+ public void setHelpId(String helpId) {
+ this.helpId = helpId;
+ }
+
+ /**
+ * @return the image
+ */
+ public String getImage() {
+ return image;
+ }
+
+ /**
+ * @param image the image to set
+ */
+ public void setImage(String image) {
+ this.image = image;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/actions/ColumnVascAction.java b/vasc-core/src/main/java/com/idcanet/vasc/core/actions/ColumnVascAction.java
new file mode 100644
index 0000000..6f4491d
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/actions/ColumnVascAction.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.actions;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface ColumnVascAction extends VascAction {
+
+ public void doColumnAction(VascEntry table,VascEntryField column) throws Exception;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/actions/GlobalVascAction.java b/vasc-core/src/main/java/com/idcanet/vasc/core/actions/GlobalVascAction.java
new file mode 100644
index 0000000..dc33b67
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/actions/GlobalVascAction.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.actions;
+
+import com.idcanet.vasc.core.VascEntry;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface GlobalVascAction extends VascAction {
+
+ public void doGlobalAction(VascEntry vascEntry) throws Exception;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/actions/RowVascAction.java b/vasc-core/src/main/java/com/idcanet/vasc/core/actions/RowVascAction.java
new file mode 100644
index 0000000..2c4ee09
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/actions/RowVascAction.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.actions;
+
+import com.idcanet.vasc.core.VascEntry;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface RowVascAction extends VascAction {
+
+ public boolean isMultiRowAction();
+
+ public void doRowAction(VascEntry vascEntry,Object rowObject) throws Exception;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/actions/VascAction.java b/vasc-core/src/main/java/com/idcanet/vasc/core/actions/VascAction.java
new file mode 100644
index 0000000..4fd08ec
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/actions/VascAction.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.actions;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface VascAction extends Cloneable,Serializable {
+
+ public String getId();
+
+ public void setId(String id);
+
+ public String getName();
+
+ public void setName(String name);
+
+ public String getDescription();
+
+ public void setDescription(String description);
+
+ public String getImage();
+
+ public void setImage(String image);
+
+ public String getHelpId();
+
+ public void setHelpId(String helpId);
+
+ /**
+ * Force impl to have public clone methode
+ * @return
+ * @throws CloneNotSupportedException
+ */
+ public VascAction clone() throws CloneNotSupportedException;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryBackendEventListener.java b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryBackendEventListener.java
new file mode 100644
index 0000000..e4fa447
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryBackendEventListener.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.entry;
+
+import java.io.Serializable;
+
+import com.idcanet.vasc.core.VascEntry;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Jul 05, 2010
+ */
+public interface VascEntryBackendEventListener extends Serializable {
+
+ public enum VascBackendEventType {
+ EXECUTE,
+ PERSIST,
+ MERGE,
+ DELETE,
+ PROVIDE_FIELD_VALUE,
+ PROVIDE_RECORD_CREATOR,
+ TOTAL_EXECUTE_SIZE,
+ MOVE_DOWN,
+ MOVE_UP
+ }
+
+ public VascBackendEventType getEventType();
+
+ /**
+ * Is executed when the type of event is fired.
+ * @param entry
+ * @param type
+ * @param data
+ */
+ public void vascEvent(VascEntry entry,Object data);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryExporter.java b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryExporter.java
new file mode 100644
index 0000000..40e9f88
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryExporter.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.entry;
+
+import java.io.OutputStream;
+import java.io.Serializable;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascException;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 19, 2007
+ */
+public interface VascEntryExporter extends Serializable {
+
+ public void doExport(OutputStream out,VascEntry vascEntry) throws VascException;
+
+ public String getMineType();
+
+ public String getType();
+
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldEventChannel.java b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldEventChannel.java
new file mode 100644
index 0000000..840978d
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldEventChannel.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.entry;
+
+import java.io.Serializable;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 04, 2008
+ */
+public interface VascEntryFieldEventChannel extends Serializable {
+
+ public void setChannel(String channel);
+ public String getChannel();
+
+
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValidatorService.java b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValidatorService.java
new file mode 100644
index 0000000..753a6de
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValidatorService.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.entry;
+
+import java.util.List;
+
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+
+
+/**
+ * Executes validation on a field.
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 13, 2009
+ */
+public interface VascEntryFieldValidatorService {
+
+ public List validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValue.java b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValue.java
new file mode 100644
index 0000000..c595180
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValue.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.entry;
+
+import java.io.Serializable;
+
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface VascEntryFieldValue extends Serializable {
+
+ public Object getValue(VascEntryField field,Object record) throws VascException;
+
+ public String getDisplayValue(VascEntryField field,Object record) throws VascException;
+
+ public void setValue(VascEntryField field,Object record,Object value) throws VascException;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFrontendEventListener.java b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFrontendEventListener.java
new file mode 100644
index 0000000..63351ce
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryFrontendEventListener.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.entry;
+
+import java.io.Serializable;
+
+import com.idcanet.vasc.core.VascEntry;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Aug 02, 2007
+ */
+public interface VascEntryFrontendEventListener extends Serializable {
+
+ public enum VascFrontendEventType {
+ EXCEPTION,
+
+ DATA_CREATE,
+ DATA_READ,
+ DATA_SELECT,
+ DATA_PRE_UPDATE,
+ DATA_POST_UPDATE,
+ DATA_DELETE,
+ DATA_LIST_UPDATE,
+
+ DATA_SORT,
+ DATA_PAGE,
+ DATA_SEARCH,
+
+ OPTION_UPDATE,
+ }
+
+ public VascFrontendEventType[] getEventTypes();
+
+ /**
+ * Is executed when the type of event is fired.
+ * @param entry
+ * @param type
+ * @param data
+ */
+ public void vascEvent(VascEntry entry,Object data);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryRecordCreator.java b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryRecordCreator.java
new file mode 100644
index 0000000..8774718
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryRecordCreator.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.entry;
+
+import java.io.Serializable;
+
+import com.idcanet.vasc.core.VascEntry;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface VascEntryRecordCreator extends Serializable {
+
+ public Object newRecord(VascEntry entry) throws Exception;
+
+ public Class> getObjectClass();
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceImageResolver.java b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceImageResolver.java
new file mode 100644
index 0000000..d59e77b
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceImageResolver.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.entry;
+
+import com.idcanet.vasc.core.VascEntry;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 13, 2009
+ */
+public interface VascEntryResourceImageResolver {
+
+ public Object getImageValue(VascEntry entry,String key);
+
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceResolver.java b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceResolver.java
new file mode 100644
index 0000000..737a90c
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceResolver.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.entry;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public interface VascEntryResourceResolver {
+
+ public String getTextValue(String key,Object...params);
+
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascColumnValueModelListener.java b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascColumnValueModelListener.java
new file mode 100644
index 0000000..67f5e85
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascColumnValueModelListener.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.ui;
+
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Aug 12, 2007
+ */
+public class VascColumnValueModelListener implements VascValueModelListener {
+
+ private VascEntryField vascEntryField = null;
+ private Object bean = null;
+
+ public VascColumnValueModelListener() {
+ }
+
+ public VascColumnValueModelListener(VascEntryField vascEntryField,Object bean) {
+ setVascEntryField(vascEntryField);
+ setBean(bean);
+ }
+
+ public void valueUpdate(VascValueModel model) throws VascException {
+ vascEntryField.getVascEntryFieldValue().setValue(vascEntryField, bean, model.getValue());
+ }
+
+ /**
+ * @return the vascEntryField
+ */
+ public VascEntryField getVascEntryField() {
+ return vascEntryField;
+ }
+
+ /**
+ * @param vascEntryField the vascEntryField to set
+ */
+ public void setVascEntryField(VascEntryField vascEntryField) {
+ this.vascEntryField = vascEntryField;
+ }
+
+ /**
+ * @return the bean
+ */
+ public Object getBean() {
+ return bean;
+ }
+
+ /**
+ * @param bean the bean to set
+ */
+ public void setBean(Object bean) {
+ this.bean = bean;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascOptionValueModelListener.java b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascOptionValueModelListener.java
new file mode 100644
index 0000000..deb7471
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascOptionValueModelListener.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.ui;
+
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 21, 2009
+ */
+public class VascOptionValueModelListener implements VascValueModelListener {
+
+ private VascEntryField vascEntryField = null;
+
+ public VascOptionValueModelListener() {
+ }
+
+ public VascOptionValueModelListener(VascEntryField vascEntryField) {
+ setVascEntryField(vascEntryField);
+ }
+
+ public void valueUpdate(VascValueModel model) throws VascException {
+ String key = vascEntryField.getBackendName();
+ Object value = model.getValue();
+ vascEntryField.getVascEntry().setEntryParameter(key, value);
+ }
+
+ /**
+ * @return the vascEntryField
+ */
+ public VascEntryField getVascEntryField() {
+ return vascEntryField;
+ }
+
+ /**
+ * @param vascEntryField the vascEntryField to set
+ */
+ public void setVascEntryField(VascEntryField vascEntryField) {
+ this.vascEntryField = vascEntryField;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascSelectItem.java b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascSelectItem.java
new file mode 100644
index 0000000..e15e079
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascSelectItem.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.ui;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Aug 12, 2007
+ */
+public class VascSelectItem {
+
+ private String label = null;
+ private Object value = null;
+ private String keyValue = null;
+ private boolean disabled = false;
+
+ public VascSelectItem() {
+
+ }
+ public VascSelectItem(String label,Object value) {
+ setLabel(label);
+ setValue(value);
+ }
+ public VascSelectItem(String label,Object value,String keyValue) {
+ setLabel(label);
+ setValue(value);
+ setKeyValue(keyValue);
+ }
+
+ /**
+ * @return the label
+ */
+ public String getLabel() {
+ return label;
+ }
+
+ /**
+ * @param label the label to set
+ */
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ /**
+ * @return the value
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ /**
+ * @return the keyValue
+ */
+ public String getKeyValue() {
+ return keyValue;
+ }
+
+ /**
+ * @param keyValue the keyValue to set
+ */
+ public void setKeyValue(String keyValue) {
+ this.keyValue = keyValue;
+ }
+
+ /**
+ * @return the disabled
+ */
+ public boolean isDisabled() {
+ return disabled;
+ }
+
+ /**
+ * @param disabled the disabled to set
+ */
+ public void setDisabled(boolean disabled) {
+ this.disabled = disabled;
+ }
+}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascSelectItemModel.java b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascSelectItemModel.java
new file mode 100644
index 0000000..2dc52bc
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascSelectItemModel.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.ui;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascException;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Aug 12, 2007
+ */
+public interface VascSelectItemModel extends Serializable {
+
+ /**
+ * Creates an SelectItem list.
+ * @param entry
+ * @return
+ * @throws VascException
+ */
+ public List getVascSelectItems(VascEntry entry) throws VascException;
+
+ /**
+ * @return the nullLabel
+ */
+ public String getNullLabel();
+
+ /**
+ * @param nullLabel the nullLabel to set
+ */
+ public void setNullLabel(String nullLabel);
+
+ /**
+ * @return the nullKeyValue
+ */
+ public String getNullKeyValue();
+
+ /**
+ * @param nullKeyValue the nullKeyValue to set
+ */
+ public void setNullKeyValue(String nullKeyValue);
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponent.java b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponent.java
new file mode 100644
index 0000000..ade93be
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponent.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.ui;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Nov 19, 2008
+ */
+public interface VascUIActionComponent extends VascUIComponent {
+
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponentListener.java b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponentListener.java
new file mode 100644
index 0000000..49ffaf5
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponentListener.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.ui;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Nov 19, 2008
+ */
+public interface VascUIActionComponentListener {
+
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascUIComponent.java b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascUIComponent.java
new file mode 100644
index 0000000..4aace44
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascUIComponent.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.ui;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Aug 12, 2007
+ */
+public interface VascUIComponent {
+
+ // required ui components
+ static public final String VASC_LABEL = "VascLabel";
+ static public final String VASC_TEXT = "VascText";
+ static public final String VASC_LIST = "VascList";
+ static public final String VASC_BUTTON = "VascButton";
+
+ // optional ui Components
+ static public final String VASC_TEXTAREA = "VascTextArea";
+ static public final String VASC_BOOLEAN = "VascBoolean";
+ static public final String VASC_DATE = "VascDate";
+ static public final String VASC_COLOR = "VascColor";
+
+ static public final String[] requiredUIComponents = {VASC_LABEL,VASC_TEXT,VASC_LIST,VASC_BUTTON};
+
+ public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException;
+
+ public void setErrorText(String text);
+ public String getErrorText();
+
+ public void setDisabled(boolean disabled);
+ public boolean isDisabled();
+
+ public void setRendered(boolean rendered);
+ public boolean isRendered();
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascValueModel.java b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascValueModel.java
new file mode 100644
index 0000000..adc5ddb
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascValueModel.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.idcanet.vasc.core.VascException;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Aug 12, 2007
+ */
+public class VascValueModel {
+
+ private Object value = null;
+ private List listeners = null;
+ private VascValueModel parentModel = null;
+
+ public VascValueModel() {
+ listeners = new ArrayList(2);
+ }
+ public VascValueModel(VascValueModel parentModel) {
+ this();
+ this.parentModel=parentModel;
+ }
+
+ public Object getValue() throws VascException {
+ if (parentModel!=null) {
+ return parentModel.getValue();
+ }
+ return value;
+ }
+
+ public void setValue(Object value) throws VascException {
+ if (parentModel!=null) {
+ parentModel.setValue(value);
+ } else {
+ this.value = value;
+ }
+ fireListeners();
+ }
+
+ public void addListener(VascValueModelListener l) {
+ listeners.add(l);
+ }
+ public void removeListener(VascValueModelListener l) {
+ listeners.remove(l);
+ }
+ private void fireListeners() throws VascException {
+ for (VascValueModelListener l:listeners) {
+ l.valueUpdate(this);
+ }
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascValueModelListener.java b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascValueModelListener.java
new file mode 100644
index 0000000..d5ab5ee
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/core/ui/VascValueModelListener.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.core.ui;
+
+import java.util.EventListener;
+
+import com.idcanet.vasc.core.VascException;
+
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Aug 12, 2007
+ */
+public interface VascValueModelListener extends EventListener {
+
+ public void valueUpdate(VascValueModel model) throws VascException;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascBackedEntryFinalizer.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascBackedEntryFinalizer.java
new file mode 100644
index 0000000..0f816ec
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascBackedEntryFinalizer.java
@@ -0,0 +1,436 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import java.util.Collections;
+import java.util.Comparator;
+
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascEntryFieldSet;
+import com.idcanet.vasc.core.VascEntryFieldType;
+import com.idcanet.vasc.core.VascEntryFinalizer;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.VascLinkEntry;
+import com.idcanet.vasc.core.VascLinkEntryType;
+import com.idcanet.vasc.core.actions.VascAction;
+
+/**
+ * Checks for minimal needed stuff
+ * and fills up the rest.
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 14, 2008
+ */
+public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFinalizer#finalizeVascEntry(com.idcanet.vasc.core.VascEntry)
+ */
+ public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
+
+ // First Check if we all have ids
+ String id = entry.getId();
+ if (id==null) {
+ throw new IllegalArgumentException("The VascEntry need an id.");
+ }
+ if (entry.getBackendId()==null) {
+ throw new IllegalArgumentException("The VascEntry need an backendId in entryId: "+id);
+ }
+ if (entry.getVascEntryFields().size()==0) {
+ throw new IllegalArgumentException("We need at least one VascEntryField in entryId: "+id);
+ }
+ for (VascEntryField vef:entry.getVascEntryFields()) {
+ if (vef.getId()==null) {
+ throw new IllegalArgumentException("All VascEntryField need an id in entryId: "+id);
+ }
+ }
+ for (VascEntryField vef:entry.getListOptions()) {
+ if (vef.getId()==null) {
+ throw new IllegalArgumentException("All listOption VascEntryField to have an id in entryId: "+id);
+ }
+ }
+
+ // Check if backendId is valid
+ VascBackend back = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
+ if (back==null) {
+ throw new IllegalArgumentException("The VascEntry backendId is not found in backends: '"+entry.getBackendId()+"' in entryId: "+id);
+ }
+
+
+ // Fill up all not field i18n keys
+
+ // entry fields
+ if (entry.getName()==null) {
+ entry.setName("vasc.entry."+id+".name");
+ }
+ if (entry.getImage()==null) {
+ entry.setImage("vasc.entry."+id+".image");
+ }
+ if (entry.getHelpId()==null) {
+ entry.setHelpId("vasc.entry."+id+".helpId");
+ }
+
+ if (entry.getListDescription()==null) {
+ entry.setListDescription("vasc.entry."+id+".listDescription");
+ }
+ if (entry.getListImage()==null) {
+ entry.setListImage("vasc.entry."+id+".listImage");
+ }
+ if (entry.getEditDescription()==null) {
+ entry.setEditDescription("vasc.entry."+id+".editDescription");
+ }
+ if (entry.getEditImage()==null) {
+ entry.setEditImage("vasc.entry."+id+".editImage");
+ }
+ if (entry.getDeleteDescription()==null) {
+ entry.setDeleteDescription("vasc.entry."+id+".deleteDescription");
+ }
+ if (entry.getDeleteImage()==null) {
+ entry.setDeleteImage("vasc.entry."+id+".deleteImage");
+ }
+ if (entry.getCreateDescription()==null) {
+ entry.setCreateDescription("vasc.entry."+id+".createDescription");
+ }
+ if (entry.getCreateImage()==null) {
+ entry.setCreateImage("vasc.entry."+id+".createImage");
+ }
+
+ // boolean view helper
+ if (entry.isVascDisplayOnly()) {
+ entry.setVascAdminCreate(false);
+ entry.setVascAdminDelete(false);
+ entry.setVascAdminEdit(false);
+ }
+
+ // optional field sets
+ for (VascEntryFieldSet s:entry.getVascEntryFieldSets()) {
+
+ // check id
+ String sid = s.getId();
+ if (sid==null) {
+ throw new IllegalArgumentException("All VascEntryFieldSet need an id in entryId: "+id);
+ }
+
+ // check if refenced ids are avalible
+ for (String fid:s.getVascEntryFieldIds()) {
+ if (entry.getVascEntryFieldById(fid)==null) {
+ throw new IllegalArgumentException("VascEntryFieldSet "+sid+" has non excisting field id: "+fid+" in entryId: "+id);
+ }
+ }
+
+ // fill up properties
+ if (s.getName()==null) {
+ s.setName("vasc.entry."+id+"."+sid+".name");
+ }
+ if (s.getDescription()==null) {
+ s.setDescription("vasc.entry."+id+"."+sid+".description");
+ }
+ if (s.getImage()==null) {
+ s.setImage("vasc.entry."+id+"."+sid+".image");
+ }
+ if (s.getHelpId()==null) {
+ s.setHelpId("vasc.entry."+id+"."+sid+".helpId");
+ }
+ if (s.getStyleEdit()==null) {
+ s.setStyleEdit("vasc.entry."+id+"."+sid+".styleEdit");
+ }
+ if (s.getStyleList()==null) {
+ s.setStyleList("vasc.entry."+id+"."+sid+".styleEdit");
+ }
+ }
+
+ // Set defaults field Id for key ad display
+ if (entry.getPrimaryKeyFieldId()==null) {
+ entry.setPrimaryKeyFieldId(entry.getVascEntryFields().get(0).getId());
+ }
+
+ if (entry.getDisplayNameFieldId()==null) {
+ entry.setDisplayNameFieldId(entry.getVascEntryFields().get(0).getId());
+ }
+
+
+ // Check fields
+ int orderIndex = 0;
+ for (VascEntryField vef:entry.getVascEntryFields()) {
+ String vid = vef.getId();
+
+ // set manual stuff
+ if (vef.getBackendName()==null) {
+ vef.setBackendName(vid);
+ }
+ if (vef.getVascEntry()==null) {
+ vef.setVascEntry(entry);
+ }
+
+ //System.out.println("Field: "+vef.getId()+" order: "+vef.getOrderIndex()+" else: "+orderIndex);
+ if (vef.getOrderIndex()==null) {
+ vef.setOrderIndex(orderIndex);
+ }
+ orderIndex = orderIndex+100;
+
+ // fill up properties
+ if (vef.getName()==null) {
+ vef.setName("vasc.entry."+id+"."+vid+".name");
+ }
+ if (vef.getDescription()==null) {
+ vef.setDescription("vasc.entry."+id+"."+vid+".description");
+ }
+ if (vef.getImage()==null) {
+ vef.setImage("vasc.entry."+id+"."+vid+".image");
+ }
+ if (vef.getHelpId()==null) {
+ vef.setHelpId("vasc.entry."+id+"."+vid+".helpId");
+ }
+ if (vef.getStyleEdit()==null) {
+ vef.setStyleEdit("vasc.entry."+id+"."+vid+".styleEdit");
+ }
+ if (vef.getStyleList()==null) {
+ vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
+ }
+
+ //if (vef.getDefaultValue()==null) {
+ // vef.setDefaultValue("vasc.entry."+id+"."+vid+".defaultValue");
+ //}
+
+ if (vef.getView()==null) {
+ vef.setView(true);
+ }
+ if (vef.getList()==null) {
+ vef.setList(true);
+ }
+ if (vef.getCreate()==null) {
+ vef.setCreate(true);
+ }
+ if (vef.getEdit()==null) {
+ vef.setEdit(true);
+ }
+ if (vef.getEditReadOnly()==null) {
+ vef.setEditReadOnly(false);
+ }
+
+ if (vef.getVascEntryFieldValue()==null) {
+ VascBackend back2 = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
+ vef.setVascEntryFieldValue(back2.provideVascEntryFieldValue(vef));
+ }
+
+ if (vef.getVascEntryFieldType()==null) {
+ Object defValue = vef.getDefaultValue();
+ if (defValue != null) {
+ for (String typeId: vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
+ VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
+
+ if (type.getAutoDetectClass()!=null) {
+ if (type.getAutoDetectClass().isAssignableFrom(defValue.getClass())) {
+ vef.setVascEntryFieldType(type);
+ break;
+ }
+ }
+ }
+ }
+ if (vef.getVascEntryFieldType()==null) {
+ vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
+ }
+ //vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
+ }
+
+ //for (VascValidator vv:vef.getVascValidators()) {
+ //}
+ }
+
+
+ class OrderIndexComparator implements Comparator {
+ public int compare(VascEntryField v1, VascEntryField v2) {
+ return v1.getOrderIndex().compareTo(v2.getOrderIndex());
+ }
+ }
+ Collections.sort(entry.getVascEntryFields(),new OrderIndexComparator());
+
+
+ // place primary key in front
+ int index = 0;
+ for (VascEntryField vef:entry.getVascEntryFields()) {
+ if (entry.getPrimaryKeyFieldId().equals(vef.getId())) {
+ break;
+ }
+ index++;
+ }
+ if (index==entry.getVascEntryFields().size()) {
+ // no primarry key found selecting the first field.
+ index=0;
+ }
+ VascEntryField idField = entry.getVascEntryFields().remove(index);
+ entry.getVascEntryFields().add(0, idField);
+
+ // Check if link entries excists
+ for (VascLinkEntry vle:entry.getVascLinkEntries()) {
+
+ // check id
+ String vid = vle.getId();
+ if (vid==null) {
+ throw new IllegalArgumentException("All VascLinkEntry need an id in entryId: "+id);
+ }
+ if (vle.getVascEntryId()==null) {
+ throw new IllegalArgumentException("All VascLinkEntry need an vascEntryId: "+id);
+ }
+
+ if (vle.getVascLinkEntryType()==null) {
+ vle.setVascLinkEntryType(VascLinkEntryType.DEFAULT_TYPE);
+ }
+ if (vle.getName()==null) {
+ vle.setName("vasc.entry."+vle.getVascEntryId()+".name");
+ }
+ }
+
+ for (VascEntryField vef:entry.getListOptions()) {
+ String vid = vef.getId();
+ // set manual stuff
+ if (vef.getBackendName()==null) {
+ vef.setBackendName(vid);
+ }
+ if (vef.getVascEntry()==null) {
+ vef.setVascEntry(entry);
+ }
+ if (vef.getOrderIndex()==null) {
+ vef.setOrderIndex(orderIndex);
+ }
+ orderIndex = orderIndex+100;
+
+ // fill up properties
+ if (vef.getName()==null) {
+ vef.setName("vasc.entry."+id+"."+vid+".name");
+ }
+ if (vef.getDescription()==null) {
+ vef.setDescription("vasc.entry."+id+"."+vid+".description");
+ }
+ if (vef.getImage()==null) {
+ vef.setImage("vasc.entry."+id+"."+vid+".image");
+ }
+ if (vef.getHelpId()==null) {
+ vef.setHelpId("vasc.entry."+id+"."+vid+".helpId");
+ }
+ if (vef.getStyleEdit()==null) {
+ vef.setStyleEdit("vasc.entry."+id+"."+vid+".styleEdit");
+ }
+ if (vef.getStyleList()==null) {
+ vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
+ }
+
+ //if (vef.getDefaultValue()==null) {
+ // vef.setDefaultValue("vasc.entry."+id+"."+vid+".defaultValue");
+ //}
+
+ if (vef.getView()==null) {
+ vef.setView(true);
+ }
+ if (vef.getList()==null) {
+ vef.setList(true);
+ }
+ if (vef.getCreate()==null) {
+ vef.setCreate(true);
+ }
+ if (vef.getEdit()==null) {
+ vef.setEdit(true);
+ }
+ if (vef.getEditReadOnly()==null) {
+ vef.setEditReadOnly(false);
+ }
+
+ if (vef.getVascEntryFieldValue()==null) {
+ //VascBackend back2 = vascController.getVascBackendControllerResolver().getVascBackendController().getVascBackendById( entry.getBackendId() );
+ //vef.setVascEntryFieldValue(back2.provideVascEntryFieldValue(vef));
+ }
+
+ }
+
+
+
+ for (VascAction action:entry.getGlobalActions()) {
+ String aid = action.getId();
+ if (aid==null) {
+ throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
+ }
+ if (action.getName()==null) {
+ action.setName("vasc.action."+aid+".name");
+ }
+ if (action.getDescription()==null) {
+ action.setDescription("vasc.action."+aid+".description");
+ }
+ if (action.getImage()==null) {
+ action.setImage("vasc.action."+aid+".image");
+ }
+ if (action.getHelpId()==null) {
+ action.setHelpId("vasc.action."+aid+".helpId");
+ }
+ }
+ for (VascAction action:entry.getRowActions()) {
+ String aid = action.getId();
+ if (aid==null) {
+ throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
+ }
+ if (action.getName()==null) {
+ action.setName("vasc.action."+aid+".name");
+ }
+ if (action.getDescription()==null) {
+ action.setDescription("vasc.action."+aid+".description");
+ }
+ if (action.getImage()==null) {
+ action.setImage("vasc.action."+aid+".image");
+ }
+ if (action.getHelpId()==null) {
+ action.setHelpId("vasc.action."+aid+".helpId");
+ }
+ }
+ for (VascAction action:entry.getColumnActions()) {
+ String aid = action.getId();
+ if (aid==null) {
+ throw new IllegalArgumentException("Action has no id: "+action+" in entryId: "+id);
+ }
+ if (action.getName()==null) {
+ action.setName("vasc.action."+aid+".name");
+ }
+ if (action.getDescription()==null) {
+ action.setDescription("vasc.action."+aid+".description");
+ }
+ if (action.getImage()==null) {
+ action.setImage("vasc.action."+aid+".image");
+ }
+ if (action.getHelpId()==null) {
+ action.setHelpId("vasc.action."+aid+".helpId");
+ }
+ }
+
+
+ return entry;
+ }
+
+
+
+}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendController.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendController.java
new file mode 100644
index 0000000..97b9db8
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendController.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascBackendControllerLocal;
+
+/**
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 18, 2008
+ */
+public class DefaultVascBackendController implements VascBackendControllerLocal {
+
+ private Map backends = null;
+
+ public DefaultVascBackendController() {
+ backends = new HashMap(7);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackendController#getVascBackendById(java.lang.String)
+ */
+ public VascBackend getVascBackendById(String id) {
+ return backends.get(id);
+ }
+
+ /**
+ * Local
+ */
+ public void addVascBackend(VascBackend backend) {
+ if (backend==null) {
+ throw new NullPointerException("backend must not be null.");
+ }
+ if (backend.getId()==null) {
+ throw new IllegalArgumentException("The backend must have an id.");
+ }
+ backends.put(backend.getId(), backend);
+ }
+
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendState.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendState.java
new file mode 100644
index 0000000..cbe03c4
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendState.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import com.idcanet.vasc.core.AbstractVascBackendState;
+
+/**
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 26, 2009
+ */
+public class DefaultVascBackendState extends AbstractVascBackendState {
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascController.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascController.java
new file mode 100644
index 0000000..972924d
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascController.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import com.idcanet.vasc.core.VascBackendController;
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.vasc.core.VascEntryController;
+import com.idcanet.vasc.core.VascEntryFieldTypeController;
+import com.idcanet.vasc.core.VascEventChannelController;
+import com.idcanet.vasc.core.VascUserRoleController;
+
+/**
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 11, 2008
+ */
+public class DefaultVascController implements VascController {
+
+ private VascBackendController vascBackendController = null;
+ private VascEntryController vascEntryController = null;
+ private VascEntryFieldTypeController vascEntryFieldTypeController = null;
+ private VascEventChannelController vascEventChannelController = null;
+ private VascUserRoleController vascUserRoleController = null;
+
+ /**
+ * @return the vascEventChannelController
+ */
+ public VascEventChannelController getVascEventChannelController() {
+ return vascEventChannelController;
+ }
+
+ /**
+ * @param vascEventChannelController the vascEventChannelController to set
+ */
+ public void setVascEventChannelController(VascEventChannelController vascEventChannelController) {
+ this.vascEventChannelController = vascEventChannelController;
+ }
+
+ /**
+ * @return the vascBackendController
+ */
+ public VascBackendController getVascBackendController() {
+ return vascBackendController;
+ }
+
+ /**
+ * @param vascBackendController the vascBackendController to set
+ */
+ public void setVascBackendController(VascBackendController vascBackendController) {
+ this.vascBackendController = vascBackendController;
+ }
+
+ /**
+ * @return the vascEntryController
+ */
+ public VascEntryController getVascEntryController() {
+ return vascEntryController;
+ }
+
+ /**
+ * @param vascEntryController the vascEntryController to set
+ */
+ public void setVascEntryController(VascEntryController vascEntryController) {
+ this.vascEntryController = vascEntryController;
+ }
+
+ /**
+ * @return the vascEntryFieldController
+ */
+ public VascEntryFieldTypeController getVascEntryFieldTypeController() {
+ return vascEntryFieldTypeController;
+ }
+
+ /**
+ * @param vascEntryFieldController the vascEntryFieldController to set
+ */
+ public void setVascEntryFieldTypeController(VascEntryFieldTypeController vascEntryFieldTypeController) {
+ this.vascEntryFieldTypeController = vascEntryFieldTypeController;
+ }
+
+ /**
+ * @return the vascUserRoleController
+ */
+ public VascUserRoleController getVascUserRoleController() {
+ return vascUserRoleController;
+ }
+
+ /**
+ * @param vascUserRoleController the vascUserRoleController to set
+ */
+ public void setVascUserRoleController(VascUserRoleController vascUserRoleController) {
+ this.vascUserRoleController = vascUserRoleController;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java
new file mode 100644
index 0000000..c8f9ddb
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java
@@ -0,0 +1,770 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.idcanet.vasc.core.VascBackendFilter;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascEntryFieldSet;
+import com.idcanet.vasc.core.VascFrontendData;
+import com.idcanet.vasc.core.VascLinkEntry;
+import com.idcanet.vasc.core.actions.ColumnVascAction;
+import com.idcanet.vasc.core.actions.GlobalVascAction;
+import com.idcanet.vasc.core.actions.RowVascAction;
+import com.idcanet.vasc.core.actions.VascAction;
+import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
+import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
+import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
+
+/**
+ * VascEntry
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public class DefaultVascEntry implements VascEntry {
+
+ private static final long serialVersionUID = 1L;
+ private String id = null;
+ private String name = null;
+ private String helpId = null;
+ private String image = null;
+
+ private String listDescription = null;
+ private String listImage = null;
+ private String editDescription = null;
+ private String editImage = null;
+ private String deleteDescription = null;
+ private String deleteImage = null;
+ private String createDescription = null;
+ private String createImage = null;
+
+ private String primaryKeyFieldId = null;
+ private String displayNameFieldId = null;
+
+ private boolean vascDisplayOnly = false;
+ private boolean vascAdminList = true;
+ private boolean vascAdminEdit = true;
+ private boolean vascAdminCreate = true;
+ private boolean vascAdminDelete = true;
+
+ private List vascFields = null;
+
+ private List rowActions = null;
+ private List columnActions = null;
+ private List globalActions = null;
+
+ private List vascEntryFieldSets = null;
+ private List vascLinkEntries = null;
+ private Map entryParameters = null;
+ private VascEntryFieldEventChannel vascEntryFieldEventChannel = null;
+ private List> eventEntryFrontendEventListeners = null;
+ private List> eventEntryBackendEventListeners = null;
+ private List listOptions = null;
+ private List backendFilters = null;
+
+ private String backendId = null;
+ private VascFrontendData vascFrontendData = null;
+
+ /**
+ * Te constructor
+ */
+ public DefaultVascEntry() {
+ vascFields = new ArrayList(20);
+
+ rowActions = new ArrayList(10);
+ columnActions = new ArrayList(10);
+ globalActions = new ArrayList(10);
+
+ vascEntryFieldSets = new ArrayList(10);
+ vascLinkEntries = new ArrayList(10);
+ entryParameters = new HashMap(10);
+
+ eventEntryFrontendEventListeners = new ArrayList>(10);
+ eventEntryBackendEventListeners = new ArrayList>(10);
+ listOptions = new ArrayList(5);
+ backendFilters = new ArrayList(3);
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public VascEntry clone() throws CloneNotSupportedException {
+
+ DefaultVascEntry result = new DefaultVascEntry();
+ result.id=id;
+ result.name=name;
+ result.helpId=helpId;
+ result.image=image;
+ result.listDescription=listDescription;
+ result.listImage=listImage;
+ result.editDescription=editDescription;
+ result.editImage=editImage;
+ result.deleteDescription=deleteDescription;
+ result.deleteImage=deleteImage;
+ result.createDescription=createDescription;
+ result.createImage=createImage;
+ result.primaryKeyFieldId=primaryKeyFieldId;
+ result.displayNameFieldId=displayNameFieldId;
+ result.vascDisplayOnly=vascDisplayOnly;
+ result.vascAdminList=vascAdminList;
+ result.vascAdminCreate=vascAdminCreate;
+ result.vascAdminEdit=vascAdminEdit;
+ result.vascAdminDelete=vascAdminDelete;
+ result.backendId=backendId;
+ result.vascEntryFieldEventChannel=vascEntryFieldEventChannel;
+ result.eventEntryFrontendEventListeners.addAll(eventEntryFrontendEventListeners);
+ result.eventEntryBackendEventListeners.addAll(eventEntryBackendEventListeners);
+ // skipping 'vascFrontendData' because it should always be null when cloning happens.
+
+ for (VascEntryField f:vascFields) {
+ VascEntryField ff = f.clone();
+ ff.setVascEntry(result); // mmm remove this ?
+ result.vascFields.add(ff);
+ }
+ for (VascAction a:rowActions) {
+ result.rowActions.add((RowVascAction)a.clone());
+ }
+ for (VascAction a:columnActions) {
+ result.columnActions.add((ColumnVascAction)a.clone());
+ }
+ for (VascAction a:globalActions) {
+ result.globalActions.add((GlobalVascAction)a.clone());
+ }
+ for (VascEntryFieldSet s:vascEntryFieldSets) {
+ result.vascEntryFieldSets.add(s.clone());
+ }
+ for (VascLinkEntry l:vascLinkEntries) {
+ result.vascLinkEntries.add(l.clone());
+ }
+ for (VascEntryField listOption:listOptions) {
+ VascEntryField ff = listOption.clone();
+ ff.setVascEntry(result);
+ result.listOptions.add(ff);
+ }
+ for (VascBackendFilter f:backendFilters) {
+ VascBackendFilter ff = f.clone();
+ result.backendFilters.add(ff);
+ }
+
+
+ // no cloning of the values here ?
+ for (String key:entryParameters.keySet()) {
+ Object value = entryParameters.get(key);
+ result.setEntryParameter(key, value);
+ }
+ return result;
+ }
+
+
+
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the helpId
+ */
+ public String getHelpId() {
+ return helpId;
+ }
+
+ /**
+ * @param helpId the helpId to set
+ */
+ public void setHelpId(String helpId) {
+ this.helpId = helpId;
+ }
+
+ /**
+ * @return the image
+ */
+ public String getImage() {
+ return image;
+ }
+
+ /**
+ * @param image the image to set
+ */
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ /**
+ * @return the listDescription
+ */
+ public String getListDescription() {
+ return listDescription;
+ }
+
+ /**
+ * @param listDescription the listDescription to set
+ */
+ public void setListDescription(String listDescription) {
+ this.listDescription = listDescription;
+ }
+
+ /**
+ * @return the listImage
+ */
+ public String getListImage() {
+ return listImage;
+ }
+
+ /**
+ * @param listImage the listImage to set
+ */
+ public void setListImage(String listImage) {
+ this.listImage = listImage;
+ }
+
+ /**
+ * @return the editDescription
+ */
+ public String getEditDescription() {
+ return editDescription;
+ }
+
+ /**
+ * @param editDescription the editDescription to set
+ */
+ public void setEditDescription(String editDescription) {
+ this.editDescription = editDescription;
+ }
+
+ /**
+ * @return the editImage
+ */
+ public String getEditImage() {
+ return editImage;
+ }
+
+ /**
+ * @param editImage the editImage to set
+ */
+ public void setEditImage(String editImage) {
+ this.editImage = editImage;
+ }
+
+ /**
+ * @return the deleteDescription
+ */
+ public String getDeleteDescription() {
+ return deleteDescription;
+ }
+
+ /**
+ * @param deleteDescription the deleteDescription to set
+ */
+ public void setDeleteDescription(String deleteDescription) {
+ this.deleteDescription = deleteDescription;
+ }
+
+ /**
+ * @return the deleteImage
+ */
+ public String getDeleteImage() {
+ return deleteImage;
+ }
+
+ /**
+ * @param deleteImage the deleteImage to set
+ */
+ public void setDeleteImage(String deleteImage) {
+ this.deleteImage = deleteImage;
+ }
+
+ /**
+ * @return the createDescription
+ */
+ public String getCreateDescription() {
+ return createDescription;
+ }
+
+ /**
+ * @param createDescription the createDescription to set
+ */
+ public void setCreateDescription(String createDescription) {
+ this.createDescription = createDescription;
+ }
+
+ /**
+ * @return the createImage
+ */
+ public String getCreateImage() {
+ return createImage;
+ }
+
+ /**
+ * @param createImage the createImage to set
+ */
+ public void setCreateImage(String createImage) {
+ this.createImage = createImage;
+ }
+
+ /**
+ * @return the primaryKeyFieldId
+ */
+ public String getPrimaryKeyFieldId() {
+ return primaryKeyFieldId;
+ }
+
+ /**
+ * @param primaryKeyFieldId the primaryKeyFieldId to set
+ */
+ public void setPrimaryKeyFieldId(String primaryKeyFieldId) {
+ this.primaryKeyFieldId = primaryKeyFieldId;
+ }
+
+ /**
+ * @return the displayNameFieldId
+ */
+ public String getDisplayNameFieldId() {
+ return displayNameFieldId;
+ }
+
+ /**
+ * @param displayNameFieldId the displayNameFieldId to set
+ */
+ public void setDisplayNameFieldId(String displayNameFieldId) {
+ this.displayNameFieldId = displayNameFieldId;
+ }
+
+ /**
+ * @return the vascAdminList
+ */
+ public boolean isVascAdminList() {
+ return vascAdminList;
+ }
+
+ /**
+ * @param vascAdminList the vascAdminList to set
+ */
+ public void setVascAdminList(boolean vascAdminList) {
+ this.vascAdminList = vascAdminList;
+ }
+
+ /**
+ * @return the vascAdminEdit
+ */
+ public boolean isVascAdminEdit() {
+ return vascAdminEdit;
+ }
+
+ /**
+ * @param vascAdminEdit the vascAdminEdit to set
+ */
+ public void setVascAdminEdit(boolean vascAdminEdit) {
+ this.vascAdminEdit = vascAdminEdit;
+ }
+
+ /**
+ * @return the vascAdminCreate
+ */
+ public boolean isVascAdminCreate() {
+ return vascAdminCreate;
+ }
+
+ /**
+ * @param vascAdminCreate the vascAdminCreate to set
+ */
+ public void setVascAdminCreate(boolean vascAdminCreate) {
+ this.vascAdminCreate = vascAdminCreate;
+ }
+
+ /**
+ * @return the vascAdminDelete
+ */
+ public boolean isVascAdminDelete() {
+ return vascAdminDelete;
+ }
+
+ /**
+ * @param vascAdminDelete the vascAdminDelete to set
+ */
+ public void setVascAdminDelete(boolean vascAdminDelete) {
+ this.vascAdminDelete = vascAdminDelete;
+ }
+
+ /**
+ * @return the vascFields
+ */
+ public List getVascEntryFields() {
+ return vascFields;
+ }
+
+ /**
+ * @param vascField the vascFields to add
+ */
+ public void addVascEntryField(VascEntryField vascField) {
+ vascFields.add(vascField);
+ }
+
+ /**
+ * @param vascField the vascFields to remove
+ */
+ public void removeVascEntryField(VascEntryField vascField) {
+ vascFields.remove(vascField);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntry#getVascEntryFieldById(java.lang.String)
+ */
+ public VascEntryField getVascEntryFieldById(String id) {
+ for (VascEntryField v:vascFields) {
+ if (v.getId().equals(id)) {
+ return v;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @return the rowActions
+ */
+ public List getRowActions() {
+ return rowActions;
+ }
+
+ /**
+ * @return the RowVascAction
+ */
+ public RowVascAction getRowActionById(String actionId) {
+ for (RowVascAction a:rowActions) {
+ if (a.getId().equals(actionId)) {
+ return a;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param rowAction the rowAction to add
+ */
+ public void addRowAction(RowVascAction rowAction) {
+ rowActions.add(rowAction);
+ }
+
+ /**
+ * @param rowAction the rowAction to remove
+ */
+ public void removeRowAction(RowVascAction rowAction) {
+ rowActions.remove(rowAction);
+ }
+
+ /**
+ * @return the columnActions
+ */
+ public List getColumnActions() {
+ return columnActions;
+ }
+
+ /**
+ * @return the ColumnVascAction
+ */
+ public ColumnVascAction getColumnActionById(String actionId) {
+ for (ColumnVascAction a:columnActions) {
+ if (a.getId().equals(actionId)) {
+ return a;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param columnAction the columnActions to add
+ */
+ public void addColumnAction(ColumnVascAction columnAction) {
+ columnActions.add(columnAction);
+ }
+
+ /**
+ * @param columnAction the columnActions to remove
+ */
+ public void removeColumnAction(ColumnVascAction columnAction) {
+ columnActions.remove(columnAction);
+ }
+
+ /**
+ * @return the globalActions
+ */
+ public List getGlobalActions() {
+ return globalActions;
+ }
+
+ /**
+ * @return the GlobalVascAction
+ */
+ public GlobalVascAction getGlobalActionById(String actionId) {
+ for (GlobalVascAction a:globalActions) {
+ if (a.getId().equals(actionId)) {
+ return a;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param globalAction the globalAction to add
+ */
+ public void addGlobalAction(GlobalVascAction globalAction) {
+ globalActions.add(globalAction);
+ }
+
+ /**
+ * @param globalAction the globalAction to remove
+ */
+ public void removeGlobalAction(GlobalVascAction globalAction) {
+ globalActions.remove(globalAction);
+ }
+
+ /**
+ * @return the vascEntryFieldSets
+ */
+ public List getVascEntryFieldSets() {
+ return vascEntryFieldSets;
+ }
+
+ /**
+ * @return the VascEntryFieldSet
+ */
+ public VascEntryFieldSet getVascEntryFieldSetById(String fieldSetId) {
+ for (VascEntryFieldSet a:vascEntryFieldSets) {
+ if (a.getId().equals(fieldSetId)) {
+ return a;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param vascEntryFieldSet the vascEntryFieldSet to add
+ */
+ public void addVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet) {
+ vascEntryFieldSets.add(vascEntryFieldSet);
+ }
+
+ /**
+ * @param vascEntryFieldSet the vascEntryFieldSet to add
+ */
+ public void removeVascEntryFieldSet(VascEntryFieldSet vascEntryFieldSet) {
+ vascEntryFieldSets.remove(vascEntryFieldSet);
+ }
+
+ /**
+ * @return the vascLinkEntries
+ */
+ public List getVascLinkEntries() {
+ return vascLinkEntries;
+ }
+
+ /**
+ * @return the VascLinkEntry
+ */
+ public VascLinkEntry getVascLinkEntryById(String linkId) {
+ for (VascLinkEntry a:vascLinkEntries) {
+ if (a.getId().equals(linkId)) {
+ return a;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @param vascLinkEntry the vascLinkEntry to set
+ */
+ public void addVascLinkEntry(VascLinkEntry vascLinkEntry) {
+ vascLinkEntries.add(vascLinkEntry);
+ }
+
+ /**
+ * @param vascLinkEntry the vascLinkEntry to remove
+ */
+ public void removeVascLinkEntry(VascLinkEntry vascLinkEntry) {
+ vascLinkEntries.remove(vascLinkEntry);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntry#getEntryParameter(java.lang.String)
+ */
+ public Object getEntryParameter(String key) {
+ return entryParameters.get(key);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntry#getEntryParameterKeys()
+ */
+ public List getEntryParameterKeys() {
+ return new ArrayList(entryParameters.keySet());
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntry#setEntryParameter(java.lang.String, java.lang.Object)
+ */
+ public void setEntryParameter(String key, Object value) {
+ entryParameters.put(key, value);
+ }
+
+ /**
+ * @return the vascFrontendData
+ */
+ public VascFrontendData getVascFrontendData() {
+ return vascFrontendData;
+ }
+
+ /**
+ * @param vascFrontendData the vascFrontendData to set
+ */
+ public void setVascFrontendData(VascFrontendData vascFrontendData) {
+ this.vascFrontendData = vascFrontendData;
+ }
+
+ /**
+ * @return the backendId
+ */
+ public String getBackendId() {
+ return backendId;
+ }
+
+ /**
+ * @param backendId the backendId to set
+ */
+ public void setBackendId(String backendId) {
+ this.backendId = backendId;
+ }
+
+ /**
+ * @return the vascDisplayOnly
+ */
+ public boolean isVascDisplayOnly() {
+ return vascDisplayOnly;
+ }
+
+ /**
+ * @param vascDisplayOnly the vascDisplayOnly to set
+ */
+ public void setVascDisplayOnly(boolean vascDisplayOnly) {
+ this.vascDisplayOnly = vascDisplayOnly;
+ }
+
+ /**
+ * @return the vascEntryFieldEventChannel
+ */
+ public VascEntryFieldEventChannel getVascEntryFieldEventChannel() {
+ return vascEntryFieldEventChannel;
+ }
+
+ /**
+ * @param vascEntryFieldEventChannel the vascEntryFieldEventChannel to set
+ */
+ public void setVascEntryFieldEventChannel(VascEntryFieldEventChannel vascEntryFieldEventChannel) {
+ this.vascEntryFieldEventChannel = vascEntryFieldEventChannel;
+ }
+
+ /**
+ * Added an VascEntryBackendEventListener
+ * @param listener The class of the event listener.
+ */
+ public void addVascEntryBackendEventListener(Class listener) {
+ eventEntryBackendEventListeners.add(listener);
+ }
+
+ /**
+ * Returns the list of VascEntryBackendEventListener
+ * @return
+ */
+ public List> getVascEntryBackendEventListeners() {
+ return eventEntryBackendEventListeners;
+ }
+
+ /**
+ * Added an VascEntryFrontendEventListener
+ * @param listener The class of the event listener.
+ */
+ public void addVascEntryFrontendEventListener(Class listener) {
+ eventEntryFrontendEventListeners.add(listener);
+ }
+
+ /**
+ * Returns the list of VascEntryFrontendEventListener
+ * @return
+ */
+ public List> getVascEntryFrontendEventListeners() {
+ return eventEntryFrontendEventListeners;
+ }
+
+ public void addListOption(VascEntryField listOption) {
+ if (listOption==null) {
+ throw new NullPointerException("can not add null listOption.");
+ }
+ listOptions.add(listOption);
+ }
+
+ public List getListOptions() {
+ return listOptions;
+ }
+
+
+ public void addVascBackendFilter(VascBackendFilter filter) {
+ backendFilters.add(filter);
+ }
+
+ public List getVascBackendFilters() {
+ return backendFilters;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryController.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryController.java
new file mode 100644
index 0000000..54e9620
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryController.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryControllerLocal;
+import com.idcanet.vasc.core.VascException;
+
+/**
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 18, 2008
+ */
+public class DefaultVascEntryController implements VascEntryControllerLocal {
+
+ private Map entries = null;
+
+ public DefaultVascEntryController() {
+ entries = new HashMap();
+ }
+
+ public void addVascEntry(VascEntry entry,VascController vascController) throws VascException {
+ DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
+ entry = f.finalizeVascEntry(entry,vascController);
+ entries.put(entry.getId(), entry);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryController#getVascEntryById(java.lang.String)
+ */
+ public VascEntry getVascEntryById(String id) {
+ VascEntry entry = entries.get(id);
+ if (entry==null) {
+ throw new NullPointerException("Could not find vasc entry with id: "+id);
+ }
+ try {
+ return entry.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new NullPointerException("Could not clone entry: "+e.getMessage());
+ }
+ }
+
+
+ public VascEntry getRealVascEntryById(String id) {
+ VascEntry entry = entries.get(id);
+ return entry;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryController#getVascEntryIds()
+ */
+ public List getVascEntryIds() {
+ List result = new ArrayList(entries.keySet());
+ Collections.sort(result); // lets do abc for consistance behauvior.
+ return result;
+ }
+
+ /**
+ * Retuns only the adminList table entries
+ */
+ public List getVascEntryAdminIds() {
+ List adminIds = new ArrayList(30);
+ for (VascEntry e:entries.values()) {
+ if (Boolean.TRUE.equals(e.isVascAdminList())) {
+ adminIds.add(e.getId());
+ }
+ }
+ Collections.sort(adminIds); // lets do abc for consistance behauvior.
+ return adminIds;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryField.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryField.java
new file mode 100644
index 0000000..081da97
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryField.java
@@ -0,0 +1,614 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascEntryFieldType;
+import com.idcanet.vasc.core.entry.VascEntryFieldValue;
+import com.idcanet.vasc.validators.VascValidator;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public class DefaultVascEntryField implements VascEntryField {
+
+ private static final long serialVersionUID = 1L;
+
+ private VascEntry vascEntry = null;
+
+ private String id = null;
+ private String backendName = null;
+ private String displayName = null;
+
+ private VascEntryFieldType vascEntryFieldType = null;
+ private VascEntryFieldValue vascEntryFieldValue = null;
+ private List vascValidators = null;
+
+ private String name = null;
+ private String description = null;
+ private String helpId = null;
+ private String image = null;
+ private Integer orderIndex = null;
+ private Object defaultValue = null;
+
+ private Integer sizeList = null;
+ private Integer sizeEdit = null;
+ private String styleList = null;
+ private String styleEdit = null;
+
+ private String choices = null;
+ private Boolean choicesAsRadio = null;
+
+ /** Defines if this columns is used in interface list,create,edit **/
+ private Boolean view = null;
+ private Boolean optional = null;
+
+ /** Defines per view state of this field **/
+ private Boolean create = null;
+ private Boolean edit = null;
+ private Boolean editReadOnly = null;
+ private Boolean editBlank = null;
+ private Boolean list = null;
+
+ /** Defines the roles stuff if all up is true **/
+ private String rolesCreate = null;
+ private String rolesEdit = null;
+ private String rolesEditReadOnly = null;
+ private String rolesList = null;
+
+ private Boolean sortable = null;
+ private Boolean sumable = null;
+ private Boolean graphable = null;
+
+ public DefaultVascEntryField() {
+ vascValidators = new ArrayList(5);
+ }
+
+ public DefaultVascEntryField(String id) {
+ this();
+ setId(id);
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public VascEntryField clone() throws CloneNotSupportedException {
+ DefaultVascEntryField result = new DefaultVascEntryField();
+ result.id=id;
+ result.backendName=backendName;
+ result.displayName=displayName;
+ result.vascEntryFieldType=vascEntryFieldType;
+ result.name=name;
+ result.description=description;
+ result.helpId=helpId;
+ result.image=image;
+ result.defaultValue=defaultValue;
+ result.orderIndex=orderIndex;
+ result.sizeList=sizeList;
+ result.sizeEdit=sizeEdit;
+ result.styleList=styleList;
+ result.styleEdit=styleEdit;
+ result.choices=choices;
+ result.choicesAsRadio=choicesAsRadio;
+ result.view=view;
+ result.optional=optional;
+ result.create=create;
+ result.edit=edit;
+ result.editReadOnly=editReadOnly;
+ result.editBlank=editBlank;
+ result.list=list;
+
+ result.rolesCreate=rolesCreate;
+ result.rolesEdit=rolesEdit;
+ result.rolesEditReadOnly=rolesEditReadOnly;
+ result.rolesList=rolesList;
+
+ result.sortable=sortable;
+ result.sumable=sumable;
+ result.graphable=graphable;
+
+ // this polls full backend..
+ //result.vascEntryFieldValue=vascEntryFieldValue;
+
+ for (VascValidator val:vascValidators) {
+ result.vascValidators.add(val.clone());
+ }
+
+ return result;
+ }
+
+ public VascEntry getVascEntry() {
+ return vascEntry;
+ }
+
+ public void setVascEntry(VascEntry vascEntry) {
+ this.vascEntry=vascEntry;
+ }
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the vascEntryFieldType
+ */
+ public VascEntryFieldType getVascEntryFieldType() {
+ return vascEntryFieldType;
+ }
+
+ /**
+ * @param vascEntryFieldType the vascEntryFieldType to set
+ */
+ public void setVascEntryFieldType(VascEntryFieldType vascEntryFieldType) {
+ this.vascEntryFieldType = vascEntryFieldType;
+ }
+
+ /**
+ * @return the backendName
+ */
+ public String getBackendName() {
+ return backendName;
+ }
+
+ /**
+ * @param backendName the backendName to set
+ */
+ public void setBackendName(String backendName) {
+ this.backendName = backendName;
+ }
+
+ /**
+ * @return the vascEntryFieldValue
+ */
+ public VascEntryFieldValue getVascEntryFieldValue() {
+ return vascEntryFieldValue;
+ }
+
+ /**
+ * @param vascEntryFieldValue the vascEntryFieldValue to set
+ */
+ public void setVascEntryFieldValue(VascEntryFieldValue vascEntryFieldValue) {
+ this.vascEntryFieldValue = vascEntryFieldValue;
+ }
+
+ /**
+ * @return the vascValidators
+ */
+ public List getVascValidators() {
+ return vascValidators;
+ }
+
+ /**
+ * @param vascValidators the vascValidators to add
+ */
+ public void addVascValidator(VascValidator vascValidator) {
+ this.vascValidators.add(vascValidator);
+ }
+
+ /**
+ * @param vascValidators the vascValidators to remove
+ */
+ public void removeVascValidator(VascValidator vascValidator) {
+ this.vascValidators.remove(vascValidator);
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the helpId
+ */
+ public String getHelpId() {
+ return helpId;
+ }
+
+ /**
+ * @param helpId the helpId to set
+ */
+ public void setHelpId(String helpId) {
+ this.helpId = helpId;
+ }
+
+ /**
+ * @return the image
+ */
+ public String getImage() {
+ return image;
+ }
+
+ /**
+ * @param image the image to set
+ */
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ /**
+ * @return the defaultValue
+ */
+ public Object getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * @param defaultValue the defaultValue to set
+ */
+ public void setDefaultValue(Object defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * @return the sizeList
+ */
+ public Integer getSizeList() {
+ return sizeList;
+ }
+
+ /**
+ * @param sizeList the sizeList to set
+ */
+ public void setSizeList(Integer sizeList) {
+ this.sizeList = sizeList;
+ }
+
+ /**
+ * @return the sizeEdit
+ */
+ public Integer getSizeEdit() {
+ return sizeEdit;
+ }
+
+ /**
+ * @param sizeEdit the sizeEdit to set
+ */
+ public void setSizeEdit(Integer sizeEdit) {
+ this.sizeEdit = sizeEdit;
+ }
+
+ /**
+ * @return the styleList
+ */
+ public String getStyleList() {
+ return styleList;
+ }
+
+ /**
+ * @param styleList the styleList to set
+ */
+ public void setStyleList(String styleList) {
+ this.styleList = styleList;
+ }
+
+ /**
+ * @return the styleEdit
+ */
+ public String getStyleEdit() {
+ return styleEdit;
+ }
+
+ /**
+ * @param styleEdit the styleEdit to set
+ */
+ public void setStyleEdit(String styleEdit) {
+ this.styleEdit = styleEdit;
+ }
+
+ /**
+ * @return the choices
+ */
+ public String getChoices() {
+ return choices;
+ }
+
+ /**
+ * @param choices the choices to set
+ */
+ public void setChoices(String choices) {
+ this.choices = choices;
+ }
+
+ /**
+ * @return the view
+ */
+ public Boolean getView() {
+ return view;
+ }
+
+ /**
+ * @param view the view to set
+ */
+ public void setView(Boolean view) {
+ this.view = view;
+ }
+
+ /**
+ * @return the optional
+ */
+ public Boolean getOptional() {
+ return optional;
+ }
+
+ /**
+ * @param optional the optional to set
+ */
+ public void setOptional(Boolean optional) {
+ this.optional = optional;
+ }
+
+ /**
+ * @return the create
+ */
+ public Boolean getCreate() {
+ return create;
+ }
+
+ /**
+ * @param create the create to set
+ */
+ public void setCreate(Boolean create) {
+ this.create = create;
+ }
+
+ /**
+ * @return the edit
+ */
+ public Boolean getEdit() {
+ return edit;
+ }
+
+ /**
+ * @param edit the edit to set
+ */
+ public void setEdit(Boolean edit) {
+ this.edit = edit;
+ }
+
+ /**
+ * @return the editReadOnly
+ */
+ public Boolean getEditReadOnly() {
+ return editReadOnly;
+ }
+
+ /**
+ * @param editReadOnly the editReadOnly to set
+ */
+ public void setEditReadOnly(Boolean editReadOnly) {
+ this.editReadOnly = editReadOnly;
+ }
+
+ /**
+ * @return the list
+ */
+ public Boolean getList() {
+ return list;
+ }
+
+ /**
+ * @param list the list to set
+ */
+ public void setList(Boolean list) {
+ this.list = list;
+ }
+
+ /**
+ * @return the rolesCreate
+ */
+ public String getRolesCreate() {
+ return rolesCreate;
+ }
+
+ /**
+ * @param rolesCreate the rolesCreate to set
+ */
+ public void setRolesCreate(String rolesCreate) {
+ this.rolesCreate = rolesCreate;
+ }
+
+ /**
+ * @return the rolesEdit
+ */
+ public String getRolesEdit() {
+ return rolesEdit;
+ }
+
+ /**
+ * @param rolesEdit the rolesEdit to set
+ */
+ public void setRolesEdit(String rolesEdit) {
+ this.rolesEdit = rolesEdit;
+ }
+
+ /**
+ * @return the rolesEditReadOnly
+ */
+ public String getRolesEditReadOnly() {
+ return rolesEditReadOnly;
+ }
+
+ /**
+ * @param rolesEditReadOnly the rolesEditReadOnly to set
+ */
+ public void setRolesEditReadOnly(String rolesEditReadOnly) {
+ this.rolesEditReadOnly = rolesEditReadOnly;
+ }
+
+ /**
+ * @return the rolesList
+ */
+ public String getRolesList() {
+ return rolesList;
+ }
+
+ /**
+ * @param rolesList the rolesList to set
+ */
+ public void setRolesList(String rolesList) {
+ this.rolesList = rolesList;
+ }
+
+ /**
+ * @return the choicesAsRadio
+ */
+ public Boolean getChoicesAsRadio() {
+ return choicesAsRadio;
+ }
+
+ /**
+ * @param choicesAsRadio the choicesAsRadio to set
+ */
+ public void setChoicesAsRadio(Boolean choicesAsRadio) {
+ this.choicesAsRadio = choicesAsRadio;
+ }
+
+ /**
+ * @return the editBlank
+ */
+ public Boolean getEditBlank() {
+ return editBlank;
+ }
+
+ /**
+ * @param editBlank the editBlank to set
+ */
+ public void setEditBlank(Boolean editBlank) {
+ this.editBlank = editBlank;
+ }
+
+ /**
+ * @return the displayName
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ /**
+ * @param displayName the displayName to set
+ */
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * @return the orderIndex
+ */
+ public Integer getOrderIndex() {
+ return orderIndex;
+ }
+
+ /**
+ * @param orderIndex the orderIndex to set
+ */
+ public void setOrderIndex(Integer orderIndex) {
+ this.orderIndex = orderIndex;
+ }
+
+ /**
+ * @return the sortable
+ */
+ public Boolean getSortable() {
+ return sortable;
+ }
+
+ /**
+ * @param sortable the sortable to set
+ */
+ public void setSortable(Boolean sortable) {
+ this.sortable = sortable;
+ }
+
+ /**
+ * @return the sumable
+ */
+ public Boolean getSumable() {
+ return sumable;
+ }
+
+ /**
+ * @param sumable the sumable to set
+ */
+ public void setSumable(Boolean sumable) {
+ this.sumable = sumable;
+ }
+
+ /**
+ * @return the graphable
+ */
+ public Boolean getGraphable() {
+ return graphable;
+ }
+
+ /**
+ * @param graphable the graphable to set
+ */
+ public void setGraphable(Boolean graphable) {
+ this.graphable = graphable;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryFieldSet.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryFieldSet.java
new file mode 100644
index 0000000..fbd1b06
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryFieldSet.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.idcanet.vasc.core.VascEntryFieldSet;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public class DefaultVascEntryFieldSet implements VascEntryFieldSet {
+
+ private String id = null;
+
+ private String name = null;
+ private String description = null;
+ private String helpId = null;
+ private String image = null;
+
+ private String styleList = null;
+ private String styleEdit = null;
+
+ private boolean collapsed = false;
+ private boolean optional = false;
+
+ private List vascEntryFieldIds = null;
+
+ public DefaultVascEntryFieldSet() {
+ vascEntryFieldIds = new ArrayList(10);
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public VascEntryFieldSet clone() throws CloneNotSupportedException {
+ DefaultVascEntryFieldSet result = new DefaultVascEntryFieldSet();
+ result.id=id;
+ result.name=name;
+ result.description=description;
+ result.helpId=helpId;
+ result.image=image;
+ result.styleList=styleList;
+ result.styleEdit=styleEdit;
+ result.collapsed=collapsed;
+ result.optional=optional;
+ result.vascEntryFieldIds.addAll(vascEntryFieldIds);
+ return result;
+ }
+
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the helpId
+ */
+ public String getHelpId() {
+ return helpId;
+ }
+
+ /**
+ * @param helpId the helpId to set
+ */
+ public void setHelpId(String helpId) {
+ this.helpId = helpId;
+ }
+
+ /**
+ * @return the image
+ */
+ public String getImage() {
+ return image;
+ }
+
+ /**
+ * @param image the image to set
+ */
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ /**
+ * @return the styleList
+ */
+ public String getStyleList() {
+ return styleList;
+ }
+
+ /**
+ * @param styleList the styleList to set
+ */
+ public void setStyleList(String styleList) {
+ this.styleList = styleList;
+ }
+
+ /**
+ * @return the styleEdit
+ */
+ public String getStyleEdit() {
+ return styleEdit;
+ }
+
+ /**
+ * @param styleEdit the styleEdit to set
+ */
+ public void setStyleEdit(String styleEdit) {
+ this.styleEdit = styleEdit;
+ }
+
+ /**
+ * @return the collapsed
+ */
+ public boolean isCollapsed() {
+ return collapsed;
+ }
+
+ /**
+ * @param collapsed the collapsed to set
+ */
+ public void setCollapsed(boolean collapsed) {
+ this.collapsed = collapsed;
+ }
+
+ /**
+ * @return the optional
+ */
+ public boolean isOptional() {
+ return optional;
+ }
+
+ /**
+ * @param optional the optional to set
+ */
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
+ /**
+ * @return the vascEntryFieldIds
+ */
+ public List getVascEntryFieldIds() {
+ return vascEntryFieldIds;
+ }
+
+ /**
+ * @param vascEntryFieldIds the vascEntryFieldIds to set
+ */
+ public void addVascEntryFieldId(String vascEntryFieldId) {
+ vascEntryFieldIds.add(vascEntryFieldId);
+ }
+
+ /**
+ * @param vascEntryFieldIds the vascEntryFieldIds to set
+ */
+ public void removeVascEntryFieldId(String vascEntryFieldId) {
+ vascEntryFieldIds.remove(vascEntryFieldId);
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryState.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryState.java
new file mode 100644
index 0000000..529579d
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryState.java
@@ -0,0 +1,16 @@
+/**
+ *
+ */
+package com.idcanet.vasc.impl;
+
+import com.idcanet.vasc.core.AbstractVascEntryState;
+
+/**
+ * Holds all state values
+ *
+ * @author Willem Cazander
+ * @version 1.0 Dec 15, 2009
+ */
+public class DefaultVascEntryState extends AbstractVascEntryState {
+ private static final long serialVersionUID = 1L;
+}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFactory.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFactory.java
new file mode 100644
index 0000000..f92d266
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFactory.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascBackendFilter;
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.VascFrontendData;
+import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
+import com.idcanet.vasc.impl.entry.VascValidatorsValidatorService;
+import com.idcanet.vasc.impl.type.DefaultVascEntryFieldTypeController;
+
+/**
+ * Default Vasc Factory for creating some base object plumming for vasc useage.
+ *
+ * @author Willem Cazander
+ * @version 1.0 Dec 15, 2009
+ */
+public class DefaultVascFactory {
+
+
+ static public VascController getDefaultVascController(Long userId,String userName,String...roles) throws VascException {
+
+ // config full controller for local jvm use
+ DefaultVascController c = new DefaultVascController();
+
+ DefaultVascBackendController vascBackendController = new DefaultVascBackendController();
+ c.setVascBackendController(vascBackendController);
+
+ DefaultVascEntryController vascEntryController = new DefaultVascEntryController();
+ c.setVascEntryController(vascEntryController);
+
+ DefaultVascEntryFieldTypeController vascEntryFieldTypeController = new DefaultVascEntryFieldTypeController();
+ c.setVascEntryFieldTypeController(vascEntryFieldTypeController);
+
+ DefaultVascUserRoleController vascUserRoleController = new DefaultVascUserRoleController(userId,userName,roles);
+ c.setVascUserRoleController(vascUserRoleController);
+
+ return c;
+ }
+
+ static public VascFrontendData getDefaultVascFrontendData(String resourceBundle,Locale locale) {
+ ResourceBundle bundle = ResourceBundle.getBundle(resourceBundle, locale);
+ return getDefaultVascFrontendData(bundle);
+ }
+
+ static public VascFrontendData getDefaultVascFrontendData(ResourceBundle resourceBundle) {
+ DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData(); // controller is set by vasc
+ vascFrontendData.setVascEntryResourceResolver(new DefaultVascEntryResourceResolver(resourceBundle));
+ vascFrontendData.setVascFrontendHelper(new DefaultVascFrontendHelper());
+ //vascFrontendData.setVascEntryResourceImageResolver(new ImageResources());
+ vascFrontendData.setVascEntryState(new DefaultVascEntryState());
+ vascFrontendData.getVascEntryState().setVascBackendState(new DefaultVascBackendState());
+ vascFrontendData.getVascEntryState().getVascBackendState().setPageSize(100); // default page size is zero aka disabled
+ vascFrontendData.getVascEntryState().getVascBackendState().setPageSizeMax(1000); // max 1k records on screen.
+ vascFrontendData.addVascValidatorService(new VascValidatorsValidatorService()); // normal vasc validators
+ return vascFrontendData;
+ }
+
+ static public VascBackend getProxyVascBackend(VascEntry entry) {
+ // Get the real backend
+ VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendController().getVascBackendById(entry.getBackendId());
+
+ // logs all actions log logger
+ backend = new VascBackendProxyTimerLogger(backend,entry);
+
+ // only cached one result, checks for paramater differnce
+ backend = new VascBackendProxyCache(backend,entry);
+
+ for (VascBackendFilter filter:entry.getVascBackendFilters()) {
+ filter.initFilter(entry);
+ backend = new VascBackendProxyFilter(backend,entry,filter);
+ }
+ if (backend.isSearchable()==false) {
+ backend = new VascBackendProxySearch(backend,entry);
+ }
+ if (backend.isSortable()==false) {
+ backend = new VascBackendProxySort(backend,entry);
+ }
+ if (backend.isPageable()==false) {
+ backend = new VascBackendProxyPaged(backend,entry);
+ }
+ return backend;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java
new file mode 100644
index 0000000..a0d6be7
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascEntryFinalizer;
+import com.idcanet.vasc.core.VascEntryState;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.VascFrontend;
+import com.idcanet.vasc.core.VascFrontendData;
+import com.idcanet.vasc.core.VascFrontendHelper;
+import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
+import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
+import com.idcanet.vasc.core.entry.VascEntryResourceImageResolver;
+import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
+import com.idcanet.vasc.core.ui.VascUIComponent;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public class DefaultVascFrontendData implements VascFrontendData {
+
+ private VascFrontend vascFrontend = null;
+ private VascEntryFinalizer vascEntryFinalizer = null;
+ private VascFrontendHelper vascFrontendHelper = null;
+ private VascEntryResourceResolver vascEntryResourceResolver = null;
+ private VascEntryResourceImageResolver vascEntryResourceImageResolver = null;
+ private Map uiComponents = null;
+ private VascController vascController = null;
+ private Map> vascEntryFrontendEventListeners = null;
+ private VascEntryState state = null;
+
+
+ private Map fieldComps = null;
+ private Map fieldEditors = null;
+ private List validatorServices = null;
+
+ public DefaultVascFrontendData() {
+ uiComponents = new HashMap(8);
+ fieldComps = new HashMap(8);
+ fieldEditors = new HashMap(8);
+ validatorServices = new ArrayList(4);
+ vascEntryFrontendEventListeners = new HashMap>(10);
+ }
+
+ /**
+ * @return the vascFrontend
+ */
+ public VascFrontend getVascFrontend() {
+ return vascFrontend;
+ }
+
+ /**
+ * @param vascFrontend the vascFrontend to set
+ */
+ public void setVascFrontend(VascFrontend vascFrontend) {
+ this.vascFrontend = vascFrontend;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackendData#getVascEntryFinalizer()
+ */
+ public VascEntryFinalizer getVascEntryFinalizer() {
+ return vascEntryFinalizer;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackendData#setVascEntryFinalizer(com.idcanet.vasc.core.VascEntryFinalizer)
+ */
+ public void setVascEntryFinalizer(VascEntryFinalizer vascEntryFinalizer) {
+ this.vascEntryFinalizer=vascEntryFinalizer;
+ }
+
+ /**
+ * @return the vascFrontendHelper
+ */
+ public VascFrontendHelper getVascFrontendHelper() {
+ return vascFrontendHelper;
+ }
+
+ /**
+ * @param vascFrontendHelper the vascFrontendHelper to set
+ */
+ public void setVascFrontendHelper(VascFrontendHelper vascFrontendHelper) {
+ this.vascFrontendHelper = vascFrontendHelper;
+ }
+
+ /**
+ * @return the vascEntryResourceResolver
+ */
+ public VascEntryResourceResolver getVascEntryResourceResolver() {
+ return vascEntryResourceResolver;
+ }
+
+ /**
+ * @param vascEntryResourceResolver the vascEntryResourceResolver to set
+ */
+ public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver) {
+ this.vascEntryResourceResolver = vascEntryResourceResolver;
+ }
+
+
+ public VascUIComponent getVascUIComponent(String rendererId) throws VascException {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null) {
+ cl = rendererId.getClass().getClassLoader(); // fallback
+ }
+ String componentClass = getVascUIComponentClass(rendererId);
+ if (componentClass==null) {
+
+ // TODO: auto wire text <-> object converts
+
+ componentClass = getVascUIComponentClass(VascUIComponent.VASC_TEXT);
+ }
+ if (componentClass==null) {
+ throw new VascException("No component Class found for frontend UIComponent: "+rendererId);
+ }
+ try {
+ return (VascUIComponent)cl.loadClass(componentClass).newInstance();
+ } catch (Exception e) {
+ throw new VascException(e);
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendData#getVascUIComponent(java.lang.String)
+ */
+ public String getVascUIComponentClass(String rendererId) {
+ return uiComponents.get(rendererId);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendData#putVascUIComponent(java.lang.String, java.lang.String)
+ */
+ public void putVascUIComponent(String rendererId, String uiComponentClass) {
+ uiComponents.put(rendererId, uiComponentClass);
+ }
+
+ /**
+ * @return the vascController
+ */
+ public VascController getVascController() {
+ return vascController;
+ }
+
+ /**
+ * @param vascController the vascController to set
+ */
+ public void setVascController(VascController vascController) {
+ this.vascController = vascController;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendData#addFieldVascUIComponents(com.idcanet.vasc.core.VascEntryField, com.idcanet.vasc.core.ui.VascUIComponent, java.lang.Object)
+ */
+ public void addFieldVascUIComponents(VascEntryField field,VascUIComponent uiComponent, Object editor) {
+ fieldComps.put(field, uiComponent);
+ fieldEditors.put(field, editor);
+ }
+
+ public void clearFieldRenderObjects() {
+ fieldComps.clear();
+ fieldEditors.clear();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendData#getFieldRealRenderer(com.idcanet.vasc.core.VascEntryField)
+ */
+ public Object getFieldRealRenderer(VascEntryField field) {
+ return fieldEditors.get(field);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendData#getFieldVascUIComponent(com.idcanet.vasc.core.VascEntryField)
+ */
+ public VascUIComponent getFieldVascUIComponent(VascEntryField field) {
+ return fieldComps.get(field);
+ }
+
+ /**
+ * @return the vascEntryResourceImageResolver
+ */
+ public VascEntryResourceImageResolver getVascEntryResourceImageResolver() {
+ return vascEntryResourceImageResolver;
+ }
+
+ /**
+ * @param vascEntryResourceImageResolver the vascEntryResourceImageResolver to set
+ */
+ public void setVascEntryResourceImageResolver(VascEntryResourceImageResolver vascEntryResourceImageResolver) {
+ this.vascEntryResourceImageResolver = vascEntryResourceImageResolver;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendData#addVascValidatorService(com.idcanet.vasc.core.entry.VascEntryFieldValidatorService)
+ */
+ public void addVascValidatorService(VascEntryFieldValidatorService validatorService) {
+ validatorServices.add(validatorService);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendData#getVascValidatorServices()
+ */
+ public List getVascValidatorServices() {
+ return validatorServices;
+ }
+
+ public VascEntryState getVascEntryState() {
+ return state;
+ }
+
+ public void setVascEntryState(VascEntryState state) {
+ this.state=state;
+ }
+
+
+ public void initFrontendListeners(VascEntry entry) throws InstantiationException, IllegalAccessException {
+ for (Class clazz:entry.getVascEntryFrontendEventListeners()) {
+ VascEntryFrontendEventListener listener = clazz.newInstance();
+ addVascEntryFrontendEventListener(listener);
+ }
+ }
+
+ public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener) {
+ for (VascEntryFrontendEventListener.VascFrontendEventType type:listener.getEventTypes()) {
+ List list = vascEntryFrontendEventListeners.get(type);
+ if (list==null) {
+ list = new ArrayList(10);
+ vascEntryFrontendEventListeners.put(type, list);
+ }
+ list.add(listener);
+ }
+ }
+
+ public List getVascEntryFrontendEventListener(VascEntryFrontendEventListener.VascFrontendEventType type) {
+ List list = vascEntryFrontendEventListeners.get(type);
+ if (list==null) {
+ return new ArrayList(0);
+ }
+ return list;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendEntryFinalizer.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendEntryFinalizer.java
new file mode 100644
index 0000000..7665da2
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendEntryFinalizer.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryFinalizer;
+import com.idcanet.vasc.core.VascException;
+
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 14, 2008
+ */
+public class DefaultVascFrontendEntryFinalizer implements VascEntryFinalizer {
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFinalizer#finalizeVascEntry(com.idcanet.vasc.core.VascEntry)
+ */
+ public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
+
+ return entry;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendHelper.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendHelper.java
new file mode 100644
index 0000000..2466d1d
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendHelper.java
@@ -0,0 +1,535 @@
+/*
+ * Copyright 2004-2010 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.logging.Logger;
+
+import com.idcanet.vasc.core.VascBackendFilter;
+import com.idcanet.vasc.core.VascBackendPageNumber;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.VascFrontendHelper;
+import com.idcanet.vasc.core.VascLinkEntry;
+import com.idcanet.vasc.core.VascLinkEntryType;
+import com.idcanet.vasc.core.VascUserRoleController;
+import com.idcanet.vasc.core.actions.GlobalVascAction;
+import com.idcanet.vasc.core.actions.RowVascAction;
+import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
+import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
+import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
+import com.idcanet.vasc.core.ui.VascUIComponent;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Apr 28, 2007
+ */
+public class DefaultVascFrontendHelper implements VascFrontendHelper {
+
+ private Logger logger = Logger.getLogger(DefaultVascFrontendHelper.class.getName());
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#renderView(com.idcanet.vasc.core.VascEntryField)
+ */
+ public boolean renderView(VascEntryField field) {
+ if (field.getView()==false) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#renderCreate(com.idcanet.vasc.core.VascEntryField)
+ */
+ public boolean renderCreate(VascEntryField field) {
+ if (renderView(field)==false) {
+ return false;
+ }
+ VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
+ if (field.getRolesCreate()!=null && u.hasRole(field.getRolesCreate())) {
+ return true;
+ }
+ if (field.getCreate()) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#renderEdit(com.idcanet.vasc.core.VascEntryField)
+ */
+ public boolean renderEdit(VascEntryField field) {
+ if (renderView(field)==false) {
+ return false;
+ }
+ if (field.getVascEntry().getVascFrontendData().getVascEntryState().isEditCreate()) {
+ if (renderCreate(field)==false) {
+ return false;
+ }
+ }
+ VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
+ if (field.getRolesEdit()!=null && u.hasRole(field.getRolesEdit())) {
+ return true;
+ }
+ if (field.getEdit()) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#renderEditReadOnly(com.idcanet.vasc.core.VascEntryField)
+ */
+ public boolean renderEditReadOnly(VascEntryField field) {
+ if (renderView(field)==false) {
+ return false;
+ }
+ VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
+ if (field.getRolesEditReadOnly()!=null && u.hasRole(field.getRolesEditReadOnly())) {
+ return true;
+ }
+ if (field.getEditReadOnly()) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#renderList(com.idcanet.vasc.core.VascEntryField)
+ */
+ public boolean renderList(VascEntryField field) {
+ if (renderView(field)==false) {
+ return false;
+ }
+ VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
+ if (field.getRolesList()!=null && u.hasRole(field.getRolesList())) {
+ return true;
+ }
+ if (field.getList()) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#renderGlobalVascAction(com.idcanet.vasc.core.actions.GlobalVascAction)
+ */
+ public boolean renderGlobalVascAction(GlobalVascAction action) {
+ return true;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#renderRowVascAction(com.idcanet.vasc.core.actions.RowVascAction)
+ */
+ public boolean renderRowVascAction(RowVascAction action) {
+ return true;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#fireVascEvent(com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType, java.lang.Object)
+ */
+ public void fireVascEvent(VascEntry entry,VascFrontendEventType type, Object data) {
+ List list = entry.getVascFrontendData().getVascEntryFrontendEventListener(type);
+ for (VascEntryFrontendEventListener l:list) {
+ l.vascEvent(entry, data);
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#getTotalColumnsWidth(com.idcanet.vasc.core.VascEntry)
+ */
+ public Integer getTotalColumnsWidth(VascEntry entry) {
+ int result = 0;
+ for(VascEntryField c:entry.getVascEntryFields()) {
+ if(c.getSizeList()==null) {
+ logger.finer("Column no size: "+c.getName());
+ } else {
+ result+=c.getSizeList();
+ }
+ }
+ return result;
+ }
+
+ public List getVascLinkEntryByType(VascEntry entry,VascLinkEntryType type) {
+ List result = new ArrayList(10);
+ for (VascLinkEntry link:entry.getVascLinkEntries()) {
+ if (type==null) {
+ result.add(link);
+ continue;
+ }
+ if (type.equals(link.getVascLinkEntryType())) {
+ result.add(link);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns the total amount of pages
+ * @return
+ */
+ public List getVascBackendPageNumbers(VascEntry entry) {
+ List result = new ArrayList(30);
+ VascBackendState state = entry.getVascFrontendData().getVascEntryState().getVascBackendState();
+ if (state.getPageSize()==0) {
+ return result; // paging disabled
+ }
+ Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
+ if (total==null) {
+ return result; // no pages
+ }
+ int pages = new Long(total/state.getPageSize()).intValue();
+ for (int i=0;i<=pages;i++) {
+ VascBackendPageNumber pn = new VascBackendPageNumber(i);
+ if (state.getPageIndex()==i) {
+ pn.setSelected(true);
+ }
+ result.add(pn);
+ }
+ return result;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#handleException(com.idcanet.vasc.core.VascEntry,java.lang.Exception)
+ */
+ public void handleException(VascEntry entry,Exception exception) {
+ fireVascEvent(entry,VascFrontendEventType.EXCEPTION , exception);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#initEditObject(com.idcanet.vasc.core.VascEntry)
+ */
+ public Object createObject(VascEntry entry) {
+ try {
+ Object object = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryRecordCreator(entry.clone()).newRecord(entry);
+ if (object==null) {
+ throw new IllegalStateException("Can't work with null object for backend storage.");
+ }
+ for (VascEntryField field:entry.getVascEntryFields()) {
+ if (field.getDefaultValue()==null) {
+ continue; // no default value to set.
+ }
+ Object value = field.getVascEntryFieldValue().getValue(field, object);
+ if (value!=null) {
+ continue; // value is already set by backend creator.
+ }
+ Object defaultValue = field.getDefaultValue();
+ if (defaultValue instanceof String) {
+ String def = (String)defaultValue;
+ if (def.equals("now()")) { // TODO: add default string parsers
+ defaultValue = new Date();
+ }
+ }
+ logger.finer("Setting default value for: "+field.getName()+" def: "+defaultValue);
+ field.getVascEntryFieldValue().setValue(field, object, defaultValue);
+ }
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_CREATE, object);
+ return object;
+ } catch (Exception e) {
+ handleException(entry,e);
+ return null; /// ?? ,,
+ }
+ }
+
+ protected int removeObjectFromDataList(VascEntry entry,Object object) {
+ int indexOld = entry.getVascFrontendData().getVascEntryState().getEntryDataList().indexOf(object);
+ if (entry.getVascFrontendData().getVascEntryState().getEntryDataList().remove(object)) {
+ return indexOld; // java worked well for use
+ }
+
+ // 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
+ try {
+ VascEntryField field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
+ Object idObject = field.getVascEntryFieldValue().getValue(field, object);
+
+ // is only null when creating objects
+ if (idObject!=null) {
+ int index = 0;
+ for (Object o:entry.getVascFrontendData().getVascEntryState().getEntryDataList()) {
+ field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
+ Object id = field.getVascEntryFieldValue().getValue(field, o);
+ if (idObject.equals(id)) {
+ break;
+ }
+ index++;
+ }
+ if (indexentry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSizeMax()) {
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageSize(entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSizeMax());
+ }
+
+ for (String key:entry.getEntryParameterKeys()) {
+ Object value = entry.getEntryParameter(key);
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setDataParameter(key, value);
+ }
+ entry.getVascFrontendData().getVascEntryState().setEntryDataList(entry.getVascFrontendData().getVascEntryState().getVascBackend().execute(entry.getVascFrontendData().getVascEntryState().getVascBackendState()));
+
+ // also update total every time
+ Long total = entry.getVascFrontendData().getVascEntryState().getVascBackend().fetchTotalExecuteSize(entry.getVascFrontendData().getVascEntryState().getVascBackendState());
+ entry.getVascFrontendData().getVascEntryState().setTotalBackendRecords(total);
+ } catch (Exception e) {
+ handleException(entry, e);
+ }
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_READ, null);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE, null);
+ }
+
+ public void headerOptionsCreatedFillData(VascEntry entry) {
+ entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascFrontendHelper#validateObjectField(com.idcanet.vasc.core.VascEntryField, java.lang.Object)
+ */
+ public List validateObjectField(VascEntryField field) {
+ if (field==null) {
+ throw new NullPointerException("Can't validate null field.");
+ }
+ VascEntry entry = field.getVascEntry();
+ if (entry.getVascFrontendData().getVascEntryState().getEntryDataObject()==null) {
+ throw new NullPointerException("Can't validate null entry object.");
+ }
+ List error = new ArrayList(3);
+
+ // skip non-create and non-edit fields
+ if (entry.getVascFrontendData().getVascFrontendHelper().renderCreate(field) == false &
+ entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
+ return error;
+ }
+ if (entry.getVascFrontendData().getVascFrontendHelper().renderEditReadOnly(field) &
+ entry.getVascFrontendData().getVascEntryState().isEditCreate()==false) {
+ return error;
+ }
+
+ try {
+ Object objectSelected = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
+ Object objectValue = field.getVascEntryFieldValue().getValue(field, objectSelected);
+ for (VascEntryFieldValidatorService s:entry.getVascFrontendData().getVascValidatorServices()) {
+ error.addAll(s.validateObjectField(field, objectSelected, objectValue));
+ }
+ } catch (VascException e) {
+ handleException(entry, e);
+ }
+ return error;
+ }
+
+ /**
+ *
+ */
+ public boolean validateAndSetErrorText(VascEntry entry) {
+ boolean hadError = false;
+ for (VascEntryField field:entry.getVascEntryFields()) {
+ VascUIComponent comp = entry.getVascFrontendData().getFieldVascUIComponent(field);
+ List error = validateObjectField(field);
+ logger.info("Check field: "+field.getId()+" comp: "+comp+" Errors: "+error.size());
+ if (error.isEmpty()) {
+ if (comp!=null) {
+ comp.setErrorText(null);
+ }
+ continue;
+ }
+ if (comp==null) {
+ logger.warning("Field: "+field.getId()+" gives errors but no UI component to display.");
+ continue;
+ }
+ hadError=true;
+ StringBuffer buf = new StringBuffer(100);
+ for (String s:error) {
+ buf.append(s);
+ buf.append('\n');
+ }
+ comp.setErrorText(buf.toString());
+ }
+ return hadError;
+ }
+
+ public void editReadOnlyUIComponents(VascEntry entry) {
+ // reset edit read only
+ for (VascEntryField f:entry.getVascEntryFields()) {
+ if (entry.getVascFrontendData().getFieldVascUIComponent(f)==null) {
+ continue;
+ }
+
+ // TODO: move back to rendered when jsf fixes
+ if (entry.getVascFrontendData().getVascFrontendHelper().renderCreate(f) == false &
+ entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
+ //entry.getVascFrontendData().getFieldVascUIComponent(f).setRendered(false);
+ entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(true);
+ } else {
+ //entry.getVascFrontendData().getFieldVascUIComponent(f).setRendered(true);
+ entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(false);
+ }
+
+ // only when editing set edit readonlys
+ if (entry.getVascFrontendData().getVascFrontendHelper().renderEditReadOnly(f) &
+ entry.getVascFrontendData().getVascEntryState().isEditCreate()==false) {
+ entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(true);
+ } else {
+ if (entry.getVascFrontendData().getVascEntryState().isEditCreate()==false) { // todo: remove when jsf fixes
+ entry.getVascFrontendData().getFieldVascUIComponent(f).setDisabled(false);
+ }
+ }
+ }
+ }
+
+ public void sortAction(VascEntry entry,VascEntryField field) {
+ String curSort = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getSortField();
+ if (field.getBackendName().equals(curSort)) {
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortAscending(!entry.getVascFrontendData().getVascEntryState().getVascBackendState().isSortAscending());
+ }
+ String sortID = field.getBackendName();
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortField(sortID);
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(0);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_SORT, field);
+
+ refreshData(entry);
+ }
+
+ public void searchAction(VascEntry entry,String searchString) {
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSearchString(searchString);
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setSortField(null);
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(0);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_SEARCH, searchString);
+
+ refreshData(entry);
+ }
+
+ public void pageAction(VascEntry entry,Integer pageIndex) {
+ if (pageIndex<1) {
+ pageIndex = 0;
+ }
+ Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords(); // note: total is only null when pageAction is done before first refresh, which should never happen anyway.
+ if (total!=null && pageIndex>(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize())) {
+ pageIndex = new Long(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize()).intValue();
+ }
+
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(pageIndex);
+ fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_PAGE, pageIndex);
+
+ // lets load data;
+ refreshData(entry);
+ }
+
+ public void moveAction(VascEntry entry,Object record,boolean moveUp) {
+ if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) {
+ try {
+ VascEntryField p = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
+ Object primaryId = p.getVascEntryFieldValue().getValue(p, record);
+ if (moveUp) {
+ entry.getVascFrontendData().getVascEntryState().getVascBackend().doRecordMoveUpById(entry.getVascFrontendData().getVascEntryState().getVascBackendState(),primaryId);
+ } else {
+ entry.getVascFrontendData().getVascEntryState().getVascBackend().doRecordMoveDownById(entry.getVascFrontendData().getVascEntryState().getVascBackendState(),primaryId);
+ }
+ } catch (Exception e) {
+ handleException(entry, e);
+ }
+
+ // lets load data;
+ refreshData(entry);
+ }
+ }
+
+ public List getMultiRowActions(VascEntry entry) {
+ List result = new ArrayList(5);
+ for (RowVascAction a:entry.getRowActions()) {
+ if (a.isMultiRowAction()) {
+ result.add(a);
+ }
+ }
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascLinkEntry.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascLinkEntry.java
new file mode 100644
index 0000000..d1eaa02
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascLinkEntry.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.idcanet.vasc.core.VascLinkEntry;
+import com.idcanet.vasc.core.VascLinkEntryType;
+
+
+/**
+ * The DefaultVascLinkEntry
+ *
+ * @author Willem Cazander
+ * @version 1.0 Oct 27, 2007
+ */
+public class DefaultVascLinkEntry implements VascLinkEntry {
+
+ private static final long serialVersionUID = 1L;
+ private String id = null;
+ private String vascEntryId = null;
+ private Map entryParameterFieldIds = new HashMap(3);
+ private Map entryCreateFieldValues = new HashMap(3);
+ private VascLinkEntryType vascLinkEntryType = null;
+ private String doActionId = null;
+ private String name = null;
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+
+ public String getEntryParameterFieldId(String parameterName) {
+ return entryParameterFieldIds.get(parameterName);
+ }
+ public void addEntryParameterFieldId(String parameterName,String valueFieldId) {
+ entryParameterFieldIds.put(parameterName, valueFieldId);
+ }
+ public List getEntryParameterFieldIdKeys() {
+ return new ArrayList(entryParameterFieldIds.keySet());
+ }
+
+ public String getEntryCreateFieldValue(String valueFieldId) {
+ return entryCreateFieldValues.get(valueFieldId);
+ }
+ public void addEntryCreateFieldValue(String valueFieldId,String selectedFieldId) {
+ entryCreateFieldValues.put(valueFieldId, selectedFieldId);
+ }
+ public List getEntryCreateFieldValueKeys() {
+ return new ArrayList(entryCreateFieldValues.keySet());
+ }
+
+ /**
+ * @return the vascEntryId
+ */
+ public String getVascEntryId() {
+ return vascEntryId;
+ }
+
+ /**
+ * @param vascEntryId the vascEntryId to set
+ */
+ public void setVascEntryId(String vascEntryId) {
+ this.vascEntryId = vascEntryId;
+ }
+
+ /**
+ * @return the vascLinkEntryType
+ */
+ public VascLinkEntryType getVascLinkEntryType() {
+ return vascLinkEntryType;
+ }
+
+ /**
+ * @param vascLinkEntryType the vascLinkEntryType to set
+ */
+ public void setVascLinkEntryType(VascLinkEntryType vascLinkEntryType) {
+ this.vascLinkEntryType = vascLinkEntryType;
+ }
+
+ /**
+ * @return the doActionId
+ */
+ public String getDoActionId() {
+ return doActionId;
+ }
+
+ /**
+ * @param doActionId the doActionId to set
+ */
+ public void setDoActionId(String doActionId) {
+ this.doActionId = doActionId;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public VascLinkEntry clone() throws CloneNotSupportedException {
+ DefaultVascLinkEntry result = new DefaultVascLinkEntry();
+ result.doActionId=doActionId;
+ result.vascLinkEntryType=vascLinkEntryType;
+ result.vascEntryId=vascEntryId;
+ result.entryParameterFieldIds=entryParameterFieldIds;
+ result.entryCreateFieldValues=entryCreateFieldValues;
+ result.id=id;
+ result.name=name;
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascSelectItemModel.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascSelectItemModel.java
new file mode 100644
index 0000000..ff640e1
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascSelectItemModel.java
@@ -0,0 +1,293 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+* following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+* the following disclaimer.
+* 2. 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 IDCA 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 IDCA 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.
+*
+* The views and conclusions contained in the software and documentation are those of the authors and
+* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+*/
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.entry.VascEntryFieldValue;
+import com.idcanet.vasc.core.ui.VascSelectItem;
+import com.idcanet.vasc.core.ui.VascSelectItemModel;
+
+
+/**
+* The DefaultVascSelectItemModel
+*
+* @author Willem Cazander
+* @version 1.0 Oct 27, 2007
+*/
+public class DefaultVascSelectItemModel implements VascSelectItemModel {
+
+ private static final long serialVersionUID = 1L;
+ private String entryId = null;
+ private String keyFieldId = null;
+ private String displayFieldId = null;
+ private String nullLabel = null;
+ private String nullKeyValue = null;
+ private Boolean returnKeyValue = null;
+ private Map entryParameterFieldIds = new HashMap(3);
+ private Boolean useParentFields = null;
+
+ /**
+ * @see com.idcanet.vasc.core.ui.VascSelectItemModel#getVascSelectItems(com.idcanet.vasc.core.VascEntry)
+ */
+ public List getVascSelectItems(VascEntry currentEntry) throws VascException {
+ List result = new ArrayList(100);
+ VascEntry entry = currentEntry.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(entryId);
+
+ if (keyFieldId==null) {
+ keyFieldId = entry.getPrimaryKeyFieldId();
+ }
+ VascEntryField key = entry.getVascEntryFieldById(keyFieldId);
+
+ if (displayFieldId==null) {
+ displayFieldId = entry.getDisplayNameFieldId();
+ }
+ VascEntryField dis = entry.getVascEntryFieldById(displayFieldId);
+ if (key==null) {
+ throw new VascException("Could not find: "+keyFieldId+" from: "+entry.getId());
+ }
+ if (dis==null) {
+ throw new VascException("Could not find: "+displayFieldId+" from: "+entry.getId());
+ }
+
+ // set frontend data for new clone, we need te get better lifecycle management for stats/entry/etc
+ entry.setVascFrontendData(currentEntry.getVascFrontendData());
+ VascBackend back = DefaultVascFactory.getProxyVascBackend(entry);
+ try {
+ if (nullLabel!=null) {
+ if (nullKeyValue==null) {
+ nullKeyValue = "null";
+ }
+ nullLabel = currentEntry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(nullLabel);
+ VascSelectItem item = new VascSelectItem(nullLabel,null,nullKeyValue);
+ result.add(item);
+ }
+
+ // set def para
+ VascBackendState state = new DefaultVascBackendState();
+ for (String key2:entry.getEntryParameterKeys()) {
+ Object value = entry.getEntryParameter(key2);
+ //System.out.println("Copy paras name: "+key2+" value: "+value+" class: "+value.getClass().getName());
+ state.setDataParameter(key2, value);
+ }
+
+ // set list para
+ for (VascEntryField vef:entry.getListOptions()) {
+ Object def = vef.getDefaultValue();
+ if (def==null) {
+ continue;
+ }
+ String backendName = vef.getBackendName();
+ state.setDataParameter(backendName, def);
+ }
+
+ // set para from parent state entry
+ for (String paraName:entryParameterFieldIds.keySet()) {
+
+ VascEntry fieldEntry = currentEntry;
+ if (useParentFields!=null && useParentFields==true) {
+ if (currentEntry.getVascFrontendData().getVascEntryState().getParent()==null) {
+ throw new IllegalStateException("Requested to use parent state field values but no parent state found.");
+ }
+ fieldEntry = currentEntry.getVascFrontendData().getVascEntryState().getParent().getVascEntry();
+ }
+
+ String paraValueId = entryParameterFieldIds.get(paraName);
+ VascEntryField fieldOrg = fieldEntry.getVascEntryFieldById(paraValueId);
+ if (fieldOrg==null) {
+ //System.out.println("could not find field: "+paraValueId);
+ continue;
+ }
+ VascEntryField field = fieldOrg.clone();
+ field.getVascValidators().clear();
+ VascEntryFieldValue v = fieldEntry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(field);
+
+ Object record = fieldEntry.getVascFrontendData().getVascEntryState().getEntryDataObject();
+ if (record==null) {
+ //System.out.println("could not get selected records from state.");
+ continue;
+ }
+ Object value = v.getValue(fieldOrg, record);
+
+ //System.out.println("Set entry paras name: "+paraName+" value: "+value+" class: "+value.getClass().getName());
+ state.setDataParameter(paraName, value);
+ }
+
+
+ // TODO: FIX >>>>>>>>>>>>>>>>>>
+ if (key.getVascEntryFieldValue()==null) {
+ // TODO: fix this for better remote support
+ VascEntryField fieldClone = key.clone();
+ fieldClone.getVascValidators().clear();
+
+ VascEntryFieldValue v = currentEntry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone);
+ key.setVascEntryFieldValue(v);
+ }
+ if (dis.getVascEntryFieldValue()==null) {
+ // TODO: fix this for better remote support
+ VascEntryField fieldClone = dis.clone();
+ fieldClone.getVascValidators().clear();
+
+ VascEntryFieldValue v = currentEntry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone);
+ dis.setVascEntryFieldValue(v);
+ }
+
+
+ // execute
+ for (Object o:back.execute(state)) {
+ Object keyId = key.getVascEntryFieldValue().getValue(key, o);
+ String nameId = dis.getVascEntryFieldValue().getDisplayValue(dis, o);
+ if (returnKeyValue!=null && true==returnKeyValue) {
+ VascSelectItem item = new VascSelectItem(nameId,keyId,""+keyId);
+ result.add(item);
+ } else {
+ VascSelectItem item = new VascSelectItem(nameId,o,""+keyId);
+ result.add(item);
+ }
+ }
+ } catch (Exception e) {
+ throw new VascException(e);
+ }
+ return result;
+ }
+
+ /**
+ * @return the entryId
+ */
+ public String getEntryId() {
+ return entryId;
+ }
+
+ /**
+ * @param entryId the entryId to set
+ */
+ public void setEntryId(String entryId) {
+ this.entryId = entryId;
+ }
+
+ /**
+ * @return the keyFieldId
+ */
+ public String getKeyFieldId() {
+ return keyFieldId;
+ }
+
+ /**
+ * @param keyFieldId the keyFieldId to set
+ */
+ public void setKeyFieldId(String keyFieldId) {
+ this.keyFieldId = keyFieldId;
+ }
+
+ /**
+ * @return the displayFieldId
+ */
+ public String getDisplayFieldId() {
+ return displayFieldId;
+ }
+
+ /**
+ * @param displayFieldId the displayFieldId to set
+ */
+ public void setDisplayFieldId(String displayFieldId) {
+ this.displayFieldId = displayFieldId;
+ }
+
+ /**
+ * @return the nullLabel
+ */
+ public String getNullLabel() {
+ return nullLabel;
+ }
+
+ /**
+ * @param nullLabel the nullLabel to set
+ */
+ public void setNullLabel(String nullLabel) {
+ this.nullLabel = nullLabel;
+ }
+
+ /**
+ * @return the nullKeyValue
+ */
+ public String getNullKeyValue() {
+ return nullKeyValue;
+ }
+
+ /**
+ * @param nullKeyValue the nullKeyValue to set
+ */
+ public void setNullKeyValue(String nullKeyValue) {
+ this.nullKeyValue = nullKeyValue;
+ }
+
+ /**
+ * @return the returnKeyValue
+ */
+ public Boolean getReturnKeyValue() {
+ return returnKeyValue;
+ }
+
+ /**
+ * @param returnKeyValue the returnKeyValue to set
+ */
+ public void setReturnKeyValue(Boolean returnKeyValue) {
+ this.returnKeyValue = returnKeyValue;
+ }
+
+ public String getEntryParameterFieldId(String parameterName) {
+ return entryParameterFieldIds.get(parameterName);
+ }
+ public void addEntryParameterFieldId(String parameterName,String valueFieldId) {
+ entryParameterFieldIds.put(parameterName, valueFieldId);
+ }
+ public List getEntryParameterFieldIdKeys() {
+ return new ArrayList(entryParameterFieldIds.keySet());
+ }
+
+ /**
+ * @return the useParentFields
+ */
+ public Boolean getUseParentFields() {
+ return useParentFields;
+ }
+
+ /**
+ * @param useParentFields the useParentFields to set
+ */
+ public void setUseParentFields(Boolean useParentFields) {
+ this.useParentFields = useParentFields;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascUserRoleController.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascUserRoleController.java
new file mode 100644
index 0000000..631c303
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/DefaultVascUserRoleController.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.idcanet.vasc.core.VascUserRoleController;
+
+/**
+ * Simple default user controller for wrapping user info into vasc
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 13, 2009
+ */
+public class DefaultVascUserRoleController implements VascUserRoleController {
+
+ private Long userId = null;
+ private String userName = null;
+ private List userRoles = null;
+
+
+ public DefaultVascUserRoleController(Long userId,String userName) {
+ if (userId==null) {
+ throw new NullPointerException("userId may not be null.");
+ }
+ if (userName==null) {
+ throw new NullPointerException("userName may not be null");
+ }
+ this.userId=userId;
+ this.userName=userName;
+ userRoles = new ArrayList(10);
+ }
+
+ public DefaultVascUserRoleController(Long userId,String userName,String...roles) {
+ this(userId,userName);
+ for (String role:roles) {
+ userRoles.add(role);
+ }
+ }
+
+
+ /**
+ * @see com.idcanet.vasc.core.VascUserRoleController#getUserId()
+ */
+ public Long getUserId() {
+ return userId;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascUserRoleController#getUserName()
+ */
+ public String getUserName() {
+ return userName;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascUserRoleController#getUserRoles()
+ */
+ public List getUserRoles() {
+ return userRoles;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascUserRoleController#hasRole(java.lang.String)
+ */
+ public boolean hasRole(String roles) {
+ if (roles==null) {
+ return false;
+ }
+ // input: admin|superAdmin
+ // input: (admin|superAdmin)&login
+ String[] r = roles.split("|");
+ for (String rr:r) {
+ if (userRoles.contains(rr)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyCache.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyCache.java
new file mode 100644
index 0000000..544ecb9
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyCache.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+* following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+* the following disclaimer.
+* 2. 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 IDCA 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 IDCA 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.
+*
+* The views and conclusions contained in the software and documentation are those of the authors and
+* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+*/
+
+package com.idcanet.vasc.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.idcanet.vasc.core.AbstractVascBackendProxy;
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascException;
+
+/**
+* Does simple caching for the data.
+*
+* @author Willem Cazander
+* @version 1.0 Nov 19, 2009
+*/
+public class VascBackendProxyCache extends AbstractVascBackendProxy {
+
+ private Long records = null;
+ private List data = null;
+ private String dataSearchString = null;
+ private Map dataState = null;
+
+ public VascBackendProxyCache(VascBackend backend,VascEntry entry) {
+ super(backend);
+ dataState = new HashMap(10);
+ }
+
+ private boolean isStateChanged(VascBackendState state) {
+ boolean changed = false;
+ for (String key:state.getDataParameterKeys()) {
+ Object value = state.getDataParameter(key);
+ Object valueLast = dataState.get(key);
+ dataState.put(key, value);
+ if (value==null & valueLast==null) {
+ continue;
+ }
+ if (value==null & valueLast!=null) {
+ changed = true;
+ break;
+ }
+ if (value.equals(valueLast)==false) {
+ changed = true;
+ break;
+ }
+ }
+
+ if (state.getSearchString()!=null && state.getSearchString().equals(dataSearchString)==false) {
+ changed = true;
+ }
+ dataSearchString = state.getSearchString();
+ return changed;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
+ */
+ @Override
+ public List execute(VascBackendState state) throws VascException {
+ boolean changed = isStateChanged(state);
+ if (data==null | changed) {
+ data = backend.execute(state);
+ }
+ return data;
+ }
+
+ @Override
+ public long fetchTotalExecuteSize(VascBackendState state) {
+ boolean changed = isStateChanged(state);
+ if (records==null | changed) {
+ records = backend.fetchTotalExecuteSize(state);
+ }
+ return records;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyFilter.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyFilter.java
new file mode 100644
index 0000000..cd81f95
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyFilter.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+* following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+* the following disclaimer.
+* 2. 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 IDCA 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 IDCA 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.
+*
+* The views and conclusions contained in the software and documentation are those of the authors and
+* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+*/
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.idcanet.vasc.core.AbstractVascBackendProxy;
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascBackendFilter;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascException;
+
+
+/**
+* Simple filter support
+*
+* @author Willem Cazander
+* @version 1.0 Oct 27, 2007
+*/
+public class VascBackendProxyFilter extends AbstractVascBackendProxy {
+
+ private long records = 0;
+ private VascBackendFilter filter = null;
+
+ public VascBackendProxyFilter(VascBackend backend,VascEntry entry,VascBackendFilter filter) {
+ super(backend);
+ this.filter=filter;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
+ */
+ @Override
+ public List execute(VascBackendState state) throws VascException {
+ List result = backend.execute(state);
+ if (filter==null) {
+ return result;
+ }
+ List search = new ArrayList(result.size()/2);
+ for (Object o:result) {
+ Object r = filter.filterObject(o);
+ if (r!=null) {
+ search.add(r);
+ }
+ }
+ records = search.size();
+ return search;
+ }
+
+ @Override
+ public long fetchTotalExecuteSize(VascBackendState state) {
+ return records;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyPaged.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyPaged.java
new file mode 100644
index 0000000..34abc50
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyPaged.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+* following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+* the following disclaimer.
+* 2. 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 IDCA 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 IDCA 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.
+*
+* The views and conclusions contained in the software and documentation are those of the authors and
+* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+*/
+
+package com.idcanet.vasc.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.idcanet.vasc.core.AbstractVascBackendProxy;
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascException;
+
+
+/**
+* Simulates a real pages backend.
+*
+* @author Willem Cazander
+* @version 1.0 Oct 27, 2007
+*/
+public class VascBackendProxyPaged extends AbstractVascBackendProxy {
+
+ private long records = 0;
+
+ public VascBackendProxyPaged(VascBackend backend,VascEntry entry) {
+ super(backend);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isPageable()
+ */
+ @Override
+ public boolean isPageable() {
+ return true;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
+ */
+ @Override
+ public List execute(VascBackendState state) throws VascException {
+ List allData = backend.execute(state);
+ int pageSize = state.getPageSize();
+ if (pageSize==0) {
+ records = allData.size();
+ return allData;
+ }
+ List paged = new ArrayList(state.getPageSize());
+ int off = state.getPageIndex()*pageSize;
+ int offMax = off+state.getPageSize();
+ for (int i=off;i=allData.size()) {
+ break;
+ }
+ Object o = allData.get(i);
+ paged.add(o);
+ }
+ records = allData.size();
+ return paged;
+ }
+
+ @Override
+ public long fetchTotalExecuteSize(VascBackendState state) {
+ return records;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxySearch.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxySearch.java
new file mode 100644
index 0000000..32fcac3
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxySearch.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+* following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+* the following disclaimer.
+* 2. 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 IDCA 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 IDCA 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.
+*
+* The views and conclusions contained in the software and documentation are those of the authors and
+* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+*/
+
+package com.idcanet.vasc.impl;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.idcanet.vasc.core.AbstractVascBackendProxy;
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascException;
+
+
+/**
+* Simple text search
+*
+* @author Willem Cazander
+* @version 1.0 Oct 27, 2007
+*/
+public class VascBackendProxySearch extends AbstractVascBackendProxy {
+
+ private long records = 0;
+
+ public VascBackendProxySearch(VascBackend backend,VascEntry entry) {
+ super(backend);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#isSearchable()
+ */
+ @Override
+ public boolean isSearchable() {
+ return true;
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
+ */
+ @Override
+ public List execute(VascBackendState state) throws VascException {
+ List result = backend.execute(state);
+ if (state.getSearchString()==null) {
+ if (backend.isPageable()) {
+ records = backend.fetchTotalExecuteSize(state);
+ } else {
+ records = result.size();
+ }
+ return result;
+ }
+ String searchString = state.getSearchString().toLowerCase();
+ List search = new ArrayList(result.size()/4);
+ for (Object o:result) {
+ for (Method method:o.getClass().getMethods()) {
+ if (method.getName().startsWith("get")==false) { //a bit durty
+ continue;
+ }
+ if (method.getName().equals("getClass")) {
+ continue;
+ }
+ if (method.getReturnType().isAssignableFrom(Collection.class)) {
+ continue;
+ }
+ if (method.getReturnType().isAssignableFrom(List.class)) {
+ continue;
+ }
+ if (method.getReturnType().isAssignableFrom(Set.class)) {
+ continue;
+ }
+ if (method.getReturnType().isAssignableFrom(Map.class)) {
+ continue;
+ }
+ Object res;
+ try {
+ res = method.invoke(o,new Object[]{});
+ } catch (Exception e) {
+ throw new VascException(e);
+ }
+ if (res==null) {
+ continue;
+ }
+ String r = res.toString().toLowerCase();
+ if (r.contains(searchString)) {
+ search.add(o);
+ break;
+ }
+ }
+ }
+ records = search.size();
+ return search;
+ }
+
+ @Override
+ public long fetchTotalExecuteSize(VascBackendState state) {
+ return records;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxySort.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxySort.java
new file mode 100644
index 0000000..76df4d2
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxySort.java
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+* following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+* the following disclaimer.
+* 2. 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 IDCA 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 IDCA 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.
+*
+* The views and conclusions contained in the software and documentation are those of the authors and
+* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+*/
+
+package com.idcanet.vasc.impl;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import com.idcanet.vasc.core.AbstractVascBackendProxy;
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.entry.VascEntryFieldValue;
+
+
+/**
+* Add an sortware sort an a backend
+*
+* @author Willem Cazander
+* @version 1.0 Oct 27, 2007
+*/
+public class VascBackendProxySort extends AbstractVascBackendProxy {
+
+ private VascEntry entry = null;
+
+ public VascBackendProxySort(VascBackend backend,VascEntry entry) {
+ super(backend);
+ this.entry=entry;
+ }
+
+ // sort stuff
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List execute(final VascBackendState state) throws VascException {
+ List result = backend.execute(state);
+ if (state.getSortField()==null) {
+ return result;
+ }
+ try {
+ final VascEntryField field = entry.getVascEntryFieldById(state.getSortField());
+ final VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue(field.clone());
+ Collections.sort(result, new Comparator() {
+ public int compare(Object o1, Object o2) {
+ try {
+ Comparable c1 = null;
+ Comparable c2 = null;
+ if (field.getDisplayName()!=null) {
+ c1 = (Comparable)fieldValue.getDisplayValue(field, o1);
+ c2 = (Comparable)fieldValue.getDisplayValue(field, o2);
+ } else {
+ c1 = (Comparable)fieldValue.getValue(field, o1);
+ c2 = (Comparable)fieldValue.getValue(field, o2);
+ }
+ if (c1==null & c2==null) {
+ return 0;
+ }
+ if (c1==null) {
+ if (state.isSortAscending()) {
+ return 1;
+ } else {
+ return -1;
+ }
+ }
+ if (c2==null) {
+ if (state.isSortAscending()) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+ if (c1 instanceof String & c2 instanceof String) {
+ c1 = ((String)c1).toLowerCase();
+ c2 = ((String)c2).toLowerCase();
+ }
+
+ if (state.isSortAscending()) {
+ return c1.compareTo(c2);
+ } else {
+ return c2.compareTo(c1);
+ }
+ } catch (VascException 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/com/idcanet/vasc/impl/VascBackendProxyTimerLogger.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyTimerLogger.java
new file mode 100644
index 0000000..7da3430
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/VascBackendProxyTimerLogger.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+* following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+* the following disclaimer.
+* 2. 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 IDCA 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 IDCA 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.
+*
+* The views and conclusions contained in the software and documentation are those of the authors and
+* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+*/
+
+package com.idcanet.vasc.impl;
+
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.idcanet.vasc.core.AbstractVascBackendProxy;
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascBackendState;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascException;
+
+/**
+* Does simple caching for the data.
+*
+* @author Willem Cazander
+* @version 1.0 Nov 19, 2009
+*/
+public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
+
+ protected Logger logger = null;
+ protected Level logLevel = Level.INFO;
+
+ public VascBackendProxyTimerLogger(VascBackend backend,VascEntry entry) {
+ super(backend);
+ logger = Logger.getLogger(VascBackendProxyTimerLogger.class.getName());
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
+ */
+ @Override
+ public List execute(VascBackendState state) throws VascException {
+ long t1 = System.currentTimeMillis();
+ try {
+ return backend.execute(state);
+ } finally {
+ long t2 = System.currentTimeMillis();
+ logger.log(logLevel,"vasc-execute backend: "+getId()+" in "+(t2-t1)+" ms");
+ }
+ }
+
+ @Override
+ public long fetchTotalExecuteSize(VascBackendState state) {
+ long t1 = System.currentTimeMillis();
+ try {
+ return backend.fetchTotalExecuteSize(state);
+ } finally {
+ long t2 = System.currentTimeMillis();
+ logger.log(logLevel,"vasc-fetchTotalExecuteSize backend: "+getId()+" in "+(t2-t1)+" ms");
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackendProxy#doRecordMoveDownById(com.idcanet.vasc.core.VascBackendState, java.lang.Object)
+ */
+ @Override
+ public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascException {
+ long t1 = System.currentTimeMillis();
+ try {
+ return backend.doRecordMoveDownById(state, primaryId);
+ } finally {
+ long t2 = System.currentTimeMillis();
+ logger.log(logLevel,"vasc-doRecordMoveDownById backend: "+getId()+" in "+(t2-t1)+" ms");
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackendProxy#doRecordMoveUpById(com.idcanet.vasc.core.VascBackendState, java.lang.Object)
+ */
+ @Override
+ public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
+ long t1 = System.currentTimeMillis();
+ try {
+ return backend.doRecordMoveUpById(state, primaryId);
+ } finally {
+ long t2 = System.currentTimeMillis();
+ logger.log(logLevel,"vasc-doRecordMoveUpById backend: "+getId()+" in "+(t2-t1)+" ms");
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackendProxy#delete(java.lang.Object)
+ */
+ @Override
+ public void delete(Object object) throws VascException {
+ long t1 = System.currentTimeMillis();
+ try {
+ backend.delete(object);
+ } finally {
+ long t2 = System.currentTimeMillis();
+ logger.log(logLevel,"vasc-delete backend: "+getId()+" in "+(t2-t1)+" ms");
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackendProxy#merge(java.lang.Object)
+ */
+ @Override
+ public Object merge(Object object) throws VascException {
+ long t1 = System.currentTimeMillis();
+ try {
+ return backend.merge(object);
+ } finally {
+ long t2 = System.currentTimeMillis();
+ logger.log(logLevel,"vasc-merge backend: "+getId()+" in "+(t2-t1)+" ms");
+ }
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascBackendProxy#persist(java.lang.Object)
+ */
+ @Override
+ public void persist(Object object) throws VascException {
+ long t1 = System.currentTimeMillis();
+ try {
+ backend.persist(object);
+ } finally {
+ long t2 = System.currentTimeMillis();
+ logger.log(logLevel,"vasc-persist backend: "+getId()+" in "+(t2-t1)+" ms");
+ }
+ }
+
+ /**
+ * @return the logLevel
+ */
+ public Level getLogLevel() {
+ return logLevel;
+ }
+
+ /**
+ * @param logLevel the logLevel to set
+ */
+ public void setLogLevel(Level logLevel) {
+ this.logLevel = logLevel;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/AddRowAction.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/AddRowAction.java
new file mode 100644
index 0000000..b8027cd
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/AddRowAction.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.actions;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.actions.AbstractVascAction;
+import com.idcanet.vasc.core.actions.RowVascAction;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 30, 2007
+ */
+public class AddRowAction extends AbstractVascAction implements RowVascAction {
+
+ private static final long serialVersionUID = 1L;
+ static public final String ACTION_ID = "addRowAction";
+
+ protected String getActionId() {
+ return ACTION_ID;
+ }
+
+
+ public void doRowAction(VascEntry entry,Object rowObject) throws Exception {
+ entry.getVascFrontendData().getVascEntryState().setEditCreate(true);
+ Object object = entry.getVascFrontendData().getVascFrontendHelper().createObject(entry);
+ entry.getVascFrontendData().getVascEntryState().setEntryDataObject(object);
+ entry.getVascFrontendData().getVascFrontend().renderEdit();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.actions.RowVascAction#isMultiRowAction()
+ */
+ public boolean isMultiRowAction() {
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/CSVExportGlobalAction.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/CSVExportGlobalAction.java
new file mode 100644
index 0000000..fa49e9f
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/CSVExportGlobalAction.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.actions;
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+
+import com.idcanet.vasc.core.entry.VascEntryExporter;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.actions.AbstractVascAction;
+import com.idcanet.vasc.core.actions.GlobalVascAction;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 30, 2007
+ */
+public class CSVExportGlobalAction extends AbstractVascAction implements GlobalVascAction,VascEntryExporter {
+
+ private static final long serialVersionUID = -3951608685719832654L;
+ static public final String ACTION_ID = "csvExportAction";
+
+ protected String getActionId() {
+ return ACTION_ID;
+ }
+
+ public void doGlobalAction(VascEntry entry) throws Exception {
+ entry.getVascFrontendData().getVascFrontend().renderExport(this);
+ }
+
+ public void doExport(OutputStream out,VascEntry entry) throws VascException {
+ PrintWriter p = new PrintWriter(out);
+ p.write("# csv\n");
+ for (VascEntryField c:entry.getVascEntryFields()) {
+ p.write(c.getId()+"\t");
+ }
+ p.write("\n");
+
+ int oldIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
+ Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
+ int pages = total.intValue()/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
+ for (int page=0;page<=pages;page++) {
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(page);
+ entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
+ for (Object o:entry.getVascFrontendData().getVascEntryState().getEntryDataList()) {
+ for (VascEntryField c:entry.getVascEntryFields()) {
+ p.write(c.getVascEntryFieldValue().getDisplayValue(c, o)+"\t");
+ }
+ p.write("\n");
+ p.flush();
+ }
+ }
+ p.write("# end\n");
+ p.flush();
+
+ // restore old page size
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(oldIndex);
+
+ }
+
+ public String getMineType() {
+ return "text/csv";
+ }
+
+ public String getType() {
+ return "csv";
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/DeleteRowAction.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/DeleteRowAction.java
new file mode 100644
index 0000000..7b0e09d
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/DeleteRowAction.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.actions;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.actions.AbstractVascAction;
+import com.idcanet.vasc.core.actions.RowVascAction;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 30, 2007
+ */
+public class DeleteRowAction extends AbstractVascAction implements RowVascAction {
+
+ private static final long serialVersionUID = 1L;
+ static public final String ACTION_ID = "deleteRowAction";
+
+ protected String getActionId() {
+ return ACTION_ID;
+ }
+
+ public void doRowAction(VascEntry entry,Object rowObject) throws Exception {
+ if (rowObject==null) {
+ return; // nothing selected
+ }
+ entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
+ entry.getVascFrontendData().getVascFrontend().renderDelete();
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.actions.RowVascAction#isMultiRowAction()
+ */
+ public boolean isMultiRowAction() {
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/EditRowAction.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/EditRowAction.java
new file mode 100644
index 0000000..27549f6
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/EditRowAction.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.actions;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.actions.AbstractVascAction;
+import com.idcanet.vasc.core.actions.RowVascAction;
+import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 30, 2007
+ */
+public class EditRowAction extends AbstractVascAction implements RowVascAction {
+
+ private static final long serialVersionUID = 1L;
+ static public final String ACTION_ID = "editRowAction";
+
+ protected String getActionId() {
+ return ACTION_ID;
+ }
+
+
+ public void doRowAction(VascEntry entry,Object rowObject) throws Exception {
+ if (rowObject==null) {
+ return; // nothing selected
+ }
+ entry.getVascFrontendData().getVascEntryState().setEditCreate(false);
+ entry.getVascFrontendData().getVascFrontendHelper().fireVascEvent(entry, VascFrontendEventType.DATA_SELECT, rowObject);
+ entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject);
+ entry.getVascFrontendData().getVascFrontend().renderEdit();
+ }
+
+
+ /**
+ * @see com.idcanet.vasc.core.actions.RowVascAction#isMultiRowAction()
+ */
+ public boolean isMultiRowAction() {
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/RefreshDataGlobalAction.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/RefreshDataGlobalAction.java
new file mode 100644
index 0000000..3afe54d
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/RefreshDataGlobalAction.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.actions;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.actions.AbstractVascAction;
+import com.idcanet.vasc.core.actions.GlobalVascAction;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Apr 28, 2007
+ */
+public class RefreshDataGlobalAction extends AbstractVascAction implements GlobalVascAction {
+
+ private static final long serialVersionUID = 1L;
+ static public final String ACTION_ID = "refreshDataAction";
+
+ protected String getActionId() {
+ return ACTION_ID;
+ }
+
+
+ public void doGlobalAction(VascEntry entry) throws Exception {
+ entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry); // this wil also fire the event
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/XMLExportGlobalAction.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/XMLExportGlobalAction.java
new file mode 100644
index 0000000..ca9d1ec
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/actions/XMLExportGlobalAction.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.actions;
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.actions.AbstractVascAction;
+import com.idcanet.vasc.core.actions.GlobalVascAction;
+import com.idcanet.vasc.core.entry.VascEntryExporter;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 30, 2007
+ */
+public class XMLExportGlobalAction extends AbstractVascAction implements GlobalVascAction,VascEntryExporter {
+
+ private static final long serialVersionUID = 3719424578585760828L;
+ static public final String ACTION_ID = "xmlExportAction";
+
+ protected String getActionId() {
+ return ACTION_ID;
+ }
+
+ public void doGlobalAction(VascEntry entry) throws Exception {
+ entry.getVascFrontendData().getVascFrontend().renderExport(this);
+ }
+
+ public void doExport(OutputStream out,VascEntry entry) throws VascException {
+ PrintWriter p = new PrintWriter(out);
+ p.write("\n");
+ p.write("\n");
+
+ int oldIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex();
+ Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords();
+ int pages = total.intValue()/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize();
+ for (int page=0;page<=pages;page++) {
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(page);
+ entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
+ for (Object o:entry.getVascFrontendData().getVascEntryState().getEntryDataList()) {
+ p.write("\t\n");
+ for (VascEntryField c:entry.getVascEntryFields()) {
+ p.write("\t\t \n");
+ }
+ p.write("\t
\n");
+ p.flush();
+ }
+ }
+ p.write(" \n");
+ p.flush();
+
+ // restore old page size
+ entry.getVascFrontendData().getVascEntryState().getVascBackendState().setPageIndex(oldIndex);
+ }
+
+ public String getMineType() {
+ return "text/xml";
+ }
+
+ public String getType() {
+ return "xml";
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/BeanPropertyVascEntryFieldValue.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/BeanPropertyVascEntryFieldValue.java
new file mode 100644
index 0000000..ea047dc
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/BeanPropertyVascEntryFieldValue.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.entry;
+
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.entry.VascEntryFieldValue;
+import com.idcanet.x4o.impl.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 com.idcanet.vasc.core.column.VascColumnValue#getValue(com.idcanet.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 com.idcanet.vasc.core.entry.VascEntryFieldValue#getDisplayValue(com.idcanet.vasc.core.VascEntryField, java.lang.Object)
+ */
+ public String getDisplayValue(VascEntryField field, Object record) throws VascException {
+ return ""+getValue(field,record); // not supported
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.column.VascColumnValue#setValue(com.idcanet.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/com/idcanet/vasc/impl/entry/BeanVascEntryRecordCreator.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/BeanVascEntryRecordCreator.java
new file mode 100644
index 0000000..b84a063
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/BeanVascEntryRecordCreator.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.entry;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public class BeanVascEntryRecordCreator implements VascEntryRecordCreator {
+
+ private static final long serialVersionUID = 1L;
+ private Class> objectClass = null;
+
+ public BeanVascEntryRecordCreator() {
+ }
+
+ public BeanVascEntryRecordCreator(Class> objectClass) {
+ setObjectClass(objectClass);
+ }
+
+ public Object newRecord(VascEntry entry) throws Exception {
+ return objectClass.newInstance();
+ }
+
+ public Class> getObjectClass() {
+ return objectClass;
+ }
+ public void setObjectClass(Class> objectClass) {
+ this.objectClass=objectClass;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/DefaultVascEntryResourceResolver.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/DefaultVascEntryResourceResolver.java
new file mode 100644
index 0000000..d1dd66a
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/DefaultVascEntryResourceResolver.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.entry;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 21, 2007
+ */
+public class DefaultVascEntryResourceResolver implements VascEntryResourceResolver {
+
+ protected ResourceBundle resourceBundle = null;
+
+
+ public DefaultVascEntryResourceResolver() {
+ }
+
+ public DefaultVascEntryResourceResolver(ResourceBundle resourceBundle) {
+ setResourceBundle(resourceBundle);
+ }
+
+ public DefaultVascEntryResourceResolver(String baseName,Locale locale) {
+ this(ResourceBundle.getBundle(baseName, locale));
+ }
+
+ public String getTextValue(String text,Object...params) {
+ if (resourceBundle==null) {
+ return text;
+ }
+ if (text==null) {
+ throw new NullPointerException("Can't get null text key value.");
+ }
+
+ String textValue = null;
+ try {
+ textValue = resourceBundle.getString(text);
+ } catch (MissingResourceException mre) {
+ return text;
+ }
+ if (params.length>0) {
+ textValue = MessageFormat.format(textValue, params);
+ }
+ return textValue;
+ }
+
+ /**
+ * @return the resourceBundle
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ /**
+ * @param resourceBundle the resourceBundle to set
+ */
+ public void setResourceBundle(ResourceBundle resourceBundle) {
+ if (resourceBundle==null) {
+ throw new NullPointerException("may not set resourceBundle to null.");
+ }
+ this.resourceBundle = resourceBundle;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/HibernateValidatorService.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/HibernateValidatorService.java
new file mode 100644
index 0000000..402c21f
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/HibernateValidatorService.java
@@ -0,0 +1,178 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.entry;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.logging.Logger;
+
+import org.hibernate.validator.ClassValidator;
+import org.hibernate.validator.InvalidValue;
+import org.hibernate.validator.MessageInterpolator;
+import org.hibernate.validator.Validator;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
+
+/**
+ * Executes the hibernate field validators
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 13, 2009
+ */
+public class HibernateValidatorService implements VascEntryFieldValidatorService {
+
+ private Logger logger = Logger.getLogger(HibernateValidatorService.class.getName());
+
+ @SuppressWarnings("unchecked")
+ public List validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException {
+ List error = new ArrayList(3);
+ try {
+ ClassValidator val = new ClassValidator(selectedRecord.getClass(),new VascHibernateMessage(field.getVascEntry()));
+ InvalidValue[] ival = val.getInvalidValues(selectedRecord);
+ logger.fine("Hiber Validating: "+ival.length);
+ String prop = field.getBackendName();
+ InvalidValue iv = findInvalidValueByProperty(ival,prop);
+
+ if(iv!=null) {
+ error.add(iv.getMessage());
+ }
+ } catch (Exception e) {
+ throw new VascException(e);
+ }
+ return error;
+ }
+
+ private InvalidValue findInvalidValueByProperty(InvalidValue[] ival,String property) {
+ for(InvalidValue iv:ival) {
+ if(iv.getPropertyName().equals(property)) {
+ return iv;
+ }
+ }
+ return null;
+ }
+
+ class VascHibernateMessage implements MessageInterpolator, Serializable {
+
+ private static final long serialVersionUID = -8241727232507976072L;
+ //private static final Logger log = Logger.getLogger(VascHibernateMessage.class.getName());
+ private Map annotationParameters = new HashMap();
+ private String annotationMessage;
+ private String interpolateMessage;
+ private VascEntry vascEntry;
+
+ public VascHibernateMessage(VascEntry vascEntry) {
+ this.vascEntry=vascEntry;
+ }
+
+ public void initialize(Annotation annotation, MessageInterpolator defaultInterpolator) {
+ Class> clazz = annotation.getClass();
+ for ( Method method : clazz.getMethods() ) {
+ try {
+ //FIXME remove non serilalization elements on writeObject?
+ if ( method.getReturnType() != void.class
+ && method.getParameterTypes().length == 0
+ && ! Modifier.isStatic( method.getModifiers() ) ) {
+ //cannot use an exclude list because the parameter name could match a method name
+ annotationParameters.put( method.getName(), method.invoke( annotation ) );
+ }
+ } catch (IllegalAccessException e) {
+ //really should not happen, but we degrade nicely
+ //log.warning( "Unable to access {}", StringHelper.qualify( clazz.toString(), method.getName() ) );
+ } catch (InvocationTargetException e) {
+ //really should not happen, but we degrade nicely
+ //log.warn( "Unable to access {}", StringHelper.qualify( clazz.toString(), method.getName() ) );
+ }
+ }
+ annotationMessage = (String) annotationParameters.get( "message" );
+ if (annotationMessage == null) {
+ throw new IllegalArgumentException( "Annotation " + clazz + " does not have an (accessible) message attribute");
+ }
+ //do not resolve the property eagerly to allow validator.apply to work wo interpolator
+ }
+
+ @SuppressWarnings("unchecked")
+ public String interpolate(String message, Validator validator, MessageInterpolator defaultInterpolator) {
+ if ( annotationMessage!=null && annotationMessage.equals( message ) ) {
+ //short cut
+ if (interpolateMessage == null) {
+ interpolateMessage = replace( annotationMessage );
+ }
+ return interpolateMessage;
+ } else {
+ //TODO keep them in a weak hash map, but this might not even be useful
+ return replace( message );
+ }
+ }
+
+ public String getAnnotationMessage() {
+ return annotationMessage;
+ }
+
+ private String replace(String message) {
+ StringTokenizer tokens = new StringTokenizer( message, "#{}", true );
+ StringBuilder buf = new StringBuilder( 30 );
+ boolean escaped = false;
+ boolean el = false;
+ while ( tokens.hasMoreTokens() ) {
+ String token = tokens.nextToken();
+ if ( !escaped && "#".equals( token ) ) {
+ el = true;
+ }
+ if ( !el && "{".equals( token ) ) {
+ escaped = true;
+ } else if ( escaped && "}".equals( token ) ) {
+ escaped = false;
+ } else if ( !escaped ) {
+ if ( "{".equals( token ) ) el = false;
+ buf.append( token );
+ } else {
+ Object variable = annotationParameters.get( token );
+ if ( variable != null ) {
+ buf.append( variable );
+ } else {
+ String string = vascEntry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(token);
+ if ( string != null ) {
+ buf.append(replace(string));
+ }
+ }
+ }
+ }
+ return buf.toString();
+ }
+ }
+}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/PersistanceValidatorService.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/PersistanceValidatorService.java
new file mode 100644
index 0000000..a9d6ce6
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/PersistanceValidatorService.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.entry;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
+import com.idcanet.vasc.validators.VascObjectNotNullValidator;
+import com.idcanet.vasc.validators.VascStringLengthValidator;
+import com.idcanet.vasc.validators.VascValidator;
+import com.idcanet.vasc.validators.VascValidatorMessages;
+
+/**
+ * Scans for JPA annotations and wrap some items aroud in a vasc validator.
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 13, 2009
+ */
+public class PersistanceValidatorService implements VascEntryFieldValidatorService {
+
+ private Logger logger = Logger.getLogger(PersistanceValidatorService.class.getName());
+
+ public List validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException {
+ List error = new ArrayList(3);
+ try {
+ List vals = new ArrayList(2);
+ String property = field.getBackendName();
+ for (Method method:selectedRecord.getClass().getMethods()) {
+ if (method.getName().equalsIgnoreCase("get"+property)==false) { //a bit durty
+ continue;
+ }
+ Column col = method.getAnnotation(Column.class);
+ if (col!=null) {
+ if (col.nullable()==false) {
+ Id idAnno = method.getAnnotation(Id.class);
+ GeneratedValue genAnno = method.getAnnotation(GeneratedValue.class);
+ if (idAnno!=null || genAnno!=null) {
+ continue; // don't add validator in JPA ID.
+ }
+ VascObjectNotNullValidator val = new VascObjectNotNullValidator();
+ vals.add(val);
+ }
+ // weird default 255 value
+ if (col.length()!=255) {
+ VascStringLengthValidator val = new VascStringLengthValidator();
+ val.setMaxLenght(col.length());
+ val.setNullable(col.nullable());
+ vals.add(val);
+ }
+ }
+ }
+
+ VascValidatorMessages m = new VascValidatorMessages();
+ for (VascValidator val:vals) {
+ logger.finer("Validating: "+val);
+ if (val.isObjectValid(objectValue)==false) {
+ error.add(m.getErrorMessage(field.getVascEntry(), val));
+ }
+ }
+ } catch (Exception e) {
+ throw new VascException(e);
+ }
+ return error;
+ }
+}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/VascValidatorsValidatorService.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/VascValidatorsValidatorService.java
new file mode 100644
index 0000000..2b41f2f
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/entry/VascValidatorsValidatorService.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.entry;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
+import com.idcanet.vasc.validators.VascValidator;
+import com.idcanet.vasc.validators.VascValidatorMessages;
+
+/**
+ * Executes the normal vasc validators for fields.
+ *
+ * @author Willem Cazander
+ * @version 1.0 May 13, 2009
+ */
+public class VascValidatorsValidatorService implements VascEntryFieldValidatorService {
+
+ private Logger logger = Logger.getLogger(VascValidatorsValidatorService.class.getName());
+
+ public List validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException {
+ List error = new ArrayList(3);
+ try {
+ VascValidatorMessages m = new VascValidatorMessages();
+ for (VascValidator val:field.getVascEntryFieldType().getVascValidators()) {
+ logger.finer("Validating: "+val);
+ if (val.isObjectValid(objectValue)==false) {
+ error.add(m.getErrorMessage(field.getVascEntry(), val));
+ }
+ }
+ for (VascValidator val:field.getVascValidators()) {
+ logger.finer("Validating: "+val);
+ if (val.isObjectValid(objectValue)==false) {
+ error.add(m.getErrorMessage(field.getVascEntry(), val));
+ }
+ }
+ } catch (Exception e) {
+ throw new VascException(e);
+ }
+ return error;
+ }
+}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldType.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldType.java
new file mode 100644
index 0000000..a93cb3d
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldType.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.type;
+
+
+import com.idcanet.vasc.core.AbstractVascEntryFieldType;
+import com.idcanet.vasc.core.VascEntryFieldType;
+
+/**
+ * Only knows how to clone its self.
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 8, 2008
+ */
+public class DefaultVascEntryFieldType extends AbstractVascEntryFieldType {
+
+ private static final long serialVersionUID = 1L;
+ @Override
+ public VascEntryFieldType clone() throws CloneNotSupportedException {
+ DefaultVascEntryFieldType clone = new DefaultVascEntryFieldType();
+ clone.id=id;
+ clone.autoDetectClass=autoDetectClass;
+ clone.uiComponentId=uiComponentId;
+ clone.inputMask=inputMask;
+ for (String key:properties.keySet()) {
+ clone.properties.put(key,properties.get(key));
+ }
+ // mmm
+ clone.vascValidators.addAll(vascValidators);
+ return clone;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldTypeController.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldTypeController.java
new file mode 100644
index 0000000..0ef07e0
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldTypeController.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.type;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.idcanet.vasc.core.VascEntryFieldType;
+import com.idcanet.vasc.core.VascEntryFieldTypeControllerLocal;
+import com.idcanet.vasc.core.VascException;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 14, 2008
+ */
+public class DefaultVascEntryFieldTypeController implements VascEntryFieldTypeControllerLocal {
+
+ private Map vascEntryFieldTypes = null;
+
+ public DefaultVascEntryFieldTypeController() throws VascException {
+ try {
+ FieldTypeParser parser = new FieldTypeParser();
+ parser.parseVascFieldTypes();
+
+ vascEntryFieldTypes = new HashMap(35);
+ for(VascEntryFieldType v:parser.getTypes()) {
+ vascEntryFieldTypes.put(v.getId(),v);
+ }
+ } catch (Exception e) {
+ throw new VascException(e);
+ }
+ }
+
+ /**
+ *
+ */
+ public void addVascEntryFieldType(VascEntryFieldType vascEntryFieldType) {
+ if (vascEntryFieldType==null) {
+ throw new NullPointerException("Can't add null vascEntryFieldType.");
+ }
+ vascEntryFieldTypes.put(vascEntryFieldType.getId(),vascEntryFieldType);
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldTypeController#getVascEntryFieldTypeById(java.lang.String)
+ */
+ public VascEntryFieldType getVascEntryFieldTypeById(String id) {
+ VascEntryFieldType result = vascEntryFieldTypes.get(id);
+ if (result==null) {
+ throw new IllegalArgumentException("Field not found: "+id);
+ }
+ try {
+ return result.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new IllegalArgumentException("FieldType not clonable: "+e.getMessage());
+ }
+ }
+
+
+ public VascEntryFieldType getRealVascEntryFieldTypeById(String id) {
+ VascEntryFieldType result = vascEntryFieldTypes.get(id);
+ if (result==null) {
+ throw new IllegalArgumentException("Field not found: "+id);
+ }
+ return result;
+ }
+
+
+ /**
+ * @see com.idcanet.vasc.core.VascEntryFieldTypeController#getVascEntryFieldTypeIds()
+ */
+ public List getVascEntryFieldTypeIds() {
+ List result = new ArrayList(5);
+ result.addAll(vascEntryFieldTypes.keySet());
+ Collections.sort(result); // lets do abc for consistance behauvior.
+ return result;
+ }
+}
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/type/FieldTypeParser.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/type/FieldTypeParser.java
new file mode 100644
index 0000000..117763d
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/type/FieldTypeParser.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.type;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.InvalidPropertiesFormatException;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.xml.sax.SAXException;
+
+import com.idcanet.vasc.core.VascEntryFieldType;
+import com.idcanet.x4o.core.X4OParser;
+import com.idcanet.x4o.element.Element;
+
+/**
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Sep 11, 2008
+ */
+public class FieldTypeParser extends X4OParser {
+
+ static public final String FIELD_TYPE_LANGUAGE = "fieldtype";
+
+ /**
+ *
+ * @param language
+ * @throws IOException
+ * @throws InvalidPropertiesFormatException
+ * @throws Exception
+ */
+ public FieldTypeParser() throws InvalidPropertiesFormatException, IOException {
+ super(FIELD_TYPE_LANGUAGE);
+ }
+
+ public void parseVascFieldTypes() throws IOException, SecurityException, NullPointerException, ParserConfigurationException, SAXException {
+ parseResource("META-INF/fieldtypes.xml");
+ }
+
+ public List getTypes() {
+ List result = new ArrayList(4);
+ for (Element e:getElementContext().getRootElement().getChilderen()) {
+ VascEntryFieldType a = (VascEntryFieldType)e.getElementObject();
+ result.add(a);
+ }
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/type/MultiTextVascEntryFieldType.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/type/MultiTextVascEntryFieldType.java
new file mode 100644
index 0000000..610a1a7
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/type/MultiTextVascEntryFieldType.java
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.type;
+
+import java.util.List;
+
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascEntryFieldType;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.vasc.core.ui.VascValueModel;
+
+
+/**
+ * Custem FieldType for multi text values.
+ *
+ * @author Willem Cazander
+ * @version 1.0 Nov 17, 2008
+ */
+public class MultiTextVascEntryFieldType extends DefaultVascEntryFieldType {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public VascEntryFieldType clone() throws CloneNotSupportedException {
+ MultiTextVascEntryFieldType clone = new MultiTextVascEntryFieldType();
+ clone.id=id;
+ clone.autoDetectClass=autoDetectClass;
+ clone.uiComponentId=uiComponentId;
+ clone.inputMask=inputMask;
+ for (String key:properties.keySet()) {
+ clone.properties.put(key,properties.get(key));
+ }
+ // mmm
+ clone.vascValidators.addAll(vascValidators);
+ return clone;
+ }
+
+ /*
+ private Object getIndexValue(VascEntryField entryField,int index) throws VascException {
+ Object record = entryField.getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataObject();
+ Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
+
+ if (value instanceof List>) {
+ return ((List>)value).get(index);
+ }
+ if (value instanceof String[]) {
+ if (index >= ((String[])value).length ) {
+ return "";
+ }
+ return ((String[])value)[index];
+ }
+ if (value instanceof String) {
+ return ((String)value);
+ }
+ throw new VascException("Unknown object type");
+ }
+
+ @SuppressWarnings("unchecked")
+ private void setIndexValue(VascEntryField entryField,int index,Object newValue) throws VascException {
+ Object record = entryField.getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataObject();
+ Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
+
+ if (value instanceof List>) {
+ ((List)value).set(index, newValue); // TODO: fix @SuppressWarnings here
+ return;
+ }
+ if (value instanceof String[]) {
+
+ if (index+1 > ((String[])value).length ) {
+ String[] n = new String[index+1];
+ for (int i=0;i<((String[])value).length;i++) {
+ n[i]= ((String[])value)[i];
+ }
+ value = n;
+ }
+ ((String[])value)[index] = newValue.toString();
+ return;
+ }
+ if (value instanceof String) {
+ value = new String[] { (String)value };
+ return;
+ }
+ throw new VascException("Unknown object type: "+value);
+ }
+ */
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascEntryFieldType#getUIComponentCount(com.idcanet.vasc.core.VascEntryField)
+ */
+ @Override
+ public int getUIComponentCount(VascEntryField entryField) throws VascException {
+ return 1;
+ /*
+ Object record = entryField.getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataObject();
+ Object value = entryField.getVascEntryFieldValue().getValue(entryField, record);
+
+ if (value instanceof List>) {
+ return ((List>)value).size()+1;
+ }
+ if (value instanceof String[]) {
+ return ((String[])value).length+1;
+ }
+ if (value instanceof String) {
+ return 1+1;
+ }
+ throw new VascException("Unknown object type: "+value);
+ */
+ }
+
+ /**
+ * @see com.idcanet.vasc.core.AbstractVascEntryFieldType#provideEditorVascValueModel(int, com.idcanet.vasc.core.VascEntryField)
+ */
+ @Override
+ public VascValueModel provideEditorVascValueModel(final int index,final VascEntryField entryField) {
+ MultiVascValueModel model = new MultiVascValueModel();
+ return model;
+
+ /* note: not allowed to use inner classes in backend , that breaks remoting !!
+ VascValueModel model = new VascValueModel() {
+ public Object getValue() throws VascException {
+ Object value = getIndexValue(entryField,index);
+ return value;
+ }
+
+ public void setValue(Object value) throws VascException {
+ setIndexValue(entryField,index,value);
+ super.setValue(value);
+ }
+ };
+
+ return model;
+ */
+ }
+}
+class MultiVascValueModel extends VascValueModel {
+ public Object getValue() throws VascException {
+ Object value = super.getValue();
+ //System.out.println("value: "+value+" type: "+value.getClass());
+ StringBuffer buf = new StringBuffer(100);
+ if (value instanceof List>) {
+ for (Object o:((List>)value)) {
+ buf.append(o);
+ buf.append("\n");
+ }
+ return buf.toString();
+ }
+ if (value instanceof String[]) {
+ for (Object o:((String[])value)) {
+ buf.append(o);
+ buf.append("\n");
+ }
+ return buf.toString();
+ }
+ if (value instanceof String) {
+ return (String)value;
+ }
+ return value;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void setValue(Object editValueObj) throws VascException {
+
+ if (super.getValue()==null) {
+ super.setValue(editValueObj);
+ return;
+ }
+
+ if ((editValueObj instanceof String)==false) {
+ throw new VascException("Can only handle string stuff.");
+ }
+ String editValue = (String)editValueObj;
+
+ String[] editList = editValue.split(",|\t|\n");
+
+ Object value = super.getValue();
+ if (value instanceof List>) {
+ ((List>)value).clear();
+ for (String o:editList) {
+ ((List)value).add(o);
+ }
+ super.setValue(value);
+ return;
+ }
+ if (value instanceof String[]) {
+ super.setValue(value);
+ return;
+ }
+ // solo String type
+ super.setValue(value);
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/AnnotationParserElement.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/AnnotationParserElement.java
new file mode 100644
index 0000000..07cb203
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/AnnotationParserElement.java
@@ -0,0 +1,446 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.lang.reflect.Method;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import com.idcanet.vasc.annotations.VascAnnotationParser;
+import com.idcanet.vasc.annotations.VascChoices;
+import com.idcanet.vasc.annotations.VascChoicesSelectItemModel;
+import com.idcanet.vasc.annotations.VascEventListener;
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascEntryFieldType;
+import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
+import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
+import com.idcanet.vasc.impl.DefaultVascEntryField;
+import com.idcanet.vasc.validators.VascValidator;
+import com.idcanet.vasc.validators.VascValidatorClassParser;
+
+import com.idcanet.x4o.core.X4OParser;
+import com.idcanet.x4o.element.AbstractElement;
+import com.idcanet.x4o.element.ElementException;
+
+
+/**
+ * Parses the xml element for auto adding field or defaults of fields.
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 24, 2009
+ */
+public class AnnotationParserElement extends AbstractElement {
+
+ /**
+ * @see com.idcanet.x4o.element.AbstractElement#doElementRun()
+ */
+ @Override
+ public void doElementRun() throws ElementException {
+ String className = getAttributes().get("className");
+ String addFields = getAttributes().get("addFields");
+ Object parentObject = getParent().getElementObject();
+
+ Class> modelClass;
+ try {
+ modelClass = X4OParser.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ throw new ElementException(e);
+ }
+ VascAnnotationParser parser = new VascAnnotationParser();
+
+ if (parentObject instanceof VascEntry) {
+ VascEntry entry = (VascEntry)parentObject;
+ fillEntry(entry,modelClass,parser);
+
+ if (addFields!=null && "false".equals(addFields)) {
+ // when false we don't add the fields.
+ } else {
+ addFields(entry,modelClass);
+ }
+ for (VascEntryField field:entry.getVascEntryFields()) {
+ fillField(field,modelClass,parser);
+ }
+ entry.setDisplayNameFieldId(parser.getVascDisplayName(modelClass));
+ entry.setPrimaryKeyFieldId(parser.getVascPrimaryKey(modelClass));
+
+ } else if (parentObject instanceof VascEntryField) {
+ VascEntryField field = (VascEntryField)parentObject;
+ fillField(field,modelClass,parser);
+ } else {
+ throw new ElementException("Unknow parent object type: "+parentObject);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void fillEntry(VascEntry entry,Class> modelClass,VascAnnotationParser parser) throws ElementException {
+
+
+ if (entry.getId()==null) {
+
+ }
+
+ VascEventListener vc = parser.getVascEventListener(modelClass);
+ if (vc!=null) {
+ int i = 0;
+ for (Class> listener:vc.listeners()) {
+ if (listener.isAssignableFrom(VascEntryFrontendEventListener.class)) {
+ entry.addVascEntryFrontendEventListener((Class)listener);
+ }
+ if (listener.isAssignableFrom(VascEntryBackendEventListener.class)) {
+ entry.addVascEntryBackendEventListener((Class)listener);
+ }
+ i++;
+ }
+ }
+
+ }
+
+ private void fillField(VascEntryField field,Class> modelClass,VascAnnotationParser parser) {
+ String value = null;
+ value = parser.getVascFieldBackendName(modelClass, field.getId());
+ if (value!=null && "".equals(value)==false) {
+ field.setBackendName(value);
+ }
+
+
+ if (field.getDisplayName()==null) {
+ field.setDisplayName( parser.getVascDisplayName (modelClass, field.getId()));
+ }
+ if (field.getName()==null) {
+ field.setName( parser.getVascI18nName (modelClass, field.getId()));
+ }
+ if (field.getDescription()==null) {
+ field.setDescription( parser.getVascI18nDescription (modelClass, field.getId()));
+ }
+ if (field.getImage()==null) {
+ field.setImage( parser.getVascI18nImage (modelClass, field.getId()));
+ }
+ if (field.getHelpId()==null) {
+ field.setHelpId( parser.getVascI18nHelpId (modelClass, field.getId()));
+ }
+ if (field.getOrderIndex()==null) {
+ field.setOrderIndex( parser.getVascOrderIndex (modelClass, field.getId()));
+ }
+ if (field.getCreate()==null) {
+ field.setCreate( parser.getVascFieldCreate (modelClass, field.getId()));
+ }
+ if (field.getEdit()==null) {
+ field.setEdit( parser.getVascFieldEdit (modelClass, field.getId()));
+ }
+ if (field.getEditReadOnly()==null) {
+ field.setEditReadOnly( parser.getVascFieldEditReadOnly (modelClass, field.getId()));
+ }
+ if (field.getEditBlank()==null) {
+ field.setEditBlank( parser.getVascFieldEditBlank (modelClass, field.getId()));
+ }
+ if (field.getList()==null) {
+ field.setList( parser.getVascFieldList (modelClass, field.getId()));
+ }
+ if (field.getView()==null) {
+ field.setView( parser.getVascFieldView (modelClass, field.getId()));
+ }
+ if (field.getOptional()==null) {
+ field.setOptional( parser.getVascFieldOptional (modelClass, field.getId()));
+ }
+ if (field.getSortable()==null) {
+ field.setSortable( parser.getVascFieldSortable (modelClass, field.getId()));
+ }
+ if (field.getSumable()==null) {
+ field.setSumable( parser.getVascFieldSumable (modelClass, field.getId()));
+ if (field.getSumable()==null) {
+ Method methodCall = null;
+ // note: model references properties are not resolved yet.
+
+ // search for method on bean.
+ for (Method method:modelClass.getMethods()) {
+ if (method.getName().startsWith("get")==false) { //a bit durty
+ continue;
+ }
+ if (method.getName().equals("getClass")) {
+ continue;
+ }
+ if (field.getBackendName()==null) {
+ if (method.getName().equalsIgnoreCase("get"+field.getId())) {
+ methodCall = method;
+ break;
+ }
+ } else {
+ if (method.getName().equalsIgnoreCase("get"+field.getBackendName())) {
+ methodCall = method;
+ break;
+ }
+ }
+ }
+ // System.out.println("Found method: "+methodCall);
+
+ // search for type
+ if (methodCall!=null) {
+ Class> retType = methodCall.getReturnType();
+ if (retType.isAssignableFrom(Number.class)) {
+ field.setSumable(true);
+ }
+ }
+ }
+ if (field.getSumable()==null) {
+ field.setSumable(false);
+ }
+ }
+ if (field.getGraphable()==null) {
+ field.setGraphable( parser.getVascFieldGraphable (modelClass, field.getId()));
+ if (field.getGraphable()==null) {
+ field.setGraphable(field.getSumable());
+ }
+ }
+
+ if (field.getRolesCreate()==null) {
+ field.setRolesCreate( parser.getVascRolesCreate (modelClass, field.getId()));
+ }
+ if (field.getRolesEdit()==null) {
+ field.setRolesEdit( parser.getVascRolesEdit (modelClass, field.getId()));
+ }
+ if (field.getRolesEditReadOnly()==null) {
+ field.setRolesEditReadOnly(parser.getVascRolesEditReadOnly (modelClass, field.getId()));
+ }
+ if (field.getRolesList()==null) {
+ field.setRolesList( parser.getVascRolesList (modelClass, field.getId()));
+ }
+
+
+ if (field.getSizeEdit()==null) {
+ field.setSizeEdit( parser.getVascStyleSizeEdit (modelClass, field.getId()));
+ }
+ if (field.getSizeList()==null) {
+ field.setSizeList( parser.getVascStyleSizeList (modelClass, field.getId()));
+ }
+ if (field.getStyleEdit()==null) {
+ field.setStyleEdit( parser.getVascStyleStyleEdit (modelClass, field.getId()));
+ }
+ if (field.getStyleList()==null) {
+ field.setStyleList( parser.getVascStyleStyleList (modelClass, field.getId()));
+ }
+
+ VascValidatorClassParser validatorParser = new VascValidatorClassParser();
+
+ Class> temp = parser.getVascFieldTemplateClass (modelClass, field.getId());
+ String tempProp = parser.getVascFieldTemplate (modelClass, field.getId());
+ if (temp!=null) {
+ if (tempProp==null) {
+ tempProp=field.getId();
+ }
+ if (tempProp.isEmpty()) {
+ tempProp=field.getId();
+ }
+ List val = validatorParser.getValidatorsByPropertyName(temp, tempProp);
+ for (VascValidator v:val) {
+ field.addVascValidator(v);
+ }
+ }
+
+ List val = validatorParser.getValidatorsByPropertyName(modelClass, field.getId());
+ for (VascValidator v:val) {
+ field.addVascValidator(v); // todo: merg with already added list of template so we can override.
+ }
+
+ VascController vascController = VascParser.getVascController(this.getElementContext());
+ VascChoices vc = parser.getVascChoices (modelClass, field.getId());
+ if (vc!=null) {
+ VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById("ListField");
+ type.setDataObject(new VascChoicesSelectItemModel(vc));
+ field.setVascEntryFieldType(type);
+ }
+ if (field.getVascEntryFieldType()==null) {
+ String fieldType = parser.getVascFieldType (modelClass, field.getId());
+ if (fieldType!=null) {
+ VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById(fieldType);
+ field.setVascEntryFieldType(type);
+
+ // copy properties
+ String[] prop = parser.getVascFieldTypeProperties (modelClass, field.getId());
+ if (prop!=null) {
+ Properties properties = new Properties();
+ for (String p:prop) {
+ try {
+ // let properties class parse the key=value pairs.
+ properties.load(new StringReader(p));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ for (Object key:properties.keySet()) {
+ type.setProperty((String)key, (String)properties.get(key));
+ }
+ }
+ }
+ }
+
+ if (field.getVascEntryFieldType()==null) {
+
+ Method methodCall = null;
+ // note: model references properties are not resolved yet.
+
+ // search for method on bean.
+ for (Method method:modelClass.getMethods()) {
+ if (method.getName().startsWith("get")==false) { //a bit durty
+ continue;
+ }
+ if (method.getName().equals("getClass")) {
+ continue;
+ }
+ if (field.getBackendName()==null) {
+ if (method.getName().equalsIgnoreCase("get"+field.getId())) {
+ methodCall = method;
+ break;
+ }
+ } else {
+ if (method.getName().equalsIgnoreCase("get"+field.getBackendName())) {
+ methodCall = method;
+ break;
+ }
+ }
+ }
+ // System.out.println("Found method: "+methodCall);
+
+ // search for type
+ if (methodCall!=null) {
+ Class> retType = methodCall.getReturnType();
+
+ for (String typeId: vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
+ VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
+
+ //String auto = "";
+ //if (type.getAutoDetectClass()!=null) {
+ // auto = type.getAutoDetectClass().getName();
+ //}
+ //System.out.println("Check ret: "+retType.getName()+" type: "+type.getId()+" auto: "+auto);
+
+
+ if (type.getAutoDetectClass()!=null) {
+ if (type.getAutoDetectClass().isAssignableFrom(retType)) {
+ field.setVascEntryFieldType(type);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+
+ if (field.getDefaultValue()==null) {
+ String defValue = parser.getVascDefaultValue (modelClass, field.getId());
+ if (defValue!=null) {
+ Method methodCall = null;
+
+ // note: model references properties are not resolved yet.
+
+ // search for method on bean.
+ for (Method method:modelClass.getMethods()) {
+ if (method.getName().startsWith("get")==false) { //a bit durty
+ continue;
+ }
+ if (method.getName().equals("getClass")) {
+ continue;
+ }
+ if (field.getBackendName()==null) {
+ if (method.getName().equalsIgnoreCase("get"+field.getId())) {
+ methodCall = method;
+ break;
+ }
+ } else {
+ if (method.getName().equalsIgnoreCase("get"+field.getBackendName())) {
+ methodCall = method;
+ break;
+ }
+ }
+ }
+ // System.out.println("Found method: "+methodCall);
+
+ // search for type
+ if (methodCall!=null) {
+ Class> retType = methodCall.getReturnType();
+ try {
+ //System.out.println("creating real def value of: "+defValue+" for: "+retType.getName());
+ Object defObject = null;
+ if (Date.class.equals(retType)) {
+ defObject = new Date();
+ } else if (Calendar.class.equals(retType)) {
+ defObject = Calendar.getInstance();
+ } else {
+ defObject = retType.getConstructor(String.class).newInstance(defValue);
+ }
+ //System.out.println("real object: "+defObject);
+ field.setDefaultValue(defObject);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ }
+
+ private void addFields(VascEntry entry,Class> modelClass) {
+ for (Method method:modelClass.getMethods()) {
+ if (method.getName().startsWith("get")==false) { //a bit durty
+ continue;
+ }
+ if (method.getName().equals("getClass")) {
+ continue;
+ }
+ if (method.getReturnType().isAssignableFrom(Collection.class)) {
+ continue;
+ }
+ if (method.getReturnType().isAssignableFrom(List.class)) {
+ continue;
+ }
+ if (method.getReturnType().isAssignableFrom(Set.class)) {
+ continue;
+ }
+ if (method.getReturnType().isAssignableFrom(Map.class)) {
+ continue;
+ }
+
+ String fieldId = method.getName().substring(3,4).toLowerCase()+method.getName().substring(4);
+ VascEntryField field = new DefaultVascEntryField();
+ field.setId(fieldId);
+
+ if (entry.getVascEntryFieldById(fieldId)==null) {
+ entry.addVascEntryField(field);
+ } else {
+ continue; // already set in xml
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/SelectItemModelBindingHandler.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/SelectItemModelBindingHandler.java
new file mode 100644
index 0000000..0d69411
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/SelectItemModelBindingHandler.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004-2006 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascEntryFieldType;
+import com.idcanet.vasc.core.ui.VascSelectItemModel;
+import com.idcanet.x4o.element.AbstractElementBindingHandler;
+import com.idcanet.x4o.element.Element;
+import com.idcanet.x4o.element.ElementBindingHandlerException;
+
+/**
+ * Binds SelectItems
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Apr 02, 2009
+ */
+public class SelectItemModelBindingHandler extends AbstractElementBindingHandler {
+
+ /**
+ * @see com.idcanet.x4o.element.ElementBindingHandler#canBind(com.idcanet.x4o.element.Element)
+ */
+ public boolean canBind(Element element) {
+ if (element.getParent()==null) {
+ return false;
+ }
+ Object parent = element.getParent().getElementObject();
+ Object child = element.getElementObject();
+ boolean p = false;
+ boolean c = false;
+ if (parent instanceof VascEntryField) { p=true; }
+ if (child instanceof VascSelectItemModel) { c=true; }
+ if (p&c) { return true; } else { return false; }
+ }
+
+ /**
+ * @see com.idcanet.x4o.element.ElementBindingHandler#doBind(com.idcanet.x4o.element.Element)
+ */
+ public void doBind(Element element) throws ElementBindingHandlerException {
+ Object child = element.getElementObject();
+ Object parentObject = element.getParent().getElementObject();
+ if (parentObject instanceof VascEntryField) {
+ VascEntryField parent = (VascEntryField)parentObject;
+ if (child instanceof VascSelectItemModel) {
+ VascEntryFieldType type = parent.getVascEntryFieldType();
+ type.setDataObject(child);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/SetParameterElement.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/SetParameterElement.java
new file mode 100644
index 0000000..25496b2
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/SetParameterElement.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import java.util.logging.Logger;
+
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.vasc.core.VascEntry;
+
+import com.idcanet.x4o.element.AbstractElement;
+import com.idcanet.x4o.element.ElementException;
+
+
+/**
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 24, 2009
+ */
+public class SetParameterElement extends AbstractElement {
+
+ private Logger logger = Logger.getLogger(SetParameterElement.class.getName());
+
+ /**
+ * @see com.idcanet.x4o.element.AbstractElement#doElementRun()
+ */
+ @Override
+ public void doElementRun() throws ElementException {
+ String name = getAttributes().get("name");
+ String value = getAttributes().get("value");
+ String type = getAttributes().get("type");
+ VascEntry entry = (VascEntry)getParent().getElementObject();
+ VascController cont = VascParser.getVascController(getElementContext());
+ logger.fine("Setting parameter name: "+name+" value: "+value+" type: "+type);
+
+ if ("setUserParameter".equals(getElementClass().getTag())) {
+ if (value==null) {
+ value="id";
+ }
+ if ("id".equals(value)) {
+ if ("int".equals(type)) {
+ Long userId = cont.getVascUserRoleController().getUserId();
+ entry.setEntryParameter(name, userId.intValue());
+ } else {
+ Long userId = cont.getVascUserRoleController().getUserId();
+ entry.setEntryParameter(name, userId);
+ }
+ } else {
+ String userName = cont.getVascUserRoleController().getUserName();
+ entry.setEntryParameter(name, userName);
+ }
+ return;
+ }
+
+ if (type==null) {
+ entry.setEntryParameter(name, value);
+ return;
+ }
+
+ if ("long".equalsIgnoreCase(type)) {
+ entry.setEntryParameter(name, new Long(value));
+ return;
+ }
+ if ("int".equalsIgnoreCase(type)) {
+ entry.setEntryParameter(name, new Integer(value));
+ return;
+ }
+
+ throw new ElementException("Could not set dataParameter: "+name+" with type: "+type);
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascBackendElementConfigurator.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascBackendElementConfigurator.java
new file mode 100644
index 0000000..b447a17
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascBackendElementConfigurator.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascBackendController;
+import com.idcanet.vasc.core.VascBackendControllerLocal;
+import com.idcanet.vasc.core.VascController;
+
+import com.idcanet.x4o.element.AbstractElementConfigurator;
+import com.idcanet.x4o.element.Element;
+import com.idcanet.x4o.element.ElementConfiguratorException;
+
+
+/**
+ * Adds the backend to the local controller
+ *
+ * @author Willem Cazander
+ * @version 1.0 Nov 16, 2008
+ */
+public class VascBackendElementConfigurator extends AbstractElementConfigurator {
+
+ /**
+ * @see com.idcanet.x4o.element.AbstractElementConfigurator#doConfigEndTag(com.idcanet.x4o.element.Element)
+ */
+ public void doConfigElement(Element element) throws ElementConfiguratorException {
+
+ VascBackend backend = (VascBackend)element.getElementObject();
+
+ VascController vascController = VascParser.getVascController(element.getElementContext());
+ VascBackendController backendController = vascController.getVascBackendController();
+
+ if (backendController instanceof VascBackendControllerLocal) {
+ try {
+ ((VascBackendControllerLocal)backendController).addVascBackend(backend);
+ } catch (Exception e) {
+ throw new ElementConfiguratorException(this,"Couln't add backend: "+e.getMessage(),e);
+ }
+ } else {
+ throw new ElementConfiguratorException(this,"Can not add backend '"+backend.getId()+"' to VascBackendController because we have no access to VascBackendControllerLocal interface.");
+ }
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryElementConfigurator.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryElementConfigurator.java
new file mode 100644
index 0000000..4670a55
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryElementConfigurator.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryController;
+import com.idcanet.vasc.core.VascEntryControllerLocal;
+import com.idcanet.vasc.core.VascException;
+import com.idcanet.x4o.element.AbstractElementConfigurator;
+import com.idcanet.x4o.element.Element;
+import com.idcanet.x4o.element.ElementConfiguratorException;
+
+
+/**
+ * Converts the type to the type object
+ *
+ * @author Willem Cazander
+ * @version 1.0 Nov 16, 2008
+ */
+public class VascEntryElementConfigurator extends AbstractElementConfigurator {
+
+ /**
+ * @see com.idcanet.x4o.element.AbstractElementConfigurator#doConfigEndTag(com.idcanet.x4o.element.Element)
+ */
+ public void doConfigElement(Element element) throws ElementConfiguratorException {
+
+ VascEntry entry = (VascEntry)element.getElementObject();
+
+ VascController vascController = VascParser.getVascController(element.getElementContext());
+ VascEntryController entryController = vascController.getVascEntryController();
+
+ if (entryController instanceof VascEntryControllerLocal) {
+ try {
+ ((VascEntryControllerLocal)entryController).addVascEntry(entry, vascController);
+ } catch (VascException e) {
+ throw new ElementConfiguratorException(this,"Couln't add entry: "+e.getMessage(),e);
+ }
+ } else {
+ throw new ElementConfiguratorException(this,"Can not add entry '"+entry.getId()+"' to VascEntryController because we have no access to VascEntryControllerLocal interface.");
+ }
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldBindingHandler.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldBindingHandler.java
new file mode 100644
index 0000000..7446704
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldBindingHandler.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2004-2006 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.x4o.element.AbstractElementBindingHandler;
+import com.idcanet.x4o.element.Element;
+import com.idcanet.x4o.element.ElementBindingHandlerException;
+
+/**
+ * Binds fields
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Apr 02, 2009
+ */
+public class VascEntryFieldBindingHandler extends AbstractElementBindingHandler {
+
+ /**
+ * @see com.idcanet.x4o.element.ElementBindingHandler#canBind(com.idcanet.x4o.element.Element)
+ */
+ public boolean canBind(Element element) {
+ if (element.getParent()==null) {
+ return false;
+ }
+ Object parent = element.getParent().getElementObject();
+ Object child = element.getElementObject();
+ boolean p = false;
+ boolean c = false;
+ if (parent instanceof VascEntry) { p=true; }
+ if (child instanceof VascEntryField) { c=true; }
+ if (p&c) { return true; } else { return false; }
+ }
+
+ /**
+ * @see com.idcanet.x4o.element.ElementBindingHandler#doBind(com.idcanet.x4o.element.Element)
+ */
+ public void doBind(Element element) throws ElementBindingHandlerException {
+ Object childObject = element.getElementObject();
+ Object parentObject = element.getParent().getElementObject();
+ if (parentObject instanceof VascEntry) {
+ VascEntry parent = (VascEntry)parentObject;
+ if (childObject instanceof VascEntryField) {
+ VascEntryField child = (VascEntryField) childObject;
+ if (element.getElementClass().getTag().equals("listOption")) {
+ parent.addListOption(child);
+ } else {
+ parent.addVascEntryField(child);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldElement.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldElement.java
new file mode 100644
index 0000000..cb70b5b
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldElement.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import java.util.logging.Logger;
+
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.core.VascEntryField;
+
+import com.idcanet.x4o.element.AbstractElement;
+import com.idcanet.x4o.element.ElementException;
+
+
+/**
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 27, 2009
+ */
+public class VascEntryFieldElement extends AbstractElement {
+
+ private Logger logger = Logger.getLogger(VascEntryFieldElement.class.getName());
+
+
+ /**
+ * @see com.idcanet.x4o.element.AbstractElement#doElementRun()
+ */
+ @Override
+ public void doElementRun() throws ElementException {
+ String id = getAttributes().get("id");
+ VascEntry back = (VascEntry)getParent().getElementObject();
+ VascEntryField field = back.getVascEntryFieldById(id);
+ if (field==null) {
+ return;
+ }
+ if (field==getElementObject()) {
+ return; // is the same object
+ }
+ logger.fine("ReSetting elementObject: "+field.getId());
+ setElementObject(field);
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldSetAttributeConverter.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldSetAttributeConverter.java
new file mode 100644
index 0000000..40f9d07
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldSetAttributeConverter.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import com.idcanet.vasc.core.VascEntryFieldSet;
+import com.idcanet.x4o.element.AbstractElementAttributeConverter;
+import com.idcanet.x4o.element.Element;
+import com.idcanet.x4o.element.ElementAttributeConverterException;
+
+
+/**
+ * Converts the VascEntryFieldSet parameter
+ *
+ * @author Willem Cazander
+ * @version 1.0 Nov 17, 2008
+ */
+public class VascEntryFieldSetAttributeConverter extends AbstractElementAttributeConverter {
+
+ /**
+ * @see com.idcanet.x4o.element.AbstractElementAttributeConverter#doConvertAttribute(com.idcanet.x4o.element.Element, java.lang.Object)
+ */
+ public Object doConvertAttribute(Element element, Object parameterValue) throws ElementAttributeConverterException {
+
+ if (parameterValue==null) {
+ throw new NullPointerException("can't convert null parameter");
+ }
+ if ("".equals(parameterValue)) {
+ return null;
+ }
+ String[] ids = parameterValue.toString().split(",");
+
+ VascEntryFieldSet set = (VascEntryFieldSet)element.getElementObject();
+ for (String id:ids) {
+ set.addVascEntryFieldId(id);
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeAttributeConverter.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeAttributeConverter.java
new file mode 100644
index 0000000..b6660dd
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeAttributeConverter.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.x4o.element.AbstractElementAttributeConverter;
+import com.idcanet.x4o.element.Element;
+import com.idcanet.x4o.element.ElementAttributeConverterException;
+
+
+/**
+ * Converts the type to the type object
+ *
+ * @author Willem Cazander
+ * @version 1.0 Nov 16, 2008
+ */
+public class VascEntryFieldTypeAttributeConverter extends AbstractElementAttributeConverter {
+
+ /**
+ * @see com.idcanet.x4o.element.AbstractElementAttributeConverter#doConvertAttribute(com.idcanet.x4o.element.Element, java.lang.Object)
+ */
+ public Object doConvertAttribute(Element element, Object attributeValue) throws ElementAttributeConverterException {
+ if (attributeValue==null) {
+ throw new NullPointerException("can't convert null parameter");
+ }
+ if ("".equals(attributeValue)) {
+ attributeValue = "TextField"; // ??
+ }
+ String fieldID = attributeValue.toString();
+
+ VascController controller = VascParser.getVascController(element.getElementContext());
+ Object result = controller.getVascEntryFieldTypeController().getVascEntryFieldTypeById(fieldID);
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeElement.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeElement.java
new file mode 100644
index 0000000..18b4d25
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeElement.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import java.util.logging.Logger;
+
+import com.idcanet.vasc.core.VascEntryField;
+import com.idcanet.vasc.core.VascEntryFieldType;
+
+import com.idcanet.x4o.core.X4OPhase;
+import com.idcanet.x4o.element.AbstractElement;
+import com.idcanet.x4o.element.ElementException;
+
+
+/**
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Mar 27, 2009
+ */
+public class VascEntryFieldTypeElement extends AbstractElement {
+
+ private Logger logger = Logger.getLogger(VascEntryFieldTypeElement.class.getName());
+
+
+ /**
+ * @see com.idcanet.x4o.element.AbstractElement#doElementRun()
+ */
+ @Override
+ public void doElementRun() throws ElementException {
+ if (getElementObject()!=null) {
+ return; // already done.
+ }
+ VascEntryField field = (VascEntryField)getParent().getElementObject();
+ VascEntryFieldType type = field.getVascEntryFieldType();
+ setElementObject(type);
+ logger.info("Readding the element for reparsing");
+ getElementContext().addDirtyElement(this, X4OPhase.startX4OPhase);
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascLinkEntryParameterElement.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascLinkEntryParameterElement.java
new file mode 100644
index 0000000..310343d
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascLinkEntryParameterElement.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import com.idcanet.vasc.core.VascLinkEntry;
+import com.idcanet.vasc.impl.DefaultVascSelectItemModel;
+
+import com.idcanet.x4o.element.AbstractElement;
+import com.idcanet.x4o.element.ElementException;
+
+/**
+ * Adds the link is paramets
+ *
+ * @author Willem Cazander
+ * @version 1.0 Jun 09, 2009
+ */
+public class VascLinkEntryParameterElement extends AbstractElement {
+
+ /**
+ * @see com.idcanet.x4o.element.AbstractElement#doElementRun()
+ */
+ @Override
+ public void doElementRun() throws ElementException {
+ String valueFieldId = getAttributes().get("valueFieldId");
+ String parameterName = getAttributes().get("name");
+ String selectedFieldId = getAttributes().get("selectedFieldId");
+
+ if (getParent().getElementObject() instanceof DefaultVascSelectItemModel) {
+ DefaultVascSelectItemModel m = (DefaultVascSelectItemModel)getParent().getElementObject();
+ m.addEntryParameterFieldId(parameterName, valueFieldId);
+ return;
+ }
+ if (getParent().getElementObject() instanceof VascLinkEntry) {
+ VascLinkEntry link = (VascLinkEntry)getParent().getElementObject();
+ if (parameterName!=null) {
+ // normal parameter
+ link.addEntryParameterFieldId(parameterName, valueFieldId);
+ } else {
+ link.addEntryCreateFieldValue(valueFieldId,selectedFieldId);
+ }
+ return;
+ }
+ throw new ElementException("Unsupported parent object: "+getParent().getElementObject());
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascParser.java b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascParser.java
new file mode 100644
index 0000000..468659f
--- /dev/null
+++ b/vasc-core/src/main/java/com/idcanet/vasc/impl/x4o/VascParser.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2004-2008 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.impl.x4o;
+
+import javax.el.ValueExpression;
+
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.x4o.core.AbstractX4OPhaseHandler;
+import com.idcanet.x4o.core.X4OParser;
+import com.idcanet.x4o.core.X4OPhaseException;
+import com.idcanet.x4o.core.X4OPhaseHandler;
+import com.idcanet.x4o.core.X4OPhase;
+import com.idcanet.x4o.element.Element;
+import com.idcanet.x4o.element.ElementContext;
+
+/**
+ * Parses the vasc xml streams
+ *
+ *
+ *
+ * @author Willem Cazander
+ * @version 1.0 Oct 27, 2008
+ */
+public class VascParser extends X4OParser {
+
+ static public String VASC_LANGUAGE = "vasc";
+ private VascController vascController = null;
+
+ /**
+ * @see X4OParser#X4OParser(String)
+ */
+ public VascParser(VascController vascController) throws Exception {
+ super(VASC_LANGUAGE);
+ if (vascController==null) {
+ throw new NullPointerException("vascController may not be null");
+ }
+ this.vascController=vascController;
+ }
+
+ public VascController getVascController() {
+ return vascController;
+ }
+
+ static public VascController getVascController(ElementContext context) {
+ ValueExpression ee = context.getExpressionFactory().createValueExpression(context.getELContext(),"${vascController}", VascController.class);
+ VascController con = (VascController)ee.getValue(context.getELContext());
+ return con;
+ }
+
+ /**
+ *
+ */
+ @Override
+ protected X4OPhaseHandler getConfigOptionalPhase() {
+ X4OPhaseHandler result = new AbstractX4OPhaseHandler() {
+ protected void setX4OPhase() {
+ phase = X4OPhase.configOptionalPhase;
+ }
+ public boolean isElementPhase() {
+ return false;
+ }
+ public void runElementPhase(Element element) throws X4OPhaseException {
+ }
+ public void runPhase(ElementContext elementContext) throws X4OPhaseException {
+ // Add the controller to EL
+ ValueExpression ee = getElementContext().getExpressionFactory().createValueExpression(getElementContext().getELContext(),"${vascController}", VascController.class);
+ ee.setValue(getElementContext().getELContext(), vascController);
+ }
+ };
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/vasc-core/src/main/resources/META-INF/fieldtype/fieldtype-lang.eld b/vasc-core/src/main/resources/META-INF/fieldtype/fieldtype-lang.eld
new file mode 100644
index 0000000..9775506
--- /dev/null
+++ b/vasc-core/src/main/resources/META-INF/fieldtype/fieldtype-lang.eld
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vasc-core/src/main/resources/META-INF/fieldtype/fieldtype-namespaces.xml b/vasc-core/src/main/resources/META-INF/fieldtype/fieldtype-namespaces.xml
new file mode 100644
index 0000000..ea0c8b2
--- /dev/null
+++ b/vasc-core/src/main/resources/META-INF/fieldtype/fieldtype-namespaces.xml
@@ -0,0 +1,8 @@
+
+
+
+
+ Vasc namespace for the fieldtype language
+
+ fieldtype-lang.eld
+
\ No newline at end of file
diff --git a/vasc-core/src/main/resources/META-INF/fieldtypes.xml b/vasc-core/src/main/resources/META-INF/fieldtypes.xml
new file mode 100644
index 0000000..5cda54d
--- /dev/null
+++ b/vasc-core/src/main/resources/META-INF/fieldtypes.xml
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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
new file mode 100644
index 0000000..1b2da16
--- /dev/null
+++ b/vasc-core/src/main/resources/META-INF/vasc/vasc-lang.eld
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vasc-core/src/main/resources/META-INF/vasc/vasc-namespaces.xml b/vasc-core/src/main/resources/META-INF/vasc/vasc-namespaces.xml
new file mode 100644
index 0000000..a52db5a
--- /dev/null
+++ b/vasc-core/src/main/resources/META-INF/vasc/vasc-namespaces.xml
@@ -0,0 +1,8 @@
+
+
+
+
+ Vasc namespace for the fieldtype language
+
+ vasc-lang.eld
+
\ No newline at end of file
diff --git a/vasc-ejb3/.classpath b/vasc-ejb3/.classpath
new file mode 100644
index 0000000..f42fb64
--- /dev/null
+++ b/vasc-ejb3/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/vasc-ejb3/.project b/vasc-ejb3/.project
new file mode 100644
index 0000000..66a9c88
--- /dev/null
+++ b/vasc-ejb3/.project
@@ -0,0 +1,23 @@
+
+
+ vasc-ejb3
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.maven.ide.eclipse.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.maven.ide.eclipse.maven2Nature
+
+
diff --git a/vasc-ejb3/.settings/org.eclipse.jdt.core.prefs b/vasc-ejb3/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..7d9018c
--- /dev/null
+++ b/vasc-ejb3/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,6 @@
+#Fri Sep 10 01:31:37 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/vasc-ejb3/.settings/org.maven.ide.eclipse.prefs b/vasc-ejb3/.settings/org.maven.ide.eclipse.prefs
new file mode 100644
index 0000000..980916a
--- /dev/null
+++ b/vasc-ejb3/.settings/org.maven.ide.eclipse.prefs
@@ -0,0 +1,9 @@
+#Fri Sep 10 01:31:36 CEST 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
diff --git a/vasc-ejb3/pom.xml b/vasc-ejb3/pom.xml
new file mode 100644
index 0000000..97742b6
--- /dev/null
+++ b/vasc-ejb3/pom.xml
@@ -0,0 +1,41 @@
+
+ 4.0.0
+
+ vasc-base
+ com.idcanet.vasc
+ 0.3-SNAPSHOT
+
+ com.idcanet.vasc
+ vasc-ejb3
+ 0.3-SNAPSHOT
+
+
+ com.idcanet.vasc
+ vasc-core
+ ${project.version}
+
+
+ com.idcanet.vasc
+ vasc-backend-jpa
+ ${project.version}
+
+
+ javax.ejb
+ ejb-api
+ 3.0
+ provided
+
+
+ javax.persistence
+ persistence-api
+ 1.0
+ provided
+
+
+ com.idcanet.xtes
+ xtes-xpql-ejb3
+ 0.6-SNAPSHOT
+ provided
+
+
+
\ No newline at end of file
diff --git a/vasc-ejb3/src/main/java/com/idcanet/vasc/ejb3/VascServiceManager.java b/vasc-ejb3/src/main/java/com/idcanet/vasc/ejb3/VascServiceManager.java
new file mode 100644
index 0000000..9adf581
--- /dev/null
+++ b/vasc-ejb3/src/main/java/com/idcanet/vasc/ejb3/VascServiceManager.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.ejb3;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.ejb.Remote;
+
+import com.idcanet.vasc.core.VascEntry;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 17 Sep 2010
+ */
+public interface VascServiceManager {
+
+ public Map getResourceBundle(String locale);
+
+ public List getVascEntryIds();
+
+ public VascEntry getVascEntry(String entryId);
+
+ public Object invokeBackendMethod(String backendId,String method,Object[] args);
+
+ @Local
+ public interface ILocal extends VascServiceManager {
+ }
+
+ @Remote
+ public interface IRemote extends VascServiceManager {
+ }
+}
diff --git a/vasc-ejb3/src/main/java/com/idcanet/vasc/ejb3/VascServiceManagerImpl.java b/vasc-ejb3/src/main/java/com/idcanet/vasc/ejb3/VascServiceManagerImpl.java
new file mode 100644
index 0000000..8e2a0e9
--- /dev/null
+++ b/vasc-ejb3/src/main/java/com/idcanet/vasc/ejb3/VascServiceManagerImpl.java
@@ -0,0 +1,402 @@
+/*
+ * Copyright 2004-2007 IDCA. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
+ * following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
+ * the following disclaimer.
+ * 2. 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 IDCA 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 IDCA 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.
+ *
+ * The views and conclusions contained in the software and documentation are those of the authors and
+ * should not be interpreted as representing official policies, either expressed or implied, of IDCA.
+ */
+
+package com.idcanet.vasc.ejb3;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.el.ValueExpression;
+import javax.naming.InitialContext;
+import javax.persistence.EntityManager;
+
+import com.idcanet.vasc.backends.jpa.EntityManagerProvider;
+import com.idcanet.vasc.core.VascBackend;
+import com.idcanet.vasc.core.VascController;
+import com.idcanet.vasc.core.VascEntry;
+import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
+import com.idcanet.vasc.impl.DefaultVascEntryController;
+import com.idcanet.vasc.impl.DefaultVascFactory;
+import com.idcanet.vasc.impl.actions.AddRowAction;
+import com.idcanet.vasc.impl.actions.CSVExportGlobalAction;
+import com.idcanet.vasc.impl.actions.DeleteRowAction;
+import com.idcanet.vasc.impl.actions.EditRowAction;
+import com.idcanet.vasc.impl.actions.XMLExportGlobalAction;
+import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
+import com.idcanet.vasc.impl.x4o.VascParser;
+import com.idcanet.x4o.core.AbstractX4OPhaseHandler;
+import com.idcanet.x4o.core.X4OPhase;
+import com.idcanet.x4o.core.X4OPhaseException;
+import com.idcanet.x4o.core.X4OPhaseHandler;
+import com.idcanet.x4o.element.Element;
+import com.idcanet.x4o.element.ElementContext;
+import com.idcanet.xtes.xpql.ejb3.XpqlQueryManager;
+import com.idcanet.xtes.xpql.query.Query;
+
+/**
+ *
+ * @author Willem Cazander
+ * @version 1.0 13 Aug 2007
+ */
+@Stateless(name="ejb/vascSericeManager")
+public class VascServiceManagerImpl implements VascServiceManager.IRemote,VascServiceManager.ILocal {
+
+ private Logger logger = Logger.getLogger(VascServiceManagerImpl.class.getName());
+
+ protected EntityManager entityManager;
+
+ protected XpqlQueryManager xpqlController = null;
+
+ protected VascController sharedVascController = null;
+
+ protected ResourceBundle resourceBundle = null;
+
+ @PostConstruct
+ public void loadAll() {
+ logger.fine("VascServiceManager created now loading resources...");
+ try {
+ long s = System.currentTimeMillis();
+
+ Map keys = loadKeys();
+ for (String key:keys.keySet()) {
+ String value = keys.get(key);
+ if ("persistenceUnit".equals(key)) {
+ logger.info("getting EntityManager: "+value);
+ entityManager = (EntityManager)new InitialContext().lookup(value);
+ }
+ if ("xpqlController".equals(key)) {
+ logger.info("getting XpqlQueryManagerLocal: "+value);
+ xpqlController = (XpqlQueryManager)new InitialContext().lookup(value);
+ }
+ if ("i18nBundle".equals(key)) {
+ resourceBundle = ResourceBundle.getBundle(value);
+ }
+ }
+
+ if (entityManager==null) {
+ new NullPointerException("Have no entityManager");
+ }
+ if (xpqlController==null) {
+ new NullPointerException("Have no xpqlController");
+ }
+ if (resourceBundle==null) {
+ new NullPointerException("Have no resourceBundle");
+ }
+
+ // get local jvm plugging controller
+ VascController c = DefaultVascFactory.getDefaultVascController(22l, "test", "login");
+
+ for (String key:keys.keySet()) {
+ String value = keys.get(key);
+ if (key.startsWith("load")) {
+ // TODO made reuse working.
+ new HackVascParser(c).parseResource(value);
+ }
+ }
+ finalVascController(c);
+
+ sharedVascController = c;
+
+ long t = System.currentTimeMillis()-s;
+ logger.info("Total loaded vasc entries: "+c.getVascEntryController().getVascEntryIds().size()+" in "+t+" ms.");
+ } catch (Exception e) {
+ throw new RuntimeException("Error while init resources error: "+e.getMessage(),e);
+ }
+ }
+
+ /**
+ * Loads xtes-xpql-ejb3.xml from meta-inf and gives the keys
+ */
+ protected Map loadKeys() throws IOException {
+
+ Properties properties = new Properties();
+
+ logger.fine("Getting urls");
+ Enumeration e = Thread.currentThread().getContextClassLoader().getResources("META-INF/vasc-ejb3.xml");
+ while(e.hasMoreElements()) {
+ URL u = e.nextElement();
+ logger.finer("Loading reletive namespaces of: "+u+" for: META-INF/vasc-ejb3.xml");
+ InputStream in = u.openStream();
+ try {
+ properties.loadFromXML(in);
+ } finally {
+ if (in!=null) {
+ in.close();
+ }
+ }
+ }
+
+
+ e = Thread.currentThread().getContextClassLoader().getResources("/META-INF/vasc-ejb3.xml");
+ while(e.hasMoreElements()) {
+ URL u = e.nextElement();
+ logger.finer("Loading root namespaces of: "+u+" for: /META-INF/vasc-ejb3.xml");
+ InputStream in = u.openStream();
+ try {
+ properties.loadFromXML(in);
+ } finally {
+ if (in!=null) {
+ in.close();
+ }
+ }
+ }
+ logger.fine("done loading");
+
+ Map result = new HashMap(20);
+ for (Object key:properties.keySet()) {
+ if (key instanceof String) {
+ String key2 = (String) key;
+ String value = properties.getProperty(key2);
+ result.put(key2, value);
+ }
+ }
+ return result;
+ }
+
+
+ public Map getResourceBundle(String locale) {
+ Map result = new HashMap(resourceBundle.keySet().size());
+ for (String key:resourceBundle.keySet()) {
+ String value = resourceBundle.getString(key);
+ result.put(key,value);
+ }
+ return result;
+ }
+
+ public List