diff --git a/.classpath b/.classpath index ce15ddb..d0bec0f 100644 --- a/.classpath +++ b/.classpath @@ -1,11 +1,6 @@ - - - - - diff --git a/.hgignore b/.hgignore index 74f723f..b705f2a 100644 --- a/.hgignore +++ b/.hgignore @@ -1,3 +1,12 @@ -syntax: regexp -^target$ \ No newline at end of file +syntax: glob + +# HG .orig files +*.orig + +# A hidden file created by the Mac OS X Finder. +.DS_Store + +# Ignore target dirs. +target/* +*/target/* \ No newline at end of file diff --git a/.project b/.project index 6dbf548..c903031 100644 --- a/.project +++ b/.project @@ -5,51 +5,6 @@ - - org.eclipse.wst.common.project.facet.core.builder - - - - - com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator - - - - - com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator - - - - - org.eclipse.ui.externaltools.ExternalToolBuilder - full,incremental, - - - LaunchConfigHandle - <project>/.externalToolBuilders/org.eclipse.wst.validation.validationbuilder.launch - - - - - org.eclipse.wst.validation.validationbuilder - - - - - com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder - - - org.maven.ide.eclipse.maven2Builder @@ -58,11 +13,5 @@ org.maven.ide.eclipse.maven2Nature - com.genuitec.eclipse.ast.deploy.core.deploymentnature - com.genuitec.eclipse.j2eedt.core.webnature - org.eclipse.jem.workbench.JavaEMFNature - org.eclipse.jdt.core.javanature - org.eclipse.jem.beaninfo.BeanInfoNature - org.eclipse.wst.common.project.facet.core.nature diff --git a/pom.xml b/pom.xml index 67e4df8..96a44f0 100644 --- a/pom.xml +++ b/pom.xml @@ -3,9 +3,9 @@ 4.0.0 com.idcanet.vasc -vasc-main +vasc-base 0.3-SNAPSHOT -jar +pom vasc Simple crud'ing for all. http://www.x4o.org/vasc @@ -65,284 +65,29 @@ false - - - - - com.idcanet.x4o - x4o-main - 0.8-SNAPSHOT - - - - - com.idcanet.serv5 - serv5-main - 0.6-SNAPSHOT - compile - - - - - com.idcanet.xtes - xtes-main - 0.6-SNAPSHOT - compile - - - - - com.idcanet.fff - fff-main - 0.8-SNAPSHOT - compile - - - - - com.novell.ldap - jldap - 4.3 - compile - - - - - com.michaelbaranov - microba - 0.4.4.1 - compile - - - - - - - - org.apache.openejb - javaee-api - 5.0-1 - provided - - - javax.faces - jsf-api - 1.2_04 - provided - - - javax.servlet - jstl - 1.2 - provided - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - javax.faces - jsf-impl - 1.2_04 - provided - - - - - org.apache.myfaces.tomahawk - tomahawk12 - 1.1.8 - compile - - + + UTF-8 + 2.1.0 + 5.8 + 0.8-SNAPSHOT + 4.3 + 0.6-SNAPSHOT + + + org.testng testng - 5.8 + ${testng.version} jdk15 test - - - - - de.odysseus.juel - juel - 2.1.0 - provided - - - org.eclipse - jface - 3.2.1-M20060908-1000 - jar - compile - - - - - - linux-x86 - - - i386 - unix - linux - - - - - org.eclipse.swt.gtk.linux - x86 - [3.2.0,4.0.0) - - - - - linux-x86_64 - - - amd64 - unix - linux - - - - - org.eclipse.swt.gtk.linux - x86_64 - [3.2.0,4.0.0) - - - - - solaris-sparc - - - sparc - unix - SunOS - - - - - org.eclipse.swt.gtk.solaris - sparc - [3.2.0,4.0.0) - - - - - macosx - - - unix - mac os x - - - - - org.eclipse.swt.carbon - macosx - [3.2.0,4.0.0) - - - - - win32 - - - x86 - windows - - - - - org.eclipse.swt.win32.win32 - x86 - [3.2.0,4.0.0) - - - - - win64 - - - amd64 - windows - - - - - org.eclipse.swt.win32.win32 - x86_64 - [3.2.0,4.0.0) - - - - @@ -540,6 +285,15 @@ + + vasc-backend-jpa + vasc-backend-ldap + vasc-frontend-swing + vasc-frontend-swt + vasc-frontend-web-jsf + vasc-core + vasc-ejb3 + \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/backends/jpa/AbstractHibernateVascBackend.java b/src/main/java/com/idcanet/vasc/backends/jpa/AbstractHibernateVascBackend.java deleted file mode 100644 index 173373d..0000000 --- a/src/main/java/com/idcanet/vasc/backends/jpa/AbstractHibernateVascBackend.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/backends/jpa/AbstractPersistenceVascBackend.java b/src/main/java/com/idcanet/vasc/backends/jpa/AbstractPersistenceVascBackend.java deleted file mode 100644 index ac57e7c..0000000 --- a/src/main/java/com/idcanet/vasc/backends/jpa/AbstractPersistenceVascBackend.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/backends/jpa/EntityManagerProvider.java b/src/main/java/com/idcanet/vasc/backends/jpa/EntityManagerProvider.java deleted file mode 100644 index 16b08b0..0000000 --- a/src/main/java/com/idcanet/vasc/backends/jpa/EntityManagerProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/backends/jpa/HibernateSessionProvider.java b/src/main/java/com/idcanet/vasc/backends/jpa/HibernateSessionProvider.java deleted file mode 100644 index f9f4173..0000000 --- a/src/main/java/com/idcanet/vasc/backends/jpa/HibernateSessionProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/backends/jpa/XpqlHibernateVascBackend.java b/src/main/java/com/idcanet/vasc/backends/jpa/XpqlHibernateVascBackend.java deleted file mode 100644 index f241dac..0000000 --- a/src/main/java/com/idcanet/vasc/backends/jpa/XpqlHibernateVascBackend.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/backends/jpa/XpqlPersistanceVascBackend.java b/src/main/java/com/idcanet/vasc/backends/jpa/XpqlPersistanceVascBackend.java deleted file mode 100644 index 94497c8..0000000 --- a/src/main/java/com/idcanet/vasc/backends/jpa/XpqlPersistanceVascBackend.java +++ /dev/null @@ -1,437 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/backends/ldap/LdapConnectionProvider.java b/src/main/java/com/idcanet/vasc/backends/ldap/LdapConnectionProvider.java deleted file mode 100644 index a519c76..0000000 --- a/src/main/java/com/idcanet/vasc/backends/ldap/LdapConnectionProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/backends/ldap/LdapVascBackend.java b/src/main/java/com/idcanet/vasc/backends/ldap/LdapVascBackend.java deleted file mode 100644 index 12eee3d..0000000 --- a/src/main/java/com/idcanet/vasc/backends/ldap/LdapVascBackend.java +++ /dev/null @@ -1,331 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/backends/ldap/SimpleLdapConnectionProvider.java b/src/main/java/com/idcanet/vasc/backends/ldap/SimpleLdapConnectionProvider.java deleted file mode 100644 index b14df75..0000000 --- a/src/main/java/com/idcanet/vasc/backends/ldap/SimpleLdapConnectionProvider.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/backends/meta/MetaModelVascBackend.java b/src/main/java/com/idcanet/vasc/backends/meta/MetaModelVascBackend.java deleted file mode 100644 index 8f904ae..0000000 --- a/src/main/java/com/idcanet/vasc/backends/meta/MetaModelVascBackend.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.meta; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -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 dk.eobjects.metamodel.query.Query; - -/** - * - * @author Willem Cazander - * @version 1.0 Dec 19, 2008 - */ -public class MetaModelVascBackend extends AbstractVascBackend { - - private Query listQuery = null; - - // interface - - public void delete(Object object) throws VascException { - } - - public List execute(VascBackendState state) throws VascException { - return null; - } - - public Object merge(Object object) throws VascException { - return null; - } - - public void persist(Object object) throws VascException { - } - - public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) { - return null; - } - - public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) { - return null; - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/core/AbstractVascBackend.java b/src/main/java/com/idcanet/vasc/core/AbstractVascBackend.java deleted file mode 100644 index f745a75..0000000 --- a/src/main/java/com/idcanet/vasc/core/AbstractVascBackend.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/AbstractVascBackendProxy.java b/src/main/java/com/idcanet/vasc/core/AbstractVascBackendProxy.java deleted file mode 100644 index 78894d7..0000000 --- a/src/main/java/com/idcanet/vasc/core/AbstractVascBackendProxy.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/AbstractVascBackendState.java b/src/main/java/com/idcanet/vasc/core/AbstractVascBackendState.java deleted file mode 100644 index e4fc903..0000000 --- a/src/main/java/com/idcanet/vasc/core/AbstractVascBackendState.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/AbstractVascEntryFieldType.java b/src/main/java/com/idcanet/vasc/core/AbstractVascEntryFieldType.java deleted file mode 100644 index 1167f14..0000000 --- a/src/main/java/com/idcanet/vasc/core/AbstractVascEntryFieldType.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/AbstractVascEntryState.java b/src/main/java/com/idcanet/vasc/core/AbstractVascEntryState.java deleted file mode 100644 index cb88124..0000000 --- a/src/main/java/com/idcanet/vasc/core/AbstractVascEntryState.java +++ /dev/null @@ -1,142 +0,0 @@ -/** - * - */ -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/src/main/java/com/idcanet/vasc/core/AbstractVascFrontend.java b/src/main/java/com/idcanet/vasc/core/AbstractVascFrontend.java deleted file mode 100644 index ca2ea20..0000000 --- a/src/main/java/com/idcanet/vasc/core/AbstractVascFrontend.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascBackend.java b/src/main/java/com/idcanet/vasc/core/VascBackend.java deleted file mode 100644 index 925bf2a..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascBackend.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascBackendController.java b/src/main/java/com/idcanet/vasc/core/VascBackendController.java deleted file mode 100644 index 6a05d43..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascBackendController.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascBackendControllerLocal.java b/src/main/java/com/idcanet/vasc/core/VascBackendControllerLocal.java deleted file mode 100644 index 2249590..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascBackendControllerLocal.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascBackendFilter.java b/src/main/java/com/idcanet/vasc/core/VascBackendFilter.java deleted file mode 100644 index ee4cbd8..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascBackendFilter.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascBackendPageNumber.java b/src/main/java/com/idcanet/vasc/core/VascBackendPageNumber.java deleted file mode 100644 index c86e947..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascBackendPageNumber.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascBackendState.java b/src/main/java/com/idcanet/vasc/core/VascBackendState.java deleted file mode 100644 index cb48a78..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascBackendState.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascController.java b/src/main/java/com/idcanet/vasc/core/VascController.java deleted file mode 100644 index b202c13..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascController.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEntry.java b/src/main/java/com/idcanet/vasc/core/VascEntry.java deleted file mode 100644 index 70cff2d..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEntry.java +++ /dev/null @@ -1,420 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEntryController.java b/src/main/java/com/idcanet/vasc/core/VascEntryController.java deleted file mode 100644 index 16bd5fe..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEntryController.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEntryControllerLocal.java b/src/main/java/com/idcanet/vasc/core/VascEntryControllerLocal.java deleted file mode 100644 index 3c38f4f..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEntryControllerLocal.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEntryField.java b/src/main/java/com/idcanet/vasc/core/VascEntryField.java deleted file mode 100644 index b8e9733..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEntryField.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEntryFieldSet.java b/src/main/java/com/idcanet/vasc/core/VascEntryFieldSet.java deleted file mode 100644 index 3fce41f..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEntryFieldSet.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEntryFieldType.java b/src/main/java/com/idcanet/vasc/core/VascEntryFieldType.java deleted file mode 100644 index 32698c4..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEntryFieldType.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeController.java b/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeController.java deleted file mode 100644 index 115067a..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeController.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeControllerLocal.java b/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeControllerLocal.java deleted file mode 100644 index d019818..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEntryFieldTypeControllerLocal.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEntryFinalizer.java b/src/main/java/com/idcanet/vasc/core/VascEntryFinalizer.java deleted file mode 100644 index af2f5c5..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEntryFinalizer.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEntryState.java b/src/main/java/com/idcanet/vasc/core/VascEntryState.java deleted file mode 100644 index 04529ad..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEntryState.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEventChannelController.java b/src/main/java/com/idcanet/vasc/core/VascEventChannelController.java deleted file mode 100644 index 58b6dc5..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEventChannelController.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascEventChannelControllerLocal.java b/src/main/java/com/idcanet/vasc/core/VascEventChannelControllerLocal.java deleted file mode 100644 index 16691c4..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascEventChannelControllerLocal.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascException.java b/src/main/java/com/idcanet/vasc/core/VascException.java deleted file mode 100644 index 2a26e34..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascException.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascFrontend.java b/src/main/java/com/idcanet/vasc/core/VascFrontend.java deleted file mode 100644 index 562a733..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascFrontend.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascFrontendData.java b/src/main/java/com/idcanet/vasc/core/VascFrontendData.java deleted file mode 100644 index 02b5d07..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascFrontendData.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascFrontendExceptionHandler.java b/src/main/java/com/idcanet/vasc/core/VascFrontendExceptionHandler.java deleted file mode 100644 index f7810df..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascFrontendExceptionHandler.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascFrontendHelper.java b/src/main/java/com/idcanet/vasc/core/VascFrontendHelper.java deleted file mode 100644 index 6dacda2..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascFrontendHelper.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascLinkEntry.java b/src/main/java/com/idcanet/vasc/core/VascLinkEntry.java deleted file mode 100644 index 53f0441..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascLinkEntry.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascLinkEntryType.java b/src/main/java/com/idcanet/vasc/core/VascLinkEntryType.java deleted file mode 100644 index 79db136..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascLinkEntryType.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/VascUserRoleController.java b/src/main/java/com/idcanet/vasc/core/VascUserRoleController.java deleted file mode 100644 index 93cca4e..0000000 --- a/src/main/java/com/idcanet/vasc/core/VascUserRoleController.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/actions/AbstractVascAction.java b/src/main/java/com/idcanet/vasc/core/actions/AbstractVascAction.java deleted file mode 100644 index d82fe4b..0000000 --- a/src/main/java/com/idcanet/vasc/core/actions/AbstractVascAction.java +++ /dev/null @@ -1,135 +0,0 @@ - -/* - * 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/src/main/java/com/idcanet/vasc/core/actions/ColumnVascAction.java b/src/main/java/com/idcanet/vasc/core/actions/ColumnVascAction.java deleted file mode 100644 index 6f4491d..0000000 --- a/src/main/java/com/idcanet/vasc/core/actions/ColumnVascAction.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/actions/GlobalVascAction.java b/src/main/java/com/idcanet/vasc/core/actions/GlobalVascAction.java deleted file mode 100644 index dc33b67..0000000 --- a/src/main/java/com/idcanet/vasc/core/actions/GlobalVascAction.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/actions/RowVascAction.java b/src/main/java/com/idcanet/vasc/core/actions/RowVascAction.java deleted file mode 100644 index 2c4ee09..0000000 --- a/src/main/java/com/idcanet/vasc/core/actions/RowVascAction.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/actions/VascAction.java b/src/main/java/com/idcanet/vasc/core/actions/VascAction.java deleted file mode 100644 index 4fd08ec..0000000 --- a/src/main/java/com/idcanet/vasc/core/actions/VascAction.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/entry/VascEntryBackendEventListener.java b/src/main/java/com/idcanet/vasc/core/entry/VascEntryBackendEventListener.java deleted file mode 100644 index e4fa447..0000000 --- a/src/main/java/com/idcanet/vasc/core/entry/VascEntryBackendEventListener.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/entry/VascEntryExporter.java b/src/main/java/com/idcanet/vasc/core/entry/VascEntryExporter.java deleted file mode 100644 index 40e9f88..0000000 --- a/src/main/java/com/idcanet/vasc/core/entry/VascEntryExporter.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldEventChannel.java b/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldEventChannel.java deleted file mode 100644 index 840978d..0000000 --- a/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldEventChannel.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValidatorService.java b/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValidatorService.java deleted file mode 100644 index 753a6de..0000000 --- a/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValidatorService.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValue.java b/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValue.java deleted file mode 100644 index c595180..0000000 --- a/src/main/java/com/idcanet/vasc/core/entry/VascEntryFieldValue.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/entry/VascEntryFrontendEventListener.java b/src/main/java/com/idcanet/vasc/core/entry/VascEntryFrontendEventListener.java deleted file mode 100644 index 63351ce..0000000 --- a/src/main/java/com/idcanet/vasc/core/entry/VascEntryFrontendEventListener.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/entry/VascEntryRecordCreator.java b/src/main/java/com/idcanet/vasc/core/entry/VascEntryRecordCreator.java deleted file mode 100644 index 8774718..0000000 --- a/src/main/java/com/idcanet/vasc/core/entry/VascEntryRecordCreator.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceImageResolver.java b/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceImageResolver.java deleted file mode 100644 index d59e77b..0000000 --- a/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceImageResolver.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceResolver.java b/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceResolver.java deleted file mode 100644 index 737a90c..0000000 --- a/src/main/java/com/idcanet/vasc/core/entry/VascEntryResourceResolver.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/ui/VascColumnValueModelListener.java b/src/main/java/com/idcanet/vasc/core/ui/VascColumnValueModelListener.java deleted file mode 100644 index 67f5e85..0000000 --- a/src/main/java/com/idcanet/vasc/core/ui/VascColumnValueModelListener.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/ui/VascOptionValueModelListener.java b/src/main/java/com/idcanet/vasc/core/ui/VascOptionValueModelListener.java deleted file mode 100644 index deb7471..0000000 --- a/src/main/java/com/idcanet/vasc/core/ui/VascOptionValueModelListener.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/ui/VascSelectItem.java b/src/main/java/com/idcanet/vasc/core/ui/VascSelectItem.java deleted file mode 100644 index e15e079..0000000 --- a/src/main/java/com/idcanet/vasc/core/ui/VascSelectItem.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/ui/VascSelectItemModel.java b/src/main/java/com/idcanet/vasc/core/ui/VascSelectItemModel.java deleted file mode 100644 index 2dc52bc..0000000 --- a/src/main/java/com/idcanet/vasc/core/ui/VascSelectItemModel.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponent.java b/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponent.java deleted file mode 100644 index ade93be..0000000 --- a/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponentListener.java b/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponentListener.java deleted file mode 100644 index 49ffaf5..0000000 --- a/src/main/java/com/idcanet/vasc/core/ui/VascUIActionComponentListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/ui/VascUIComponent.java b/src/main/java/com/idcanet/vasc/core/ui/VascUIComponent.java deleted file mode 100644 index 4aace44..0000000 --- a/src/main/java/com/idcanet/vasc/core/ui/VascUIComponent.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/ui/VascValueModel.java b/src/main/java/com/idcanet/vasc/core/ui/VascValueModel.java deleted file mode 100644 index adc5ddb..0000000 --- a/src/main/java/com/idcanet/vasc/core/ui/VascValueModel.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/core/ui/VascValueModelListener.java b/src/main/java/com/idcanet/vasc/core/ui/VascValueModelListener.java deleted file mode 100644 index d5ab5ee..0000000 --- a/src/main/java/com/idcanet/vasc/core/ui/VascValueModelListener.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/ejb3/VascServiceManager.java b/src/main/java/com/idcanet/vasc/ejb3/VascServiceManager.java deleted file mode 100644 index 0275d84..0000000 --- a/src/main/java/com/idcanet/vasc/ejb3/VascServiceManager.java +++ /dev/null @@ -1,299 +0,0 @@ - - -package com.idcanet.vasc.ejb3; - -import java.io.ByteArrayOutputStream; -import java.io.ObjectOutputStream; -import java.lang.reflect.Method; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.ResourceBundle; -import java.util.Set; -import java.util.logging.Logger; - -import javax.ejb.EJB; -import javax.ejb.Stateless; -import javax.el.ValueExpression; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; - -import org.hibernate.Session; - -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.query.Query; - -/** - * - * @author Willem Cazander - * @version 1.0 13 Aug 2007 - */ -@Stateless(name="ejb/vascSericeManager") -public class VascServiceManager implements VascServiceManagerRemote { - - private Logger logger = Logger.getLogger(VascServiceManager.class.getName()); - - //@PersistenceContext - //protected EntityManager entityManager; - - // @EJB - /// public XtesManagerLocal xtesManager; - - - private VascController sharedVascController = null; - - public Map getResourceBundle(String locale) { - Map result = new HashMap(100); - ResourceBundle b = ResourceBundle.getBundle("com/idcanet/logstats/resources/i18n/LogstatsBundleEJB"); - for (String key:b.keySet()) { - String value = b.getString(key); - result.put(key,value); - } - return result; - } - - public List getVascEntryIds() { - VascController v = getVascController(); - return v.getVascEntryController().getVascEntryIds(); - } - - public VascEntry getVascEntry(String entryId) { - VascController v = getVascController(); - VascEntry ve = v.getVascEntryController().getVascEntryById(entryId); - - try { - VascEntry result = ve.clone(); - //logger.info("Returning cloned ve."); - /* - ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed - ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray); - objOutstream.writeObject(ve); - objOutstream.close(); - - int objectSize = dataArray.size(); - */ - //logger.info("Writing obj to data: "+objectSize); - - return result; - } catch (CloneNotSupportedException e) { - throw new RuntimeException("VascEntry should alway be clonable",e); - } catch (Exception e) { - throw new RuntimeException("VascEntry error:",e); - } - } - - public Object invokeBackendMethod(String backendId,String method,Object[] args) { - VascController v = getVascController(); - VascBackend vb = v.getVascBackendController().getVascBackendById(backendId); - Method vbm = null; - for (Method m:vb.getClass().getMethods()) { - if (m.getName().equals(method)) { - vbm = m; - break; - } - } - if (vbm==null) { - throw new IllegalArgumentException("Could not find: "+method); - } - try { - Object result = vbm.invoke(vb, args); - return result; - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public VascController getVascController() { - if (sharedVascController==null) { - sharedVascController = getParsedVascController(); - } - return sharedVascController; - } - - - class XpqlController implements Map { - - public void clear() { - } - - public boolean containsKey(Object key) { - return true; - } - - public boolean containsValue(Object value) { - return true; - } - - public Set> entrySet() { - return null; - } - - public Query get(Object key) { - return null; - //return xtesManager.getQuery((String)key); - } - - public boolean isEmpty() { - return false; - } - - public Set keySet() { - return null; - } - - public Query put(String key, Query value) { - return null; - } - - @SuppressWarnings("unchecked") - public void putAll(Map m) { - } - - public Query remove(Object key) { - return null; - } - - public int size() { - return 0; - } - - public Collection values() { - return null; - } - - } - - class DatafeedsEntityManagerProvider implements EntityManagerProvider { - /** - * @see com.idcanet.vasc.backends.jpa.EntityManagerProvider#getEntityManager() - */ - public EntityManager getEntityManager() { - return null; - //return entityManager; - } - - public boolean hasEntityManagerTransaction() { - return false; - } - }; - - - class HackVascParser extends VascParser { - - public HackVascParser(VascController c) throws Exception { - super(c); - } - - @Override - protected X4OPhaseHandler getConfigOptionalPhase() { - final X4OPhaseHandler resultSuper = super.getConfigOptionalPhase(); - X4OPhaseHandler result = new AbstractX4OPhaseHandler() { - protected void setX4OPhase() { - phase = X4OPhase.configOptionalPhase; - } - @Override - public boolean isElementPhase() { - return false; - } - public void runElementPhase(Element element) throws X4OPhaseException { - } - public void runPhase(ElementContext elementContext) throws X4OPhaseException { - resultSuper.runPhase(elementContext); // this is needed !! - ValueExpression e1 = getElementContext().getExpressionFactory().createValueExpression(getElementContext().getELContext(),"${entityManagerProvider}", EntityManagerProvider.class); - e1.setValue(getElementContext().getELContext(), new DatafeedsEntityManagerProvider()); - - ValueExpression e2 = getElementContext().getExpressionFactory().createValueExpression(getElementContext().getELContext(),"${xpqlController}", XpqlController.class); - e2.setValue(getElementContext().getELContext(), new XpqlController()); - } - }; - return result; - } - } - - private VascController getParsedVascController() { - try { - // get local jvm plugging controller - VascController c = DefaultVascFactory.getDefaultVascController(22l, "test", "login"); - - // TODO made reuse working. - new HackVascParser(c).parseResource("com/idcanet/logstats/resources/vasc/logstats.xml"); - //new HackVascParser(c).parseResource("com/idcanet/logstats/resources/vasc/flowuser.xml"); - - - // fill stuff in all global entry'ies - for (String id:c.getVascEntryController().getVascEntryIds()) { - VascEntry entry = ((DefaultVascEntryController)c.getVascEntryController()).getRealVascEntryById(id); - if (entry.isVascDisplayOnly()==false) { - if (entry.isVascAdminCreate()) { - entry.addRowAction(new AddRowAction()); - } - if (entry.isVascAdminEdit()) { - entry.addRowAction(new EditRowAction()); - } - if (entry.isVascAdminDelete()) { - entry.addRowAction(new DeleteRowAction()); - } - } - entry.addGlobalAction(new XMLExportGlobalAction()); - entry.addGlobalAction(new CSVExportGlobalAction()); - //entry.addGlobalAction(new RefreshDataGlobalAction()); - - Locale locale = null; - // auto fix generic edit/del/create descriptiong if i18n key does not excits. - locale = Locale.getDefault(); - DefaultVascEntryResourceResolver t = new DefaultVascEntryResourceResolver(); - // TODO: new DefaultVascEntryResourceResolver("com/mbuyu/m4n/resources/datafeeds/i18n/DatafeedsBundle",locale); - - if (t.getTextValue(entry.getEditDescription()).equals(entry.getEditDescription())) { - entry.setEditDescription("generic.editDescription"); - } - if (t.getTextValue(entry.getDeleteDescription()).equals(entry.getDeleteDescription())) { - entry.setDeleteDescription("generic.deleteDescription"); - } - if (t.getTextValue(entry.getCreateDescription()).equals(entry.getCreateDescription())) { - entry.setCreateDescription("generic.createDescription"); - } - - // add global listener to make sure we have all LAZY properties of a bean before we goto edit mode. - //entry.addVascEntryEventListener(VascEventType.DATA_SELECT, new RefreshObjectForLazyPropertiesListener()); - - // hackje om deze manuale actions van i18n keys te voorzien; - // this is temp untill x4o templaing - DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer(); - f.finalizeVascEntry(entry, c); - } - - logger.info("VASC COMPLEET LETS RETURN."); - - // finally set the controller for storage in this (session) bean. - return c; - - - - } catch (Exception e) { - throw new RuntimeException(e); - } - - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/ejb3/VascServiceManagerRemote.java b/src/main/java/com/idcanet/vasc/ejb3/VascServiceManagerRemote.java deleted file mode 100644 index 6f16373..0000000 --- a/src/main/java/com/idcanet/vasc/ejb3/VascServiceManagerRemote.java +++ /dev/null @@ -1,27 +0,0 @@ - - -package com.idcanet.vasc.ejb3; - -import java.util.List; -import java.util.Map; - -import javax.ejb.Remote; - -import com.idcanet.vasc.core.VascEntry; - -/** - * - * @author Willem Cazander - * @version 1.0 13 Aug 2007 - */ -@Remote -public interface VascServiceManagerRemote { - - public Map getResourceBundle(String locale); - - public List getVascEntryIds(); - - public VascEntry getVascEntry(String entryId); - - public Object invokeBackendMethod(String backendId,String method,Object[] args); -} diff --git a/src/main/java/com/idcanet/vasc/frontends/swing/SwingVascFrontend.java b/src/main/java/com/idcanet/vasc/frontends/swing/SwingVascFrontend.java deleted file mode 100644 index c414091..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swing/SwingVascFrontend.java +++ /dev/null @@ -1,842 +0,0 @@ -/* - * 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.frontends.swing; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Container; -import java.awt.Font; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Logger; - -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JFileChooser; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ListSelectionModel; -import javax.swing.Spring; -import javax.swing.SpringLayout; -import javax.swing.UIManager; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.JTableHeader; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; - -import com.idcanet.vasc.core.AbstractVascFrontend; -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascFrontendData; -import com.idcanet.vasc.core.actions.GlobalVascAction; -import com.idcanet.vasc.core.actions.RowVascAction; -import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener; -import com.idcanet.vasc.core.entry.VascEntryExporter; -import com.idcanet.vasc.core.ui.VascColumnValueModelListener; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; -import com.idcanet.vasc.frontends.swing.ui.SwingBoolean; -import com.idcanet.vasc.frontends.swing.ui.SwingButton; -import com.idcanet.vasc.frontends.swing.ui.SwingColorChooser; -import com.idcanet.vasc.frontends.swing.ui.SwingLabel; -import com.idcanet.vasc.frontends.swing.ui.SwingList; -import com.idcanet.vasc.frontends.swing.ui.SwingText; -import com.idcanet.vasc.frontends.swing.ui.SwingTextArea; - -/** - * - * @author Willem Cazander - * @version 1.0 Mar 21, 2007 - */ -public class SwingVascFrontend extends AbstractVascFrontend { - - private Logger logger = null; - private JComponent parent = null; - - public SwingVascFrontend(JComponent parent) { - logger = Logger.getLogger(SwingVascFrontend.class.getName()); - this.parent=parent; - } - - /** - * Add swing implmented ui components - */ - protected void addUiComponents() { - VascFrontendData vfd = getVascEntry().getVascFrontendData(); - - // required UI components - vfd.putVascUIComponent(VascUIComponent.VASC_LABEL,SwingLabel.class.getName()); - vfd.putVascUIComponent(VascUIComponent.VASC_TEXT, SwingText.class.getName()); - vfd.putVascUIComponent(VascUIComponent.VASC_LIST, SwingList.class.getName()); - vfd.putVascUIComponent(VascUIComponent.VASC_BUTTON, SwingButton.class.getName()); - - // optional UI components - vfd.putVascUIComponent(VascUIComponent.VASC_BOOLEAN , SwingBoolean.class.getName()); - //vfd.putVascUIComponent(VascUIComponent.VASC_DATE , SwingDate.class.getName()); - vfd.putVascUIComponent(VascUIComponent.VASC_TEXTAREA, SwingTextArea.class.getName()); - vfd.putVascUIComponent(VascUIComponent.VASC_COLOR, SwingColorChooser.class.getName()); - } - - public ImageIcon getImageIcon(String imageResource) { - /// TODO hack beter - String key = entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(imageResource); - //logger.fine("KEY======================="+key); - - if (key.startsWith("vasc.entry")) { - return null; - } - - if (key.indexOf("META-INF")>0 | key.indexOf("resource")>0) { - return null; - //return SwingImageHelper.getImageIcon(key); - } else { - return null; - } - } - - - - /** - * @see com.idcanet.vasc.core.VascViewRenderer#renderEdit(com.idcanet.vasc.core.VascEntry, java.lang.Object) - */ - public void renderEdit() throws Exception { - logger.fine("Rending Edit View"); - - Object rowBean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject(); - String beanValue = rowBean.toString(); - if (entry.getDisplayNameFieldId()!=null) { - VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId()); - - Object vv = v.getVascEntryFieldValue().getValue(v, rowBean); - if (vv==null) { - beanValue=""; - } else { - beanValue=""+vv; - } - if (beanValue.length()>30) { - beanValue=beanValue.substring(0, 30); - } - } - SwingEditDialog dialog = new SwingEditDialog(parent,entry,rowBean,i18n("vasc.dialog.edit.title"),i18n("vasc.dialog.edit.message",beanValue)); - Object result = dialog.openDialog(); - logger.finest("OPEN closed : "+result); - if(result==null) { - return; - } - entry.getVascFrontendData().getVascEntryState().setEntryDataObject(result); - entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry); - } - - public void renderDelete() throws Exception { - Object rowBean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject(); - String beanValue = rowBean.toString(); - - VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId()); - beanValue = ""+v.getVascEntryFieldValue().getValue(v, rowBean); - if (beanValue.length()>30) { - beanValue=beanValue.substring(0, 30); - } - - int response = JOptionPane.showOptionDialog( - parent // Center in window. - , i18n("vasc.dialog.delete.message",beanValue) // Message - , i18n("vasc.dialog.delete.title") // Title in titlebar - , JOptionPane.YES_NO_OPTION // Option type - , JOptionPane.PLAIN_MESSAGE // messageType - , null // Icon (none) - , null // Button text as above. - , null // Default button's label - ); - if (response==JOptionPane.YES_OPTION) { - entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry); - } - } - - - class SwingEditDialog extends JDialog { - - private static final long serialVersionUID = 10L; - private String headerText = null; - private Object result = null; - private Object bean = null; - - public SwingEditDialog(JComponent parent,VascEntry entry,Object bean,String title,String headerText) throws Exception { - super(); - this.headerText = headerText; - this.bean = bean; - - setTitle(i18n(title)); - setModal(true); - - JPanel pane = new JPanel(); - pane.setLayout(new BorderLayout()); - - JPanel header = new JPanel(); - createHeader(header); - pane.add(header,BorderLayout.NORTH); - - JPanel body = new JPanel(); - createBody(body); - pane.add(body,BorderLayout.CENTER); - - JPanel footer = new JPanel(); - createFooter(footer); - pane.add(footer,BorderLayout.SOUTH); - - add(pane); - setDefaultCloseOperation(DISPOSE_ON_CLOSE); - - //Ensure the text field always gets the first focus. - //addComponentListener(new ComponentAdapter() { - // public void componentShown(ComponentEvent ce) { - // textField.requestFocusInWindow(); - // } - /// }); - - pack(); - setLocationRelativeTo(parent); - } - - - public Object openDialog() { - setVisible(true); - return result; - } - - public void createHeader(JPanel header) { - JLabel l = new JLabel(); - l.setText(i18n(headerText)); - l.setFont(new Font(null,Font.BOLD, 14)); - //l.setToolTipText(i18n(headerText)); - header.add(l); - } - - public void createBody(JPanel body) throws Exception { - body.setLayout(new SpringLayout()); - int column = 0; - for (VascEntryField c:entry.getVascEntryFields()) { - if (c.getEdit()==false) { - continue; - } - - //if (c.isEditReadOnly()==true) { - - for (int i=0;i list = new ArrayList(); - for(VascEntryField c:entry.getVascEntryFields()) { - if (c.getList()==false) { - continue; - - } - list.add(c); - } - - VascEntryField vtc = list.get(columnIndex); - try { - //if (vtc.getVascColumnRenderer()!=null) { -// return vtc.getVascColumnRenderer().rendererColumn(vtc,bean); - //} else { - return ""+vtc.getVascEntryFieldValue().getValue(vtc,bean); - // } - } catch (Exception e) { - return "Error"; - } - } - - public VascFrontendEventType[] getEventTypes() { - VascFrontendEventType[] result = {VascFrontendEventType.DATA_LIST_UPDATE}; - return result; - } - } -} - -/** - * A 1.4 file that provides utility methods for creating form- or grid-style - * layouts with SpringLayout. These utilities are used by several programs, such - * as SpringBox and SpringCompactGrid. - */ - -class SpringUtilities { - - /** - * Aligns the first rows*cols components of - * parent in a grid. Each component is as big as the maximum - * preferred width and height of the components. The parent is made just big - * enough to fit them all. - * - * @param rows - * number of rows - * @param cols - * number of columns - * @param initialX - * x location to start the grid at - * @param initialY - * y location to start the grid at - * @param xPad - * x padding between cells - * @param yPad - * y padding between cells - */ - public static void makeGrid(Container parent, int rows, int cols, - int initialX, int initialY, int xPad, int yPad) { - SpringLayout layout; - try { - layout = (SpringLayout) parent.getLayout(); - } catch (ClassCastException exc) { - System.err - .println("The first argument to makeGrid must use SpringLayout."); - return; - } - - Spring xPadSpring = Spring.constant(xPad); - Spring yPadSpring = Spring.constant(yPad); - Spring initialXSpring = Spring.constant(initialX); - Spring initialYSpring = Spring.constant(initialY); - int max = rows * cols; - - //Calculate Springs that are the max of the width/height so that all - //cells have the same size. - Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)) - .getWidth(); - Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)) - .getWidth(); - for (int i = 1; i < max; i++) { - SpringLayout.Constraints cons = layout.getConstraints(parent - .getComponent(i)); - - maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth()); - maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight()); - } - - //Apply the new width/height Spring. This forces all the - //components to have the same size. - for (int i = 0; i < max; i++) { - SpringLayout.Constraints cons = layout.getConstraints(parent - .getComponent(i)); - - cons.setWidth(maxWidthSpring); - cons.setHeight(maxHeightSpring); - } - - //Then adjust the x/y constraints of all the cells so that they - //are aligned in a grid. - SpringLayout.Constraints lastCons = null; - SpringLayout.Constraints lastRowCons = null; - for (int i = 0; i < max; i++) { - SpringLayout.Constraints cons = layout.getConstraints(parent - .getComponent(i)); - if (i % cols == 0) { //start of new row - lastRowCons = lastCons; - cons.setX(initialXSpring); - } else { //x position depends on previous component - cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST), - xPadSpring)); - } - - if (i / cols == 0) { //first row - cons.setY(initialYSpring); - } else { //y position depends on previous row - cons.setY(Spring.sum(lastRowCons - .getConstraint(SpringLayout.SOUTH), yPadSpring)); - } - lastCons = cons; - } - - //Set the parent's size. - SpringLayout.Constraints pCons = layout.getConstraints(parent); - pCons.setConstraint(SpringLayout.SOUTH, Spring.sum(Spring - .constant(yPad), lastCons.getConstraint(SpringLayout.SOUTH))); - pCons.setConstraint(SpringLayout.EAST, Spring.sum( - Spring.constant(xPad), lastCons - .getConstraint(SpringLayout.EAST))); - } - - /* Used by makeCompactGrid. */ - private static SpringLayout.Constraints getConstraintsForCell(int row, - int col, Container parent, int cols) { - SpringLayout layout = (SpringLayout) parent.getLayout(); - Component c = parent.getComponent(row * cols + col); - return layout.getConstraints(c); - } - - /** - * Aligns the first rows*cols components of - * parent in a grid. Each component in a column is as wide as - * the maximum preferred width of the components in that column; height is - * similarly determined for each row. The parent is made just big enough to - * fit them all. - * - * @param rows - * number of rows - * @param cols - * number of columns - * @param initialX - * x location to start the grid at - * @param initialY - * y location to start the grid at - * @param xPad - * x padding between cells - * @param yPad - * y padding between cells - */ - public static void makeCompactGrid(Container parent, int rows, int cols, - int initialX, int initialY, int xPad, int yPad) { - SpringLayout layout; - try { - layout = (SpringLayout) parent.getLayout(); - } catch (ClassCastException exc) { - System.err - .println("The first argument to makeCompactGrid must use SpringLayout."); - return; - } - - //Align all cells in each column and make them the same width. - Spring x = Spring.constant(initialX); - for (int c = 0; c < cols; c++) { - Spring width = Spring.constant(0); - for (int r = 0; r < rows; r++) { - width = Spring.max(width, getConstraintsForCell(r, c, parent, - cols).getWidth()); - } - for (int r = 0; r < rows; r++) { - SpringLayout.Constraints constraints = getConstraintsForCell(r, - c, parent, cols); - constraints.setX(x); - constraints.setWidth(width); - } - x = Spring.sum(x, Spring.sum(width, Spring.constant(xPad))); - } - - //Align all cells in each row and make them the same height. - Spring y = Spring.constant(initialY); - for (int r = 0; r < rows; r++) { - Spring height = Spring.constant(0); - for (int c = 0; c < cols; c++) { - height = Spring.max(height, getConstraintsForCell(r, c, parent, - cols).getHeight()); - } - for (int c = 0; c < cols; c++) { - SpringLayout.Constraints constraints = getConstraintsForCell(r, - c, parent, cols); - constraints.setY(y); - constraints.setHeight(height); - } - y = Spring.sum(y, Spring.sum(height, Spring.constant(yPad))); - } - - //Set the parent's size. - SpringLayout.Constraints pCons = layout.getConstraints(parent); - pCons.setConstraint(SpringLayout.SOUTH, y); - pCons.setConstraint(SpringLayout.EAST, x); - } -} - diff --git a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingBoolean.java b/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingBoolean.java deleted file mode 100644 index 1ced898..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingBoolean.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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.frontends.swing.ui; - -import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JCheckBox; -import javax.swing.JComponent; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 Sep 21, 2007 - */ -public class SwingBoolean implements VascUIComponent { - - private JCheckBox checkBox = null; - private Color orgBackgroundColor = null; - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - checkBox = new JCheckBox(); - orgBackgroundColor = checkBox.getBackground(); - checkBox.setSelected(new Boolean(model.getValue().toString())); - ((JComponent)gui).add(checkBox); - checkBox.addActionListener(new SelectActionListener(model,table)); - return checkBox; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (checkBox==null) { - return null; - } - return checkBox.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (checkBox==null) { - return; - } - checkBox.setToolTipText(text); - if (text==null) { - checkBox.setBackground(orgBackgroundColor); - } else { - checkBox.setBackground(Color.RED); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !checkBox.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - checkBox.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return checkBox.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - checkBox.setVisible(rendered); - } -} -class SelectActionListener implements ActionListener { - - private VascValueModel model; - private VascEntry entry = null; - public SelectActionListener(VascValueModel model,VascEntry entry) { - this.model=model; - this.entry=entry; - } - - /** - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - public void actionPerformed(ActionEvent e) { - boolean value = ((JCheckBox)e.getSource()).isSelected(); - try { - model.setValue(value); - } catch (Exception ee) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingButton.java b/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingButton.java deleted file mode 100644 index 9c869f5..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingButton.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.frontends.swing.ui; - -import java.awt.Color; - -import javax.swing.JButton; -import javax.swing.JComponent; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - -/** - * - * - * @author Willem Cazander - * @version 1.0 Nov 18, 2008 - */ -public class SwingButton implements VascUIComponent { - - private JButton vascButton = null; - private Color orgBackgroundColor = null; - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - vascButton = new JButton("Color"); - orgBackgroundColor = vascButton.getBackground(); - ((JComponent)gui).add(vascButton); - //vascButton.addActionListener(new SelectActionListener3(model,true,table)); - return vascButton; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (vascButton==null) { - return null; - } - return vascButton.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (vascButton==null) { - return; - } - vascButton.setToolTipText(text); - if (text==null) { - vascButton.setBackground(orgBackgroundColor); - } else { - vascButton.setBackground(Color.RED); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !vascButton.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - vascButton.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return vascButton.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - vascButton.setVisible(rendered); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingColorChooser.java b/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingColorChooser.java deleted file mode 100644 index 8c01003..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingColorChooser.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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.frontends.swing.ui; - -import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JButton; -import javax.swing.JColorChooser; -import javax.swing.JComponent; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - -/** - * - * - * @author Willem Cazander - * @version 1.0 Nov 25, 2007 - */ -public class SwingColorChooser implements VascUIComponent { - - private JButton colorButton = null; - private Color orgBackgroundColor = null; - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - JButton colorButton = new JButton("Color"); - orgBackgroundColor = colorButton.getBackground(); - ((JComponent)gui).add(colorButton); - colorButton.addActionListener(new SelectActionListener3(model,true,table)); - return colorButton; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (colorButton==null) { - return null; - } - return colorButton.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (colorButton==null) { - return; - } - colorButton.setToolTipText(text); - if (text==null) { - colorButton.setBackground(orgBackgroundColor); - } else { - colorButton.setBackground(Color.RED); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !colorButton.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - colorButton.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return colorButton.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - colorButton.setVisible(rendered); - } -} -class SelectActionListener3 implements ActionListener { - - private VascValueModel model; - private boolean hexEncoding = false; - private VascEntry entry = null; - public SelectActionListener3(VascValueModel model,boolean hexEncoding,VascEntry entry) { - this.model=model; - this.hexEncoding=hexEncoding; - this.entry=entry; - } - - /** - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - public void actionPerformed(ActionEvent e) { - if (hexEncoding==false) { - Color cur=null; - try { - cur = (Color)model.getValue(); - } catch (VascException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - if (cur==null) { - cur = Color.YELLOW; - } - Color newColor = JColorChooser.showDialog(null,"Choose a color...",cur); - try { - model.setValue(newColor); - } catch (Exception ee) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee); - } - } else { - String cur=null; - try { - cur = (String)model.getValue(); - } catch (VascException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - Color c = Color.YELLOW; - try { - if (cur!=null) { - c = Color.decode(cur); - } - Color newColor = JColorChooser.showDialog(null,"Choose a color...",c); - String newColorString = "#"+Integer.toHexString( newColor.getRGB() & 0x00ffffff ); - model.setValue(newColorString); - } catch (Exception ee) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingDate.java b/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingDate.java deleted file mode 100644 index ec24216..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingDate.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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.frontends.swing.ui; - -import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.beans.PropertyVetoException; -import java.util.Date; - -import javax.swing.JComponent; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; -import com.michaelbaranov.microba.calendar.DatePicker; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 Sep 21, 2007 - */ -public class SwingDate implements VascUIComponent { - - private DatePicker datePicker = null; - private Color orgBackgroundColor = null; - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - datePicker = new DatePicker(); - orgBackgroundColor = datePicker.getBackground(); - try { - datePicker.setDate((Date)model.getValue()); - } catch (PropertyVetoException e) { - throw new VascException(new VascException(e)); - } - ((JComponent)gui).add(datePicker); - datePicker.addActionListener(new SelectActionListener2(model,table)); - return datePicker; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (datePicker==null) { - return null; - } - return datePicker.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (datePicker==null) { - return; - } - datePicker.setToolTipText(text); - if (text==null) { - datePicker.setBackground(orgBackgroundColor); - } else { - datePicker.setBackground(Color.RED); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !datePicker.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - datePicker.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return datePicker.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - datePicker.setVisible(rendered); - } -} -class SelectActionListener2 implements ActionListener { - - private VascValueModel model; - private VascEntry entry = null; - public SelectActionListener2(VascValueModel model,VascEntry entry) { - this.model=model; - this.entry=entry; - } - - /** - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - public void actionPerformed(ActionEvent e) { - Date value = ((DatePicker)e.getSource()).getDate(); - try { - model.setValue(value); - } catch (Exception ee) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingLabel.java b/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingLabel.java deleted file mode 100644 index 5daa5f5..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingLabel.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.frontends.swing.ui; - -import java.awt.Color; - -import javax.swing.JComponent; -import javax.swing.JLabel; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - - -/** - * - * @author Willem Cazander - * @version 1.0 Sep 21, 2008 - */ -public class SwingLabel implements VascUIComponent { - - private JLabel label = null; - private Color orgBackgroundColor = null; - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - label = new JLabel(); - label.setHorizontalAlignment(JLabel.TRAILING); - orgBackgroundColor = label.getBackground(); - label.setText(""+model.getValue()); - ((JComponent)gui).add(label); - return label; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (label==null) { - return null; - } - return label.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (label==null) { - return; - } - label.setToolTipText(text); - if (text==null) { - label.setBackground(orgBackgroundColor); - } else { - label.setBackground(Color.RED); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !label.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - label.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return label.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - label.setVisible(rendered); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingList.java b/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingList.java deleted file mode 100644 index 079061a..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingList.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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.frontends.swing.ui; - -import java.awt.Color; -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.ListCellRenderer; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascSelectItem; -import com.idcanet.vasc.core.ui.VascSelectItemModel; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - - -/** - * - * @author Willem Cazander - * @version 1.0 Aug 12, 2007 - */ -public class SwingList implements VascUIComponent { - - private JComboBox comboBox = null; - private Color orgBackgroundColor = null; - - public Object createComponent(final VascEntry entry,VascEntryField entryField,final VascValueModel model,Object gui) throws VascException { - VascSelectItemModel items = (VascSelectItemModel)entryField.getVascEntryFieldType().getDataObject(); - if (items==null) { - comboBox = new JComboBox(); - } else { - comboBox = new JComboBox(items.getVascSelectItems(entry).toArray()); - } - orgBackgroundColor = comboBox.getBackground(); - ((JComponent)gui).add(comboBox); - comboBox.setRenderer(new MyCellRenderer()); - comboBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - VascSelectItem i = (VascSelectItem)((JComboBox)e.getSource()).getSelectedItem(); - try { - model.setValue(i.getValue()); - } catch (Exception ee) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee); - } - } - }); - - - // set default !! - if (model.getValue()!=null) { - for (int i=0;i0) { - // else select the top one. - comboBox.setSelectedIndex(0); - } - return comboBox; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (comboBox==null) { - return null; - } - return comboBox.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (comboBox==null) { - return; - } - comboBox.setToolTipText(text); - if (text==null) { - comboBox.setBackground(orgBackgroundColor); - } else { - comboBox.setBackground(Color.RED); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !comboBox.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - comboBox.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return comboBox.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - comboBox.setVisible(rendered); - } -} - -class MyCellRenderer extends JLabel implements ListCellRenderer { - - private static final long serialVersionUID = 10L; - - public MyCellRenderer() { - setOpaque(true); - } - - public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus) { - VascSelectItem i = (VascSelectItem)value; - if (i!=null) { - setText(i.getLabel()); - } else { - setText("Error"); - } - return this; - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingText.java b/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingText.java deleted file mode 100644 index a33ced9..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingText.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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.frontends.swing.ui; - -import java.awt.Color; - -import javax.swing.JComponent; -import javax.swing.JTextField; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - - -/** - * - * @author Willem Cazander - * @version 1.0 Aug 12, 2007 - */ -public class SwingText implements VascUIComponent { - - private JTextField textField = null; - private Color orgBackgroundColor = null; - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - textField = new JTextField(); - orgBackgroundColor = textField.getBackground(); - textField.setText(""+model.getValue()); - ((JComponent)gui).add(textField); - textField.getDocument().addDocumentListener(new TextListener(model,table,this)); - return textField; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (textField==null) { - return null; - } - return textField.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (textField==null) { - return; - } - textField.setToolTipText(text); - if (text==null) { - textField.setBackground(orgBackgroundColor); - } else { - textField.setBackground(Color.RED); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !textField.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - textField.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return textField.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - textField.setVisible(rendered); - } -} - -class TextListener implements DocumentListener { - - private VascValueModel model = null; - //private VascTable table = null; - private SwingText textField = null; - - public TextListener(VascValueModel model,VascEntry table,SwingText textField) { - this.model=model; - //this.table=table; - this.textField=textField; - } - - /** - * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent) - */ - public void changedUpdate(DocumentEvent e) { - update(e); - } - - /** - * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent) - */ - public void insertUpdate(DocumentEvent e) { - update(e); - } - - /** - * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent) - */ - public void removeUpdate(DocumentEvent e) { - update(e); - } - - public void update(DocumentEvent event) { - try { - String value = event.getDocument().getText(0, event.getDocument().getLength()); - model.setValue(value); - textField.setErrorText(null); - } catch (Exception ee) { - textField.setErrorText(ee.getLocalizedMessage()); - //table.getVascTableController().handleException(ee, table); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingTextArea.java b/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingTextArea.java deleted file mode 100644 index 37f4ff7..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swing/ui/SwingTextArea.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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.frontends.swing.ui; - -import java.awt.Color; - -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JTextArea; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - - -/** - * - * @author Willem Cazander - * @version 1.0 Sep 21, 2008 - */ -public class SwingTextArea implements VascUIComponent { - - private JTextArea textArea = null; - private Color orgBackgroundColor = null; - - public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - textArea = new JTextArea(); - textArea.setBorder(BorderFactory.createEtchedBorder()); - textArea.setRows(8); - - //entryField.getVascEntryFieldType().getProperty(name) - - //textArea.setRows(rows); - //textArea.setColumns(columns); - - orgBackgroundColor = textArea.getBackground(); - textArea.setText(""+model.getValue()); - ((JComponent)gui).add(textArea); - textArea.getDocument().addDocumentListener(new TextAreaListener(model,entry,this)); - return textArea; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (textArea==null) { - return null; - } - return textArea.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (textArea==null) { - return; - } - textArea.setToolTipText(text); - if (text==null) { - textArea.setBackground(orgBackgroundColor); - } else { - textArea.setBackground(Color.RED); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !textArea.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - textArea.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return textArea.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - textArea.setVisible(rendered); - } -} - -class TextAreaListener implements DocumentListener { - - private VascValueModel model = null; - private SwingTextArea textArea = null; - - public TextAreaListener(VascValueModel model,VascEntry entry,SwingTextArea textArea) { - this.model=model; - this.textArea=textArea; - } - - /** - * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent) - */ - public void changedUpdate(DocumentEvent e) { - update(e); - } - - /** - * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent) - */ - public void insertUpdate(DocumentEvent e) { - update(e); - } - - /** - * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent) - */ - public void removeUpdate(DocumentEvent e) { - update(e); - } - - public void update(DocumentEvent event) { - try { - String value = event.getDocument().getText(0, event.getDocument().getLength()); - model.setValue(value); - textArea.setErrorText(null); - } catch (Exception ee) { - textArea.setErrorText(ee.getLocalizedMessage()); - //table.getVascTableController().handleException(ee, table); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swt/SwtVascEditDialog.java b/src/main/java/com/idcanet/vasc/frontends/swt/SwtVascEditDialog.java deleted file mode 100644 index 26a5be3..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swt/SwtVascEditDialog.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * 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.frontends.swt; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Dialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascColumnValueModelListener; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - -/** - * - * @author Willem Cazander - * @version 1.0 May 13, 2009 - */ -public class SwtVascEditDialog extends Dialog { - - private VascEntry entry = null; - private Shell shell = null; - - public SwtVascEditDialog (VascEntry entry) { - super (Display.getCurrent().getActiveShell(), 0); - this.entry=entry; - } - - protected String i18n(String key,Object...params) { - return entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(key,params); - } - - protected Object i18nImage(String key) { - if (entry.getVascFrontendData().getVascEntryResourceImageResolver()==null) { - return null; - } - return entry.getVascFrontendData().getVascEntryResourceImageResolver().getImageValue(entry,key); - } - - public void open() throws VascException { - shell = new Shell(getParent(), SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL); - shell.setText(i18n(entry.getName())); - - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - shell.setLayout(layout); - - Composite header = new Composite(shell, SWT.NONE); - GridLayout headerLayout = new GridLayout(); - headerLayout.numColumns = 6; - header.setLayout(headerLayout); - header.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Composite body = new Composite(shell, SWT.NONE); - GridLayout bodyLayout = new GridLayout(); - bodyLayout.numColumns = 1; - body.setLayout(bodyLayout); - body.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Composite footer = new Composite(shell, SWT.NONE); - GridLayout footerLayout = new GridLayout(); - footerLayout.numColumns = 6; - footer.setLayout(footerLayout); - footer.setLayoutData(new GridData(SWT.NONE)); - - createHeader(header); - createBody(body); - createFooter(footer); - - shell.pack(); - shell.open(); - - Display display = shell.getDisplay(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } - } - } - - public void createHeader(Composite header) { - - String displayFieldId = entry.getDisplayNameFieldId(); - VascEntryField dis = entry.getVascEntryFieldById(displayFieldId); - if (dis==null) { - throw new RuntimeException("Could not find: "+displayFieldId+" from: "+entry.getId()); - } - String name = null; - try { - Object bean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject(); - name = dis.getVascEntryFieldValue().getDisplayValue(dis, bean); - } catch (VascException e) { - throw new RuntimeException("Could not display value from "+entry.getId(),e); - } - - Color c = new Color(header.getDisplay(),255,255,255); - header.setBackground(c); - - Label img = new Label(header, SWT.NONE); - if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) { - img.setImage((Image)i18nImage(entry.getCreateImage())); - } else { - img.setImage((Image)i18nImage(entry.getEditImage())); - } - img.setBackground(c); - - Font headerFont = new Font(header.getDisplay(), "verdana", 14, SWT.NONE); - Label l = new Label(header, SWT.CENTER); - if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) { - l.setText(i18n(entry.getCreateDescription(),name)); - } else { - l.setText(i18n(entry.getEditDescription(),name)); - } - l.setFont(headerFont); - l.setBackground(c); -} - - public void createBody(Composite body) throws VascException { - body.setLayout(new GridLayout(2, true)); - body.setLayoutData(new GridData(GridData.FILL_BOTH)); - Object bean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject(); - - entry.getVascFrontendData().clearFieldRenderObjects(); // only needed for swt use - - for (VascEntryField c:entry.getVascEntryFields()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderEdit(c)==false) { - continue; - } - - for (int i=0;i area.height + table.getHeaderHeight()) { - // Subtract the scrollbar width from the total column width - // if a vertical scrollbar will be required - Point vBarSize = table.getVerticalBar().getSize(); - width -= vBarSize.x; - } - Point oldSize = table.getSize(); - if (oldSize.x > area.width) { - // table is getting smaller so make the columns - // smaller first and then resize the table to - // match the client area width - table.setSize(area.width, area.height); - } else { - // table is getting bigger so make the table - // bigger first and then make the columns wider - // to match the client area width - table.setSize(area.width, area.height); - //column1.setWidth(width/3); - //column2.setWidth(width - column1.getWidth()); - } - } - public void controlMoved(ControlEvent e) { - - } - } - - public void createFooter(Composite footer) { - logger.finest("Creating footer"); - for( RowVascAction action:entry.getRowActions()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderRowVascAction(action)==false) { - continue; - } - Button actionButton = new Button(footer, SWT.NONE); - actionButton.setText(i18n(action.getName())); - actionButton.setToolTipText(i18n(action.getDescription())); - actionButton.setImage((Image)i18nImage(action.getImage())); - actionButton.addSelectionListener(new ActionListener(action)); - } - } - - class ActionListener extends SelectionAdapter { - private RowVascAction action = null; - - public ActionListener(RowVascAction action) { - this.action=action; - } - - /** - * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - @Override - public void widgetSelected(SelectionEvent event) { - logger.fine("Row Action"); - try { - action.doRowAction(entry, entry.getVascFrontendData().getVascEntryState().getEntryDataObject()); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e); - } - } - } - - - class DefaultLabelProvider implements ITableLabelProvider { - - private VascEntry entry = null; - - public DefaultLabelProvider(VascEntry entry) { - this.entry=entry; - } - - /** - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) - */ - public Image getColumnImage(Object arg0, int arg1) { - return null; - } - - /** - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) - */ - public String getColumnText(Object bean, int columnNumber) { - - int col=0; - VascEntryField vtc = null; - for (VascEntryField c:entry.getVascEntryFields()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderList(c)==false) { - continue; - } - if (col==columnNumber) { - vtc = c; - break; - } - col++; - } - if (vtc==null) { - // should not happen - vtc = entry.getVascEntryFields().get(columnNumber); - } - - //if (vtc.getVascColumnRenderer()==null) { - try { - return vtc.getVascEntryFieldValue().getDisplayValue(vtc,bean); - } catch (Exception e) { - logger.log(Level.WARNING,"Error in get value: '"+vtc.getVascEntryFieldValue()+"' error: "+e.getMessage(),e); - return "Err"; - } - //} - // see custem column renderer, so this code will never be called - //return "CUSTEM_RENDER"; - } - - /** - * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) - */ - public void addListener(ILabelProviderListener arg0) { - } - - /** - * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() - */ - public void dispose() { - } - - /** - * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) - */ - public boolean isLabelProperty(Object arg0, String arg1) { - return false; - } - - /** - * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) - */ - public void removeListener(ILabelProviderListener arg0) { - } - - } - - class ListConverterContentProvider implements IStructuredContentProvider { - - /** - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ - public Object[] getElements(Object obj) { - return ((VascEntry)obj).getVascFrontendData().getVascEntryState().getEntryDataList().toArray(); - } - - /** - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ - public void dispose() { - } - - /** - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - public void inputChanged(Viewer arg0, Object arg1, Object arg2) { - } - - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtBoolean.java b/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtBoolean.java deleted file mode 100644 index 51b26e3..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtBoolean.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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.frontends.swt.ui; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 Jan 13, 2009 - */ -public class SwtBoolean implements VascUIComponent { - - private Button button = null; - private Color orgBackgroundColor = null; - private Color errorColor = null; - - public Object createComponent(final VascEntry entry,VascEntryField entryField,final VascValueModel model,Object gui) throws VascException { - button = new Button((Composite)gui, SWT.CHECK); - orgBackgroundColor = button.getBackground(); - errorColor = new Color(((Composite)gui).getDisplay(),255,0,0); - //button.setImage(getImageDescriptor("vasc.dialog.save.image").createImage()); - button.setText(""); - Object value = model.getValue(); - if (value!=null) { - button.setSelection(new Boolean(model.getValue()+"")); - } - //button.setToolTipText(i18n("vasc.dialog.save.tooltip")); - button.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - Boolean value = button.getSelection(); - try { - System.out.println("setting value: "+value); - model.setValue(value); - } catch (Exception ee) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee); - } - } - }); - return button; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (button==null) { - return null; - } - return button.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (button==null) { - return; - } - button.setToolTipText(text); - if (text==null) { - button.setBackground(orgBackgroundColor); - } else { - button.setBackground(errorColor); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !button.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - button.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return button.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - button.setVisible(rendered); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtButton.java b/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtButton.java deleted file mode 100644 index 897e6ec..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtButton.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.frontends.swt.ui; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 Jan 13, 2009 - */ -public class SwtButton implements VascUIComponent { - - private Button button = null; - private Color orgBackgroundColor = null; - private Color errorColor = null; - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - button = new Button((Composite)gui, SWT.NONE); - orgBackgroundColor = button.getBackground(); - errorColor = new Color(((Composite)gui).getDisplay(),255,0,0); - //button.setImage(getImageDescriptor("vasc.dialog.save.image").createImage()); - button.setText(model.getValue()+""); - //button.setToolTipText(i18n("vasc.dialog.save.tooltip")); - button.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - } - }); - return button; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (button==null) { - return null; - } - return button.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (button==null) { - return; - } - button.setToolTipText(text); - if (text==null) { - button.setBackground(orgBackgroundColor); - } else { - button.setBackground(errorColor); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !button.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - button.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return button.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - button.setVisible(rendered); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtLabel.java b/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtLabel.java deleted file mode 100644 index 41febeb..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtLabel.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.frontends.swt.ui; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - -/** - * - * - * @author Willem Cazander - * @version 1.0 Jan 13, 2009 - */ -public class SwtLabel implements VascUIComponent { - - private Label label = null; - private Color orgBackgroundColor = null; - private Color errorColor = null; - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - label = new Label((Composite)gui, SWT.NONE); - orgBackgroundColor = label.getBackground(); - errorColor = new Color(((Composite)gui).getDisplay(),255,0,0); - label.setText(model.getValue()+""); - return label; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (label==null) { - return null; - } - return label.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (label==null) { - return; - } - label.setToolTipText(text); - if (text==null) { - label.setBackground(orgBackgroundColor); - } else { - label.setBackground(errorColor); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !label.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - label.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return label.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - label.setVisible(rendered); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtList.java b/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtList.java deleted file mode 100644 index bd8c7d7..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtList.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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.frontends.swt.ui; - - -import java.util.List; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascSelectItem; -import com.idcanet.vasc.core.ui.VascSelectItemModel; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 May 10, 2009 - */ -public class SwtList implements VascUIComponent { - - private Combo combo = null; - private Color orgBackgroundColor = null; - private Color errorColor = null; - private List data = null; - - public Object createComponent(final VascEntry entry,VascEntryField entryField,final VascValueModel model,Object gui) throws VascException { - combo = new Combo((Composite)gui,SWT.SINGLE | SWT.BORDER); - combo.setVisibleItemCount(8); - VascSelectItemModel items = (VascSelectItemModel)entryField.getVascEntryFieldType().getDataObject(); - if (items!=null) { - data = items.getVascSelectItems(entry); - } - fillCombo(); - orgBackgroundColor = combo.getBackground(); - errorColor = new Color(((Composite)gui).getDisplay(),255,0,0); - combo.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - VascSelectItem item = findItem(combo.getText()); - if (item!=null) { - try { - model.setValue(item.getValue()); - } catch (Exception ee) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee); - } - } - } - }); - - // sets default selected - for (VascSelectItem i:data) { - Object iValue = i.getValue(); - Object mValue = model.getValue(); - if (iValue==null && mValue==null) { - combo.setText(i.getLabel()); - break; - } - if (iValue==null) { - continue; - } - if (iValue.equals(mValue)) { - combo.setText(i.getLabel()); - break; - } - } - if (combo.getText()==null) { - combo.setText(data.get(0).getLabel()); // select top one. - } - return combo; - } - - private void fillCombo() { - if (data==null | combo==null) { - return; - } - for (VascSelectItem i:data) { - if (i.isDisabled()) { - continue; - } - combo.add(i.getLabel()); - } - } - - private VascSelectItem findItem(String text) { - for (VascSelectItem i:data) { - if (i.getLabel().equals(text)) { - return i; - } - } - return null; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (combo==null) { - return null; - } - return combo.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - if (combo==null) { - return; - } - combo.setToolTipText(text); - if (text==null) { - combo.setBackground(orgBackgroundColor); - } else { - combo.setBackground(errorColor); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !combo.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - combo.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return combo.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - combo.setVisible(rendered); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtText.java b/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtText.java deleted file mode 100644 index 825f318..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtText.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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.frontends.swt.ui; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - -/** - * Renders the swt text field. - * - * @author Willem Cazander - * @version 1.0 Jan 13, 2009 - */ -public class SwtText implements VascUIComponent { - - private Text text = null; - private Color orgBackgroundColor = null; - private Color errorColor = null; - - public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - text = new Text((Composite)gui, SWT.NONE | SWT.BORDER); - orgBackgroundColor = text.getBackground(); - errorColor = new Color(((Composite)gui).getDisplay(),255,0,0); - Object value = model.getValue(); - if (value!=null) { - text.setText(value.toString()); - } - text.addModifyListener(new TextListener(model,entry)); - return text; - } - - - class TextListener implements ModifyListener { - private VascValueModel model = null; - private VascEntry entry = null; - - public TextListener(VascValueModel model,VascEntry entry) { - this.model=model; - this.entry=entry; - } - - public void modifyText(ModifyEvent e) { - Object value = text.getText(); - try { - model.setValue(value); - } catch (Exception ee) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee); - } - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (text==null) { - return null; - } - return text.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String textString) { - if (text==null) { - return; - } - text.setToolTipText(textString); - if (textString==null) { - text.setBackground(orgBackgroundColor); - } else { - text.setBackground(errorColor); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !text.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - text.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return text.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - text.setVisible(rendered); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtTextArea.java b/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtTextArea.java deleted file mode 100644 index 9231a5c..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/swt/ui/SwtTextArea.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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.frontends.swt.ui; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontMetrics; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; - -/** - * - * - * @author Willem Cazander - * @version 1.0 Jan 13, 2009 - */ -public class SwtTextArea implements VascUIComponent { - - private Text text = null; - private Color orgBackgroundColor = null; - private Color errorColor = null; - - public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - text = new Text((Composite)gui, SWT.MULTI | SWT.BORDER); - orgBackgroundColor = text.getBackground(); - errorColor = new Color(((Composite)gui).getDisplay(),255,0,0); - - int cols = 25; - int rows = 3; - - String colsString = entryField.getVascEntryFieldType().getProperty("editor.columns"); - if (colsString!=null && "".equals(colsString)==false) { - cols = new Integer(colsString); - } - String rowsString = entryField.getVascEntryFieldType().getProperty("editor.rows"); - if (rowsString!=null && "".equals(rowsString)==false) { - rows = new Integer(rowsString); - } - - GC gc = new GC(text); - FontMetrics fm = gc.getFontMetrics (); - gc.dispose (); - int width = cols * fm.getAverageCharWidth(); - int height = rows * fm.getHeight(); - GridData data = new GridData(); - data.widthHint = width; - data.heightHint = height; - text.setLayoutData(data); - Object value = model.getValue(); - if (value!=null) { - text.setText(value.toString()); - } - text.addModifyListener(new TextListener(model,entry)); - return text; - } - - class TextListener implements ModifyListener { - private VascValueModel model = null; - private VascEntry entry = null; - - public TextListener(VascValueModel model,VascEntry entry) { - this.model=model; - this.entry=entry; - } - - public void modifyText(ModifyEvent e) { - Object value = text.getText(); - try { - model.setValue(value); - } catch (Exception ee) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,ee); - } - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - if (text==null) { - return null; - } - return text.getToolTipText(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String textString) { - if (text==null) { - return; - } - text.setToolTipText(textString); - if (textString==null) { - text.setBackground(orgBackgroundColor); - } else { - text.setBackground(errorColor); - } - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return !text.isEnabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - text.setEnabled(!disabled); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - return text.isVisible(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - text.setVisible(rendered); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascEntryEventListener.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascEntryEventListener.java deleted file mode 100644 index ad3045b..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascEntryEventListener.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * - */ -package com.idcanet.vasc.frontends.web.jsf; - -import java.util.ArrayList; -import java.util.List; - -import javax.el.ValueExpression; -import javax.faces.context.FacesContext; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.entry.VascEntryFieldValue; -import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener; - -/** - * @author willemc - * - */ -public class JSFVascEntryEventListener implements VascEntryFrontendEventListener { - - private static final long serialVersionUID = 1765054259934158076L; - private String entrySupportVar = null; - - public JSFVascEntryEventListener(String entrySupportVar) { - this.entrySupportVar=entrySupportVar; - } - - /** - * @see com.idcanet.vasc.core.entry.VascEntryFrontendEventListener#getEventTypes() - */ - public VascFrontendEventType[] getEventTypes() { - VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE}; - return result; - } - - - - public void vascEvent(VascEntry entry,Object dataNotUsed) { - try { - for (VascEntryField field:entry.getVascEntryFields()) { - if (field.getVascEntryFieldValue()==null) { - // TODO: fix this for better remote support - VascEntryField fieldClone = field.clone(); - fieldClone.getVascValidators().clear(); - - VascEntryFieldValue v = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone); - field.setVascEntryFieldValue(v); - } - } - } catch (Exception e) { - throw new RuntimeException(e); - } - List data = entry.getVascFrontendData().getVascEntryState().getEntryDataList(); - List result = new ArrayList(data.size()); - int index = 0; - for (Object o:data) { - VascDataBackendBean b = new VascDataBackendBean(entry,o,index); - result.add(b); - index++; - } - - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".tableDataModel.wrappedData}", Object.class); - ve2.setValue(FacesContext.getCurrentInstance().getELContext(), result); - ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".tablePagesDataModel.wrappedData}", Object.class); - ve3.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendData().getVascFrontendHelper().getVascBackendPageNumbers(entry)); - } -} diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascEntrySupportBean.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascEntrySupportBean.java deleted file mode 100644 index 1c571bc..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascEntrySupportBean.java +++ /dev/null @@ -1,1194 +0,0 @@ -/* - * 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.frontends.web.jsf; - - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.logging.Logger; - -import javax.faces.component.UIComponent; -import javax.faces.component.html.HtmlCommandButton; -import javax.faces.component.html.HtmlCommandLink; -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.event.PhaseEvent; -import javax.faces.event.PhaseId; -import javax.faces.event.PhaseListener; -import javax.faces.event.ValueChangeEvent; -import javax.faces.model.DataModel; -import javax.faces.model.ListDataModel; -import javax.faces.model.SelectItem; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; - -import com.idcanet.vasc.core.VascBackend; -import com.idcanet.vasc.core.VascBackendPageNumber; -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascEntryState; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.VascLinkEntry; -import com.idcanet.vasc.core.VascLinkEntryType; -import com.idcanet.vasc.core.actions.GlobalVascAction; -import com.idcanet.vasc.core.actions.RowVascAction; -import com.idcanet.vasc.core.entry.VascEntryExporter; -import com.idcanet.vasc.core.entry.VascEntryFieldValue; -import com.idcanet.vasc.impl.actions.AddRowAction; -import com.idcanet.vasc.impl.actions.DeleteRowAction; -import com.idcanet.vasc.impl.actions.EditRowAction; - -/** - * - * - * @author Willem Cazander - * @version 1.0 Sep 10, 2009 - */ -public class JSFVascEntrySupportBean implements Serializable { - - private static final long serialVersionUID = 1L; - private Logger logger = null; - private VascEntry entry = null; - private JSFVascSupportI18nMapController i18nMap = null; - private VascDataBackendBean selected = null; - private String searchString = null; - private DataModel tableDataModel = null; - private DataModel tablePagesDataModel = null; - private Boolean backendSortable = null; - private Boolean backendMoveable = null; - private Boolean backendSearchable = null; - private Boolean backendPageable = null; - private Boolean sortOrder = null; - private String sortField = null; - private VascEntryExporter selectedExporter = null; - private String selectedExporterAction = "null"; - private String selectedDirectPage = "null"; - private String selectedMultiRowAction = "null"; - private Map editSelectItemModels = null; - - public JSFVascEntrySupportBean(VascEntry entry) { - if (entry==null) { - throw new NullPointerException("Can't support null entry."); - } - this.logger = Logger.getLogger(JSFVascEntrySupportBean.class.getName()); - this.entry=entry; - - // init - tableDataModel = new ListDataModel(); - tablePagesDataModel = new ListDataModel(); - editSelectItemModels = new HashMap(6); - - // cache some values - VascBackend backend = entry.getVascFrontendData().getVascEntryState().getVascBackend();; - backendPageable = backend.isPageable(); - backendMoveable = backend.isRecordMoveable(); - backendSearchable = backend.isSearchable(); - backendSortable = backend.isSortable(); - - - i18nMap = new JSFVascSupportI18nMapController(entry); - - logger.finer("Support Bean created for vascEntry: "+entry.getId()); - } - - public VascEntry getVascEntry() { - return entry; - } - - public Map getI18nMap() { - return i18nMap; - } - - public VascDataBackendBean getSelectedTableRecord() { - Object selected = tableDataModel.getRowData(); - if (selected==null) { - return null; - } - VascDataBackendBean r = (VascDataBackendBean) selected; - return r; - } - - public String getParentSelectedDisplayName() { - if (entry.getVascFrontendData().getVascEntryState().getParent()==null) { - return ""; // no parent - } - - VascEntry parent = entry.getVascFrontendData().getVascEntryState().getParent().getVascEntry(); - Object row = entry.getVascFrontendData().getVascEntryState().getParent().getEntryDataObject(); - if (row==null) { - return "no-selection"; - } - VascEntryField v = parent.getVascEntryFieldById(parent.getDisplayNameFieldId()); - VascEntryFieldValue ve = v.getVascEntryFieldValue(); - String result = "no-data"; - try { - result = ve.getDisplayValue(v, row); - } catch (VascException e) { - e.printStackTrace(); - } - return result; - } - - public String getSelectedDisplayName() { - Object row = entry.getVascFrontendData().getVascEntryState().getEntryDataObject(); - if (row==null) { - return "no-selection"; - } - VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId()); - VascEntryFieldValue ve = v.getVascEntryFieldValue(); - String result = "no-data"; - try { - result = ve.getDisplayValue(v, row); - } catch (VascException e) { - e.printStackTrace(); - } - return result; - } - - public int getTotalColumnCount() { - int t = 0; - t += getTotalFieldColumnCount(); - t += getTotalActionColumnCount(); - t += getTotalLinkColumnCount(); - return t; - } - - public int getTotalFieldColumnCount() { - int t = 0; - if (getHasMultiRowActions()) { - t++; // auto add of select boxes - } - for (VascEntryField c:entry.getVascEntryFields()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderList(c)==false) { - continue; - } - t++; - } - return t; - } - - public int getTotalActionColumnCount() { - int t = 0; - if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) { - t++; - t++; - } - t+=entry.getRowActions().size(); - return t; - } - - public int getTotalLinkColumnCount() { - return getVascLinkEntriesList().size(); - } - - public List getVascLinkEntriesList() { - return entry.getVascFrontendData().getVascFrontendHelper().getVascLinkEntryByType(entry,VascLinkEntryType.LIST); - } - public List getVascLinkEntriesEditTab() { - return entry.getVascFrontendData().getVascFrontendHelper().getVascLinkEntryByType(entry,VascLinkEntryType.EDIT_TAB); - } - public List getVascLinkEntriesEditInline() { - return entry.getVascFrontendData().getVascFrontendHelper().getVascLinkEntryByType(entry,VascLinkEntryType.EDIT_INLINE); - } - public List getVascLinkEntriesEditTabParentState() { - if (entry.getVascFrontendData().getVascEntryState().getParent()==null) { - List result = new ArrayList(0); - return result; - } - return entry.getVascFrontendData().getVascFrontendHelper().getVascLinkEntryByType(entry.getVascFrontendData().getVascEntryState().getParent().getVascEntry(),VascLinkEntryType.EDIT_TAB); - } - - - public long getPageTotalRecordCount() { - long result = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords(); - return result; - } - - public long getPageStartCount() { - int index = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex(); - int pageSize = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize(); - long result = index*pageSize; - return result; - } - public long getPageStopCount() { - int index = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex(); - int pageSize = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize(); - long result = (index*pageSize)+pageSize; - - // limit for small result sets. - if (result>entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords()) { - result = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords(); - } - return result; - } - - public List getGlobalExportItems() { - List result = new ArrayList(5); - SelectItem s = new SelectItem(); - s.setLabel(i18nMap.get("generic.vasc.jsf.table.export.select")); - s.setDescription(i18nMap.get("generic.vasc.jsf.table.export.select.alt")); - s.setValue("null"); - result.add(s); - - for (GlobalVascAction a:entry.getGlobalActions()) { - if (a.getId().contains("xport")) { - s = new SelectItem(); - s.setLabel(i18nMap.get(a.getName())); - s.setDescription(i18nMap.get(a.getDescription())); - s.setValue(a.getId()); - result.add(s); - } - } - return result; - } - - public List getDirectPageItems() { - List result = new ArrayList(5); - SelectItem s = new SelectItem(); - s.setLabel(i18nMap.get("generic.vasc.jsf.table.page.select")); - s.setDescription(i18nMap.get("generic.vasc.jsf.table.page.select.alt")); - s.setValue("null"); - result.add(s); - - int pageSize = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize(); - for (int i=0;i13) { - return true; - } - return false; - } - - public boolean getHasExtendedPageModeCenter() { - if (getHasExtendedPageMode()==false) { - return false; - } - int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex(); - if (page<5) { - return false; - } - int pages = getTablePagesDataModel().getRowCount(); - if (page>pages-6) { - return false; - } - return true; - } - - public List getTablePagesExtendedBegin() { - List result = new ArrayList(6); - getTablePagesDataModel().setRowIndex(0); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - getTablePagesDataModel().setRowIndex(1); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - getTablePagesDataModel().setRowIndex(2); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - - int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex(); - if (page==2 | page==3 | page==4) { - getTablePagesDataModel().setRowIndex(3); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - } - if (page==3 | page==4) { - getTablePagesDataModel().setRowIndex(4); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - } - if (page==4) { - getTablePagesDataModel().setRowIndex(5); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - } - return result; - } - - public List getTablePagesExtendedEnd() { - List result = new ArrayList(6); - int pages = getTablePagesDataModel().getRowCount(); - int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex(); - int off = pages-page; - - if (off==5) { - getTablePagesDataModel().setRowIndex(pages-6); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - } - if (off==4 | off==5) { - getTablePagesDataModel().setRowIndex(pages-5); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - } - if (off==3 | off==4 | off==5) { - getTablePagesDataModel().setRowIndex(pages-4); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - } - - getTablePagesDataModel().setRowIndex(pages-3); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - getTablePagesDataModel().setRowIndex(pages-2); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - getTablePagesDataModel().setRowIndex(pages-1); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - return result; - } - - public List getTablePagesExtendedCenter() { - List result = new ArrayList(3); - int page = getVascEntry().getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex(); - getTablePagesDataModel().setRowIndex(page-1); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - getTablePagesDataModel().setRowIndex(page); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - getTablePagesDataModel().setRowIndex(page+1); - result.add((VascBackendPageNumber)getTablePagesDataModel().getRowData()); - return result; - } - - private String getComponentType(UIComponent comp) { - if (comp instanceof HtmlCommandLink) { - return ((HtmlCommandLink)comp).getType(); - } - if (comp instanceof HtmlCommandButton) { - return ((HtmlCommandButton)comp).getType(); - } - throw new IllegalArgumentException("Component is of link of button type: "+comp); - } - - public List getParentCustomRowActions() { - List result = new ArrayList(5); - VascEntry entry = getVascEntry(); - if (entry.getVascFrontendData().getVascEntryState().getParent()==null) { - return result; - } - VascEntry parent = entry.getVascFrontendData().getVascEntryState().getParent().getVascEntry(); - for (RowVascAction action:parent.getRowActions()) { - String actionId = action.getId(); - if (AddRowAction.ACTION_ID.equals(actionId)) { - continue; - } - if (DeleteRowAction.ACTION_ID.equals(actionId)) { - continue; - } - if (EditRowAction.ACTION_ID.equals(actionId)) { - continue; - } - result.add(action); - } - return result; - } - - public void parentCustomRowaction(ActionEvent event) { - String actionIdString = getComponentType(event.getComponent()); - logger.fine("parentCustomRowaction: "+actionIdString); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - if (entry.getVascFrontendData().getVascEntryState().getParent()==null) { - return; - } - VascEntry parent = entry.getVascFrontendData().getVascEntryState().getParent().getVascEntry(); - - RowVascAction action = parent.getRowActionById(actionIdString); - Object parentSelected = entry.getVascFrontendData().getVascEntryState().getParent().getEntryDataObject(); - logger.fine("parentCustomRowaction do on: "+action+" parentSelection: "+parentSelected); - try { - action.doRowAction(parent,parentSelected); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - logger.fine("parentCustomRowaction DONE"); - } - - - public boolean getHasMultiRowActions() { - int size = getVascEntry().getVascFrontendData().getVascFrontendHelper().getMultiRowActions(getVascEntry()).size(); - if (size==0) { - return false; - } - return true; - } - - public List getMultiRowActionItems() { - List result = new ArrayList(5); - SelectItem s = new SelectItem(); - s.setLabel(i18nMap.get("generic.vasc.jsf.multiAction.name")); - s.setDescription(i18nMap.get("generic.vasc.jsf.multiAction.description")); - s.setValue("null"); - result.add(s); - - for (RowVascAction a:getVascEntry().getVascFrontendData().getVascFrontendHelper().getMultiRowActions(getVascEntry())) { - s = new SelectItem(); - s.setLabel(i18nMap.get(a.getName())); - s.setDescription(i18nMap.get(a.getDescription())); - s.setValue(a.getId()); - result.add(s); - } - return result; - } - - public void processMultiRowActionChange(ValueChangeEvent event) { - // first do normal global selection of action aka: globalAction(event); copyed: - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - String actionIdString = (String)event.getNewValue(); - logger.finer("multri row id "+actionIdString); - - // TODO: FIX this change listener is called before save action in row EDIT... - if (actionIdString==null) { - return; - } - - // Default selection for fancy gui - if ("null".equals(actionIdString)) { - return; - } - - logger.info("MultiRowAction: "+actionIdString); - FacesContext.getCurrentInstance().getViewRoot().addPhaseListener(new MultiRowAction(entry,actionIdString)); - } - - class MultiRowAction implements PhaseListener,Serializable { - private static final long serialVersionUID = 1L; - VascEntry vascEntry; - String actionId; - public MultiRowAction(VascEntry vascEntry,String actionId) { - this.vascEntry=vascEntry; - this.actionId=actionId; - } - public void beforePhase(PhaseEvent PhaseEvent) { - } - - public void afterPhase(PhaseEvent PhaseEvent) { - if (vascEntry==null) { - return; - } - RowVascAction action = vascEntry.getRowActionById(actionId); - VascEntryState state = vascEntry.getVascFrontendData().getVascEntryState(); - - try { - setSelectedMultiRowAction("null"); // reset to selected ... value - - for (Integer rowId:state.getMultiActionSelection().keySet()) { - Boolean value = state.getMultiActionSelection().get(rowId); - logger.fine("multiRow selected: "+rowId+" value: "+value); - if (value!=null && value==true) { - Object row = state.getEntryDataList().get(rowId); - logger.finer("row: "+row); - action.doRowAction(vascEntry, row); - if (action.getId().equals(DeleteRowAction.ACTION_ID)) { - return; - } - } - } - state.getMultiActionSelection().clear(); // after down deselect all options - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - vascEntry=null; - } - } - - public PhaseId getPhaseId(){ - return PhaseId.UPDATE_MODEL_VALUES; - } - } - - - // All Actions - - public void searchAction(ActionEvent event) { - logger.fine("searchAction"); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - entry.getVascFrontendData().getVascFrontendHelper().searchAction(entry, searchString); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - public void sortAction(ActionEvent event) { - logger.fine("sortAction"); - String fieldIdString = ((HtmlCommandLink)event.getComponent()).getType(); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - VascEntryField field = entry.getVascEntryFieldById(fieldIdString); - - entry.getVascFrontendData().getVascFrontendHelper().sortAction(entry, field); - - sortOrder = entry.getVascFrontendData().getVascEntryState().getVascBackendState().isSortAscending(); - sortField = field.getId(); - - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - public boolean getRenderBackAction() { - return getVascEntry().getVascFrontendData().getVascEntryState().getParent()!=null; - } - - public boolean getRenderBackEditAction() { - if (getVascEntry().getVascFrontendData().getVascEntryState().getParent()!=null) { - if (getVascEntry().getVascFrontendData().getVascEntryState().getParent().getVascEntry().getRowActionById("editRowAction")==null) { - return false; // parent is not editable - } - return true; - } - return false; - } - - public void backAction(ActionEvent event) { - logger.fine("backAction"); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - comp.initGoto(entry.getVascFrontendData().getVascEntryState().getParent()); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - public void backEditAction(ActionEvent event) { - logger.fine("backEditAction"); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = getVascEntry(); - - // select record to edit - Object rowObject = entry.getVascFrontendData().getVascEntryState().getParent().getEntryDataObject(); - //String idField = entry.getVascFrontendData().getVascEntryState().getParent().getVascEntry().getPrimaryKeyFieldId(); - // VascEntryField field = entry.getVascFrontendData().getVascEntryState().getParent().getVascEntry().getVascEntryFieldById(idField); -// try { - // Object id = field.getVascEntryFieldValue().getValue(field, rowObject); - comp.initGoto(entry.getVascFrontendData().getVascEntryState().getParent(),rowObject); - // } catch (VascException e1) { - // TODO Auto-generated catch block - // e1.printStackTrace(); - //} - } - - - public void pageAction(ActionEvent event) { - logger.fine("pageAction"); - Integer pageIndex = new Integer(getComponentType(event.getComponent())); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - selectedDirectPage=pageIndex+""; - entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, pageIndex); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - public void pageNextAction(ActionEvent event) { - logger.fine("pageNextAction"); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - - int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex(); - pageIndex++; - selectedDirectPage=pageIndex+""; - entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, pageIndex); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - public void pagePreviousAction(ActionEvent event) { - logger.fine("pagePreviousAction"); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - - int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex(); - pageIndex--; - selectedDirectPage=pageIndex+""; - entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, pageIndex); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - public boolean getHasPageNextAction() { - VascEntry entry = getVascEntry(); - int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex(); - pageIndex++; - // copyed from helper - Long total = entry.getVascFrontendData().getVascEntryState().getTotalBackendRecords(); - logger.finer("Checking has next action for next pageIndex"+pageIndex+" of total: "+total+" and pageSize: "+entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize()); - if (total!=null && pageIndex>(total/entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize())) { - return false; - } - return true; - } - - public boolean getHasPagePreviousAction() { - VascEntry entry = getVascEntry(); - int pageIndex = entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageIndex(); - if (pageIndex==0) { - return false; - } - return true; - } - - - public void rowAction(ActionEvent event) { - String actionIdString = getComponentType(event.getComponent()); - logger.fine("RowAction: "+actionIdString); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - RowVascAction action = entry.getRowActionById(actionIdString); - //Object selected = null; - if (actionIdString.contains("add")==false) { - selected = comp.getSupportBean().getSelectedTableRecord(); - } else { - selected = null; - } - logger.fine("RowAction do on: "+action); - try { - if (selected==null) { - action.doRowAction(entry, null); - } else { - action.doRowAction(entry, selected.getRecord()); - } - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - logger.fine("RowAction DONE"); - } - - public void globalAction(ActionEvent event) { - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - String id = getComponentType(event.getComponent()); - logger.fine("globalAction id: "+id); - GlobalVascAction action = entry.getGlobalActionById(id); - try { - action.doGlobalAction(entry); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - - public void addAction(ActionEvent event) { - logger.fine("addAction"); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - RowVascAction action = entry.getRowActionById("addRowAction"); - try { - action.doRowAction(entry, null); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - public void linkAction(ActionEvent event) { - logger.fine("linkAction"); - String linkId = getComponentType(event.getComponent()); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascDataBackendBean selected = comp.getSupportBean().getSelectedTableRecord(); - logger.finer("Set selected: "+selected); - VascEntry entry = comp.getVascEntry(); - entry.getVascFrontendData().getVascEntryState().setEntryDataObject(selected.getRecord()); - VascLinkEntry l = entry.getVascLinkEntryById(linkId); - comp.initGoto(l); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - this.selected=selected; // renderView clears selected ! - } - - public void moveAction(ActionEvent event) { - logger.fine("moveAction"); - String moveAction = getComponentType(event.getComponent()); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - Object selected = comp.getSupportBean().getSelectedTableRecord().getRecord(); - if ("up".equals(moveAction)) { - entry.getVascFrontendData().getVascFrontendHelper().moveAction(entry,selected,true); - } - if ("down".equals(moveAction)) { - entry.getVascFrontendData().getVascFrontendHelper().moveAction(entry,selected,false); - } - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - public void linkEditAction(ActionEvent event) { - logger.fine("linkEditAction"); - String linkId = getComponentType(event.getComponent()); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascDataBackendBean selected = this.selected; - logger.fine("Set selected: "+selected); - VascEntry entry = comp.getVascEntry(); - VascLinkEntry l = entry.getVascLinkEntryById(linkId); - comp.initGoto(l); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - this.selected=selected; // renderView clears selected ! - } - - public void linkListAction(ActionEvent event) { - logger.fine("linkListAction"); - String linkId = getComponentType(event.getComponent()); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascLinkEntry link = comp.getVascEntry().getVascFrontendData().getVascEntryState().getParent().getVascEntry().getVascLinkEntryById(linkId); - comp.initGoto(link,comp.getVascEntry().getVascFrontendData().getVascEntryState().getParent()); - - Object o = comp.getVascEntry().getVascFrontendData().getVascEntryState().getParent().getEntryDataObject(); - int index = comp.getVascEntry().getVascFrontendData().getVascEntryState().getParent().getEntryDataList().indexOf(o); - VascDataBackendBean selected = new VascDataBackendBean(entry,o,index); - this.selected=selected; - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - this.selected=selected; - } - - public void cancelAction(ActionEvent event) { - logger.fine("cancelAction"); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - if (getSelected()!=null) { - getSelected().setRealValue(false); - } - entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - public void saveAction(ActionEvent event) { - logger.fine("saveAction"); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - logger.fine("Savng: "+selected.getRecord()); - - /* - try { - for (Method m:selected.getRecord().getClass().getMethods()) { - if (m.getName().startsWith("get")) { - Object value = m.invoke(selected.getRecord(), new Object[0]); - logger.info("property: "+m.getName()+" value: "+value); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - */ - - entry.getVascFrontendData().getVascEntryState().setEntryDataObject(selected.getRecord()); - entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry); - - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - public void deleteAction(ActionEvent event) { - logger.fine("deleteAction"); - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - VascEntryState state = entry.getVascFrontendData().getVascEntryState(); - - List sels = new ArrayList(5); - for (Integer rowId:state.getMultiActionSelection().keySet()) { - Boolean value = state.getMultiActionSelection().get(rowId); - logger.fine("multiRow delete: "+rowId+" value: "+value); - if (value!=null && value==true) { - Object row = state.getEntryDataList().get(rowId); - sels.add(row); - } - } - if (sels.isEmpty()==false) { - for (Object row:sels) { - entry.getVascFrontendData().getVascEntryState().setEntryDataObject(row); - entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry); - } - state.getMultiActionSelection().clear(); // after down deselect all options - } else { - entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry); - } - - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - public void processDirectDownloadChange(ValueChangeEvent event){ - - // first do normal global selection of action aka: globalAction(event); copyed: - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - - String id = (String)event.getNewValue(); - - // TODO: FIX this change listener is called before save action in row EDIT... - if (id==null) { - logger.finer("FIXME: unexcepted call to direct download"); - return; - } - - // Default selection for fancy gui - if ("null".equals(id)) { - return; - } - - logger.fine("exportDownloadAction id: "+id); - - GlobalVascAction action = entry.getGlobalActionById(id); - try { - action.doGlobalAction(entry); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - - // restore normal view for next request. - comp.setRenderFacetState("listView"); - VascEntryExporter ex = getSelectedExporter(); - - if (ex==null) { - logger.fine("No exporter selected for download."); - return; - } - selectedExporterAction = "null"; // reset selection to top one. - - FacesContext fc = FacesContext.getCurrentInstance(); - try { - - HttpServletResponse response = (HttpServletResponse)fc.getExternalContext().getResponse(); - String filename = "export-list."+ex.getType(); - response.setHeader("Content-disposition", "attachment; filename=" + filename); - String contentType = ex.getMineType(); - response.setContentType(contentType); - ServletOutputStream out = response.getOutputStream(); - - ex.doExport(out, entry); - out.close(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } finally { - fc.responseComplete(); - } - } - - - public void processDirectPageChange(ValueChangeEvent event){ - - // first do normal global selection of action aka: globalAction(event); copyed: - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - - String id = (String)event.getNewValue(); - - // TODO: FIX this change listener is called before save action in row EDIT... - if (id==null) { - logger.finer("FIXME: unexcepted call to direct page change"); - return; - } - - // Default selection for fancy gui - if ("null".equals(id)) { - return; - } - - logger.fine("directPageChangeAction id: "+id); - //selectedDirectPage = "null"; - - try { - entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, new Integer(id)); - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - // Pure get/setters - - /** - * @return the searchString - */ - public String getSearchString() { - return searchString; - } - - /** - * @param searchString the searchString to set - */ - public void setSearchString(String searchString) { - this.searchString = searchString; - } - - /** - * @return the selected - */ - public VascDataBackendBean getSelected() { - return selected; - } - - /** - * @param selected the selected to set - */ - public void setSelected(VascDataBackendBean selected) { - logger.fine("Set selected records: "+selected+" on: "+this); - this.selected = selected; - } - - /** - * @return the backendSortable - */ - public Boolean getBackendSortable() { - return backendSortable; - } - - /** - * @return the backendPageable - */ - public Boolean getBackendPageable() { - return backendPageable; - } - - /** - * @return the backendMoveable - */ - public Boolean getBackendMoveable() { - return backendMoveable; - } - - /** - * @return the backendSearchable - */ - public Boolean getBackendSearchable() { - return backendSearchable; - } - - /** - * @return the tableDataModel - */ - public DataModel getTableDataModel() { - return tableDataModel; - } - - /** - * @return the tablePagesDataModel - */ - public DataModel getTablePagesDataModel() { - return tablePagesDataModel; - } - - /** - * @return the sortOrder - */ - public Boolean getSortOrder() { - return sortOrder; - } - - /** - * @return the sortField - */ - public String getSortField() { - return sortField; - } - - /** - * @return the selectedExporter - */ - public VascEntryExporter getSelectedExporter() { - return selectedExporter; - } - - /** - * @param selectedExporter the selectedExporter to set - */ - public void setSelectedExporter(VascEntryExporter selectedExporter) { - this.selectedExporter = selectedExporter; - } - - /** - * @return the selectedExporterAction - */ - public String getSelectedExporterAction() { - return selectedExporterAction; - } - - /** - * @param selectedExporterAction the selectedExporterAction to set - */ - public void setSelectedExporterAction(String selectedExporterAction) { - this.selectedExporterAction = selectedExporterAction; - } - - /** - * @return the selectedDirectPage - */ - public String getSelectedDirectPage() { - return selectedDirectPage; - } - - /** - * @param selectedDirectPage the selectedDirectPage to set - */ - public void setSelectedDirectPage(String selectedDirectPage) { - this.selectedDirectPage = selectedDirectPage; - } - - /** - * @return the editSelectItemModels - */ - public Map getEditSelectItemModels() { - return editSelectItemModels; - } - - /** - * @return the selectedMultiRowAction - */ - public String getSelectedMultiRowAction() { - return selectedMultiRowAction; - } - - /** - * @param selectedMultiRowAction the selectedMultiRowAction to set - */ - public void setSelectedMultiRowAction(String selectedMultiRowAction) { - this.selectedMultiRowAction = selectedMultiRowAction; - } - - /** - * @return the selectAllValue - */ - public Boolean getSelectAllValue() { - return false; - } - - /** - * @param selectAllValue the selectAllValue to set - */ - public void setSelectAllValue(Boolean selectAllValue) { - } -} -class JSFVascSupportI18nMapController implements Map { - private VascEntry entry = null; - public JSFVascSupportI18nMapController(VascEntry entry) { - this.entry=entry; - } - - public void clear() { - } - - public boolean containsKey(Object key) { - return true; - } - - public boolean containsValue(Object value) { - return true; - } - - public Set> entrySet() { - return null; - } - - public String get(Object key) { - String result = entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue((String)key); - return result; - } - - public boolean isEmpty() { - return false; - } - - public Set keySet() { - return null; - } - - public String put(String key, String value) { - return null; - } - - @SuppressWarnings("unchecked") - public void putAll(Map m) { - } - - public String remove(Object key) { - return null; - } - - public int size() { - return 0; - } - - public Collection values() { - return null; - } - -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascFrontendRenderer.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascFrontendRenderer.java deleted file mode 100644 index 1522e11..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascFrontendRenderer.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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.frontends.web.jsf; - -import java.io.Serializable; -import java.util.logging.Logger; - -import javax.faces.component.UIViewRoot; -import javax.faces.context.FacesContext; - -import com.idcanet.vasc.core.AbstractVascFrontend; -import com.idcanet.vasc.core.VascFrontendData; -import com.idcanet.vasc.core.entry.VascEntryExporter; -import com.idcanet.vasc.frontends.web.jsf.ui.JSFBoolean; -import com.idcanet.vasc.frontends.web.jsf.ui.JSFLabel; -import com.idcanet.vasc.frontends.web.jsf.ui.JSFList; -import com.idcanet.vasc.frontends.web.jsf.ui.JSFText; -import com.idcanet.vasc.frontends.web.jsf.ui.JSFTextArea; - -/** - * Given the jsf vasc renderer its own class - * - * - * @author Willem Cazander - * @version 1.0 Nov 12, 2009 - */ -public class JSFVascFrontendRenderer extends AbstractVascFrontend implements Serializable { - - private static final long serialVersionUID = 1L; - private Logger logger = null; - - public JSFVascFrontendRenderer() { - logger = Logger.getLogger(JSFVascFrontendRenderer.class.getName()); - } - - // Frontend Stuff - - protected void addUiComponents() { - VascFrontendData vfd = getVascEntry().getVascFrontendData(); - - // required UI components - vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_LABEL,JSFLabel.class.getName()); - vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_TEXT, JSFText.class.getName()); - vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_LIST, JSFList.class.getName()); - //vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_BUTTON, JSFButton.class.getName()); - - // optional UI components - vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_BOOLEAN , JSFBoolean.class.getName()); - //vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_DATE , JSFDate.class.getName()); - vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_TEXTAREA , JSFTextArea.class.getName()); - //vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_COLOR , JSFColorChooser.class.getName()); - - } - - /** - * @see com.idcanet.vasc.core.VascFrontend#renderDelete(java.lang.Object) - */ - public void renderDelete() throws Exception { - logger.finer("renderDelete"); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.setRenderFacetState("deleteView"); - } - - /** - * @see com.idcanet.vasc.core.VascFrontend#renderEdit(java.lang.Object) - */ - public void renderEdit() throws Exception { - logger.finer("renderEdit"); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.setRenderFacetState("editView"); - entry.getVascFrontendData().getVascFrontendHelper().editReadOnlyUIComponents(entry); - - VascDataBackendBean selBean = null; - if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) { - int index = entry.getVascFrontendData().getVascEntryState().getEntryDataList().size()+1; - selBean = new VascDataBackendBean(entry,entry.getVascFrontendData().getVascEntryState().getEntryDataObject(),index); - } else { - selBean = comp.getSupportBean().getSelectedTableRecord(); - } - selBean.setRealValue(true); - - comp.getSupportBean().setSelected(selBean); - } - - /** - * @see com.idcanet.vasc.core.VascFrontend#renderExport(com.idcanet.vasc.core.entry.VascEntryExporter) - */ - public void renderExport(VascEntryExporter exporter) throws Exception { - logger.finer("renderExport"); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.setRenderFacetState("exportView"); - comp.getSupportBean().setSelectedExporter(exporter); - } - - /** - * @see com.idcanet.vasc.core.VascFrontend#renderView() - */ - public void renderView() throws Exception { - logger.finer("renderView"); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.setRenderFacetState("listView"); - - //if (comp.getSupportBean().getSelected()!=null) { - // comp.getSupportBean().getSelected().setRealValue(false); - // comp.getSupportBean().setSelected(null); - //} - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascUIComponent.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascUIComponent.java deleted file mode 100644 index 8493750..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascUIComponent.java +++ /dev/null @@ -1,423 +0,0 @@ -/* - * 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.frontends.web.jsf; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.logging.Logger; - -import javax.el.ValueExpression; -import javax.faces.component.UIComponent; -import javax.faces.component.UIComponentBase; -import javax.faces.context.FacesContext; - -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.VascEntryState; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.VascFrontendData; -import com.idcanet.vasc.core.VascLinkEntry; -import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener; -import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType; -import com.idcanet.vasc.frontends.web.jsf.ui.JSFListModel; -import com.idcanet.vasc.impl.DefaultVascFactory; - -/** - * Renders an JSF vasc entry views. - * - * This is a bit hacky because I'm not a JSF guro. - * - * @author Willem Cazander - * @version 1.0 Nov 16, 2008 - */ -public class JSFVascUIComponent extends UIComponentBase { - - public static final String FAMILY = "vasc.jsf.component.family"; - public static final String VASC_CONTROLLER_KEY = "vascController"; - public static final String VASC_FRONTEND_DATA_KEY = "vascFrontendData"; - public static final String ENTRY_NAME_KEY = "entryName"; - public static final String ENTRY_SUPPORT_VAR_KEY = "entrySupportVar"; - public static final String TABLE_RECORD_VAR_KEY = "tableRecordVar"; - public static final String INJECT_EDIT_FIELDS_ID = "injectEditFieldsId"; - public static final String INJECT_TABLE_OPTIONS_ID = "injectTableOptionsId"; - public static final String INJECT_TABLE_COLUMNS_ID = "injectTableColumnsId"; - public static final String DISABLE_LINK_COLUMNS = "disableLinkColumns"; - - private JSFVascFrontendRenderer renderer = null; - private JSFVascEntrySupportBean supportBean = null; - private String renderFacetState = null; - private VascLinkEntry link = null; - private VascEntryState linkState = null; - private VascEntryState state = null; - private Object stateEditId = null; - private Logger logger = null; - private Boolean initClear = null; - - public JSFVascUIComponent() { - logger = Logger.getLogger(JSFVascUIComponent.class.getName()); - } - - public String getFamily() { - return FAMILY; - } - - @Override - public Object saveState(FacesContext facesContext) { - logger.fine("Save State"); - Object values[] = new Object[7]; - values[0] = super.saveState(facesContext); - values[1] = this.getAttributes().get(VASC_CONTROLLER_KEY); - values[2] = this.getAttributes().get(VASC_FRONTEND_DATA_KEY); - values[3] = this.getAttributes().get(ENTRY_NAME_KEY); - values[4] = renderer; - values[5] = supportBean; - values[6] = renderFacetState; - return values; - - } - - @Override - public void restoreState(FacesContext facesContext, Object state) { - logger.fine("Resotre State"); - Object values[] = (Object[])state; - super.restoreState(facesContext, values[0]); - this.getAttributes().put(VASC_CONTROLLER_KEY, values[1]); - this.getAttributes().put(VASC_FRONTEND_DATA_KEY, values[2]); - this.getAttributes().put(ENTRY_NAME_KEY, values[3]); - renderer = (JSFVascFrontendRenderer) values[4]; - supportBean = (JSFVascEntrySupportBean) values[5]; - renderFacetState = (String) values[6]; - - // TODO: check if we can move this some day... - String entrySupportVar = (String)getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY); - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+"}", Object.class); - ve2.setValue(FacesContext.getCurrentInstance().getELContext(), getSupportBean()); - } - - static public JSFVascUIComponent findVascParent(UIComponent comp) { - if (comp==null) { - return null; - } - if (comp instanceof JSFVascUIComponent) { - return (JSFVascUIComponent)comp; - } - return findVascParent(comp.getParent()); - } - - static public JSFVascUIComponent findVascChild(UIComponent comp,String entryId) { - if (comp==null) { - return null; - } - if (comp instanceof JSFVascUIComponent) { - JSFVascUIComponent ui = (JSFVascUIComponent)comp; - if (entryId==null) { - return ui; - } - if (entryId.equals(ui.getVascEntry().getId())) { - return ui; - } - return null; // this is a other entry on this view - } - for (UIComponent c:comp.getChildren()) { - Object res = findVascChild(c,entryId); - if (res!=null) { - return (JSFVascUIComponent)res; // found - } - } - return null; - } - - /** - * Finds component with the given id - */ - static public UIComponent findComponentById(UIComponent c, String id) { - if (id.equals(c.getId())) { - return c; - } - Iterator kids = c.getFacetsAndChildren(); - while (kids.hasNext()) { - UIComponent found = findComponentById(kids.next(), id); - if (found != null) { - return found; - } - } - return null; - } - - public VascEntry getVascEntry() { - return renderer.getVascEntry(); - } - - protected void initGoto(VascLinkEntry link) { - logger.fine("init goto "+link); - this.link=link; - } - protected void initGoto(VascLinkEntry link,VascEntryState state) { - logger.fine("init goto link: "+link); - this.link=link; - this.linkState=state; - } - - protected void initGoto(VascEntryState state) { - logger.fine("init goto "+state); - this.state=state; - } - - protected void initGoto(VascEntryState state,Object stateEditId) { - logger.fine("init goto "+state); - this.state=state; - this.stateEditId=stateEditId; - } - - public Boolean getInitClear() { - return initClear; - } - - @Override - public void encodeBegin(FacesContext context) throws IOException { - logger.fine("Comp encodeBegin link: "+link); - // no need to add multiple - if (renderer==null) { - logger.finer("Adding phase listener: JSFVascValidatePhaseListener"); - context.getViewRoot().addPhaseListener(new JSFVascValidatePhaseListener()); - } - boolean init = false; - if (renderer==null | link!=null | state!=null) { - renderFacetState = "listView"; - VascEntry entry = createClonedVascEntry(); - renderer = new JSFVascFrontendRenderer(); - try { - renderer.initEntry(entry); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - supportBean = new JSFVascEntrySupportBean(entry); - // copy search string for preadded search string from application layer - supportBean.setSearchString(entry.getVascFrontendData().getVascEntryState().getVascBackendState().getSearchString()); - - init = true; - } - - if (stateEditId!=null) { - Object rowObject = stateEditId; - - // setup for renderEdit() of frontend - List list = new ArrayList(1); - list.add(new VascDataBackendBean(supportBean.getVascEntry(),rowObject,0)); - supportBean.getTableDataModel().setWrappedData(list); - supportBean.getTableDataModel().setRowIndex(0); - - // edit action copyed - try { - VascEntry entry = supportBean.getVascEntry(); - entry.getVascFrontendData().getVascEntryState().setEditCreate(false); - entry.getVascFrontendData().getVascFrontendHelper().fireVascEvent(entry, VascFrontendEventType.DATA_SELECT, rowObject); - entry.getVascFrontendData().getVascEntryState().setEntryDataObject(rowObject); - entry.getVascFrontendData().getVascFrontend().renderEdit(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - // refresh all drop down lists.. - for (String key:supportBean.getEditSelectItemModels().keySet()) { - Object o = supportBean.getEditSelectItemModels().get(key); - if (o instanceof JSFListModel) { - JSFListModel t = (JSFListModel)o; - t.requestRefresh(); - } - } - - // set the support bean - String entrySupportVar = (String)getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY); - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+"}", Object.class); - ve2.setValue(FacesContext.getCurrentInstance().getELContext(), getSupportBean()); - - // set init for component renderer - if (init) { - initClear = false; - if (link!=null | state!=null) { - initClear = true; - } - } - super.encodeBegin(context); - } - - public UIComponent getCurrentView() { - UIComponent result = getFacet(renderFacetState); - if (result==null) { - throw new IllegalArgumentException("Could not get facet: "+renderFacetState); - } - return result; - } - - public JSFVascEntrySupportBean getSupportBean() { - return supportBean; - } - - public void setRenderFacetState(String renderFacetState) { - this.renderFacetState=renderFacetState; - } - - public String getRenderFacetState() { - return renderFacetState; - } - - public VascEntry createClonedVascEntry() { - - String entryName = null; - VascController vascController = null; - VascFrontendData frontendData = null; - - if (getAttributes().get(VASC_CONTROLLER_KEY) instanceof String) { - // fix for JSP tag handler - logger.finer("Getting expression: "+getAttributes().get(VASC_CONTROLLER_KEY)); - ValueExpression ve1 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), (String)getAttributes().get(VASC_CONTROLLER_KEY), Object.class); - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), (String)getAttributes().get(VASC_FRONTEND_DATA_KEY), Object.class); - ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), (String)getAttributes().get(ENTRY_NAME_KEY), String.class); - vascController = (VascController)ve1.getValue( FacesContext.getCurrentInstance().getELContext()); - frontendData = (VascFrontendData)ve2.getValue( FacesContext.getCurrentInstance().getELContext()); - entryName = (String)ve3.getValue( FacesContext.getCurrentInstance().getELContext()); - } else { - vascController = (VascController)getAttributes().get(VASC_CONTROLLER_KEY); - frontendData = (VascFrontendData)getAttributes().get(VASC_FRONTEND_DATA_KEY); - entryName = (String)getAttributes().get(ENTRY_NAME_KEY); - } - - if (link!=null) { - entryName = link.getVascEntryId(); - } - if (state!=null) { - entryName = state.getVascEntry().getId(); - } - - VascEntry entry = vascController.getVascEntryController().getVascEntryById(entryName); - if (entry==null) { - throw new NullPointerException("Could not locate '"+entryName+"' from : "+vascController); - } - - frontendData.setVascController(vascController); - entry.setVascFrontendData(frontendData); - try { - frontendData.initFrontendListeners(entry); - } catch (InstantiationException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (IllegalAccessException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry); - frontendData.getVascEntryState().setVascBackend(backend); - frontendData.getVascEntryState().setVascEntry(entry); - - if (state!=null) { - // copy prevois parent - frontendData.getVascEntryState().setParent(state.getParent()); - } - - if (link!=null) { - // save state - if (linkState==null) { - frontendData.getVascEntryState().setParent(getVascEntry().getVascFrontendData().getVascEntryState()); - } else { - frontendData.getVascEntryState().setParent(linkState); - } - - // Set parameters - try { - Object selected = getSupportBean().getSelected().getRecord(); - for (String parameterName:link.getEntryParameterFieldIdKeys()) { - String fieldId = link.getEntryParameterFieldId(parameterName); - VascEntryField v = getVascEntry().getVascEntryFieldById(fieldId); - if (v==null) { - logger.warning("Could nog get VascEntryField for fieldID: "+fieldId); - continue; - } - if (v.getVascEntryFieldValue()==null) { - logger.warning("Could not get VascEntryFieldValue for fieldID: "+fieldId); - continue; - } - Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected); - - // set data parameter on new vasc entry - entry.getVascFrontendData().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue); - logger.fine("Setting link parameter: "+parameterName+" with: "+selectedValue); - } - - for (String fieldId:link.getEntryCreateFieldValueKeys()) { - String selectedfieldId = link.getEntryParameterFieldId(fieldId); - Object selectedValue = selected; - if (selectedfieldId!=null) { - VascEntryField v = getVascEntry().getVascEntryFieldById(selectedfieldId); - selectedValue = v.getVascEntryFieldValue().getValue(v, selected); - } - - // create listener for new objects - entry.getVascFrontendData().addVascEntryFrontendEventListener(new CreateEntryFieldValuesListener2(fieldId,selectedValue)); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - - String entrySupportVar = (String)getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY); - entry.getVascFrontendData().addVascEntryFrontendEventListener(new JSFVascEntryEventListener(entrySupportVar)); - - return entry; - } - - class CreateEntryFieldValuesListener2 implements VascEntryFrontendEventListener { - private static final long serialVersionUID = 1L; - private String fieldId = null; - private Object value = null; - public CreateEntryFieldValuesListener2(String fieldId,Object value) { - if (fieldId==null) { - throw new NullPointerException("fieldId may not be null"); - } - this.fieldId=fieldId; - this.value=value; - } - public VascFrontendEventType[] getEventTypes() { - VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_CREATE}; - return result; - } - public void vascEvent(VascEntry entry,Object data) { - VascEntryField field = entry.getVascEntryFieldById(fieldId); - try { - field.getVascEntryFieldValue().setValue(field, data, value); - } catch (VascException e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascUIComponentRenderer.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascUIComponentRenderer.java deleted file mode 100644 index c06e9b8..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascUIComponentRenderer.java +++ /dev/null @@ -1,531 +0,0 @@ -/* - * 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.frontends.web.jsf; - -import java.io.IOException; -import java.io.Serializable; -import java.lang.reflect.Constructor; -import java.util.List; -import java.util.logging.Logger; - -import javax.el.ELContext; -import javax.el.MethodExpression; -import javax.el.ValueExpression; -import javax.faces.FacesException; -import javax.faces.application.Application; -import javax.faces.application.FacesMessage; -import javax.faces.component.UIColumn; -import javax.faces.component.UIComponent; -import javax.faces.component.UIInput; -import javax.faces.component.UIOutput; -import javax.faces.component.UIViewRoot; -import javax.faces.component.html.HtmlCommandLink; -import javax.faces.component.html.HtmlMessage; -import javax.faces.component.html.HtmlOutputText; -import javax.faces.component.html.HtmlSelectBooleanCheckbox; -import javax.faces.context.FacesContext; -import javax.faces.context.ResponseWriter; -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.MethodExpressionActionListener; -import javax.faces.event.ValueChangeEvent; -import javax.faces.event.ValueChangeListener; -import javax.faces.render.Renderer; -import javax.faces.validator.Validator; -import javax.faces.validator.ValidatorException; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.VascLinkEntry; -import com.idcanet.vasc.core.VascLinkEntryType; -import com.idcanet.vasc.core.actions.RowVascAction; -import com.idcanet.vasc.core.ui.VascOptionValueModelListener; -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.core.ui.VascValueModel; -import com.idcanet.vasc.impl.actions.AddRowAction; - -/** - * Renders an JSF vasc entry views. - * - * This is a bit hacky because I'm not a JSF guro. - * - * @author Willem Cazander - * @version 1.0 Nov 16, 2008 - */ -public class JSFVascUIComponentRenderer extends Renderer { - - private Logger logger = null; - - public JSFVascUIComponentRenderer() { - logger = Logger.getLogger(JSFVascUIComponentRenderer.class.getName()); - } - - @Override - public void encodeBegin(FacesContext facesContext,UIComponent component) throws IOException { - super.encodeBegin(facesContext, component); - ResponseWriter writer = facesContext.getResponseWriter(); - JSFVascUIComponent comp = (JSFVascUIComponent)component; - logger.fine("renderen encodeBegin for: "+comp.getRenderFacetState()); - writer.startElement("div", component); - //String styleClass = (String)attributes.get(Shuffler.STYLECLASS_ATTRIBUTE_KEY); - //writer.writeAttribute("class", styleClass, null); - - // check if injection is needed - if (comp.getInitClear()!=null) { - injectAll(facesContext,comp,comp.getInitClear()); - - // hack for edit back action to set field disabled - VascEntry entry = comp.getVascEntry(); - entry.getVascFrontendData().getVascFrontendHelper().editReadOnlyUIComponents(entry); - } - - // render the current facet of the vasc component - UIComponent view = comp.getCurrentView(); - view.encodeAll(facesContext); - } - - @Override - public void encodeEnd(FacesContext facesContext,UIComponent component) throws IOException { - ResponseWriter writer = facesContext.getResponseWriter(); - writer.endElement("div"); - } - - - // ========== All private - - - private void injectAll(FacesContext context,JSFVascUIComponent comp,boolean clean) { - - String injectEditFieldsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_EDIT_FIELDS_ID); - String injectTableOptionsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_TABLE_OPTIONS_ID); - String injectTableColumnsId = (String)comp.getAttributes().get(JSFVascUIComponent.INJECT_TABLE_COLUMNS_ID); - - UIComponent injectEditFieldsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("editView"),injectEditFieldsId); - UIComponent injectTableOptionsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("listView"),injectTableOptionsId); - UIComponent injectTableColumnsComponent = JSFVascUIComponent.findComponentById(comp.getFacet("listView"),injectTableColumnsId); - if (injectEditFieldsComponent==null) { - throw new NullPointerException("Could not find injectEditFieldsId: "+injectEditFieldsId); - } - if (injectTableOptionsComponent==null) { - throw new NullPointerException("Could not find injectTableOptionsId: "+injectTableOptionsId); - } - if (injectTableColumnsComponent==null) { - throw new NullPointerException("Could not find injectTableColumnsId: "+injectTableColumnsId); - } - - if (clean) { - logger.finer("Cleaning of all dynamic JSF components."); - injectEditFieldsComponent.getChildren().clear(); - injectTableOptionsComponent.getChildren().clear(); - injectTableColumnsComponent.getChildren().clear(); - } - logger.finer("Injection of all dynamic JSF components."); - try { - addEditFields(context, injectEditFieldsComponent); - addTableOptions(context, injectTableOptionsComponent); - addColumns(context,comp,injectTableColumnsComponent ); - } catch (Exception e) { - throw new RuntimeException("Error while injecting; "+e.getMessage(),e); - } - } - - private String i18n(VascEntry entry,String key,Object...params) { - return entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(key,params); - } - - - private void addEditFields(FacesContext fc,UIComponent grid) throws FacesException, VascException { - - Application application = fc.getApplication(); - UIViewRoot viewRoot = fc.getViewRoot(); - - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(grid); - VascEntry entry = comp.getVascEntry(); - String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY); - - int column = 0; - for (VascEntryField c:entry.getVascEntryFields()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderEdit(c)==false) { - continue; - } - //System.out.println("Multi edit size: "+c.getVascEntryFieldType().getUIComponentCount(c)+" of: "+c.getVascEntryFieldType()); - for (int i=0;i errors = entry.getVascFrontendData().getVascFrontendHelper().validateObjectField(field); - logger.fine("Validate: "+component+" errors: "+errors.size()+" value: "+object); - if (errors.isEmpty()) { - return; // no errors - } - - buf = new StringBuffer(200); - for (String err:errors) { - buf.append(err); - buf.append('\n'); - } - } catch (Exception e) { - e.printStackTrace(); - return; - } - - FacesMessage message = new FacesMessage(buf.toString()); - message.setSeverity(FacesMessage.SEVERITY_ERROR); - throw new ValidatorException(message); - } - } - - - private void addTableOptions(FacesContext fc,UIComponent grid) throws FacesException, VascException { - - //Application application = fc.getApplication(); - //UIViewRoot viewRoot = fc.getViewRoot(); - - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(grid); - VascEntry entry = comp.getVascEntry(); - - for (VascEntryField option:entry.getListOptions()) { - for (int i=0;i clazz = option.getVascEntryFieldType().getAutoDetectClass(); - if (clazz!=null && model.getValue()!=null) { - if (clazz.equals(model.getValue().getClass())==false) { - // lets try setting correct default. - try { - Constructor c = clazz.getConstructor(String.class); - Object value = c.newInstance(model.getValue()); - jsfEdit.setValue(value); - } catch (Exception e) { - throw new VascException(e); - } - } else { - jsfEdit.setValue(model.getValue()); // set default value - } - } - // i==0 is for multi field editor support... which is stell very in progress aka not working - if (i==0) { - entry.getVascFrontendData().addFieldVascUIComponents(option, editor,jsfEdit); - } - } - } - entry.getVascFrontendData().getVascFrontendHelper().headerOptionsCreatedFillData(entry); - } - public class ModelChangeListener implements ValueChangeListener,Serializable { - private static final long serialVersionUID = 1L; - VascValueModel model; - public ModelChangeListener(VascValueModel model) { - this.model=model; - } - public void processValueChange(ValueChangeEvent event) throws AbortProcessingException { - try { - model.setValue(event.getNewValue()); - } catch (VascException e) { - throw new AbortProcessingException(e); - } - } - } - - private void addColumns(FacesContext fc,JSFVascUIComponent comp,UIComponent table) { - - Application application = fc.getApplication(); - UIViewRoot viewRoot = fc.getViewRoot(); - - VascEntry entry = comp.getVascEntry(); - String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY); - String tableRecordVar = (String)comp.getAttributes().get(JSFVascUIComponent.TABLE_RECORD_VAR_KEY); - - if (!entry.getVascFrontendData().getVascFrontendHelper().getMultiRowActions(entry).isEmpty()) { - UIColumn colUp = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - colUp.setId(viewRoot.createUniqueId()); - - /* - // Select box head in table - HtmlCommandLink selectAll = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - selectAll.setId(viewRoot.createUniqueId()); - selectAll.setType("selectAll"); - MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".selectAllAction}"); - MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression); - selectAll.addActionListener(meActionListener); - - HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderUp.setId(viewRoot.createUniqueId()); - orderUp.setEscape(false); - orderUp.setValue("selectAll"); - - selectAll.getChildren().add(orderUp); - colUp.setHeader(selectAll); - */ - - HtmlSelectBooleanCheckbox select = (HtmlSelectBooleanCheckbox)application.createComponent(HtmlSelectBooleanCheckbox.COMPONENT_TYPE); - select.setId(viewRoot.createUniqueId()); - select.setStyleClass("js_table_select_all"); - ValueExpression ve1 = application.getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(),"#{"+entrySupportVar+".vascEntry.vascFrontendData.vascEntryState.multiActionSelection["+tableRecordVar+".recordId]}",Object.class); - select.setValueExpression("value", ve1); - - colUp.getChildren().add(select); - table.getChildren().add(colUp); - } - - - for (VascEntryField c:entry.getVascEntryFields()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderList(c)==false) { - continue; - } - UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - col.setId(viewRoot.createUniqueId()); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.setType(c.getId()); - - MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".sortAction}"); - MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression); - link.addActionListener(meActionListener); - - HtmlOutputText out2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out2.setId(viewRoot.createUniqueId()); - out2.setEscape(false); - out2.setValue(i18n(entry,c.getName())+" "); - - HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderUp.setId(viewRoot.createUniqueId()); - orderUp.setEscape(false); - orderUp.setValue("↑"); // ↑ - ValueExpression ren2 = application.getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".sortOrder==true and "+entrySupportVar+".sortField=='"+c.getId()+"'}", Boolean.class); - orderUp.setValueExpression("rendered", ren2); - - HtmlOutputText orderDown = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderDown.setId(viewRoot.createUniqueId()); - orderDown.setEscape(false); - orderDown.setValue("↓"); // ↓ - ValueExpression ren3 = application.getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".sortOrder==false and "+entrySupportVar+".sortField=='"+c.getId()+"'}", Boolean.class); - orderDown.setValueExpression("rendered", ren3); - - link.getChildren().add(out2); - link.getChildren().add(orderUp); - link.getChildren().add(orderDown); - col.setHeader(link); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - int index = VascDataBackendBean.getIndexId(c); - ValueExpression ve1 = application.getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(),"#{"+tableRecordVar+".field"+index+"}",Object.class); - out.setValueExpression("value", ve1); - - col.getChildren().add(out); - table.getChildren().add(col); - } - - if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) { - UIColumn colUp = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - colUp.setId(viewRoot.createUniqueId()); - - HtmlCommandLink linkUp = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - linkUp.setId(viewRoot.createUniqueId()); - linkUp.setType("up"); - MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".moveAction}"); - MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression); - linkUp.addActionListener(meActionListener); - - HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderUp.setId(viewRoot.createUniqueId()); - orderUp.setEscape(false); - orderUp.setValue("↑ up"); // ↑ - - linkUp.getChildren().add(orderUp); - colUp.getChildren().add(linkUp); - table.getChildren().add(colUp); - - HtmlCommandLink linkDown = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - linkDown.setId(viewRoot.createUniqueId()); - linkDown.setType("down"); - MethodExpression actionExpression2 = getMethodExpression("#{"+entrySupportVar+".moveAction}"); - MethodExpressionActionListener meActionListener2 = new MethodExpressionActionListener(actionExpression2); - linkDown.addActionListener(meActionListener2); - - UIColumn colDown = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - colDown.setId(viewRoot.createUniqueId()); - HtmlOutputText orderDown = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderDown.setId(viewRoot.createUniqueId()); - orderDown.setEscape(false); - orderDown.setValue("↓ down"); // ↓ - - linkDown.getChildren().add(orderDown); - colDown.getChildren().add(linkDown); - table.getChildren().add(colDown); - } - - for (VascLinkEntry vascLink:entry.getVascFrontendData().getVascFrontendHelper().getVascLinkEntryByType(entry, VascLinkEntryType.LIST)) { - UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - col.setId(viewRoot.createUniqueId()); - - UIOutput colHeader = (UIOutput)application.createComponent(UIOutput.COMPONENT_TYPE); - colHeader.setId(viewRoot.createUniqueId()); - colHeader.setValue("link"); - col.setHeader(colHeader); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.setType(vascLink.getId()); - MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".linkAction}"); - MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression); - link.addActionListener(meActionListener); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue(i18n(entry,vascLink.getName())); - - link.getChildren().add(out); - col.getChildren().add(link); - - table.getChildren().add(col); - } - - for (RowVascAction action:entry.getRowActions()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderRowVascAction(action)==false) { - continue; - } - if (AddRowAction.ACTION_ID.equals(action.getId())) { - continue; - } - - UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - col.setId(viewRoot.createUniqueId()); - - UIOutput colHeader = (UIOutput)application.createComponent(UIOutput.COMPONENT_TYPE); - colHeader.setId(viewRoot.createUniqueId()); - colHeader.setValue(i18n(entry,action.getName())); - col.setHeader(colHeader); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.setType(action.getId()); - MethodExpression actionExpression = getMethodExpression("#{"+entrySupportVar+".rowAction}"); - MethodExpressionActionListener meActionListener = new MethodExpressionActionListener(actionExpression); - link.addActionListener(meActionListener); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue(i18n(entry,action.getName())); - - link.getChildren().add(out); - col.getChildren().add(link); - - table.getChildren().add(col); - } - } - - private MethodExpression getMethodExpression(String name) { - Class[] argtypes = new Class[1]; - argtypes[0] = ActionEvent.class; - FacesContext facesCtx = FacesContext.getCurrentInstance(); - ELContext elContext = facesCtx.getELContext(); - return facesCtx.getApplication().getExpressionFactory().createMethodExpression(elContext, name, null, argtypes); - } - -}; \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascUIComponentTag.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascUIComponentTag.java deleted file mode 100644 index e5ceabd..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascUIComponentTag.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * 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.frontends.web.jsf; - - -import javax.el.ValueExpression; -import javax.faces.component.UIComponent; -import javax.faces.webapp.UIComponentELTag; - -/** - * - * - * @author Willem Cazander - * @version 1.0 Nov 16, 2008 - */ -public class JSFVascUIComponentTag extends UIComponentELTag { - - public static final String COMPONENT_TYPE = "vasc.jsf.component"; - public static final String RENDERER_TYPE = "vasc.jsf.component.renderer"; - - private ValueExpression vascController = null; - private ValueExpression vascFrontendData = null; - private ValueExpression entryName = null; - private ValueExpression entrySupportVar = null; - private ValueExpression tableRecordVar = null; - private ValueExpression injectEditFieldsId = null; - private ValueExpression injectTableOptionsId = null; - private ValueExpression injectTableColumnsId = null; - private ValueExpression disableLinkColumns = null; - - @Override - public String getComponentType() { - return COMPONENT_TYPE; - } - - @Override - public String getRendererType() { - return RENDERER_TYPE; - } - - /** - * @see javax.faces.webapp.UIComponentELTag#setProperties(javax.faces.component.UIComponent) - */ - @Override - protected void setProperties(UIComponent component) { - super.setProperties(component); - processProperty(component, vascController, JSFVascUIComponent.VASC_CONTROLLER_KEY); - processProperty(component, vascFrontendData, JSFVascUIComponent.VASC_FRONTEND_DATA_KEY); - processProperty(component, entryName, JSFVascUIComponent.ENTRY_NAME_KEY); - processProperty(component, entrySupportVar, JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY); - processProperty(component, tableRecordVar, JSFVascUIComponent.TABLE_RECORD_VAR_KEY); - processProperty(component, injectEditFieldsId, JSFVascUIComponent.INJECT_EDIT_FIELDS_ID); - processProperty(component, injectTableOptionsId,JSFVascUIComponent.INJECT_TABLE_OPTIONS_ID); - processProperty(component, injectTableColumnsId,JSFVascUIComponent.INJECT_TABLE_COLUMNS_ID); - processProperty(component, disableLinkColumns ,JSFVascUIComponent.DISABLE_LINK_COLUMNS); - } - - public void release() { - super.release(); - vascController = null; - vascFrontendData = null; - entryName = null; - entrySupportVar = null; - tableRecordVar = null; - injectEditFieldsId = null; - injectTableOptionsId = null; - injectTableColumnsId = null; - disableLinkColumns = null; - } - - protected final void processProperty(final UIComponent component, final ValueExpression property,final String propertyName) { - if (property != null) { - if(property.isLiteralText()) { - component.getAttributes().put(propertyName, property.getExpressionString()); - } else { - component.setValueExpression(propertyName, property); - } - } - } - - // ============= BEAN FIELDS - - /** - * @return the vascController - */ - public ValueExpression getVascController() { - return vascController; - } - - /** - * @param vascController the vascController to set - */ - public void setVascController(ValueExpression vascController) { - this.vascController = vascController; - } - - /** - * @return the entryName - */ - public ValueExpression getEntryName() { - return entryName; - } - - /** - * @param entryName the entryName to set - */ - public void setEntryName(ValueExpression entryName) { - this.entryName = entryName; - } - - /** - * @return the vascFrontendData - */ - public ValueExpression getVascFrontendData() { - return vascFrontendData; - } - - /** - * @param vascFrontendData the vascFrontendData to set - */ - public void setVascFrontendData(ValueExpression vascFrontendData) { - this.vascFrontendData = vascFrontendData; - } - - /** - * @return the entrySupportVar - */ - public ValueExpression getEntrySupportVar() { - return entrySupportVar; - } - - /** - * @param entrySupportVar the entrySupportVar to set - */ - public void setEntrySupportVar(ValueExpression entrySupportVar) { - this.entrySupportVar = entrySupportVar; - } - - /** - * @return the injectEditFieldsId - */ - public ValueExpression getInjectEditFieldsId() { - return injectEditFieldsId; - } - - /** - * @param injectEditFieldsId the injectEditFieldsId to set - */ - public void setInjectEditFieldsId(ValueExpression injectEditFieldsId) { - this.injectEditFieldsId = injectEditFieldsId; - } - - /** - * @return the injectTableOptionsId - */ - public ValueExpression getInjectTableOptionsId() { - return injectTableOptionsId; - } - - /** - * @param injectTableOptionsId the injectTableOptionsId to set - */ - public void setInjectTableOptionsId(ValueExpression injectTableOptionsId) { - this.injectTableOptionsId = injectTableOptionsId; - } - - /** - * @return the injectTableColumnsId - */ - public ValueExpression getInjectTableColumnsId() { - return injectTableColumnsId; - } - - /** - * @param injectTableColumnsId the injectTableColumnsId to set - */ - public void setInjectTableColumnsId(ValueExpression injectTableColumnsId) { - this.injectTableColumnsId = injectTableColumnsId; - } - - /** - * @return the tableRecordVar - */ - public ValueExpression getTableRecordVar() { - return tableRecordVar; - } - - /** - * @param tableRecordVar the tableRecordVar to set - */ - public void setTableRecordVar(ValueExpression tableRecordVar) { - this.tableRecordVar = tableRecordVar; - } - - /** - * @return the disableLinkColumns - */ - public ValueExpression getDisableLinkColumns() { - return disableLinkColumns; - } - - /** - * @param disableLinkColumns the disableLinkColumns to set - */ - public void setDisableLinkColumns(ValueExpression disableLinkColumns) { - this.disableLinkColumns = disableLinkColumns; - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascValidatePhaseListener.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascValidatePhaseListener.java deleted file mode 100644 index 4df464b..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/JSFVascValidatePhaseListener.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * - */ -package com.idcanet.vasc.frontends.web.jsf; - -import java.util.Iterator; -import java.util.Map; -import java.util.logging.Logger; - -import javax.faces.application.FacesMessage; -import javax.faces.component.UIComponent; -import javax.faces.component.UIInput; -import javax.faces.context.FacesContext; -import javax.faces.event.PhaseEvent; -import javax.faces.event.PhaseId; -import javax.faces.event.PhaseListener; -import javax.faces.validator.Validator; -import javax.faces.validator.ValidatorException; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.frontends.web.jsf.JSFVascUIComponentRenderer.VascJSFInputValidator2; - - -/** - * JSFVascValidatePhaseListener runs the vasc field edit fields. - * - * @author Willem Cazander - * @version 1.0 Nov 15, 2009 - */ -public class JSFVascValidatePhaseListener implements PhaseListener { - - private static final long serialVersionUID = 1L; - private Logger logger = null; - - public JSFVascValidatePhaseListener() { - logger = Logger.getLogger(JSFVascValidatePhaseListener.class.getName()); - } - - private static final String SAVE_ACTION_ID_HACK = "VASC_SAVE"; - - public void afterPhase(PhaseEvent event) { - FacesContext context = event.getFacesContext(); - - // we really only want validation this early when saveing. - // this is currently a bit hacky impl; - Map requestMap = context.getExternalContext().getRequestParameterMap(); - for (String key:requestMap.keySet()) { - if (key.contains(SAVE_ACTION_ID_HACK)) { - validateUIInput(context.getViewRoot(),context); - return; - } - } - } - public void beforePhase(PhaseEvent event) { - } - public PhaseId getPhaseId() { - return PhaseId.PROCESS_VALIDATIONS; - } - private void validateUIInput(UIComponent component,FacesContext context) { - if (component instanceof UIInput) { - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(component); - logger.finer("Validate UIInput: "+component+" comp: "+comp); - if (comp==null) { - return; // non-vasc ui-input - } - if (comp.getSupportBean().getSelected()==null) { - return; // no editing - } - VascEntry entry = comp.getVascEntry(); - if (entry.getVascFrontendData().getVascEntryState().getEntryDataObject()==null) { - return; // we are not in edit mode. - } - UIInput in = (UIInput)component; - for (Validator v:in.getValidators()) { - if (v instanceof VascJSFInputValidator2) { - VascJSFInputValidator2 validator = (VascJSFInputValidator2)v; - try { - in.setValid(true); - validator.validatePhase(context, in, in.getValue()); - } catch (ValidatorException ve) { - in.setValid(false); - - // note: ve has the message already but this is the UIInput way - FacesMessage message; - String validatorMessageString = in.getValidatorMessage(); - if (null != validatorMessageString) { - message = new FacesMessage(FacesMessage.SEVERITY_ERROR,validatorMessageString,validatorMessageString); - message.setSeverity(FacesMessage.SEVERITY_ERROR); - } else { - message = ve.getFacesMessage(); - } - if (message != null) { - context.addMessage(in.getClientId(context), message); - } - } - } - } - } - Iterator kids = component.getFacetsAndChildren(); - while (kids.hasNext()) { - UIComponent child = kids.next(); - validateUIInput(child,context); - } - } -} diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/OldVascUIComponent.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/OldVascUIComponent.java deleted file mode 100644 index c2a3ead..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/OldVascUIComponent.java +++ /dev/null @@ -1,1738 +0,0 @@ -/* - * 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.frontends.web.jsf; - -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.el.ValueExpression; -import javax.faces.application.Application; -import javax.faces.application.FacesMessage; -import javax.faces.component.UIColumn; -import javax.faces.component.UIComponent; -import javax.faces.component.UIComponentBase; -import javax.faces.component.UIInput; -import javax.faces.component.UIOutput; -import javax.faces.component.UIPanel; -import javax.faces.component.UIViewRoot; -import javax.faces.component.html.HtmlCommandButton; -import javax.faces.component.html.HtmlInputText; -import javax.faces.component.html.HtmlMessage; -import javax.faces.component.html.HtmlOutputText; -import javax.faces.component.html.HtmlDataTable; -import javax.faces.component.html.HtmlCommandLink; -import javax.faces.component.html.HtmlPanelGrid; -import javax.faces.component.html.HtmlPanelGroup; -import javax.faces.context.FacesContext; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; -import javax.faces.event.PhaseEvent; -import javax.faces.event.PhaseId; -import javax.faces.event.PhaseListener; -import javax.faces.model.DataModel; -import javax.faces.model.ListDataModel; -import javax.faces.validator.Validator; -import javax.faces.validator.ValidatorException; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; - -import org.apache.myfaces.custom.datalist.HtmlDataList; - -import com.idcanet.vasc.core.AbstractVascFrontend; -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.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.VascFrontendData; -import com.idcanet.vasc.core.VascLinkEntry; -import com.idcanet.vasc.core.actions.GlobalVascAction; -import com.idcanet.vasc.core.actions.RowVascAction; -import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener; -import com.idcanet.vasc.core.entry.VascEntryExporter; -import com.idcanet.vasc.core.entry.VascEntryFieldValue; -import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType; -import com.idcanet.vasc.core.ui.VascOptionValueModelListener; -import com.idcanet.vasc.core.ui.VascValueModel; -import com.idcanet.vasc.frontends.web.jsf.ui.JSFBoolean; -import com.idcanet.vasc.frontends.web.jsf.ui.JSFLabel; -import com.idcanet.vasc.frontends.web.jsf.ui.JSFList; -import com.idcanet.vasc.frontends.web.jsf.ui.JSFText; -import com.idcanet.vasc.frontends.web.jsf.ui.JSFTextArea; -import com.idcanet.vasc.impl.VascBackendProxyFilter; -import com.idcanet.vasc.impl.VascBackendProxyPaged; -import com.idcanet.vasc.impl.VascBackendProxySearch; -import com.idcanet.vasc.impl.VascBackendProxySort; - -/** - * Only here for archive a bit, does not work anymore. - * - * Renders an JSF vasc entry views. - * - * This is a bit hacky because I'm not a JSF guro. - * - * @author Willem Cazander - * @version 1.0 Nov 16, 2008 - */ -public class OldVascUIComponent extends UIComponentBase { - - public static final String COMPONENT_TYPE = "com.idcanet.vasc.frontends.web.jsf.VascUIComponent"; - private Object[] state = null; - private ValueExpression vascController = null; - private ValueExpression vascFrontendData = null; - private ValueExpression entryName = null; - private String viewId = null; - private String editId = null; - private String exportId = null; - private String deleteId = null; - private String entryNameRealId = null; - private boolean defaultRenderView = false; - private JSFFrontendRenderer renderer = null; - private DataModel tableDataModel = null; - private DataModel pagesDataModel = null; - private String selectedRecordName = "selectedRecord"; - public VascEntryExporter exporter = null; - public String entryNameOldId = null; - - public void resetViews() { - UIPanel panel = getPanel("viewId"); - panel.setRendered(false); - panel = getPanel("editId"); - panel.setRendered(false); - panel = getPanel("exportId"); - panel.setRendered(false); - panel = getPanel("deleteId"); - panel.setRendered(false); - } - - public UIPanel getPanel(String panel) { - if ("viewId".equals(panel)) { - return findUIPanel(viewId); - } - if ("editId".equals(panel)) { - return findUIPanel(editId); - } - if ("exportId".equals(panel)) { - return findUIPanel(exportId); - } - if ("deleteId".equals(panel)) { - return findUIPanel(deleteId); - } - throw new IllegalArgumentException("ID field unknow."); - } - - private UIPanel findUIPanel(String panelId) { - for (UIComponent c:this.getChildren()) { - if (panelId.equals(c.getId())) { - return (UIPanel)c; - } - } - return null; - } - - protected String i18n(String key,Object...params) { - VascEntry entry = getVascEntry(); - return entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(key,params); - } - - public VascEntry getVascEntry() { - return renderer.getVascEntry(); - } - - - public VascEntry createClonedVascEntry() { - if (vascController==null) { - throw new NullPointerException("vascController is not set."); - } - if (entryName==null) { - throw new NullPointerException("entryName is not set."); - } - String vascEntityName = null; - VascController vascControllerObj = null; - - if (vascController.isLiteralText()) { - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), vascController.getExpressionString(), VascController.class); - vascControllerObj = (VascController)ve2.getValue(FacesContext.getCurrentInstance().getELContext()); - } else { - vascControllerObj = (VascController)vascController.getValue(FacesContext.getCurrentInstance().getELContext()); - } - - if (entryName.isLiteralText()) { - if (entryName.getExpressionString().startsWith("#") | entryName.getExpressionString().startsWith("$")) { - ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), entryName.getExpressionString(), String.class); - String res = (String)ve3.getValue(FacesContext.getCurrentInstance().getELContext()); - vascEntityName = res; - } else { - vascEntityName = entryName.getExpressionString(); - } - } else { - vascEntityName = (String)entryName.getValue(FacesContext.getCurrentInstance().getELContext()); - } - - if (entryNameRealId!=null | "".equals(vascEntityName)) { - vascEntityName = entryNameRealId; - } - - VascEntry entry = vascControllerObj.getVascEntryController().getVascEntryById(vascEntityName); - if (entry==null) { - throw new NullPointerException("Could not locate '"+vascEntityName+"' from : "+vascControllerObj+" ("+entryName.getExpressionString()+")"); - } - - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), vascFrontendData.getExpressionString(), VascFrontendData.class); - VascFrontendData frontendData = (VascFrontendData)ve2.getValue(FacesContext.getCurrentInstance().getELContext()); - try { - frontendData.initFrontendListeners(entry); - } catch (InstantiationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - frontendData.setVascController(vascControllerObj); - entry.setVascFrontendData(frontendData); - - VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendController().getVascBackendById(entry.getBackendId()); - - 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); - } - frontendData.getVascEntryState().setVascBackend(backend); - - entry.getVascFrontendData().addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() { - private static final long serialVersionUID = 1L; - public VascFrontendEventType[] getEventTypes() { - VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE}; - return result; - } - public void vascEvent(VascEntry entry, Object dataNotUsed) { - List data = entry.getVascFrontendData().getVascEntryState().getEntryDataList(); - for (VascEntryField field:entry.getVascEntryFields()) { - if (field.getVascEntryFieldValue()==null) { - VascEntryFieldValue v = entry.getVascFrontendData().getVascEntryState().getVascBackend().provideVascEntryFieldValue(field); - field.setVascEntryFieldValue(v); - } - } - List result = new ArrayList(data.size()); - int index = 0; - for (Object o:data) { - VascDataBackendBean b = new VascDataBackendBean(entry,o,index); - result.add(b); - index++; - } - tableDataModel.setWrappedData(result); - pagesDataModel.setWrappedData(entry.getVascFrontendData().getVascFrontendHelper().getVascBackendPageNumbers(entry)); - - // ui value - ValueExpression ren3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['totalPageResults']}", Integer.class); - ren3.setValue(FacesContext.getCurrentInstance().getELContext(), getVascEntry().getVascFrontendData().getVascEntryState().getEntryDataList().size()); - ValueExpression ren4 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['totalResults']}", Integer.class); - ren4.setValue(FacesContext.getCurrentInstance().getELContext(), getVascEntry().getVascFrontendData().getVascEntryState().getTotalBackendRecords()); - } - }); - - return entry; - } - - static public OldVascUIComponent findVascParent(UIComponent comp) { - if (comp==null) { - return null; - } - if (comp instanceof OldVascUIComponent) { - return (OldVascUIComponent)comp; - } - return findVascParent(comp.getParent()); - } - - static public OldVascUIComponent findVascChild(UIComponent comp,String entryId) { - if (comp==null) { - return null; - } - //System.out.println("Checking object: "+comp); - if (comp instanceof OldVascUIComponent) { - OldVascUIComponent ui = (OldVascUIComponent)comp; - if (entryId.equals(ui.getVascEntry().getId())) { - return ui; - } - return null; // this is a other entry on this view - } - for (UIComponent c:comp.getChildren()) { - Object res = findVascChild(c,entryId); - if (res!=null) { - return (OldVascUIComponent)res; // found - } - } - return null; - } - - /** - * Finds component with the given id - */ - static public UIComponent findComponentById(UIComponent c, String id) { - if (id.equals(c.getId())) { - return c; - } - Iterator kids = c.getFacetsAndChildren(); - while (kids.hasNext()) { - UIComponent found = findComponentById(kids.next(), id); - if (found != null) { - return found; - } - } - return null; - } - - - @SuppressWarnings("unchecked") - public static void renderChildren2(FacesContext facesContext, UIComponent component) throws IOException { - if (component.getChildCount() <= 0) { - return; - } - for (Iterator it = component.getChildren().iterator(); it.hasNext(); ) { - UIComponent child = (UIComponent)it.next(); - renderChild2(facesContext, child); - } - } - public static void renderChild2(FacesContext facesContext, UIComponent child) throws IOException { - if (!child.isRendered()) { - return; - } - child.encodeBegin(facesContext); - if (child.getRendersChildren()) { - child.encodeChildren(facesContext); - } else { - renderChildren2(facesContext, child); - } - child.encodeEnd(facesContext); - } - - // ==== JSF Stuff - - public String getFamily () { - return COMPONENT_TYPE; - } - - public void restoreState(FacesContext context, Object stateObject) { - state = (Object[])stateObject; - vascController=(ValueExpression)state[0]; - entryName=(ValueExpression)state[1]; - viewId=(String)state[2]; - editId=(String)state[3]; - exportId=(String)state[4]; - deleteId=(String)state[5]; - entryNameRealId=(String)state[6]; - renderer=(JSFFrontendRenderer)state[7]; - tableDataModel=(DataModel)state[8]; - pagesDataModel=(DataModel)state[9]; - vascFrontendData=(ValueExpression)state[10]; - exporter=(VascEntryExporter)state[11]; - entryNameOldId=(String)state[12]; - } - - public Object saveState(FacesContext context) { - state = new Object[13]; - state[0]=vascController; - state[1]=entryName; - state[2]=viewId; - state[3]=editId; - state[4]=exportId; - state[5]=deleteId; - state[6]=entryNameRealId; - state[7]=renderer; - state[8]=tableDataModel; - state[9]=pagesDataModel; - state[10]=vascFrontendData; - state[11]=exporter; - state[12]=entryNameOldId; - return state; - } - - protected void init() { - if (renderer!=null) { - return; - } - VascEntry entry = createClonedVascEntry(); - try { - ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['entryId']}", String.class); - ren2.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getId()); - tableDataModel = new ListDataModel(); - pagesDataModel = new ListDataModel(); - - renderer = new JSFFrontendRenderer(); - renderer.initEntry(entry); - - viewId = createView(entry); - editId = createEdit(entry); - exportId = createExport(entry); - deleteId = createDelete(entry); - entryNameRealId = getVascEntry().getId(); - - resetViews(); - UIPanel panel = getPanel("viewId"); - panel.setRendered(true); - - defaultRenderView = true; - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - - protected void initGoto(VascLinkEntry link) { - this.getChildren().clear(); - - if (link!=null) { - entryNameOldId = entryNameRealId; - entryNameRealId = link.getVascEntryId(); - } else { - // back to old id - entryNameRealId = entryNameOldId; - entryNameOldId = null; // removed back link. - } - - // reset some stuff - ValueExpression ve1 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortOrder']}", Boolean.class); - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortField']}", String.class); - ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.searchString}", String.class); - ve1.setValue(FacesContext.getCurrentInstance().getELContext(), null); - ve2.setValue(FacesContext.getCurrentInstance().getELContext(), null); - ve3.setValue(FacesContext.getCurrentInstance().getELContext(), null); - - try { - VascEntry entryOld = getVascEntry(); - VascEntry entry = createClonedVascEntry(); - - if (link!=null) { - Object selected = getSelectedTableObject(); - for (String parameterName:link.getEntryParameterFieldIdKeys()) { - String fieldId = link.getEntryParameterFieldId(parameterName); - VascEntryField v = entryOld.getVascEntryFieldById(fieldId); - Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected); - - // set data parameter on new vasc entry - entry.getVascFrontendData().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue); - } - - for (String fieldId:link.getEntryCreateFieldValueKeys()) { - String selectedfieldId = link.getEntryParameterFieldId(fieldId); - Object selectedValue = selected; - if (selectedfieldId!=null) { - VascEntryField v = entryOld.getVascEntryFieldById(selectedfieldId); - selectedValue = v.getVascEntryFieldValue().getValue(v, selected); - } - - // create listener for new objects - entry.getVascFrontendData().addVascEntryFrontendEventListener(new CreateEntryFieldValuesListener(fieldId,selectedValue)); - } - } - - ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['entryId']}", String.class); - ren2.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getId()); - - renderer = new JSFFrontendRenderer(); - renderer.initEntry(entry); - - viewId = createView(entry); - editId = createEdit(entry); - exportId = createExport(entry); - deleteId = createDelete(entry); - entryNameRealId = getVascEntry().getId(); - - resetViews(); - UIPanel panel = getPanel("viewId"); - panel.setRendered(true); - - defaultRenderView = true; - } catch (Exception e) { - getVascEntry().getVascFrontendData().getVascFrontendHelper().handleException(getVascEntry(), e); - } - } - - class CreateEntryFieldValuesListener implements VascEntryFrontendEventListener { - private static final long serialVersionUID = 1L; - private String fieldId = null; - private Object value = null; - public CreateEntryFieldValuesListener(String fieldId,Object value) { - if (fieldId==null) { - throw new NullPointerException("fieldId may not be null"); - } - this.fieldId=fieldId; - this.value=value; - } - public VascFrontendEventType[] getEventTypes() { - VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.DATA_CREATE}; - return result; - } - public void vascEvent(VascEntry entry,Object data) { - VascEntryField field = entry.getVascEntryFieldById(fieldId); - try { - field.getVascEntryFieldValue().setValue(field, data, value); - } catch (VascException e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - - public Object getSelectedTableObject() { - DataModel dm = tableDataModel; - Object selected = dm.getRowData(); - if (selected==null) { - return null; - } - VascDataBackendBean r = (VascDataBackendBean) selected; - return r.getRecord(); - } - - public VascDataBackendBean getSelectedTableBean() { - DataModel dm = tableDataModel; - Object selected = dm.getRowData(); - if (selected==null) { - return null; - } - VascDataBackendBean r = (VascDataBackendBean) selected; - return r; - } - - /** - * @see javax.faces.component.UIComponentBase#encodeBegin(javax.faces.context.FacesContext) - */ - @Override - public void encodeBegin(FacesContext context) throws IOException { - // all work done in encodeEnd() - } - - /** - * @see javax.faces.component.UIComponentBase#encodeChildren(javax.faces.context.FacesContext) - */ - @Override - public void encodeChildren(FacesContext arg0) throws IOException { - // all work done in encodeEnd() - } - - /** - * @see javax.faces.component.UIComponentBase#encodeEnd(javax.faces.context.FacesContext) - */ - @Override - public void encodeEnd(FacesContext context) throws IOException { - - //UIComponent deleteComponent = getFacet("deleteForm"); - //if (deleteComponent != null) { - // deleteComponent.encodeAll(context); - //} - - if (defaultRenderView) { - VascEntry entry = getVascEntry(); - JSFFrontendRenderer r = (JSFFrontendRenderer)entry.getVascFrontendData().getVascFrontend(); - if (r==null) { - return; - } - try { - r.renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - - context.getViewRoot().addPhaseListener(new VascValidatePhase()); - } - } - - class VascValidatePhase implements PhaseListener { - private static final long serialVersionUID = 1L; - public void afterPhase(PhaseEvent event) { - FacesContext context = event.getFacesContext(); - validateUIInput(context.getViewRoot(),context); - } - public void beforePhase(PhaseEvent event) { - } - public PhaseId getPhaseId() { - return PhaseId.PROCESS_VALIDATIONS; - } - private void validateUIInput(UIComponent component,FacesContext context) { - if (component instanceof UIInput) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(component); - if (comp==null) { - return; // non-vasc ui-input - } - VascEntry entry = comp.getVascEntry(); - if (entry.getVascFrontendData().getVascEntryState().getEntryDataObject()==null) { - return; // we are not in edit mode. - } - UIInput in = (UIInput)component; - for (Validator v:in.getValidators()) { - if (v instanceof VascJSFInputValidator) { - VascJSFInputValidator validator = (VascJSFInputValidator)v; - try { - in.setValid(true); - //Object value = in.getValue(); - //System.out.println("Checking value: "+value); - validator.validatePhase(context, in, in.getValue()); - } catch (ValidatorException ve) { - //System.out.println("Error"); - in.setValid(false); - - // note: ve has the message already but this is the UIInput way - FacesMessage message; - String validatorMessageString = in.getValidatorMessage(); - if (null != validatorMessageString) { - message = new FacesMessage(FacesMessage.SEVERITY_ERROR,validatorMessageString,validatorMessageString); - message.setSeverity(FacesMessage.SEVERITY_ERROR); - } else { - message = ve.getFacesMessage(); - } - if (message != null) { - context.addMessage(in.getClientId(context), message); - } - } - } - } - } - for (UIComponent child:component.getChildren()) { - validateUIInput(child,context); - } - } - } - - - /** - * @return the vascController - */ - public ValueExpression getVascController() { - return vascController; - } - - /** - * @param vascController the vascController to set - */ - public void setVascController(ValueExpression vascController) { - this.vascController = vascController; - } - - /** - * @return the entryName - */ - public ValueExpression getEntryName() { - return entryName; - } - - /** - * @param entryName the entryName to set - */ - public void setEntryName(ValueExpression entryName) { - this.entryName = entryName; - } - - /** - * @return the vascFrontendData - */ - public ValueExpression getVascFrontendData() { - return vascFrontendData; - } - - /** - * @param vascFrontendData the vascFrontendData to set - */ - public void setVascFrontendData(ValueExpression vascFrontendData) { - this.vascFrontendData = vascFrontendData; - } - - /** - * @return the selectedRecordName - */ - public String getSelectedRecordName() { - return selectedRecordName; - } - - /** - * @param selectedRecordName the selectedRecordName to set - */ - public void setSelectedRecordName(String selectedRecordName) { - this.selectedRecordName = selectedRecordName; - } - - public String createDelete(VascEntry entry) throws Exception { - - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - - UIPanel panelDelete = (UIPanel)application.createComponent(UIPanel.COMPONENT_TYPE); - panelDelete.setId(viewRoot.createUniqueId()); - - this.getFacetsAndChildren(); - - HtmlOutputText title = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - title.setId(viewRoot.createUniqueId()); - title.setValue("

"+i18n(entry.getName())+"

"); - title.setEscape(false); - panelDelete.getChildren().add(title); - - //HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - //br.setId(viewRoot.createUniqueId()); - //br.setValue("

"); - //br.setEscape(false); - //panelDelete.getChildren().add(br); - - HtmlOutputText header = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - header.setId(viewRoot.createUniqueId()); - header.setValue(i18n(entry.getDeleteDescription())); - panelDelete.getChildren().add(header); - - HtmlOutputText br2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br2.setId(viewRoot.createUniqueId()); - br2.setValue("

"); - br2.setEscape(false); - panelDelete.getChildren().add(br2); - - HtmlOutputText text = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - text.setId(viewRoot.createUniqueId()); - panelDelete.getChildren().add(text); - int index = VascDataBackendBean.getIndexId(entry.getVascEntryFieldById(entry.getDisplayNameFieldId())); - ValueExpression ve7 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected.field"+index+"}", Object.class); - text.setValueExpression("value", ve7); - - HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br.setId(viewRoot.createUniqueId()); - br.setValue("
"); - br.setEscape(false); - panelDelete.getChildren().add(br); - - HtmlCommandButton save = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE); - save.setId(viewRoot.createUniqueId()); - save.addActionListener(new DeleteActionListener()); - save.setImmediate(true); - save.setValue("Delete"); - panelDelete.getChildren().add(save); - - HtmlOutputText space = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space.setId(viewRoot.createUniqueId()); - space.setValue(" "); - space.setEscape(false); - panelDelete.getChildren().add(space); - - HtmlCommandButton cancel = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE); - cancel.setId(viewRoot.createUniqueId()); - cancel.addActionListener(new BackActionListener()); - cancel.setImmediate(true); - cancel.setValue("Cancel"); - panelDelete.getChildren().add(cancel); - - this.getChildren().add(panelDelete); - return panelDelete.getId(); - } - - public String createEdit(VascEntry entry) throws Exception { - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - - UIPanel panelEdit = (UIPanel)application.createComponent(UIPanel.COMPONENT_TYPE); - panelEdit.setId(viewRoot.createUniqueId()); - - HtmlOutputText title = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - title.setId(viewRoot.createUniqueId()); - title.setValue("

"+i18n(entry.getName())+"

"); - title.setEscape(false); - panelEdit.getChildren().add(title); - - //HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - //br.setId(viewRoot.createUniqueId()); - //br.setValue("

"); - //br.setEscape(false); - //panelEdit.getChildren().add(br); - - /* - String displayFieldId = entry.getDisplayNameFieldId(); - VascEntryField dis = entry.getVascEntryFieldById(displayFieldId); - if (dis==null) { - throw new RuntimeException("Could not find: "+displayFieldId+" from: "+entry.getId()); - } - String name = null; - try { - Object bean = entry.getVascFrontendData().getEntryDataObject(); - name = dis.getVascEntryFieldValue().getDisplayValue(dis, bean); - } catch (VascException e) { - throw new RuntimeException("Could not display value from "+entry.getId(),e); - }*/ - - HtmlOutputText header = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - header.setEscape(false); - header.setId(viewRoot.createUniqueId()); - header.setValue(i18n(entry.getEditDescription())); - panelEdit.getChildren().add(header); - - HtmlOutputText br2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br2.setId(viewRoot.createUniqueId()); - br2.setValue("

"); - br2.setEscape(false); - panelEdit.getChildren().add(br2); - - HtmlPanelGrid grid = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE); - grid.setId(viewRoot.createUniqueId()); - grid.setColumns(3); - grid.setStyleClass("form"); - //grid.setHeaderClass("style_tableHeader1"); - //grid.setColumnClasses("style_tableDarkGray_dub, style_tableLightGray_dub, style_tableLightGray_dub"); - panelEdit.getChildren().add(grid); - - HtmlOutputText gridHeaderText = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - gridHeaderText.setId(viewRoot.createUniqueId()); - gridHeaderText.setValue("Edit"); - //grid.getFacets().put("header", gridHeaderText); - - int column = 0; - for (VascEntryField c:entry.getVascEntryFields()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderEdit(c)==false) { - continue; - } - - for (int i=0;i"); - br.setEscape(false); - panelEdit.getChildren().add(br); - - HtmlCommandButton save = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE); - save.setId(viewRoot.createUniqueId()); - save.addActionListener(new SaveActionListener()); - save.setValue("Save"); - panelEdit.getChildren().add(save); - - HtmlOutputText space = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space.setId(viewRoot.createUniqueId()); - space.setValue(" "); - space.setEscape(false); - panelEdit.getChildren().add(space); - - HtmlCommandButton cancel = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE); - cancel.setId(viewRoot.createUniqueId()); - cancel.addActionListener(new BackActionListener()); - cancel.setValue("Cancel"); - cancel.setImmediate(true); - panelEdit.getChildren().add(cancel); - - this.getChildren().add(panelEdit); - return panelEdit.getId(); - } - class VascJSFInputValidator implements Validator,Serializable { - private static final long serialVersionUID = -5715250529474737642L; - String fieldId = null; - public VascJSFInputValidator(String fieldId) { - this.fieldId=fieldId; - } - public void validate(FacesContext context, UIComponent component,Object object) throws ValidatorException { - // always oke, we are runned by phase listener - } - public void validatePhase(FacesContext context, UIComponent component,Object object) throws ValidatorException { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(component); - VascEntry entry = comp.getVascEntry(); - VascEntryField field = entry.getVascEntryFieldById(fieldId); - - // note we have to set the value to the vasc backend before we can run validation - int index = VascDataBackendBean.getIndexId(field); - ValueExpression ve7 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected.field"+index+"}", Object.class); - ve7.setValue(FacesContext.getCurrentInstance().getELContext(), object); - - List errors = entry.getVascFrontendData().getVascFrontendHelper().validateObjectField(field); - //System.out.println("Validate: "+component+" errors: "+errors.size()+" value: "+object); - if (errors.isEmpty()) { - return; // no errors - } - - StringBuffer buf = new StringBuffer(200); - for (String err:errors) { - buf.append(err); - buf.append('\n'); - } - FacesMessage message = new FacesMessage(buf.toString()); - message.setSeverity(FacesMessage.SEVERITY_ERROR); - throw new ValidatorException(message); - } - } - - public String createExport(VascEntry entry) throws Exception { - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - - UIPanel panelExport = (UIPanel)application.createComponent(UIPanel.COMPONENT_TYPE); - panelExport.setId(viewRoot.createUniqueId()); - - HtmlOutputText title = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - title.setId(viewRoot.createUniqueId()); - title.setValue("

"+i18n(entry.getName())+"

"); - title.setEscape(false); - panelExport.getChildren().add(title); - - HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br.setId(viewRoot.createUniqueId()); - br.setValue("

"); - br.setEscape(false); - panelExport.getChildren().add(br); - - HtmlOutputText header = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - header.setEscape(false); - header.setId(viewRoot.createUniqueId()); - header.setValue(i18n(entry.getListDescription())); - panelExport.getChildren().add(header); - - HtmlOutputText br2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br2.setId(viewRoot.createUniqueId()); - br2.setValue("

"); - br2.setEscape(false); - panelExport.getChildren().add(br2); - - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new BackActionListener()); - - - HtmlCommandLink linkExport = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - linkExport.setId(viewRoot.createUniqueId()); - linkExport.addActionListener(new ExportActionListener()); - linkExport.setValue("Download"); - linkExport.setImmediate(true); - panelExport.getChildren().add(linkExport); - - br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br.setId(viewRoot.createUniqueId()); - br.setValue("

"); - br.setEscape(false); - panelExport.getChildren().add(br); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue("Back"); - - link.getChildren().add(out); - panelExport.getChildren().add(link); - - - - this.getChildren().add(panelExport); - return panelExport.getId(); - } - - @SuppressWarnings("serial") - class ExportActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - try { - VascEntryExporter ex = comp.exporter; - if (ex==null) { - // todo: should not happen ? - FacesContext fc = FacesContext.getCurrentInstance(); - fc.responseComplete(); - return; - } - - - FacesContext fc = FacesContext.getCurrentInstance(); - HttpServletResponse response = (HttpServletResponse)fc.getExternalContext().getResponse(); - String filename = "export-list."+ex.getType(); - response.setHeader("Content-disposition", "attachment; filename=" + filename); - String contentType = ex.getMineType(); - response.setContentType(contentType); - ServletOutputStream out = response.getOutputStream(); - - - ex.doExport(out, entry); - out.close(); - - fc.responseComplete(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - - - @SuppressWarnings("serial") - class BackActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null); - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected}", Object.class); - VascDataBackendBean editObject = (VascDataBackendBean) ve2.getValue(FacesContext.getCurrentInstance().getELContext()); - if (editObject!=null) { - editObject.setRealValue(false); - } - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - - @SuppressWarnings("serial") - class DeleteActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - @SuppressWarnings("serial") - class SaveActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected}", Object.class); - VascDataBackendBean editObject = (VascDataBackendBean) ve2.getValue(FacesContext.getCurrentInstance().getELContext()); - - entry.getVascFrontendData().getVascEntryState().setEntryDataObject(editObject.getRecord()); - - entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - @SuppressWarnings("serial") - class PageLinkActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - Integer pageIndex = (Integer)((HtmlCommandLink)event.getComponent()).getValue(); - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - - entry.getVascFrontendData().getVascFrontendHelper().pageAction(entry, pageIndex); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - @SuppressWarnings("serial") - class SortActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - String fieldIdString = ((HtmlCommandLink)event.getComponent()).getType(); - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - VascEntryField field = entry.getVascEntryFieldById(fieldIdString); - - entry.getVascFrontendData().getVascFrontendHelper().sortAction(entry, field); - - ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortOrder']}", Boolean.class); - ValueExpression ren3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortField']}", String.class); - ren2.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendData().getVascEntryState().getVascBackendState().isSortAscending()); - ren3.setValue(FacesContext.getCurrentInstance().getELContext(), field.getId()); - - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - @SuppressWarnings("serial") - class SearchActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - - ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.searchString}", String.class); - String ss = (String)ve3.getValue(FacesContext.getCurrentInstance().getELContext()); - - entry.getVascFrontendData().getVascFrontendHelper().searchAction(entry, ss); - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - @SuppressWarnings("serial") - class MoveActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - String to = (String)((HtmlCommandLink)event.getComponent()).getType(); - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - Object selected = comp.getSelectedTableObject(); - if ("up".equals(to)) { - entry.getVascFrontendData().getVascFrontendHelper().moveAction(entry,selected,true); - } - if ("down".equals(to)) { - entry.getVascFrontendData().getVascFrontendHelper().moveAction(entry,selected,false); - } - try { - entry.getVascFrontendData().getVascFrontend().renderView(); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - } - - public String createView(VascEntry entry) throws Exception { - - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - - UIPanel panelView = (UIPanel)application.createComponent(UIPanel.COMPONENT_TYPE); - panelView.setId(viewRoot.createUniqueId()); - - HtmlOutputText title = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - title.setId(viewRoot.createUniqueId()); - title.setValue("

"+i18n(entry.getName())+"

"); - title.setEscape(false); - panelView.getChildren().add(title); - - //HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - //br.setId(viewRoot.createUniqueId()); - //br.setValue("

"); - //br.setEscape(false); - //panelView.getChildren().add(br); - - HtmlOutputText header = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - header.setEscape(false); - header.setId(viewRoot.createUniqueId()); - header.setValue(i18n(entry.getListDescription())); - panelView.getChildren().add(header); - - HtmlOutputText br = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - br.setId(viewRoot.createUniqueId()); - br.setValue("

"); - br.setEscape(false); - panelView.getChildren().add(br); - - HtmlOutputText tabHeader = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - tabHeader.setId(viewRoot.createUniqueId()); - tabHeader.setValue(""); - tabHeader.setEscape(false); - panelView.getChildren().add(tabHeader); - - HtmlPanelGrid grid = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE); - grid.setId(viewRoot.createUniqueId()); - grid.setColumns(1); - grid.setStyleClass("form"); - grid.setWidth("100%"); - panelView.getChildren().add(grid); - - HtmlPanelGroup options = (HtmlPanelGroup)application.createComponent(HtmlPanelGroup.COMPONENT_TYPE); - options.setId(viewRoot.createUniqueId()); - grid.getChildren().add(options); - - //HtmlPanelGroup gridOption = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE); - //gridOption.setId(viewRoot.createUniqueId()); - //gridOption.setColumns(1); - //gridOption.setColumnClasses("style_tableDarkGray_dub"); - //options.getChildren().add(gridOption); - - for (VascEntryField option:entry.getListOptions()) { - for (int i=0;i"); - br.setEscape(false); - panelView.getChildren().add(br); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new VascLinkBackActionListener()); - link.setValue("Back"); - - panelView.getChildren().add(link); - } - - HtmlPanelGrid gridHeader = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE); - gridHeader.setId(viewRoot.createUniqueId()); - gridHeader.setColumns(3); - gridHeader.setColumnClasses(" , , style_tableHeader1"); - gridHeader.setWidth("90%"); - panelView.getChildren().add(gridHeader); - - HtmlPanelGroup gotoGroup = (HtmlPanelGroup)application.createComponent(HtmlPanelGroup.COMPONENT_TYPE); - gotoGroup.setId(viewRoot.createUniqueId()); - gridHeader.getChildren().add(gotoGroup); - - VascBackend backend = entry.getVascFrontendData().getVascEntryState().getVascBackend(); - // create pageing - if (backend.isPageable()) { - - HtmlOutputText gotoText = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - gotoText.setId(viewRoot.createUniqueId()); - gotoText.setValue("Ga naar pagina: "); - gotoGroup.getChildren().add(gotoText); - - HtmlDataList table = (HtmlDataList)application.createComponent(HtmlDataList.COMPONENT_TYPE); - table.setVar("vascPage"); - table.setId(viewRoot.createUniqueId()); - table.setValue(pagesDataModel); - table.setLayout("simple"); - gotoGroup.getChildren().add(table); - - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascPage.pageNumber}", Integer.class); - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new PageLinkActionListener()); - link.setValueExpression("value", ve2); - ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascPage.selected?'style_header1':''}", String.class); - link.setValueExpression("styleClass", ren2); - - //HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - //out.setId(viewRoot.createUniqueId()); - //out.setValueExpression("value", ve2); - //ValueExpression ren = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascPage.notSelected}", Boolean.class); - //out.setValueExpression("rendered", ren); - - //HtmlOutputText out2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - //out2.setId(viewRoot.createUniqueId()); - //out2.setStyleClass("style_header1"); - //out2.setValueExpression("value", ve2); - //ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascPage.selected}", Boolean.class); - //out2.setValueExpression("rendered", ren2); - - //link.getChildren().add(out); - //link.getChildren().add(out2); - table.getChildren().add(link); - - HtmlOutputText space2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space2.setId(viewRoot.createUniqueId()); - space2.setValue(" "); - space2.setEscape(false); - table.getChildren().add(space2); - } - - HtmlOutputText space2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space2.setId(viewRoot.createUniqueId()); - space2.setValue(" "); - space2.setEscape(false); - gridHeader.getChildren().add(space2); - - HtmlPanelGroup actionGroup = (HtmlPanelGroup)application.createComponent(HtmlPanelGroup.COMPONENT_TYPE); - actionGroup.setId(viewRoot.createUniqueId()); - gridHeader.getChildren().add(actionGroup); - - for (GlobalVascAction action:entry.getGlobalActions()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderGlobalVascAction(action)==false) { - continue; - } - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.setType(action.getId()); - link.addActionListener(new VascGlobalActionListener(action.getId())); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue(i18n(action.getName())); - - link.getChildren().add(out); - actionGroup.getChildren().add(link); - - HtmlOutputText space = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space.setId(viewRoot.createUniqueId()); - space.setValue(" "); - space.setEscape(false); - actionGroup.getChildren().add(space); - } - - // keep add button seperate - for (RowVascAction action:entry.getRowActions()) { - if ("addRowAction".equals(action.getId())==false) { - continue; - } - if (entry.getVascFrontendData().getVascFrontendHelper().renderRowVascAction(action)==false) { - continue; - } - HtmlOutputText space = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - space.setId(viewRoot.createUniqueId()); - space.setValue("     "); - space.setEscape(false); - actionGroup.getChildren().add(space); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new VascRowActionListener(action.getId())); - link.setImmediate(true); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue(i18n(action.getName())); - - link.getChildren().add(out); - actionGroup.getChildren().add(link); - } - - HtmlDataTable table = (HtmlDataTable)application.createComponent(HtmlDataTable.COMPONENT_TYPE); - table.setVar("vascRecord"); - table.setId(viewRoot.createUniqueId()); - //table.setWidth("90%"); - table.setStyleClass("utr"); - table.setRowClasses("row, row2"); - //table.setHeaderClass("style_tableHeader1"); - table.setValue(tableDataModel); - panelView.getChildren().add(table); - - for (VascEntryField c:entry.getVascEntryFields()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderList(c)==false) { - continue; - } - UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - col.setId(viewRoot.createUniqueId()); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.setType(c.getId()); - link.addActionListener(new SortActionListener()); - - HtmlOutputText out2 = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out2.setId(viewRoot.createUniqueId()); - out2.setEscape(false); - out2.setValue(i18n(c.getName())+" "); - - HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderUp.setId(viewRoot.createUniqueId()); - orderUp.setEscape(false); - orderUp.setValue("↑"); // ↑ - ValueExpression ren2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortOrder']==true and vascActionBean.values['sortField']=='"+c.getId()+"'}", Boolean.class); - orderUp.setValueExpression("rendered", ren2); - - HtmlOutputText orderDown = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderDown.setId(viewRoot.createUniqueId()); - orderDown.setEscape(false); - orderDown.setValue("↓"); // ↓ - ValueExpression ren3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.values['sortOrder']==false and vascActionBean.values['sortField']=='"+c.getId()+"'}", Boolean.class); - orderDown.setValueExpression("rendered", ren3); - - link.getChildren().add(out2); - link.getChildren().add(orderUp); - link.getChildren().add(orderDown); - col.setHeader(link); - - //getFacet("listColumnHeader").getChildren(); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - int index = VascDataBackendBean.getIndexId(c); - ValueExpression ve1 = application.getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(),"#{vascRecord.field"+index+"}",Object.class); - out.setValueExpression("value", ve1); - - col.getChildren().add(out); - table.getChildren().add(col); - } - - if (entry.getVascFrontendData().getVascEntryState().getVascBackend().isRecordMoveable()) { - UIColumn colUp = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - colUp.setId(viewRoot.createUniqueId()); - - HtmlCommandLink linkUp = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - linkUp.setId(viewRoot.createUniqueId()); - linkUp.setType("up"); - linkUp.addActionListener(new MoveActionListener()); - - HtmlOutputText orderUp = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderUp.setId(viewRoot.createUniqueId()); - orderUp.setEscape(false); - orderUp.setValue("↑ up"); // ↑ - - linkUp.getChildren().add(orderUp); - colUp.getChildren().add(linkUp); - table.getChildren().add(colUp); - - HtmlCommandLink linkDown = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - linkDown.setId(viewRoot.createUniqueId()); - linkDown.setType("down"); - linkDown.addActionListener(new MoveActionListener()); - - UIColumn colDown = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - colDown.setId(viewRoot.createUniqueId()); - HtmlOutputText orderDown = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - orderDown.setId(viewRoot.createUniqueId()); - orderDown.setEscape(false); - orderDown.setValue("↓ down"); // ↓ - - linkDown.getChildren().add(orderDown); - colDown.getChildren().add(linkDown); - table.getChildren().add(colDown); - } - - for (VascLinkEntry vascLink:entry.getVascLinkEntries()) { - - UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - col.setId(viewRoot.createUniqueId()); - - UIOutput colHeader = (UIOutput)application.createComponent(UIOutput.COMPONENT_TYPE); - colHeader.setId(viewRoot.createUniqueId()); - colHeader.setValue("link"); - col.setHeader(colHeader); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new VascLinkActionListener(vascLink.getId())); - - // rm this , bacause of unneeded copy, should add name to link - VascEntry ve = entry.getVascFrontendData().getVascController().getVascEntryController().getVascEntryById(vascLink.getVascEntryId()); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue(i18n(ve.getName())); - - link.getChildren().add(out); - col.getChildren().add(link); - - table.getChildren().add(col); - } - - for (RowVascAction action:entry.getRowActions()) { - if (entry.getVascFrontendData().getVascFrontendHelper().renderRowVascAction(action)==false) { - continue; - } - if ("addRowAction".equals(action.getId())) { - continue; - } - - UIColumn col = (UIColumn)application.createComponent(UIColumn.COMPONENT_TYPE); - col.setId(viewRoot.createUniqueId()); - - UIOutput colHeader = (UIOutput)application.createComponent(UIOutput.COMPONENT_TYPE); - colHeader.setId(viewRoot.createUniqueId()); - colHeader.setValue(i18n(action.getName())); - col.setHeader(colHeader); - - HtmlCommandLink link = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE); - link.setId(viewRoot.createUniqueId()); - link.addActionListener(new VascRowActionListener(action.getId())); - link.setImmediate(true); - - HtmlOutputText out = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - out.setId(viewRoot.createUniqueId()); - out.setValue(i18n(action.getName())); - - link.getChildren().add(out); - col.getChildren().add(link); - - table.getChildren().add(col); - } - HtmlPanelGrid gridFooter = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE); - gridFooter.setId(viewRoot.createUniqueId()); - gridFooter.setColumns(1); - - /* - HtmlOutputText pageText = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - pageText.setId(viewRoot.createUniqueId()); - pageText.setValue("Pagina: "); - gridFooter.getChildren().add(pageText); - */ - - panelView.getChildren().add(gridFooter); - - this.getChildren().add(panelView); - return panelView.getId(); - } -} - -class JSFFrontendRenderer extends AbstractVascFrontend implements Serializable { - - private static final long serialVersionUID = 1L; - - // Frontend Stuff - - protected void addUiComponents() { - VascFrontendData vfd = getVascEntry().getVascFrontendData(); - - // required UI components - vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_LABEL,JSFLabel.class.getName()); - vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_TEXT, JSFText.class.getName()); - vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_LIST, JSFList.class.getName()); - //vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_BUTTON, JSFButton.class.getName()); - - // optional UI components - vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_BOOLEAN , JSFBoolean.class.getName()); - //vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_DATE , JSFDate.class.getName()); - vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_TEXTAREA , JSFTextArea.class.getName()); - //vfd.putVascUIComponent(com.idcanet.vasc.core.ui.VascUIComponent.VASC_COLOR , JSFColorChooser.class.getName()); - - } - - /** - * @see com.idcanet.vasc.core.VascFrontend#renderDelete(java.lang.Object) - */ - public void renderDelete() throws Exception { - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - OldVascUIComponent comp = OldVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.resetViews(); - UIPanel panel = comp.getPanel("deleteId"); - panel.setRendered(true); - } - - /** - * @see com.idcanet.vasc.core.VascFrontend#renderEdit(java.lang.Object) - */ - public void renderEdit() throws Exception { - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - OldVascUIComponent comp = OldVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.resetViews(); - UIPanel panel = comp.getPanel("editId"); - panel.setRendered(true); - - entry.getVascFrontendData().getVascFrontendHelper().editReadOnlyUIComponents(entry); - - VascDataBackendBean selBean = null; - if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) { - int index = entry.getVascFrontendData().getVascEntryState().getEntryDataList().size()+1; - selBean = new VascDataBackendBean(entry,entry.getVascFrontendData().getVascEntryState().getEntryDataObject(),index); - } else { - selBean = comp.getSelectedTableBean(); - } - selBean.setRealValue(true); - - ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{vascActionBean.selected}", Object.class); - ve2.setValue(FacesContext.getCurrentInstance().getELContext(), selBean); - - } - - /** - * @see com.idcanet.vasc.core.VascFrontend#renderExport(com.idcanet.vasc.core.entry.VascEntryExporter) - */ - public void renderExport(VascEntryExporter exporter) throws Exception { - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - OldVascUIComponent comp = OldVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.resetViews(); - UIPanel panel = comp.getPanel("exportId"); - panel.setRendered(true); - - comp.exporter=exporter; - } - - /** - * @see com.idcanet.vasc.core.VascFrontend#renderView() - */ - public void renderView() throws Exception { - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - OldVascUIComponent comp = OldVascUIComponent.findVascChild(viewRoot,getVascEntry().getId()); - comp.resetViews(); - UIPanel panel = comp.getPanel("viewId"); - panel.setRendered(true); - } -} - -@SuppressWarnings("serial") -class VascGlobalActionListener implements ActionListener,Serializable { - private String actionId = null; - public VascGlobalActionListener(String actionId) { - this.actionId=actionId; - } - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - GlobalVascAction action = entry.getGlobalActionById(actionId); - try { - action.doGlobalAction(entry); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } - -} -@SuppressWarnings("serial") -class VascRowActionListener implements ActionListener,Serializable { - private String actionId = null; - public VascRowActionListener(String actionId) { - this.actionId=actionId; - } - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - RowVascAction action = entry.getRowActionById(actionId); - Object selected = null; - if (actionId.contains("add")==false) { - selected = comp.getSelectedTableObject(); - } - try { - action.doRowAction(entry, selected); - } catch (Exception e) { - entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e); - } - } -} -@SuppressWarnings("serial") -class VascLinkActionListener implements ActionListener,Serializable { - private String linkId = null; - public VascLinkActionListener(String linkId) { - this.linkId=linkId; - } - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - VascEntry entry = comp.getVascEntry(); - VascLinkEntry l = entry.getVascLinkEntryById(linkId); - comp.initGoto(l); - } -} -@SuppressWarnings("serial") -class VascLinkBackActionListener implements ActionListener,Serializable { - public void processAction(ActionEvent event) { - OldVascUIComponent comp = OldVascUIComponent.findVascParent(event.getComponent()); - comp.initGoto(null); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/VascDataBackendBean.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/VascDataBackendBean.java deleted file mode 100644 index 9c84755..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/VascDataBackendBean.java +++ /dev/null @@ -1,519 +0,0 @@ -/* - * 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.frontends.web.jsf; - - -import java.io.Serializable; - -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; - -/** - * - * - * @author Willem Cazander - * @version 1.0 May 03, 2009 - */ -public class VascDataBackendBean implements Serializable { - - private static final long serialVersionUID = 3881688974089760074L; - private VascEntry entry = null; - private Object record = null; - private boolean realValue = false; - private int recordId = 0; - - public VascDataBackendBean(VascEntry entry,Object record,int recordId) { - this.entry=entry; - this.record=record; - this.recordId=recordId; - } - - public boolean isRealValue() { - return realValue; - } - public void setRealValue(boolean realValue) { - this.realValue=realValue; - } - - static public VascEntryField getFieldIdByIndex(VascEntry entry,int index) { - if (index>entry.getVascEntryFields().size()) { - throw new IllegalArgumentException("Index is bigger then total field size: "+index); - } - return entry.getVascEntryFields().get(index); - } - - static public int getIndexId(VascEntryField field) { - int i =0; - for (VascEntryField f:field.getVascEntry().getVascEntryFields()) { - if (f.getId().equals(field.getId())) { - return i; - } - i++; - } - throw new IllegalArgumentException("Could not find field."); - } - - private Object getValue(int index) { - try { - VascEntryField field = getFieldIdByIndex(entry,index); - VascEntryFieldValue value = field.getVascEntryFieldValue(); - if (isRealValue()) { - return value.getValue(field, record); - } - return value.getDisplayValue(field, record); - } catch (VascException e) { - return "Error: "+e.getMessage(); - } - } - - private void setValue(int index,Object valueObject) { - try { - VascEntryField field = getFieldIdByIndex(entry,index); - VascEntryFieldValue value = field.getVascEntryFieldValue(); - value.setValue(field, record,valueObject); - } catch (VascException e) { - throw new RuntimeException("Could not set value on record.",e); - } - } - - public Object getRecord() { - return record; - } - - public int getRecordId() { - return recordId; - } - - // GET/SET bean methods for using in EL - - - public Object getField0() { - return getValue(0); - } - - public void setField0(Object o) { - setValue(0,o); - } - - public Object getField1() { - return getValue(1); - } - - public void setField1(Object o) { - setValue(1,o); - } - - public Object getField2() { - return getValue(2); - } - - public void setField2(Object o) { - setValue(2,o); - } - - public Object getField3() { - return getValue(3); - } - - public void setField3(Object o) { - setValue(3,o); - } - - public Object getField4() { - return getValue(4); - } - - public void setField4(Object o) { - setValue(4,o); - } - - public Object getField5() { - return getValue(5); - } - - public void setField5(Object o) { - setValue(5,o); - } - - public Object getField6() { - return getValue(6); - } - - public void setField6(Object o) { - setValue(6,o); - } - - public Object getField7() { - return getValue(7); - } - - public void setField7(Object o) { - setValue(7,o); - } - - public Object getField8() { - return getValue(8); - } - - public void setField8(Object o) { - setValue(8,o); - } - - public Object getField9() { - return getValue(9); - } - - public void setField9(Object o) { - setValue(9,o); - } - - - public Object getField10() { - return getValue(10); - } - - public void setField10(Object o) { - setValue(10,o); - } - - public Object getField11() { - return getValue(11); - } - - public void setField11(Object o) { - setValue(11,o); - } - - public Object getField12() { - return getValue(12); - } - - public void setField12(Object o) { - setValue(12,o); - } - - public Object getField13() { - return getValue(13); - } - - public void setField13(Object o) { - setValue(13,o); - } - - public Object getField14() { - return getValue(14); - } - - public void setField14(Object o) { - setValue(14,o); - } - - public Object getField15() { - return getValue(15); - } - - public void setField15(Object o) { - setValue(15,o); - } - - public Object getField16() { - return getValue(16); - } - - public void setField16(Object o) { - setValue(16,o); - } - - public Object getField17() { - return getValue(17); - } - - public void setField17(Object o) { - setValue(17,o); - } - - public Object getField18() { - return getValue(18); - } - - public void setField18(Object o) { - setValue(18,o); - } - - public Object getField19() { - return getValue(19); - } - - public void setField19(Object o) { - setValue(19,o); - } - - - public Object getField20() { - return getValue(20); - } - - public void setField20(Object o) { - setValue(20,o); - } - - public Object getField21() { - return getValue(21); - } - - public void setField21(Object o) { - setValue(21,o); - } - - public Object getField22() { - return getValue(22); - } - - public void setField22(Object o) { - setValue(22,o); - } - - public Object getField23() { - return getValue(23); - } - - public void setField23(Object o) { - setValue(23,o); - } - - public Object getField24() { - return getValue(24); - } - - public void setField24(Object o) { - setValue(24,o); - } - - public Object getField25() { - return getValue(25); - } - - public void setField25(Object o) { - setValue(25,o); - } - - public Object getField26() { - return getValue(26); - } - - public void setField26(Object o) { - setValue(26,o); - } - - public Object getField27() { - return getValue(27); - } - - public void setField27(Object o) { - setValue(27,o); - } - - public Object getField28() { - return getValue(28); - } - - public void setField28(Object o) { - setValue(28,o); - } - - public Object getField29() { - return getValue(29); - } - - public void setField29(Object o) { - setValue(29,o); - } - - - public Object getField30() { - return getValue(30); - } - - public void setField30(Object o) { - setValue(30,o); - } - - public Object getField31() { - return getValue(31); - } - - public void setField31(Object o) { - setValue(31,o); - } - - public Object getField32() { - return getValue(32); - } - - public void setField32(Object o) { - setValue(32,o); - } - - public Object getField33() { - return getValue(33); - } - - public void setField33(Object o) { - setValue(33,o); - } - - public Object getField34() { - return getValue(34); - } - - public void setField34(Object o) { - setValue(34,o); - } - - public Object getField35() { - return getValue(35); - } - - public void setField35(Object o) { - setValue(35,o); - } - - public Object getField36() { - return getValue(36); - } - - public void setField36(Object o) { - setValue(36,o); - } - - public Object getField37() { - return getValue(37); - } - - public void setField37(Object o) { - setValue(37,o); - } - - public Object getField38() { - return getValue(38); - } - - public void setField38(Object o) { - setValue(38,o); - } - - public Object getField39() { - return getValue(39); - } - - public void setField39(Object o) { - setValue(39,o); - } - - - public Object getField40() { - return getValue(40); - } - - public void setField40(Object o) { - setValue(40,o); - } - - public Object getField41() { - return getValue(41); - } - - public void setField41(Object o) { - setValue(41,o); - } - - public Object getField42() { - return getValue(42); - } - - public void setField42(Object o) { - setValue(42,o); - } - - public Object getField43() { - return getValue(43); - } - - public void setField43(Object o) { - setValue(43,o); - } - - public Object getField44() { - return getValue(44); - } - - public void setField44(Object o) { - setValue(44,o); - } - - public Object getField45() { - return getValue(45); - } - - public void setField45(Object o) { - setValue(45,o); - } - - public Object getField46() { - return getValue(46); - } - - public void setField46(Object o) { - setValue(46,o); - } - - public Object getField47() { - return getValue(47); - } - - public void setField47(Object o) { - setValue(47,o); - } - - public Object getField48() { - return getValue(48); - } - - public void setField48(Object o) { - setValue(48,o); - } - - public Object getField49() { - return getValue(49); - } - - public void setField49(Object o) { - setValue(49,o); - } -} diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/VascRequestFacesFilter.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/VascRequestFacesFilter.java deleted file mode 100644 index 21f1834..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/VascRequestFacesFilter.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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.frontends.web.jsf; - -import java.io.IOException; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.faces.FactoryFinder; -import javax.faces.application.ViewExpiredException; -import javax.faces.component.UIViewRoot; -import javax.faces.context.FacesContext; -import javax.faces.context.FacesContextFactory; -import javax.faces.lifecycle.Lifecycle; -import javax.faces.lifecycle.LifecycleFactory; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Parses the Request info path info 3 vasc attributes an dispatches the request to the templateFile. - * - * @author Willem Cazander - * @version 1.0 Mar 21, 2009 - */ -public class VascRequestFacesFilter implements Filter { - - private static final long serialVersionUID = 10l; - private Logger logger = null; - private String templateFile = null; - private ServletContext servletContext = null; - - /** - * @see javax.servlet.Filter#destroy() - */ - public void destroy() { - servletContext = null; - templateFile = null; - logger = null; - } - - /** - * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) - */ - public void init(FilterConfig config) throws ServletException { - logger = Logger.getLogger(VascRequestFacesFilter.class.getName()); - templateFile=config.getInitParameter("templateFile"); - if (templateFile==null) { - throw new ServletException("No templateFile init-param found."); - } - servletContext=config.getServletContext(); - } - - /** - * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) - */ - public void doFilter(ServletRequest servletRequest,ServletResponse servletResponse,FilterChain chain) throws IOException, ServletException { - - HttpServletRequest request = (HttpServletRequest)servletRequest; - HttpServletResponse response = (HttpServletResponse)servletResponse; - - // request info - String path = request.getRequestURI(); - String v = "/vasc/"; - if (path.contains(v)) { - path = path.substring(path.indexOf(v)+v.length()); - } - - // stuff to fill - String entityName = null; - String actionName = null; - String actionRecordId = null; - - // parse request info - //path = path.substring(1); // rm / - int index = path.indexOf("/"); // check next / - String actionString = null; - if (index>0) { - actionString = path.substring(index+1); - entityName = path.substring(0,index); - } else { - entityName = path; - } - - if (actionString!=null) { - index = actionString.indexOf("/"); - String recordString = null; - if (index>0) { - recordString = actionString.substring(index+1); - actionName = actionString.substring(0,index); - } else { - actionName = actionString; - } - if (recordString!=null) { - actionRecordId = recordString; - } - } - - //log - if (logger.isLoggable(Level.FINE)) { - logger.log(Level.FINE,"entityName="+entityName+" actionName="+actionName+" actionRecordId="+actionRecordId); - } - - // add to response - request.setAttribute("requestScopeVascEntityName", entityName); - request.setAttribute("requestScopeVascActionName", actionName); - request.setAttribute("requestScopeVascRecordId" , actionRecordId); - request.setAttribute("requestScopeVascPath" , request.getRequestURI()); - - // Acquire the FacesContext instance for this request - FacesContext facesContext = FacesContext.getCurrentInstance(); - if (facesContext == null) { - FacesContextFactory facesContextFactory = (FacesContextFactory)FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); - LifecycleFactory lifecycleFactory = (LifecycleFactory)FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); - Lifecycle lifecycle = lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE); - - facesContext = facesContextFactory.getFacesContext(servletContext, request, response, lifecycle); - ProtectedFacesContext.setFacesContextAsCurrentInstance(facesContext); - - UIViewRoot viewRoot = facesContext.getApplication().getViewHandler().createView(facesContext,entityName+actionName); - facesContext.setViewRoot(viewRoot); - } - try { - request.getRequestDispatcher(templateFile).forward(request, response); - } catch (ViewExpiredException e) { - // lets try again - response.sendRedirect(request.getRequestURL().toString()); - } - // done - } - - private abstract static class ProtectedFacesContext extends FacesContext { - protected static void setFacesContextAsCurrentInstance(FacesContext facesContext) { - FacesContext.setCurrentInstance(facesContext); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/VascViewHandler.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/VascViewHandler.java deleted file mode 100644 index fc31691..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/VascViewHandler.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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.frontends.web.jsf; - -import java.io.IOException; -import java.util.Locale; - -import javax.faces.FacesException; -import javax.faces.application.ViewHandler; -import javax.faces.component.UIViewRoot; -import javax.faces.context.FacesContext; -import javax.servlet.http.HttpServletRequest; - -/** - * Fixes the action url - * - * @author Willem Cazander - * @version 1.0 May 05, 2009 - */ -public class VascViewHandler extends ViewHandler { - - private ViewHandler parentViewHandler = null; - - - public VascViewHandler(ViewHandler viewHandler) { - super(); - this.parentViewHandler = viewHandler; - } - - /** - * @see javax.faces.application.ViewHandler#getActionURL(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - public String getActionURL(FacesContext context, String name) { - - HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest(); - if (request.getAttribute("requestScopeVascPath")==null) { - return parentViewHandler.getActionURL(context, name); - } - String path = (String)request.getAttribute("requestScopeVascPath"); - return path; - } - - /** - * @see javax.faces.application.ViewHandler#calculateLocale(javax.faces.context.FacesContext) - */ - @Override - public Locale calculateLocale(FacesContext context) { - return parentViewHandler.calculateLocale(context); - } - - /** - * @see javax.faces.application.ViewHandler#calculateRenderKitId(javax.faces.context.FacesContext) - */ - @Override - public String calculateRenderKitId(FacesContext context) { - return parentViewHandler.calculateRenderKitId(context); - } - - /** - * @see javax.faces.application.ViewHandler#createView(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - public UIViewRoot createView(FacesContext context, String name) { - return parentViewHandler.createView(context, name); - } - - /** - * @see javax.faces.application.ViewHandler#getResourceURL(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - public String getResourceURL(FacesContext context, String resource) { - return parentViewHandler.getResourceURL(context, resource); - } - - /** - * @see javax.faces.application.ViewHandler#renderView(javax.faces.context.FacesContext, javax.faces.component.UIViewRoot) - */ - @Override - public void renderView(FacesContext context, UIViewRoot viewRoot) throws IOException, FacesException { - parentViewHandler.renderView(context, viewRoot); - } - - /** - * @see javax.faces.application.ViewHandler#restoreView(javax.faces.context.FacesContext, java.lang.String) - */ - @Override - public UIViewRoot restoreView(FacesContext context, String name) { - return parentViewHandler.restoreView(context, name); - } - - /** - * @see javax.faces.application.ViewHandler#writeState(javax.faces.context.FacesContext) - */ - @Override - public void writeState(FacesContext context) throws IOException { - parentViewHandler.writeState(context); - } -} diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/AbstractJSFBaseComponent.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/AbstractJSFBaseComponent.java deleted file mode 100644 index 3b85f67..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/AbstractJSFBaseComponent.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.frontends.web.jsf.ui; - -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; - -import com.idcanet.vasc.core.ui.VascUIComponent; -import com.idcanet.vasc.frontends.web.jsf.JSFVascUIComponent; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 Aug 8, 2009 - */ -abstract public class AbstractJSFBaseComponent implements VascUIComponent { - - protected String componentId = null; - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#getErrorText() - */ - public String getErrorText() { - return ""; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setErrorText(java.lang.String) - */ - public void setErrorText(String text) { - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isRendered() - */ - public boolean isRendered() { - UIComponent component = (UIComponent)JSFVascUIComponent.findComponentById(FacesContext.getCurrentInstance().getViewRoot(),componentId); - return component.isRendered(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setRendered(boolean) - */ - public void setRendered(boolean rendered) { - // todo: disabled until templates fixes - //UIComponent component = (UIComponent)com.idcanet.vasc.frontends.web.jsf.VascUIComponent.findComponentById(FacesContext.getCurrentInstance().getViewRoot(),componentId); - //component.setRendered(rendered); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFBoolean.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFBoolean.java deleted file mode 100644 index 4388f01..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFBoolean.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.frontends.web.jsf.ui; - -import javax.faces.application.Application; -import javax.faces.component.UIComponent; -import javax.faces.component.UIViewRoot; -import javax.faces.component.html.HtmlSelectBooleanCheckbox; -import javax.faces.context.FacesContext; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascValueModel; -import com.idcanet.vasc.frontends.web.jsf.JSFVascUIComponent; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 Mar 28, 2009 - */ -public class JSFBoolean extends AbstractJSFBaseComponent { - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - HtmlSelectBooleanCheckbox component = (HtmlSelectBooleanCheckbox)application.createComponent(HtmlSelectBooleanCheckbox.COMPONENT_TYPE); - component.setId(viewRoot.createUniqueId()); - componentId = component.getId(); - - ((UIComponent)gui).getChildren().add(component); - return component; - } - - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - HtmlSelectBooleanCheckbox component = (HtmlSelectBooleanCheckbox)JSFVascUIComponent.findComponentById(FacesContext.getCurrentInstance().getViewRoot(),componentId); - return component.isDisabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - HtmlSelectBooleanCheckbox component = (HtmlSelectBooleanCheckbox)JSFVascUIComponent.findComponentById(FacesContext.getCurrentInstance().getViewRoot(),componentId); - component.setDisabled(disabled); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFLabel.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFLabel.java deleted file mode 100644 index ed24288..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFLabel.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.frontends.web.jsf.ui; - -import javax.faces.application.Application; -import javax.faces.component.UIComponent; -import javax.faces.component.UIViewRoot; -import javax.faces.component.html.HtmlOutputText; -import javax.faces.context.FacesContext; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascValueModel; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 Mar 25, 2009 - */ -public class JSFLabel extends AbstractJSFBaseComponent { - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - HtmlOutputText component = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); - component.setId(viewRoot.createUniqueId()); - componentId = component.getId(); - component.setValue(""+model.getValue()); - ((UIComponent)gui).getChildren().add(component); - return component; - } - - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - return false; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFList.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFList.java deleted file mode 100644 index 0f6eb3f..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFList.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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.frontends.web.jsf.ui; - -import java.io.Serializable; -import java.util.List; - -import javax.el.ValueExpression; -import javax.faces.application.Application; -import javax.faces.component.UIComponent; -import javax.faces.component.UISelectItems; -import javax.faces.component.UIViewRoot; -import javax.faces.component.html.HtmlSelectOneMenu; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.ConverterException; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascSelectItem; -import com.idcanet.vasc.core.ui.VascValueModel; -import com.idcanet.vasc.frontends.web.jsf.JSFVascUIComponent; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 Mar 28, 2009 - */ -public class JSFList extends AbstractJSFBaseComponent { - - - public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - HtmlSelectOneMenu component = (HtmlSelectOneMenu)application.createComponent(HtmlSelectOneMenu.COMPONENT_TYPE); - component.setId(viewRoot.createUniqueId()); - componentId = component.getId(); - - JSFVascUIComponent comp = JSFVascUIComponent.findVascParent((UIComponent)gui); - String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY); - ValueExpression itemsTestVE = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".editSelectItemModels['jsfListItems_"+componentId+"']}", JSFListModel.class); - - JSFListModel t = new JSFListModel(entryField); - itemsTestVE.setValue(FacesContext.getCurrentInstance().getELContext(), t); - - component.setConverter(new VascConverter(t)); - ((UIComponent)gui).getChildren().add(component); - - setValueTestModel(component); - - return component; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - HtmlSelectOneMenu component = (HtmlSelectOneMenu)JSFVascUIComponent.findComponentById(FacesContext.getCurrentInstance().getViewRoot(),componentId); - return component.isDisabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - HtmlSelectOneMenu component = (HtmlSelectOneMenu)JSFVascUIComponent.findComponentById(FacesContext.getCurrentInstance().getViewRoot(),componentId); - component.setDisabled(disabled); - } - - private void setValueTestModel(HtmlSelectOneMenu component) { - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - - UISelectItems item = (UISelectItems)application.createComponent(UISelectItems.COMPONENT_TYPE); - item.setId(viewRoot.createUniqueId()); - - JSFVascUIComponent comp = JSFVascUIComponent.findVascChild(viewRoot,null); - String entrySupportVar = (String)comp.getAttributes().get(JSFVascUIComponent.ENTRY_SUPPORT_VAR_KEY); - String id = component.getId(); - ValueExpression itemsVE = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".editSelectItemModels['jsfListItems_"+id+"']}", List.class); - item.setValueExpression("value", itemsVE); - - component.getChildren().clear(); - component.getChildren().add(item); - } -} -class VascConverter implements Converter,Serializable { - - private static final long serialVersionUID = 6198813637409531713L; - private JSFListModel testModel = null; - - public VascConverter(JSFListModel testModel) { - this.testModel=testModel; - } - - /** - * Convert an ID to an Object - */ - public Object getAsObject(FacesContext context,UIComponent component,String value) throws ConverterException { - if (context == null) { throw new NullPointerException("context may not be null"); } - if (component == null) { throw new NullPointerException("component may not be null"); } - if (value == null) { return null; } - if ((value=value.trim()).length() == 0) { return null; } - - for (VascSelectItem v:testModel.getVascItems()) { - if (value.equals(v.getKeyValue())) { - return v.getValue(); - } - } - throw new ConverterException("Could not convert value as object: "+value); - } - - /** - * Converts an Object to an ID. - */ - public String getAsString(FacesContext context,UIComponent component,Object value) throws ConverterException { - if (context == null) { throw new NullPointerException("context may not be null"); } - if (component == null) { throw new NullPointerException("component may not be null"); } - if (value == null) { return ""; } - - for (VascSelectItem v:testModel.getVascItems()) { - if (value.equals(v.getValue())) { - return v.getKeyValue(); - } - } - throw new ConverterException("Could not convert value as string: "+value); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFListModel.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFListModel.java deleted file mode 100644 index 4bd33df..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFListModel.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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.frontends.web.jsf.ui; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import javax.faces.model.SelectItem; - -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascSelectItem; -import com.idcanet.vasc.core.ui.VascSelectItemModel; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 Mar 28, 2009 - */ -public class JSFListModel implements Serializable,List { - - private static final long serialVersionUID = -5266070864271715383L; - private VascEntryField entryField; - private List items = null; - private List selectItems = null; - private boolean refresh = true; - - public JSFListModel() { - items = new ArrayList(40); - selectItems = new ArrayList(40); - } - - public JSFListModel(VascEntryField entryField) { - this(); - this.entryField=entryField; - } - - public List getVascItems() { - refresh(); - return items; - } - - public List getSelectItems() { - refresh(); - return selectItems; - } - - public void requestRefresh() { - refresh = true; - } - - private void refresh() { - if (refresh==false) { - return; - } - refresh=false; - items.clear(); - selectItems.clear(); - - VascSelectItemModel itemModel = (VascSelectItemModel)entryField.getVascEntryFieldType().getDataObject(); - try { - items = itemModel.getVascSelectItems(entryField.getVascEntry()); - } catch (VascException e) { - throw new RuntimeException(e); - } - for (VascSelectItem v:items) { - selectItems.add(convert(v)); - } - } - - private SelectItem convert(VascSelectItem v) { - SelectItem si = new SelectItem(); - si.setLabel(v.getLabel()); - si.setValue(v.getValue()); - si.setDisabled(v.isDisabled()); - return si; - } - - // === LIST interface - - public void add(int arg0, SelectItem arg1) { - getSelectItems().add(arg0,arg1); - } - public boolean add(SelectItem arg0) { - return getSelectItems().add(arg0); - } - public boolean addAll(Collection arg0) { - return getSelectItems().addAll(arg0); - } - public boolean addAll(int arg0, Collection arg1) { - return getSelectItems().addAll(arg0,arg1); - } - public void clear() { - getSelectItems().clear(); - } - public boolean contains(Object arg0) { - return getSelectItems().contains(arg0); - } - public boolean containsAll(Collection arg0) { - return getSelectItems().containsAll(arg0); - } - public SelectItem get(int index) { - return getSelectItems().get(index); - } - public int indexOf(Object arg0) { - return getSelectItems().indexOf(arg0); - } - public boolean isEmpty() { - return getSelectItems().isEmpty(); - } - public Iterator iterator() { - return getSelectItems().iterator(); - } - public int lastIndexOf(Object arg0) { - return getSelectItems().lastIndexOf(arg0); - } - public ListIterator listIterator() { - return getSelectItems().listIterator(); - } - public ListIterator listIterator(int arg0) { - return getSelectItems().listIterator(arg0); - } - public SelectItem remove(int arg0) { - return getSelectItems().remove(arg0); - } - public boolean remove(Object arg0) { - return getSelectItems().remove(arg0); - } - public boolean removeAll(Collection arg0) { - return getSelectItems().removeAll(arg0); - } - public boolean retainAll(Collection arg0) { - return getSelectItems().retainAll(arg0); - } - public SelectItem set(int arg0, SelectItem arg1) { - return getSelectItems().set(arg0, arg1); - } - public int size() { - return getSelectItems().size(); - } - public List subList(int arg0, int arg1) { - return getSelectItems().subList(arg0, arg1); - } - public Object[] toArray() { - return getSelectItems().toArray(); - } - public T[] toArray(T[] a) { - return getSelectItems().toArray(a); - } -} diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFText.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFText.java deleted file mode 100644 index 1752fab..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFText.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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.frontends.web.jsf.ui; - -import java.io.Serializable; - -import javax.faces.application.Application; -import javax.faces.component.UIComponent; -import javax.faces.component.UIViewRoot; -import javax.faces.component.html.HtmlInputText; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.ConverterException; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascValueModel; -import com.idcanet.vasc.frontends.web.jsf.JSFVascUIComponent; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 Mar 25, 2009 - */ -public class JSFText extends AbstractJSFBaseComponent { - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - HtmlInputText component = (HtmlInputText)application.createComponent(HtmlInputText.COMPONENT_TYPE); - component.setId(viewRoot.createUniqueId()); - componentId = component.getId(); - - component.setConverter(new VascNullConverter()); - - Integer sizeEdit = entryField.getSizeEdit(); - if (sizeEdit!=null) { - component.setSize(sizeEdit); - } - ((UIComponent)gui).getChildren().add(component); - return component; - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - HtmlInputText component = (HtmlInputText)JSFVascUIComponent.findComponentById(FacesContext.getCurrentInstance().getViewRoot(),componentId); - return component.isDisabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - HtmlInputText component = (HtmlInputText)JSFVascUIComponent.findComponentById(FacesContext.getCurrentInstance().getViewRoot(),componentId); - component.setDisabled(disabled); - } -} -class VascNullConverter implements Converter,Serializable { - - private static final long serialVersionUID = 61988136374095313L; - - /** - * Convert an ID to an Object - */ - public Object getAsObject(FacesContext context,UIComponent component,String value) throws ConverterException { - //System.out.println("getAsObject: "+component+" value: "+value); - if (context == null) { throw new NullPointerException("context may not be null"); } - if (component == null) { throw new NullPointerException("component may not be null"); } - if (value == null) { return ""; } - if ((value=value.trim()).length() == 0) { return ""; } - return value; - } - - /** - * Converts an Object to an ID. - */ - public String getAsString(FacesContext context,UIComponent component,Object value) throws ConverterException { - //System.out.println("getAsString: "+component+" value: "+value); - if (context == null) { throw new NullPointerException("context may not be null"); } - if (component == null) { throw new NullPointerException("component may not be null"); } - if (value == null) { return ""; } - return ""+value; - } - - -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFTextArea.java b/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFTextArea.java deleted file mode 100644 index 79b1fb4..0000000 --- a/src/main/java/com/idcanet/vasc/frontends/web/jsf/ui/JSFTextArea.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.frontends.web.jsf.ui; - -import javax.faces.application.Application; -import javax.faces.component.UIComponent; -import javax.faces.component.UIViewRoot; -import javax.faces.component.html.HtmlInputTextarea; -import javax.faces.context.FacesContext; - -import com.idcanet.vasc.core.VascEntry; -import com.idcanet.vasc.core.VascEntryField; -import com.idcanet.vasc.core.VascException; -import com.idcanet.vasc.core.ui.VascValueModel; -import com.idcanet.vasc.frontends.web.jsf.JSFVascUIComponent; - - -/** - * - * - * @author Willem Cazander - * @version 1.0 Mar 25, 2009 - */ -public class JSFTextArea extends AbstractJSFBaseComponent { - - public Object createComponent(VascEntry table,VascEntryField entryField,VascValueModel model,Object gui) throws VascException { - Application application = FacesContext.getCurrentInstance().getApplication(); - UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot(); - HtmlInputTextarea component = (HtmlInputTextarea)application.createComponent(HtmlInputTextarea.COMPONENT_TYPE); - component.setId(viewRoot.createUniqueId()); - componentId = component.getId(); - - String cols = entryField.getVascEntryFieldType().getProperty("editor.columns"); - if (cols!=null && "".equals(cols)==false) { - component.setCols(new Integer(cols)); - } - String rows = entryField.getVascEntryFieldType().getProperty("editor.rows"); - if (rows!=null && "".equals(rows)==false) { - component.setRows(new Integer(rows)); - } - ((UIComponent)gui).getChildren().add(component); - return component; - } - - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#isDisabled() - */ - public boolean isDisabled() { - HtmlInputTextarea component = (HtmlInputTextarea)JSFVascUIComponent.findComponentById(FacesContext.getCurrentInstance().getViewRoot(),componentId); - return component.isDisabled(); - } - - /** - * @see com.idcanet.vasc.core.ui.VascUIComponent#setDisabled(boolean) - */ - public void setDisabled(boolean disabled) { - HtmlInputTextarea component = (HtmlInputTextarea)JSFVascUIComponent.findComponentById(FacesContext.getCurrentInstance().getViewRoot(),componentId); - component.setDisabled(disabled); - } -} \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/impl/DefaultVascBackedEntryFinalizer.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascBackedEntryFinalizer.java deleted file mode 100644 index 0f816ec..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascBackedEntryFinalizer.java +++ /dev/null @@ -1,436 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendController.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendController.java deleted file mode 100644 index 97b9db8..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendController.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendState.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendState.java deleted file mode 100644 index cbe03c4..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascBackendState.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascController.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascController.java deleted file mode 100644 index 972924d..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascController.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java deleted file mode 100644 index c8f9ddb..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascEntry.java +++ /dev/null @@ -1,770 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryController.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryController.java deleted file mode 100644 index 54e9620..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryController.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryField.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryField.java deleted file mode 100644 index 081da97..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryField.java +++ /dev/null @@ -1,614 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryFieldSet.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryFieldSet.java deleted file mode 100644 index fbd1b06..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryFieldSet.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryState.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryState.java deleted file mode 100644 index 529579d..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascEntryState.java +++ /dev/null @@ -1,16 +0,0 @@ -/** - * - */ -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/src/main/java/com/idcanet/vasc/impl/DefaultVascFactory.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascFactory.java deleted file mode 100644 index f92d266..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascFactory.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java deleted file mode 100644 index a0d6be7..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendData.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendEntryFinalizer.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendEntryFinalizer.java deleted file mode 100644 index 7665da2..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendEntryFinalizer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendHelper.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendHelper.java deleted file mode 100644 index 2466d1d..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascFrontendHelper.java +++ /dev/null @@ -1,535 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascLinkEntry.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascLinkEntry.java deleted file mode 100644 index d1eaa02..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascLinkEntry.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascSelectItemModel.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascSelectItemModel.java deleted file mode 100644 index ff640e1..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascSelectItemModel.java +++ /dev/null @@ -1,293 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/DefaultVascUserRoleController.java b/src/main/java/com/idcanet/vasc/impl/DefaultVascUserRoleController.java deleted file mode 100644 index 631c303..0000000 --- a/src/main/java/com/idcanet/vasc/impl/DefaultVascUserRoleController.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/VascBackendProxyCache.java b/src/main/java/com/idcanet/vasc/impl/VascBackendProxyCache.java deleted file mode 100644 index 544ecb9..0000000 --- a/src/main/java/com/idcanet/vasc/impl/VascBackendProxyCache.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/VascBackendProxyFilter.java b/src/main/java/com/idcanet/vasc/impl/VascBackendProxyFilter.java deleted file mode 100644 index cd81f95..0000000 --- a/src/main/java/com/idcanet/vasc/impl/VascBackendProxyFilter.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/VascBackendProxyPaged.java b/src/main/java/com/idcanet/vasc/impl/VascBackendProxyPaged.java deleted file mode 100644 index 34abc50..0000000 --- a/src/main/java/com/idcanet/vasc/impl/VascBackendProxyPaged.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/VascBackendProxySearch.java b/src/main/java/com/idcanet/vasc/impl/VascBackendProxySearch.java deleted file mode 100644 index 32fcac3..0000000 --- a/src/main/java/com/idcanet/vasc/impl/VascBackendProxySearch.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/VascBackendProxySort.java b/src/main/java/com/idcanet/vasc/impl/VascBackendProxySort.java deleted file mode 100644 index 76df4d2..0000000 --- a/src/main/java/com/idcanet/vasc/impl/VascBackendProxySort.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/VascBackendProxyTimerLogger.java b/src/main/java/com/idcanet/vasc/impl/VascBackendProxyTimerLogger.java deleted file mode 100644 index 7da3430..0000000 --- a/src/main/java/com/idcanet/vasc/impl/VascBackendProxyTimerLogger.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/actions/AddRowAction.java b/src/main/java/com/idcanet/vasc/impl/actions/AddRowAction.java deleted file mode 100644 index b8027cd..0000000 --- a/src/main/java/com/idcanet/vasc/impl/actions/AddRowAction.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/actions/CSVExportGlobalAction.java b/src/main/java/com/idcanet/vasc/impl/actions/CSVExportGlobalAction.java deleted file mode 100644 index fa49e9f..0000000 --- a/src/main/java/com/idcanet/vasc/impl/actions/CSVExportGlobalAction.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/actions/DeleteRowAction.java b/src/main/java/com/idcanet/vasc/impl/actions/DeleteRowAction.java deleted file mode 100644 index 7b0e09d..0000000 --- a/src/main/java/com/idcanet/vasc/impl/actions/DeleteRowAction.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/actions/EditRowAction.java b/src/main/java/com/idcanet/vasc/impl/actions/EditRowAction.java deleted file mode 100644 index 27549f6..0000000 --- a/src/main/java/com/idcanet/vasc/impl/actions/EditRowAction.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/actions/RefreshDataGlobalAction.java b/src/main/java/com/idcanet/vasc/impl/actions/RefreshDataGlobalAction.java deleted file mode 100644 index 3afe54d..0000000 --- a/src/main/java/com/idcanet/vasc/impl/actions/RefreshDataGlobalAction.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/actions/XMLExportGlobalAction.java b/src/main/java/com/idcanet/vasc/impl/actions/XMLExportGlobalAction.java deleted file mode 100644 index ca9d1ec..0000000 --- a/src/main/java/com/idcanet/vasc/impl/actions/XMLExportGlobalAction.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/entry/BeanPropertyVascEntryFieldValue.java b/src/main/java/com/idcanet/vasc/impl/entry/BeanPropertyVascEntryFieldValue.java deleted file mode 100644 index ea047dc..0000000 --- a/src/main/java/com/idcanet/vasc/impl/entry/BeanPropertyVascEntryFieldValue.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/entry/BeanVascEntryRecordCreator.java b/src/main/java/com/idcanet/vasc/impl/entry/BeanVascEntryRecordCreator.java deleted file mode 100644 index b84a063..0000000 --- a/src/main/java/com/idcanet/vasc/impl/entry/BeanVascEntryRecordCreator.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/entry/DefaultVascEntryResourceResolver.java b/src/main/java/com/idcanet/vasc/impl/entry/DefaultVascEntryResourceResolver.java deleted file mode 100644 index d1dd66a..0000000 --- a/src/main/java/com/idcanet/vasc/impl/entry/DefaultVascEntryResourceResolver.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/entry/HibernateValidatorService.java b/src/main/java/com/idcanet/vasc/impl/entry/HibernateValidatorService.java deleted file mode 100644 index 402c21f..0000000 --- a/src/main/java/com/idcanet/vasc/impl/entry/HibernateValidatorService.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/entry/PersistanceValidatorService.java b/src/main/java/com/idcanet/vasc/impl/entry/PersistanceValidatorService.java deleted file mode 100644 index a9d6ce6..0000000 --- a/src/main/java/com/idcanet/vasc/impl/entry/PersistanceValidatorService.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/entry/VascValidatorsValidatorService.java b/src/main/java/com/idcanet/vasc/impl/entry/VascValidatorsValidatorService.java deleted file mode 100644 index 2b41f2f..0000000 --- a/src/main/java/com/idcanet/vasc/impl/entry/VascValidatorsValidatorService.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldType.java b/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldType.java deleted file mode 100644 index a93cb3d..0000000 --- a/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldType.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldTypeController.java b/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldTypeController.java deleted file mode 100644 index 0ef07e0..0000000 --- a/src/main/java/com/idcanet/vasc/impl/type/DefaultVascEntryFieldTypeController.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/type/FieldTypeParser.java b/src/main/java/com/idcanet/vasc/impl/type/FieldTypeParser.java deleted file mode 100644 index 117763d..0000000 --- a/src/main/java/com/idcanet/vasc/impl/type/FieldTypeParser.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/type/MultiTextVascEntryFieldType.java b/src/main/java/com/idcanet/vasc/impl/type/MultiTextVascEntryFieldType.java deleted file mode 100644 index 610a1a7..0000000 --- a/src/main/java/com/idcanet/vasc/impl/type/MultiTextVascEntryFieldType.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/AnnotationParserElement.java b/src/main/java/com/idcanet/vasc/impl/x4o/AnnotationParserElement.java deleted file mode 100644 index 07cb203..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/AnnotationParserElement.java +++ /dev/null @@ -1,446 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/SelectItemModelBindingHandler.java b/src/main/java/com/idcanet/vasc/impl/x4o/SelectItemModelBindingHandler.java deleted file mode 100644 index 0d69411..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/SelectItemModelBindingHandler.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/SetParameterElement.java b/src/main/java/com/idcanet/vasc/impl/x4o/SetParameterElement.java deleted file mode 100644 index 25496b2..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/SetParameterElement.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/VascBackendElementConfigurator.java b/src/main/java/com/idcanet/vasc/impl/x4o/VascBackendElementConfigurator.java deleted file mode 100644 index b447a17..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/VascBackendElementConfigurator.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryElementConfigurator.java b/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryElementConfigurator.java deleted file mode 100644 index 4670a55..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryElementConfigurator.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldBindingHandler.java b/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldBindingHandler.java deleted file mode 100644 index 7446704..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldBindingHandler.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldElement.java b/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldElement.java deleted file mode 100644 index cb70b5b..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldElement.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldSetAttributeConverter.java b/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldSetAttributeConverter.java deleted file mode 100644 index 40f9d07..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldSetAttributeConverter.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeAttributeConverter.java b/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeAttributeConverter.java deleted file mode 100644 index b6660dd..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeAttributeConverter.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeElement.java b/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeElement.java deleted file mode 100644 index 18b4d25..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/VascEntryFieldTypeElement.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/VascLinkEntryParameterElement.java b/src/main/java/com/idcanet/vasc/impl/x4o/VascLinkEntryParameterElement.java deleted file mode 100644 index 310343d..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/VascLinkEntryParameterElement.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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/src/main/java/com/idcanet/vasc/impl/x4o/VascParser.java b/src/main/java/com/idcanet/vasc/impl/x4o/VascParser.java deleted file mode 100644 index 468659f..0000000 --- a/src/main/java/com/idcanet/vasc/impl/x4o/VascParser.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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/src/main/resources/META-INF/.faces-config.mex b/src/main/resources/META-INF/.faces-config.mex deleted file mode 100644 index 0928b8d..0000000 --- a/src/main/resources/META-INF/.faces-config.mex +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/src/main/resources/META-INF/faces-config.xml b/src/main/resources/META-INF/faces-config.xml deleted file mode 100644 index 1b2b7dc..0000000 --- a/src/main/resources/META-INF/faces-config.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - Vasc JSF Component - vasc.jsf.component - com.idcanet.vasc.frontends.web.jsf.JSFVascUIComponent - - vasc.jsf.component.renderer - - - - - - vasc.jsf.component.family - vasc.jsf.component.renderer - com.idcanet.vasc.frontends.web.jsf.JSFVascUIComponentRenderer - - - - - - com.idcanet.vasc.frontends.web.jsf.VascViewHandler - - - - - - - \ No newline at end of file diff --git a/src/main/resources/META-INF/fieldtype/fieldtype-lang.eld b/src/main/resources/META-INF/fieldtype/fieldtype-lang.eld deleted file mode 100644 index 9775506..0000000 --- a/src/main/resources/META-INF/fieldtype/fieldtype-lang.eld +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/META-INF/fieldtype/fieldtype-namespaces.xml b/src/main/resources/META-INF/fieldtype/fieldtype-namespaces.xml deleted file mode 100644 index ea0c8b2..0000000 --- a/src/main/resources/META-INF/fieldtype/fieldtype-namespaces.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - Vasc namespace for the fieldtype language - - fieldtype-lang.eld - \ No newline at end of file diff --git a/src/main/resources/META-INF/fieldtypes.xml b/src/main/resources/META-INF/fieldtypes.xml deleted file mode 100644 index 5cda54d..0000000 --- a/src/main/resources/META-INF/fieldtypes.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/META-INF/vasc.taglib.xml b/src/main/resources/META-INF/vasc.taglib.xml deleted file mode 100644 index 2ddc81c..0000000 --- a/src/main/resources/META-INF/vasc.taglib.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - http://vasc.idcanet.com/vasc.tld - - vascEntry - - vasc.jsf.component - vasc.jsf.component.renderer - - - diff --git a/src/main/resources/META-INF/vasc.tld b/src/main/resources/META-INF/vasc.tld deleted file mode 100644 index d710b8a..0000000 --- a/src/main/resources/META-INF/vasc.tld +++ /dev/null @@ -1,97 +0,0 @@ - - - Vasc JSF 2.1 library - Vasc - 2.1 - vasc - http://vasc.idcanet.com/vasc.tld - - Renders the vasc entry JSF Frontend Renderer - vascEntry - com.idcanet.vasc.frontends.web.jsf.JSFVascUIComponentTag - JSP - - - id - false - - - rendered - false - - boolean - - - - binding - false - - javax.faces.component.UIComponent - - - - - vascController - true - - com.idcanet.vasc.core.VascController - - - - entryName - false - - java.lang.String - - - - vascFrontendData - true - - com.idcanet.vasc.core.VascFrontendData - - - - entrySupportVar - true - - java.lang.String - - - - tableRecordVar - true - - java.lang.String - - - - injectEditFieldsId - true - - java.lang.String - - - - injectTableOptionsId - true - - java.lang.String - - - - injectTableColumnsId - true - - java.lang.String - - - - disableLinkColumns - false - - java.lang.String - - - - diff --git a/src/main/resources/META-INF/vasc/vasc-lang.eld b/src/main/resources/META-INF/vasc/vasc-lang.eld deleted file mode 100644 index 1b2da16..0000000 --- a/src/main/resources/META-INF/vasc/vasc-lang.eld +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/META-INF/vasc/vasc-namespaces.xml b/src/main/resources/META-INF/vasc/vasc-namespaces.xml deleted file mode 100644 index a52db5a..0000000 --- a/src/main/resources/META-INF/vasc/vasc-namespaces.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - Vasc namespace for the fieldtype language - - vasc-lang.eld - \ No newline at end of file diff --git a/src/test/java/com/idcanet/vasc/VascI18nTextValue.java b/src/test/java/com/idcanet/vasc/VascI18nTextValue.java deleted file mode 100644 index e13636c..0000000 --- a/src/test/java/com/idcanet/vasc/VascI18nTextValue.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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; - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.logging.Logger; - -import com.idcanet.vasc.core.entry.VascEntryResourceResolver; - - -/** - * - * @author Willem Cazander - * @version 1.0 Aug 2, 2007 - */ -public class VascI18nTextValue implements VascEntryResourceResolver { - - private Logger logger = null; - - public VascI18nTextValue() { - logger = Logger.getLogger(VascI18nTextValue.class.getName()); - } - - private String getKeyMapping(String key) { - return key; - } - - public String getTextValue(String key,Object...params) { - return i18n(getKeyMapping(key),params); - } - - private String i18n(String key,Object...params) { - if (key==null) { throw new NullPointerException("key may not be null"); } - try { - String text = ResourceBundle.getBundle("resources.i18n.vasc").getString(key); - if (params != null) { - MessageFormat mf = new MessageFormat(text); - text = mf.format(params, new StringBuffer(), null).toString(); - } - return text; - } catch(MissingResourceException e){ - logger.finer("Missing i18n or non i18n key: "+key); - return key; - } - } -} \ No newline at end of file diff --git a/src/test/resources/META-INF/logging.properties b/src/test/resources/META-INF/logging.properties deleted file mode 100644 index 2d94ca8..0000000 --- a/src/test/resources/META-INF/logging.properties +++ /dev/null @@ -1,20 +0,0 @@ -# -# - -# Specify the handlers to create in the root logger -# (all loggers are children of the root logger) -# The following creates two handlers -handlers = java.util.logging.ConsoleHandler - -# Set the default logging level for new ConsoleHandler instances -java.util.logging.ConsoleHandler.level = ALL - -# Set the default logging level for the root logger -.level = FINE - -com.idcanet.x4o = ALL - -# Java 6 has internal logging on many builtin libs -sun.level=OFF -java.level=OFF -javax.level=OFF \ No newline at end of file diff --git a/src/test/resources/i18n/vasc.properties b/src/test/resources/i18n/vasc.properties deleted file mode 100644 index 8e9c78b..0000000 --- a/src/test/resources/i18n/vasc.properties +++ /dev/null @@ -1,57 +0,0 @@ - -test = Dit is een test - - -vasc.entry.test1.headerName = Test Entry 1 -vasc.entry.test1.headerDescription = De test omschrijving van deze entry -vasc.entry.test1.headerImage = /META-INF/images/silk/png/tick.png - -vasc.entry.test1.name.name = Naam -vasc.entry.test1.name.description = De naam van het object -vasc.entry.test1.description.name = Omschrijving -vasc.entry.test1.description.description = De omschrijving van het object -vasc.entry.test1.active.name = Aktief -vasc.entry.test1.active.description = Is deze actief -vasc.entry.test1.active.image = /META-INF/images/silk/png/tick.png -vasc.entry.test1.date.name = Datum -vasc.entry.test1.date.description = De datum om te testen -vasc.entry.test1.testModel.name = Tests Models -vasc.entry.test1.testModel.description = ddddd -vasc.entry.test1.hexColor.name = Kleur -vasc.entry.test1.hexColor.description = De kleur van omo power. - -vasc.dialog.save.name = Opslaan -vasc.dialog.save.tooltip = Het opslaan van de waardes. -vasc.dialog.save.image = /META-INF/images/silk/png/tick.png - -vasc.dialog.cancel.name = Annuleren -vasc.dialog.cancel.tooltip = Niet opslaan van de waardes. -vasc.dialog.cancel.image = /META-INF/images/silk/png/cancel.png - -vasc.dialog.delete.message = Wilt u deze {0} record verwijderen ? -vasc.dialog.delete.title = Verwijderen - -vasc.action.add.name = Toevoegen -vasc.action.add.tooltip = Voegt een nieuw rij toe. -vasc.action.add.image = /META-INF/images/silk/png/table_add.png - -vasc.action.edit.name = Aanpassen -vasc.action.edit.tooltip = Pas een waarde aan van de geselecteerde rij in de table. -vasc.action.edit.image = /META-INF/images/silk/png/table_edit.png - -vasc.action.del.name = Verwijderen -vasc.action.del.tooltip = Verwijdert de geselecteerde rij uit de table. -vasc.action.del.image = /META-INF/images/silk/png/table_delete.png - -vasc.action.csv.name = CSV -vasc.action.csv.tooltip = Exporteren naar Excel. -vasc.action.csv.image = /META-INF/images/silk/png/page_white_excel.png - -vasc.action.xml.name = XML -vasc.action.xml.tooltip = Exporteren naar Xml. -vasc.action.xml.image = /META-INF/images/silk/png/page_white_excel.png - -vasc.action.refresh.name = Vernieuwen -vasc.action.refresh.tooltip = Ververst de waardes in de table. -vasc.action.refresh.image = /META-INF/images/silk/png/table_refresh.png - diff --git a/src/test/resources/images/gabelfresser.gif b/src/test/resources/images/gabelfresser.gif deleted file mode 100644 index 912d258..0000000 Binary files a/src/test/resources/images/gabelfresser.gif and /dev/null differ diff --git a/src/test/resources/vasc/tables.xml b/src/test/resources/vasc/tables.xml deleted file mode 100644 index dd4141c..0000000 --- a/src/test/resources/vasc/tables.xml +++ /dev/null @@ -1,316 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/xtes/tests.xml b/src/test/resources/xtes/tests.xml deleted file mode 100644 index d9ffd7c..0000000 --- a/src/test/resources/xtes/tests.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - LIMIT - - - - - - OFFSET - - - - - - - - - - SELECT - USERS.USERNAME AS USERNAME - USERS.PASSWD AS PASSWORD - FROM - USERS - - Bla bla - Also see this site http://www.google.com - - - - - - - - - AND role is in - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/idcanet/vasc/annotations/VascAnnotationParser.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascAnnotationParser.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascAnnotationParser.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascAnnotationParser.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascBundleKeyGenerator.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascBundleKeyGenerator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascBundleKeyGenerator.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascBundleKeyGenerator.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascChoices.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascChoices.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascChoices.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascChoices.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascChoicesSelectItemModel.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascChoicesSelectItemModel.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascChoicesSelectItemModel.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascChoicesSelectItemModel.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascDefaultValue.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascDefaultValue.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascDefaultValue.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascDefaultValue.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascDisplayName.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascDisplayName.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascDisplayName.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascDisplayName.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascEntry.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascEntry.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascEntry.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascEntry.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascEventChannel.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascEventChannel.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascEventChannel.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascEventChannel.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascEventListener.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascEventListener.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascEventListener.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascEventListener.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascField.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascField.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascField.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascField.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascFieldOrder.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascFieldOrder.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascFieldOrder.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascFieldOrder.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascFieldTemplate.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascFieldTemplate.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascFieldTemplate.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascFieldTemplate.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascFieldType.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascFieldType.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascFieldType.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascFieldType.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascI18n.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascI18n.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascI18n.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascI18n.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascModelReference.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascModelReference.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascModelReference.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascModelReference.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascPrimaryKey.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascPrimaryKey.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascPrimaryKey.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascPrimaryKey.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascRoles.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascRoles.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascRoles.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascRoles.java diff --git a/src/main/java/com/idcanet/vasc/annotations/VascStyle.java b/vasc-core/src/main/java/com/idcanet/vasc/annotations/VascStyle.java similarity index 100% rename from src/main/java/com/idcanet/vasc/annotations/VascStyle.java rename to vasc-core/src/main/java/com/idcanet/vasc/annotations/VascStyle.java diff --git a/src/main/java/com/idcanet/vasc/backends/BeanVascEntryFieldValue.java b/vasc-core/src/main/java/com/idcanet/vasc/backends/BeanVascEntryFieldValue.java similarity index 100% rename from src/main/java/com/idcanet/vasc/backends/BeanVascEntryFieldValue.java rename to vasc-core/src/main/java/com/idcanet/vasc/backends/BeanVascEntryFieldValue.java diff --git a/src/main/java/com/idcanet/vasc/backends/BeanVascEntryRecordCreator.java b/vasc-core/src/main/java/com/idcanet/vasc/backends/BeanVascEntryRecordCreator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/backends/BeanVascEntryRecordCreator.java rename to vasc-core/src/main/java/com/idcanet/vasc/backends/BeanVascEntryRecordCreator.java diff --git a/src/main/java/com/idcanet/vasc/backends/MapVascEntryFieldValue.java b/vasc-core/src/main/java/com/idcanet/vasc/backends/MapVascEntryFieldValue.java similarity index 100% rename from src/main/java/com/idcanet/vasc/backends/MapVascEntryFieldValue.java rename to vasc-core/src/main/java/com/idcanet/vasc/backends/MapVascEntryFieldValue.java diff --git a/src/main/java/com/idcanet/vasc/backends/MapVascEntryRecordCreator.java b/vasc-core/src/main/java/com/idcanet/vasc/backends/MapVascEntryRecordCreator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/backends/MapVascEntryRecordCreator.java rename to vasc-core/src/main/java/com/idcanet/vasc/backends/MapVascEntryRecordCreator.java diff --git a/src/main/java/com/idcanet/vasc/backends/jdbc/JdbcConnectionProvider.java b/vasc-core/src/main/java/com/idcanet/vasc/backends/jdbc/JdbcConnectionProvider.java similarity index 100% rename from src/main/java/com/idcanet/vasc/backends/jdbc/JdbcConnectionProvider.java rename to vasc-core/src/main/java/com/idcanet/vasc/backends/jdbc/JdbcConnectionProvider.java diff --git a/src/main/java/com/idcanet/vasc/backends/jdbc/JdbcVascBackend.java b/vasc-core/src/main/java/com/idcanet/vasc/backends/jdbc/JdbcVascBackend.java similarity index 100% rename from src/main/java/com/idcanet/vasc/backends/jdbc/JdbcVascBackend.java rename to vasc-core/src/main/java/com/idcanet/vasc/backends/jdbc/JdbcVascBackend.java diff --git a/src/main/java/com/idcanet/vasc/backends/jdbc/JdbcXpqlVascBackend.java b/vasc-core/src/main/java/com/idcanet/vasc/backends/jdbc/JdbcXpqlVascBackend.java similarity index 100% rename from src/main/java/com/idcanet/vasc/backends/jdbc/JdbcXpqlVascBackend.java rename to vasc-core/src/main/java/com/idcanet/vasc/backends/jdbc/JdbcXpqlVascBackend.java diff --git a/src/main/java/com/idcanet/vasc/backends/jdbc/JdniDataSourceJdbcConnectionProvider.java b/vasc-core/src/main/java/com/idcanet/vasc/backends/jdbc/JdniDataSourceJdbcConnectionProvider.java similarity index 100% rename from src/main/java/com/idcanet/vasc/backends/jdbc/JdniDataSourceJdbcConnectionProvider.java rename to vasc-core/src/main/java/com/idcanet/vasc/backends/jdbc/JdniDataSourceJdbcConnectionProvider.java diff --git a/src/main/java/com/idcanet/vasc/backends/jdbc/SimpleJdbcConnectionProvider.java b/vasc-core/src/main/java/com/idcanet/vasc/backends/jdbc/SimpleJdbcConnectionProvider.java similarity index 100% rename from src/main/java/com/idcanet/vasc/backends/jdbc/SimpleJdbcConnectionProvider.java rename to vasc-core/src/main/java/com/idcanet/vasc/backends/jdbc/SimpleJdbcConnectionProvider.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascDateFuture.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascDateFuture.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascDateFuture.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascDateFuture.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascDateFutureValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascDateFutureValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascDateFutureValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascDateFutureValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascDatePast.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascDatePast.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascDatePast.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascDatePast.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascDatePastValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascDatePastValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascDatePastValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascDatePastValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascIntSize.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascIntSize.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascIntSize.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascIntSize.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascIntSizeValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascIntSizeValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascIntSizeValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascIntSizeValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascLongSize.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascLongSize.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascLongSize.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascLongSize.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascLongSizeValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascLongSizeValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascLongSizeValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascLongSizeValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascObjectNotNull.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectNotNull.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascObjectNotNull.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectNotNull.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascObjectNotNullValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectNotNullValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascObjectNotNullValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectNotNullValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascObjectNull.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectNull.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascObjectNull.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectNull.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascObjectNullValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectNullValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascObjectNullValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectNullValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascObjectUrl.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectUrl.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascObjectUrl.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectUrl.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascObjectUrlValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectUrlValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascObjectUrlValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascObjectUrlValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascStringEmail.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringEmail.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascStringEmail.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringEmail.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascStringEmailValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringEmailValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascStringEmailValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringEmailValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascStringLength.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringLength.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascStringLength.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringLength.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascStringLengthValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringLengthValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascStringLengthValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringLengthValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascStringRegex.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringRegex.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascStringRegex.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringRegex.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascStringRegexValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringRegexValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascStringRegexValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringRegexValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascStringZipCode.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringZipCode.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascStringZipCode.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringZipCode.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascStringZipCodeValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringZipCodeValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascStringZipCodeValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascStringZipCodeValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascValidator.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascValidator.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascValidator.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascValidator.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascValidatorClassParser.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascValidatorClassParser.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascValidatorClassParser.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascValidatorClassParser.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascValidatorException.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascValidatorException.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascValidatorException.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascValidatorException.java diff --git a/src/main/java/com/idcanet/vasc/validators/VascValidatorMessages.java b/vasc-core/src/main/java/com/idcanet/vasc/validators/VascValidatorMessages.java similarity index 100% rename from src/main/java/com/idcanet/vasc/validators/VascValidatorMessages.java rename to vasc-core/src/main/java/com/idcanet/vasc/validators/VascValidatorMessages.java diff --git a/src/test/java/com/idcanet/vasc/FieldTypesTest.java b/vasc-core/src/test/java/com/idcanet/vasc/FieldTypesTest.java similarity index 91% rename from src/test/java/com/idcanet/vasc/FieldTypesTest.java rename to vasc-core/src/test/java/com/idcanet/vasc/FieldTypesTest.java index a7ef109..a3938fa 100644 --- a/src/test/java/com/idcanet/vasc/FieldTypesTest.java +++ b/vasc-core/src/test/java/com/idcanet/vasc/FieldTypesTest.java @@ -44,9 +44,9 @@ public class FieldTypesTest extends TestCase { public void setUp() throws Exception { // enable all logs - InputStream loggingProperties = this.getClass().getResourceAsStream("/META-INF/logging.properties"); - LogManager.getLogManager().readConfiguration( loggingProperties ); - loggingProperties.close(); + // //InputStream loggingProperties = this.getClass().getResourceAsStream("/META-INF/logging.properties"); + // LogManager.getLogManager().readConfiguration( loggingProperties ); + // loggingProperties.close(); } public void tearDown() throws Exception { diff --git a/src/test/java/com/idcanet/vasc/SwingTest.java b/vasc-frontend-swing/src/test/java/com/idcanet/vasc/SwingTest.java similarity index 100% rename from src/test/java/com/idcanet/vasc/SwingTest.java rename to vasc-frontend-swing/src/test/java/com/idcanet/vasc/SwingTest.java diff --git a/src/test/java/com/idcanet/vasc/models/TestModel.java b/vasc-frontend-swing/src/test/java/com/idcanet/vasc/TestModel.java similarity index 96% rename from src/test/java/com/idcanet/vasc/models/TestModel.java rename to vasc-frontend-swing/src/test/java/com/idcanet/vasc/TestModel.java index 96bd0b9..f00b321 100644 --- a/src/test/java/com/idcanet/vasc/models/TestModel.java +++ b/vasc-frontend-swing/src/test/java/com/idcanet/vasc/TestModel.java @@ -25,12 +25,13 @@ * should not be interpreted as representing official policies, either expressed or implied, of IDCA. */ -package com.idcanet.vasc.models; +package com.idcanet.vasc; + import java.util.Date; -import org.hibernate.validator.NotNull; -import org.hibernate.validator.Max; +//import org.hibernate.validator.NotNull; +//import org.hibernate.validator.Max; import com.idcanet.vasc.annotations.VascEntry; import com.idcanet.vasc.annotations.VascStyle; @@ -84,8 +85,8 @@ public class TestModel { helpId="help.id") @VascDefaultValue(value="xxxxx") @VascStyle(sizeList=200) - @NotNull - @Max(value=10) +// @NotNull +// @Max(value=10) @VascObjectNotNull @VascStringLength(max=10) public String getDescription() { @@ -128,7 +129,7 @@ public class TestModel { } - @NotNull +// @NotNull @VascObjectNotNull @VascModelReference @VascI18n(image="/resources/images/gabelfresser.gif") diff --git a/src/test/java/com/idcanet/vasc/TestModelVascDataSource.java b/vasc-frontend-swing/src/test/java/com/idcanet/vasc/TestModelVascDataSource.java similarity index 99% rename from src/test/java/com/idcanet/vasc/TestModelVascDataSource.java rename to vasc-frontend-swing/src/test/java/com/idcanet/vasc/TestModelVascDataSource.java index 154b136..42d28ac 100644 --- a/src/test/java/com/idcanet/vasc/TestModelVascDataSource.java +++ b/vasc-frontend-swing/src/test/java/com/idcanet/vasc/TestModelVascDataSource.java @@ -41,7 +41,6 @@ import com.idcanet.vasc.core.ui.VascSelectItem; import com.idcanet.vasc.core.ui.VascSelectItemModel; import com.idcanet.vasc.impl.entry.BeanPropertyVascEntryFieldValue; import com.idcanet.vasc.impl.entry.BeanVascEntryRecordCreator; -import com.idcanet.vasc.models.TestModel; /** * diff --git a/src/test/java/com/idcanet/vasc/TestTable.java b/vasc-frontend-swing/src/test/java/com/idcanet/vasc/TestTable.java similarity index 100% rename from src/test/java/com/idcanet/vasc/TestTable.java rename to vasc-frontend-swing/src/test/java/com/idcanet/vasc/TestTable.java diff --git a/src/test/java/com/idcanet/vasc/SWTTableViewerTest.java b/vasc-frontend-swt/src/test/java/com/idcanet/vasc/SWTTableViewerTest.java similarity index 100% rename from src/test/java/com/idcanet/vasc/SWTTableViewerTest.java rename to vasc-frontend-swt/src/test/java/com/idcanet/vasc/SWTTableViewerTest.java diff --git a/src/test/java/com/idcanet/vasc/SWTTest.java b/vasc-frontend-swt/src/test/java/com/idcanet/vasc/SWTTest.java similarity index 93% rename from src/test/java/com/idcanet/vasc/SWTTest.java rename to vasc-frontend-swt/src/test/java/com/idcanet/vasc/SWTTest.java index 8e26e59..6647fb3 100644 --- a/src/test/java/com/idcanet/vasc/SWTTest.java +++ b/vasc-frontend-swt/src/test/java/com/idcanet/vasc/SWTTest.java @@ -48,9 +48,9 @@ public class SWTTest extends TestCase { public void setUp() throws Exception { // enable all logs - InputStream loggingProperties = this.getClass().getResourceAsStream("/META-INF/logging.properties"); - LogManager.getLogManager().readConfiguration( loggingProperties ); - loggingProperties.close(); + //InputStream loggingProperties = this.getClass().getResourceAsStream("/META-INF/logging.properties"); + //LogManager.getLogManager().readConfiguration( loggingProperties ); + //loggingProperties.close(); // load xtes queries } diff --git a/www/META-INF/MANIFEST.MF b/www/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/www/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/www/META-INF/vasc-jsf.taglib.xml b/www/META-INF/vasc-jsf.taglib.xml deleted file mode 100644 index fa8b340..0000000 --- a/www/META-INF/vasc-jsf.taglib.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - http://foo.com/foo - - foo - - com.foo.Foo - com.foo.component.Foo - - - \ No newline at end of file diff --git a/www/WEB-INF/faces-config.xml b/www/WEB-INF/faces-config.xml deleted file mode 100644 index cfd6c98..0000000 --- a/www/WEB-INF/faces-config.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - Vasc - vasc-jsf - com.idcanet.vasc.frontends.web.jsf.VascUIComponent - - - - - - \ No newline at end of file diff --git a/www/WEB-INF/vasc-jsf.tld b/www/WEB-INF/vasc-jsf.tld deleted file mode 100644 index 2421927..0000000 --- a/www/WEB-INF/vasc-jsf.tld +++ /dev/null @@ -1,27 +0,0 @@ - - - - 1.0 - vasc - http://vasc.idcanet.com/jsf - - - vasc - com.idcanet.vasc.frontends.web.jsf.VascUIComponentTag - JSP - - - id - false - true - - - - bar - false - java.lang.Object - - - \ No newline at end of file diff --git a/www/WEB-INF/web.xml b/www/WEB-INF/web.xml deleted file mode 100644 index 5715804..0000000 --- a/www/WEB-INF/web.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - index.jsp - - - - facelets.SKIP_COMMENTS - true - - - - javax.faces.STATE_SAVING_METHOD - server - - - com.sun.faces.validateXml - true - - - com.sun.faces.verifyObjects - true - - - javax.faces.DEFAULT_SUFFIX - .jsp - - - - - facelets.VIEW_MAPPINGS - *.xhtml - - - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - - - - diff --git a/www/index.jsp b/www/index.jsp deleted file mode 100644 index db9befe..0000000 --- a/www/index.jsp +++ /dev/null @@ -1,12 +0,0 @@ - - - TEST INDEX.JSP - \ No newline at end of file diff --git a/www/vasc_test1.jsp b/www/vasc_test1.jsp deleted file mode 100644 index cb446ca..0000000 --- a/www/vasc_test1.jsp +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - -

TEST vasc1

-

The HelloWorld UI Component:

- -
- - -
-
\ No newline at end of file