2
0
Fork 0

basic slit in multi module project

This commit is contained in:
willem.cazander 2010-09-19 22:02:18 +02:00
parent f79378dacb
commit d6d77072d9
198 changed files with 25404 additions and 0 deletions

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

23
vasc-backend-jpa/.project Normal file
View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-backend-jpa</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,6 @@
#Mon Aug 30 21:55:23 CEST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View file

@ -0,0 +1,9 @@
#Mon Aug 30 21:55:22 CEST 2010
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
includeModules=false
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1

30
vasc-backend-jpa/pom.xml Normal file
View file

@ -0,0 +1,30 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-base</artifactId>
<groupId>com.idcanet.vasc</groupId>
<version>0.3-SNAPSHOT</version>
</parent>
<groupId>com.idcanet.vasc</groupId>
<artifactId>vasc-backend-jpa</artifactId>
<version>0.3-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.idcanet.vasc</groupId>
<artifactId>vasc-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.4.0.GA</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,96 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import org.hibernate.Session;
import com.idcanet.vasc.core.AbstractVascBackend;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
abstract public class AbstractHibernateVascBackend extends AbstractVascBackend {
/**
* Provides a hibernate session which is closed !! when transaction is compleeted.
* @return
*/
abstract Session getHibernateSession();
public void persist(Object object) throws VascException {
Session s = getHibernateSession();
try {
s.getTransaction().begin();
s.persist(object);
s.getTransaction().commit();
} finally {
if (s!=null && s.isOpen()) {
if (s.getTransaction().isActive()) {
s.getTransaction().rollback();
}
//s.close();
}
}
}
public Object merge(Object object) throws VascException {
Session s = getHibernateSession();
try {
s.getTransaction().begin();
Object result = s.merge(object);
s.getTransaction().commit();
return result;
} finally {
if (s!=null && s.isOpen()) {
if (s.getTransaction().isActive()) {
s.getTransaction().rollback();
}
//s.close();
}
}
}
public void delete(Object object) throws VascException {
Session s = getHibernateSession();
try {
s.getTransaction().begin();
Object newObject = s.merge(object);
s.delete(newObject);
s.getTransaction().commit();
} finally {
if (s!=null && s.isOpen()) {
if (s.getTransaction().isActive()) {
s.getTransaction().rollback();
}
//s.close();
}
}
}
}

View file

@ -0,0 +1,99 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import java.lang.reflect.Method;
import javax.persistence.EntityManager;
import com.idcanet.vasc.core.AbstractVascBackend;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend {
protected boolean emTransaction = true;
abstract EntityManager getEntityManager();
public void persist(Object object) throws VascException {
EntityManager s = getEntityManager();
try {
if (emTransaction) {
s.getTransaction().begin();
}
s.persist(object);
if (emTransaction) {
s.getTransaction().commit();
}
} finally {
if (s!=null) {
//s.close();
}
}
}
public Object merge(Object object) throws VascException {
EntityManager s = getEntityManager();
try {
if (emTransaction) {
s.getTransaction().begin();
}
Object result = s.merge(object);
if (emTransaction) {
s.getTransaction().commit();
}
return result;
} finally {
if (s!=null) {
//s.close();
}
}
}
public void delete(Object object) throws VascException {
EntityManager s = getEntityManager();
try {
if (emTransaction) {
s.getTransaction().begin();
}
Object newObject = s.merge(object);
s.remove(newObject);
if (emTransaction) {
s.getTransaction().commit();
}
} finally {
if (s!=null) {
//s.close();
}
}
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import javax.persistence.EntityManager;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2009
*/
public interface EntityManagerProvider {
public EntityManager getEntityManager();
public boolean hasEntityManagerTransaction();
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import org.hibernate.Session;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2009
*/
public interface HibernateSessionProvider {
public Session getHibernateSession();
}

View file

@ -0,0 +1,433 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import java.util.List;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;
import com.idcanet.vasc.backends.BeanVascEntryFieldValue;
import com.idcanet.vasc.backends.BeanVascEntryRecordCreator;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
import com.idcanet.xtes.xpql.query.QueryParameterValue;
/**
* Manages persistance with xpql queries
*
* @author Willem Cazander
* @version 1.0 Mar 17, 2009
*/
public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
private HibernateSessionProvider hibernateSessionProvider = null;
private com.idcanet.xtes.xpql.query.Query query = null;
private com.idcanet.xtes.xpql.query.Query queryTotal = null;
private com.idcanet.xtes.xpql.query.Query queryMoveUp = null;
private com.idcanet.xtes.xpql.query.Query queryMoveUpDown = null;
private com.idcanet.xtes.xpql.query.Query queryMoveDown = null;
private com.idcanet.xtes.xpql.query.Query queryMoveDownUp = null;
private Class<?> resultClass = null;
public XpqlHibernateVascBackend() {
}
/**
* @see com.idcanet.vasc.backends.jpa.AbstractPersistenceVascBackend#getEntityManager()
*/
@Override
Session getHibernateSession() {
return hibernateSessionProvider.getHibernateSession();
}
@SuppressWarnings("unchecked")
public List<Object> 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<QueryParameterValue> 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<Object> 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<QueryParameterValue> 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<QueryParameterValue> 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<QueryParameterValue> 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;
}
}

View file

@ -0,0 +1,437 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.jpa;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import com.idcanet.vasc.backends.BeanVascEntryFieldValue;
import com.idcanet.vasc.backends.BeanVascEntryRecordCreator;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
import com.idcanet.xtes.xpql.query.QueryParameterValue;
/**
* Manages persistance with xpql queries
*
* @author Willem Cazander
* @version 1.0 Mar 17, 2009
*/
public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend {
private EntityManagerProvider entityManagerProvider = null;
private com.idcanet.xtes.xpql.query.Query query = null;
private com.idcanet.xtes.xpql.query.Query queryTotal = null;
private com.idcanet.xtes.xpql.query.Query queryMoveUp = null;
private com.idcanet.xtes.xpql.query.Query queryMoveUpDown = null;
private com.idcanet.xtes.xpql.query.Query queryMoveDown = null;
private com.idcanet.xtes.xpql.query.Query queryMoveDownUp = null;
private Class<?> resultClass = null;
public XpqlPersistanceVascBackend() {
}
/**
* @see com.idcanet.vasc.backends.jpa.AbstractPersistenceVascBackend#getEntityManager()
*/
@Override
EntityManager getEntityManager() {
emTransaction=entityManagerProvider.hasEntityManagerTransaction();
return entityManagerProvider.getEntityManager();
}
@SuppressWarnings("unchecked")
public List<Object> 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<QueryParameterValue> 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<Object> 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<QueryParameterValue> 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<QueryParameterValue> 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<QueryParameterValue> 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;
}
}

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-backend-ldap</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,6 @@
#Mon Aug 30 21:55:41 CEST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View file

@ -0,0 +1,9 @@
#Mon Aug 30 21:55:40 CEST 2010
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
includeModules=false
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1

24
vasc-backend-ldap/pom.xml Normal file
View file

@ -0,0 +1,24 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-base</artifactId>
<groupId>com.idcanet.vasc</groupId>
<version>0.3-SNAPSHOT</version>
</parent>
<groupId>com.idcanet.vasc</groupId>
<artifactId>vasc-backend-ldap</artifactId>
<version>0.3-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.idcanet.vasc</groupId>
<artifactId>vasc-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.novell.ldap</groupId>
<artifactId>jldap</artifactId>
<version>${jldap.version}</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,39 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.ldap;
import com.novell.ldap.LDAPConnection;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface LdapConnectionProvider {
public LDAPConnection getLdapConnection();
}

View file

@ -0,0 +1,331 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.ldap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.backends.MapVascEntryFieldValue;
import com.idcanet.vasc.backends.MapVascEntryRecordCreator;
import com.idcanet.vasc.core.AbstractVascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
import com.novell.ldap.LDAPAttribute;
import com.novell.ldap.LDAPAttributeSet;
import com.novell.ldap.LDAPConnection;
import com.novell.ldap.LDAPEntry;
import com.novell.ldap.LDAPModification;
import com.novell.ldap.LDAPSearchConstraints;
import com.novell.ldap.LDAPSearchResults;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public class LdapVascBackend extends AbstractVascBackend {
private LdapConnectionProvider ldapConnectionProvider = null;
private String baseDN = null;
private String keyAttribute = null;
private String ldapFilter = null;
/**
* @return the ldapConnectionProvider
*/
public LdapConnectionProvider getLdapConnectionProvider() {
return ldapConnectionProvider;
}
/**
* @param ldapConnectionProvider the ldapConnectionProvider to set
*/
public void setLdapConnectionProvider(LdapConnectionProvider ldapConnectionProvider) {
this.ldapConnectionProvider = ldapConnectionProvider;
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute()
*/
public List<Object> execute(VascBackendState state) throws VascException {
LdapConnectionProvider prov = getLdapConnectionProvider();
LDAPConnection connection = prov.getLdapConnection();
List<Object> result = new ArrayList<Object>(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<String,Object> map = new HashMap<String,Object>(10);
LDAPAttributeSet attributeSet = entry.getAttributeSet();
Iterator<LDAPAttribute> 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<String> multiValue = new ArrayList<String>(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<String,Object> 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<LDAPModification> mods = new ArrayList<LDAPModification>(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<String> multiValue = new ArrayList<String>(s.length);
for (String ss:s) {
multiValue.add(ss);
}
List<String> v = null;
if (value instanceof String) {
v = new ArrayList<String>(1);
v.add((String)value);
} else {
v = (List<String>)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<String,Object> 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;
}
}

View file

@ -0,0 +1,138 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.backends.ldap;
import com.novell.ldap.LDAPConnection;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public class SimpleLdapConnectionProvider implements LdapConnectionProvider {
private String ldapHost = "localhost";
private int ldapPort = LDAPConnection.DEFAULT_PORT;
private int ldapVersion = LDAPConnection.LDAP_V3;
private String bindUser = null;
private String bindPass = null;
/**
* @see com.idcanet.vasc.backends.ldap.LdapConnectionProvider#getLdapConnection()
*/
public LDAPConnection getLdapConnection() {
try {
// if ssl;
//Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
//System.setProperty("javax.net.ssl.trustStore", "/tmp/somewhere/ldap.root.crt");
//LDAPSocketFactory ssf = new LDAPJSSESecureSocketFactory();
// Set the socket factory as the default for all future connections
//LDAPConnection.setSocketFactory(ssf);
LDAPConnection lc = new LDAPConnection();
lc.connect( ldapHost, ldapPort );
if (bindUser!=null && bindPass!=null) {
lc.bind( ldapVersion, bindUser, bindPass.getBytes("UTF8") );
}
return lc;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* @return the ldapHost
*/
public String getLdapHost() {
return ldapHost;
}
/**
* @param ldapHost the ldapHost to set
*/
public void setLdapHost(String ldapHost) {
this.ldapHost = ldapHost;
}
/**
* @return the ldapPort
*/
public int getLdapPort() {
return ldapPort;
}
/**
* @param ldapPort the ldapPort to set
*/
public void setLdapPort(int ldapPort) {
this.ldapPort = ldapPort;
}
/**
* @return the ldapVersion
*/
public int getLdapVersion() {
return ldapVersion;
}
/**
* @param ldapVersion the ldapVersion to set
*/
public void setLdapVersion(int ldapVersion) {
this.ldapVersion = ldapVersion;
}
/**
* @return the bindUser
*/
public String getBindUser() {
return bindUser;
}
/**
* @param bindUser the bindUser to set
*/
public void setBindUser(String bindUser) {
this.bindUser = bindUser;
}
/**
* @return the bindPass
*/
public String getBindPass() {
return bindPass;
}
/**
* @param bindPass the bindPass to set
*/
public void setBindPass(String bindPass) {
this.bindPass = bindPass;
}
}

10
vasc-core/.classpath Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

23
vasc-core/.project Normal file
View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>vasc-core</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,6 @@
#Mon Aug 30 22:00:13 CEST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View file

@ -0,0 +1,9 @@
#Mon Aug 30 22:00:12 CEST 2010
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
includeModules=false
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1

35
vasc-core/pom.xml Normal file
View file

@ -0,0 +1,35 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>vasc-base</artifactId>
<groupId>com.idcanet.vasc</groupId>
<version>0.3-SNAPSHOT</version>
</parent>
<groupId>com.idcanet.vasc</groupId>
<artifactId>vasc-core</artifactId>
<version>0.3-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.idcanet.x4o</groupId>
<artifactId>x4o-core</artifactId>
<version>${x4o-core.version}</version>
</dependency>
<dependency>
<groupId>com.idcanet.xtes</groupId>
<artifactId>xtes-xpql</artifactId>
<version>${xtes-xpql.version}</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>3.1.0.CR1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,134 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.Map;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 2, 2007
*/
abstract public class AbstractVascBackend implements VascBackend {
private String id = null;
/**
* @see com.idcanet.vasc.core.VascBackend#getId()
*/
public String getId() {
return id;
}
/**
* @see com.idcanet.vasc.core.VascBackend#setId(java.lang.String)
*/
public void setId(String id) {
if (id==null) {
throw new IllegalArgumentException("id may not be null");
}
this.id=id;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isPageable()
*/
public boolean isPageable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
*/
public long fetchTotalExecuteSize(VascBackendState state) {
return 0;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSearchable()
*/
public boolean isSearchable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSortable()
*/
public boolean isSortable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#isRecordMoveable()
*/
public boolean isRecordMoveable() {
return false;
}
/**
* @see com.idcanet.vasc.core.VascBackend#doRecordMoveDownById(java.lang.Object)
*/
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
return 0l;
}
/**
* @see com.idcanet.vasc.core.VascBackend#doRecordMoveUpById(java.lang.Object)
*/
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
return 0l;
}
/**
* @see com.idcanet.vasc.core.VascBackend#executePageSummary()
*/
public Map<String, Object> executePageSummary() {
return null;
}
/**
* @see com.idcanet.vasc.core.VascBackend#executeTotalSummary()
*/
public Map<String, Object> 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;
}
}

View file

@ -0,0 +1,184 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 1, 2009
*/
abstract public class AbstractVascBackendProxy implements VascBackend {
protected VascBackend backend = null;
public AbstractVascBackendProxy(VascBackend backend) {
if (backend==null) {
throw new NullPointerException("backend object mey not be null.");
}
this.backend=backend;
}
/**
* @see com.idcanet.vasc.core.VascBackend#fetchTotalExecuteSize(VascBackendState state)
*/
public long fetchTotalExecuteSize(VascBackendState state) {
return backend.fetchTotalExecuteSize(state);
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSortable()
*/
public boolean isSortable() {
return backend.isSortable();
}
/**
* @throws Exception
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
public List<Object> 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<String, Object> executePageSummary() {
return backend.executePageSummary();
}
/**
* @see com.idcanet.vasc.core.VascBackend#executeTotalSummary()
*/
public Map<String, Object> 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();
}
}

View file

@ -0,0 +1,149 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
*
* @author Willem Cazander
* @version 1.0 May 26, 2009
*/
abstract public class AbstractVascBackendState implements VascBackendState {
private static final long serialVersionUID = 1L;
protected Map<String,Object> 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<String,Object>(10);
}
public void setDataParameter(String key,Object data) {
parameters.put(key,data);
}
public Object getDataParameter(String key) {
return parameters.get(key);
}
public Set<String> 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;
}
}

View file

@ -0,0 +1,217 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.idcanet.vasc.validators.VascValidator;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 2, 2007
*/
abstract public class AbstractVascEntryFieldType implements VascEntryFieldType {
private static final long serialVersionUID = 1L;
protected String id = null;
protected Class<?> autoDetectClass = null;
protected List<VascValidator> vascValidators = null;
protected Map<String,String> properties = null;
protected Object dataObject = null;
protected String uiComponentId = null;
protected String inputMask = null;
public AbstractVascEntryFieldType() {
vascValidators = new ArrayList<VascValidator>(4);
properties = new HashMap<String,String>();
}
/**
* @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<String> getPropertyNames() {
return new ArrayList<String>(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<VascValidator> 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;
}
}

View file

@ -0,0 +1,142 @@
/**
*
*/
package com.idcanet.vasc.core;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Holds all default state values
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
abstract public class AbstractVascEntryState implements VascEntryState {
private static final long serialVersionUID = 1L;
private List<Object> entryDataList = null;
private Object entryDataObject = null;
private Long totalBackendRecords = null;
private VascBackendState vascBackendState = null;
private VascEntryState state = null;
private Map<Integer,Boolean> multiActionSelection = null;
private boolean isEditCreate = false;
private VascBackend vascBackend = null;
private VascEntry vascEntry = null;
public AbstractVascEntryState() {
entryDataList = new ArrayList<Object>(0);
multiActionSelection = new HashMap<Integer,Boolean>(200);
}
/**
* @return the entryDataList
*/
public List<Object> getEntryDataList() {
return entryDataList;
}
/**
* @param entryDataList the entryDataList to set
*/
public void setEntryDataList(List<Object> 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<Integer,Boolean> multiActionSelection) {
this.multiActionSelection=multiActionSelection;
}
public Map<Integer,Boolean> 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;
}
}

View file

@ -0,0 +1,82 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 2, 2007
*/
abstract public class AbstractVascFrontend implements VascFrontend {
private String id = null;
protected VascEntry entry = null;
protected String i18n(String key,Object...params) {
return entry.getVascFrontendData().getVascEntryResourceResolver().getTextValue(key,params);
}
protected Object i18nImage(String key) {
return entry.getVascFrontendData().getVascEntryResourceImageResolver().getImageValue(entry,key);
}
public VascEntry getVascEntry() {
return entry;
}
abstract protected void addUiComponents();
/**
* @see com.idcanet.vasc.core.VascFrontend#initEntry(com.idcanet.vasc.core.VascEntry)
*/
public void initEntry(VascEntry entry) throws Exception {
if (entry.getVascFrontendData().getVascFrontend()==null) {
entry.getVascFrontendData().setVascFrontend(this);
} else {
if (entry.getVascFrontendData().getVascFrontend()!=this) {
throw new IllegalArgumentException("VascEntry has already a differtent VascFrontend attected");
}
}
this.entry=entry;
addUiComponents();
}
/**
* @see com.idcanet.vasc.core.VascFrontend#getId()
*/
public String getId() {
return id;
}
/**
* @see com.idcanet.vasc.core.VascFrontend#setId(java.lang.String)
*/
public void setId(String id) {
this.id=id;
}
}

View file

@ -0,0 +1,114 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascBackend {
public String getId();
public void setId(String id);
public List<Object> 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<String,Object> executePageSummary();
public boolean isTotalSummary();
public Map<String,Object> executeTotalSummary();
/*
public boolean hasSettings();
public Map<String,String> getSettings();
public void putSetting(String key,String value);
*/
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface VascBackendController {
public VascBackend getVascBackendById(String id);
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 17, 2008
*/
public interface VascBackendControllerLocal extends VascBackendController {
public void addVascBackend(VascBackend backend);
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
* Can filter the data
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2009
*/
public interface VascBackendFilter {
/**
* Inits the filter
*/
public void initFilter(VascEntry entry);
/**
* Only filters 1 object.
*/
public Object filterObject(Object object);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascBackendFilter clone() throws CloneNotSupportedException;
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
/**
* Small class to wrap page number and the selected page number.
* note: this can be removed when JSF has the combined EL.
*
* @author Willem Cazander
* @version 1.0 Apr 25, 2006
*/
public class VascBackendPageNumber implements Serializable {
private static final long serialVersionUID = 1L;
private Integer pageNumber = null;
private Boolean selected = false;
public VascBackendPageNumber(Integer pageNumber) { this.pageNumber=pageNumber; }
public Integer getPageNumber() { return pageNumber; }
public Boolean getSelected() { return selected; }
public Boolean getNotSelected() { return !selected; }
public void setSelected(Boolean selected) { this.selected=selected; }
}

View file

@ -0,0 +1,60 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.Set;
/**
* Holds all the data the backend needs to know to execute its work.
*
* @author Willem Cazander
* @version 1.0 May 26, 2009
*/
public interface VascBackendState extends Serializable {
public void setDataParameter(String key,Object data);
public Object getDataParameter(String key);
public Set<String> 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();
}

View file

@ -0,0 +1,67 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
* Resolvs all the resolvers.
* These resolved often point to an external locations.
*
* @author Willem Cazander
* @version 1.0 Sep 11, 2008
*/
public interface VascController {
/**
* @return Returns the VascBackendController
*/
public VascBackendController getVascBackendController();
/**
*
* @return Returns the VascEntryController
*/
public VascEntryController getVascEntryController();
/**
*
* @return Returns the VascEntryFieldController
*/
public VascEntryFieldTypeController getVascEntryFieldTypeController();
/**
*
* @return Returns the VascEventChannelController
*/
public VascEventChannelController getVascEventChannelController();
/**
*
* @return Returns the VascUserRoleController
*/
public VascUserRoleController getVascUserRoleController();
}

View file

@ -0,0 +1,420 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.actions.ColumnVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
/**
* The main vasc entry
*
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntry extends Cloneable,Serializable {
/**
* @return the id
*/
public String getId();
/**
* @param id the id to set
*/
public void setId(String id);
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* @return the helpId
*/
public String getHelpId();
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId);
/**
* @return the image
*/
public String getImage();
/**
* @param image the image to set
*/
public void setImage(String image);
/**
* @return the listDescription
*/
public String getListDescription();
/**
* @param listDescription the listDescription to set
*/
public void setListDescription(String listDescription);
/**
* @return the listImage
*/
public String getListImage();
/**
* @param listImage the listImage to set
*/
public void setListImage(String listImage);
/**
* @return the editDescription
*/
public String getEditDescription();
/**
* @param editDescription the editDescription to set
*/
public void setEditDescription(String editDescription);
/**
* @return the editImage
*/
public String getEditImage();
/**
* @param editImage the editImage to set
*/
public void setEditImage(String editImage);
/**
* @return the deleteDescription
*/
public String getDeleteDescription();
/**
* @param deleteDescription the deleteDescription to set
*/
public void setDeleteDescription(String deleteDescription);
/**
* @return the deleteImage
*/
public String getDeleteImage();
/**
* @param deleteImage the deleteImage to set
*/
public void setDeleteImage(String deleteImage);
/**
* @return the createDescription
*/
public String getCreateDescription();
/**
* @param createDescription the createDescription to set
*/
public void setCreateDescription(String createDescription);
/**
* @return the createImage
*/
public String getCreateImage();
/**
* @param createImage the createImage to set
*/
public void setCreateImage(String createImage);
/**
* @return the primaryKeyField
*/
public String getPrimaryKeyFieldId();
/**
* @param primaryKeyField the primaryKeyField to set
*/
public void setPrimaryKeyFieldId(String primaryKeyField);
/**
* @return the displayNameField
*/
public String getDisplayNameFieldId();
/**
* @param displayNameField the displayNameField to set
*/
public void setDisplayNameFieldId(String displayNameField);
/**
* @return the vascAdminList
*/
public boolean isVascAdminList();
/**
* @param vascAdminList the vascAdminList to set
*/
public void setVascAdminList(boolean vascAdminList);
/**
* @return the vascAdminEdit
*/
public boolean isVascAdminEdit();
/**
* @param vascAdminEdit the vascAdminEdit to set
*/
public void setVascAdminEdit(boolean vascAdminEdit);
/**
* @return the vascAdminCreate
*/
public boolean isVascAdminCreate();
/**
* @param vascAdminCreate the vascAdminCreate to set
*/
public void setVascAdminCreate(boolean vascAdminCreate);
/**
* @return the vascAdminDelete
*/
public boolean isVascAdminDelete();
/**
* @param vascAdminDelete the vascAdminDelete to set
*/
public void setVascAdminDelete(boolean vascAdminDelete);
/**
* @return the vascFields
*/
public List<VascEntryField> 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<RowVascAction> 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<ColumnVascAction> 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<GlobalVascAction> 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<VascEntryFieldSet> 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<VascLinkEntry> 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<String> 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<VascEntryBackendEventListener> listener);
/**
* Returns the list of VascEntryBackendEventListener
* @return
*/
public List<Class<VascEntryBackendEventListener>> getVascEntryBackendEventListeners();
/**
* Added an VascEntryFrontendEventListener
* @param listener The class of the event listener.
*/
public void addVascEntryFrontendEventListener(Class<VascEntryFrontendEventListener> listener);
/**
* Returns the list of VascEntryFrontendEventListener
* @return
*/
public List<Class<VascEntryFrontendEventListener>> getVascEntryFrontendEventListeners();
public void addListOption(VascEntryField listOption);
public List<VascEntryField> getListOptions();
public void addVascBackendFilter(VascBackendFilter filter);
public List<VascBackendFilter> getVascBackendFilters();
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascEntry clone() throws CloneNotSupportedException;
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface VascEntryController {
public VascEntry getVascEntryById(String id);
public List<String> getVascEntryIds();
public List<String> getVascEntryAdminIds();
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
* The local interface which is not used in controllers.
* But is needed to be able to add entry in a safe way.
*
* @author Willem Cazander
* @version 1.0 Nov 16, 2008
*/
public interface VascEntryControllerLocal extends VascEntryController {
public void addVascEntry(VascEntry entry,VascController vascController) throws VascException;
}

View file

@ -0,0 +1,387 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.validators.VascValidator;
/**
* Defines an VascEntryField
*
*
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryField extends Cloneable,Serializable {
/**
* @return the VascEntry
*/
public VascEntry getVascEntry();
/**
* @param entry the VascEntry to set
*/
public void setVascEntry(VascEntry entry);
/**
* @return the id
*/
public String getId();
/**
* @param id the id to set
*/
public void setId(String id);
/**
* @return the vascEntryFieldType
*/
public VascEntryFieldType getVascEntryFieldType();
/**
* @param vascEntryFieldType the vascEntryFieldType to set
*/
public void setVascEntryFieldType(VascEntryFieldType vascEntryFieldType);
/**
* @return the backendName
*/
public String getBackendName();
/**
* @param backendName the backendName to set
*/
public void setBackendName(String backendName);
/**
* @return the vascEntryFieldValue
*/
public VascEntryFieldValue getVascEntryFieldValue();
/**
* @param vascEntryFieldValue the vascEntryFieldValue to set
*/
public void setVascEntryFieldValue(VascEntryFieldValue vascEntryFieldValue);
/**
* @return the vascValidators
*/
public List<VascValidator> 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;
}

View file

@ -0,0 +1,154 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
* Orgenisess Fields
*
*
*
* @author Willem Cazander
* @version 1.0 Sep 56, 2008
*/
public interface VascEntryFieldSet extends Cloneable {
/**
* @return the id
*/
public String getId();
/**
* @param id the id to set
*/
public void setId(String id);
/**
* @return the name
*/
public String getName();
/**
* @param name the name to set
*/
public void setName(String name);
/**
* @return the description
*/
public String getDescription();
/**
* @param description the description to set
*/
public void setDescription(String description);
/**
* @return the helpId
*/
public String getHelpId();
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId);
/**
* @return the image
*/
public String getImage();
/**
* @param image the image to set
*/
public void setImage(String image);
/**
* @return the styleList
*/
public String getStyleList();
/**
* @param styleList the styleList to set
*/
public void setStyleList(String styleList);
/**
* @return the styleEdit
*/
public String getStyleEdit();
/**
* @param styleEdit the styleEdit to set
*/
public void setStyleEdit(String styleEdit);
/**
* @return the collapsed
*/
public boolean isCollapsed();
/**
* @param collapsed the collapsed to set
*/
public void setCollapsed(boolean collapsed);
/**
* @return the optional
*/
public boolean isOptional();
/**
* @param optional the optional to set
*/
public void setOptional(boolean optional);
/**
* @return the vascEntryFieldIds
*/
public List<String> 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;
}

View file

@ -0,0 +1,78 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.ui.VascUIComponent;
import com.idcanet.vasc.core.ui.VascValueModel;
import com.idcanet.vasc.validators.VascValidator;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryFieldType extends Serializable {
public String getId();
public void setId(String id);
public String getUIComponentId();
public void setUIComponentId(String uiComponentId);
public String getInputMask();
public void setInputMask(String inputMask);
public Class<?> getAutoDetectClass();
public void setAutoDetectClass(Class<?> classObject);
public void addVascValidator(VascValidator vascValidator);
public void removeVascValidator(VascValidator vascValidator);
public List<VascValidator> getVascValidators();
public void setProperty(String name,String value);
public String getProperty(String name);
public List<String> 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;
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 4, 2008
*/
public interface VascEntryFieldTypeController {
public VascEntryFieldType getVascEntryFieldTypeById(String id);
public List<String> getVascEntryFieldTypeIds();
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Dec 19, 2008
*/
public interface VascEntryFieldTypeControllerLocal extends VascEntryFieldTypeController {
public void addVascEntryFieldType(VascEntryFieldType vascEntryFieldType);
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 9, 2008
*/
public interface VascEntryFinalizer {
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException;
}

View file

@ -0,0 +1,117 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* Holds all the data for state.
* So we can jump forward or back to a state.
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
public interface VascEntryState extends Serializable {
/**
* @return the entryDataList
*/
public List<Object> getEntryDataList();
/**
* @param entryDataList the entryDataList to set
*/
public void setEntryDataList(List<Object> 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<Integer,Boolean> multiActionSelection);
public Map<Integer,Boolean> 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);
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2008
*/
public interface VascEventChannelController {
public void publishEntryEvent(String entryId);
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Dec 19, 2008
*/
public interface VascEventChannelControllerLocal extends VascEventChannelController {
}

View file

@ -0,0 +1,50 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
*/
@SuppressWarnings("serial")
public class VascException extends Exception {
public VascException() {
}
public VascException(String message) {
super(message);
}
public VascException(Exception e) {
super(e);
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import com.idcanet.vasc.core.entry.VascEntryExporter;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascFrontend {
public void setId(String name);
public String getId();
public void initEntry(VascEntry entry) throws Exception;
public void renderView() throws Exception;
public void renderEdit() throws Exception;
public void renderDelete() throws Exception;
public void renderExport(VascEntryExporter exporter) throws Exception;
}

View file

@ -0,0 +1,109 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.core.entry.VascEntryResourceImageResolver;
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
import com.idcanet.vasc.core.ui.VascUIComponent;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascFrontendData {
/**
* @return the vascFrontend
*/
public VascFrontend getVascFrontend();
/**
* @param vascFrontend the vascFrontend to set
*/
public void setVascFrontend(VascFrontend vascFrontend);
/**
* @return the VascFrontendHelper
*/
public VascFrontendHelper getVascFrontendHelper();
/**
* @param vascFrontendHelper The VascFrontendHelper to set.
*/
public void setVascFrontendHelper(VascFrontendHelper vascFrontendHelper);
/**
* @return the vascEntryResourceResolver
*/
public VascEntryResourceResolver getVascEntryResourceResolver();
/**
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
*/
public void setVascEntryResourceResolver(VascEntryResourceResolver vascEntryResourceResolver);
public void putVascUIComponent(String rendererId,String uiComponentClass);
public VascUIComponent getVascUIComponent(String rendererId) throws VascException;
public String getVascUIComponentClass(String rendererId);
public void setVascController(VascController vascController);
public VascController getVascController();
public void addFieldVascUIComponents(VascEntryField field,VascUIComponent uiComponent,Object editor);
public VascUIComponent getFieldVascUIComponent(VascEntryField field);
public Object getFieldRealRenderer(VascEntryField field);
public void clearFieldRenderObjects();
/**
* @return the vascEntryResourceImageResolver
*/
public VascEntryResourceImageResolver getVascEntryResourceImageResolver();
/**
* @param vascEntryResourceImageResolver the vascEntryResourceImageResolver to set
*/
public void setVascEntryResourceImageResolver(VascEntryResourceImageResolver vascEntryResourceImageResolver);
public void addVascValidatorService(VascEntryFieldValidatorService validatorService);
public List<VascEntryFieldValidatorService> getVascValidatorServices();
public VascEntryState getVascEntryState();
public void setVascEntryState(VascEntryState state);
public void initFrontendListeners(VascEntry entry) throws InstantiationException, IllegalAccessException;
public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener);
public List<VascEntryFrontendEventListener> getVascEntryFrontendEventListener(VascEntryFrontendEventListener.VascFrontendEventType type);
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.EventListener;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascFrontendExceptionHandler extends EventListener {
public void handleException(Exception e,VascFrontend vascFrontend,VascEntry entry);
}

View file

@ -0,0 +1,90 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
public interface VascFrontendHelper {
public boolean renderView(VascEntryField field);
public boolean renderList(VascEntryField field);
public boolean renderEdit(VascEntryField field);
public boolean renderEditReadOnly(VascEntryField field);
public boolean renderCreate(VascEntryField field);
public boolean renderGlobalVascAction(GlobalVascAction action);
public boolean renderRowVascAction(RowVascAction action);
public Integer getTotalColumnsWidth(VascEntry entry);
public List<VascLinkEntry> getVascLinkEntryByType(VascEntry entry,VascLinkEntryType type);
/**
* Returns the total amount of pages
* @return
*/
public List<VascBackendPageNumber> 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<String> 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<RowVascAction> getMultiRowActions(VascEntry entry);
}

View file

@ -0,0 +1,90 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 7, 2008
*/
public interface VascLinkEntry extends Cloneable,Serializable {
public String getId();
public void setId(String id);
public String getVascEntryId();
public void setVascEntryId(String vascEntryId);
public String getEntryParameterFieldId(String parameterName);
public void addEntryParameterFieldId(String parameterName,String valueFieldId);
public List<String> getEntryParameterFieldIdKeys();
public String getEntryCreateFieldValue(String valueFieldId);
public void addEntryCreateFieldValue(String valueFieldId,String selectedFieldId);
public List<String> 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;
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.io.Serializable;
/**
* The type of a VascLinkEntry
*
* @author Willem Cazander
* @version 1.0 Mrt 16, 2010
*/
public enum VascLinkEntryType implements Serializable {
EDIT_INLINE,
EDIT_TAB,
LIST;
public static VascLinkEntryType DEFAULT_TYPE = VascLinkEntryType.EDIT_TAB;
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core;
import java.util.List;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public interface VascUserRoleController {
public Long getUserId();
public String getUserName();
public List<String> getUserRoles();
public boolean hasRole(String roles);
}

View file

@ -0,0 +1,135 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 30, 2007
*/
abstract public class AbstractVascAction implements VascAction {
private static final long serialVersionUID = 1L;
private String id = null;
private String name = null;
private String description = null;
private String image = null;
private String helpId = null;
public AbstractVascAction() {
setId(getActionId());
}
abstract protected String getActionId();
public VascAction clone() throws CloneNotSupportedException {
VascAction action;
try {
action = this.getClass().newInstance();
} catch (Exception e) {
throw new CloneNotSupportedException("Could not create action from myClass: "+e.getMessage());
}
action.setId(id);
action.setName(name);
action.setDescription(description);
action.setImage(image);
action.setHelpId(helpId);
return action;
}
/**
* @see com.idcanet.vasc.core.actions.VascAction#getId()
*/
public String getId() {
return id;
}
/**
* @see com.idcanet.vasc.core.actions.VascAction#setId(java.lang.String)
*/
public void setId(String id) {
this.id=id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description description toolTip to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the helpId
*/
public String getHelpId() {
return helpId;
}
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId) {
this.helpId = helpId;
}
/**
* @return the image
*/
public String getImage() {
return image;
}
/**
* @param image the image to set
*/
public void setImage(String image) {
this.image = image;
}
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface ColumnVascAction extends VascAction {
public void doColumnAction(VascEntry table,VascEntryField column) throws Exception;
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface GlobalVascAction extends VascAction {
public void doGlobalAction(VascEntry vascEntry) throws Exception;
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface RowVascAction extends VascAction {
public boolean isMultiRowAction();
public void doRowAction(VascEntry vascEntry,Object rowObject) throws Exception;
}

View file

@ -0,0 +1,64 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.actions;
import java.io.Serializable;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascAction extends Cloneable,Serializable {
public String getId();
public void setId(String id);
public String getName();
public void setName(String name);
public String getDescription();
public void setDescription(String description);
public String getImage();
public void setImage(String image);
public String getHelpId();
public void setHelpId(String helpId);
/**
* Force impl to have public clone methode
* @return
* @throws CloneNotSupportedException
*/
public VascAction clone() throws CloneNotSupportedException;
}

View file

@ -0,0 +1,62 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Jul 05, 2010
*/
public interface VascEntryBackendEventListener extends Serializable {
public enum VascBackendEventType {
EXECUTE,
PERSIST,
MERGE,
DELETE,
PROVIDE_FIELD_VALUE,
PROVIDE_RECORD_CREATOR,
TOTAL_EXECUTE_SIZE,
MOVE_DOWN,
MOVE_UP
}
public VascBackendEventType getEventType();
/**
* Is executed when the type of event is fired.
* @param entry
* @param type
* @param data
*/
public void vascEvent(VascEntry entry,Object data);
}

View file

@ -0,0 +1,49 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.OutputStream;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 May 19, 2007
*/
public interface VascEntryExporter extends Serializable {
public void doExport(OutputStream out,VascEntry vascEntry) throws VascException;
public String getMineType();
public String getType();
}

View file

@ -0,0 +1,43 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 04, 2008
*/
public interface VascEntryFieldEventChannel extends Serializable {
public void setChannel(String channel);
public String getChannel();
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.util.List;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
* Executes validation on a field.
*
* @author Willem Cazander
* @version 1.0 May 13, 2009
*/
public interface VascEntryFieldValidatorService {
public List<String> validateObjectField(VascEntryField field, Object selectedRecord,Object objectValue) throws VascException;
}

View file

@ -0,0 +1,46 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryFieldValue extends Serializable {
public Object getValue(VascEntryField field,Object record) throws VascException;
public String getDisplayValue(VascEntryField field,Object record) throws VascException;
public void setValue(VascEntryField field,Object record,Object value) throws VascException;
}

View file

@ -0,0 +1,68 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 02, 2007
*/
public interface VascEntryFrontendEventListener extends Serializable {
public enum VascFrontendEventType {
EXCEPTION,
DATA_CREATE,
DATA_READ,
DATA_SELECT,
DATA_PRE_UPDATE,
DATA_POST_UPDATE,
DATA_DELETE,
DATA_LIST_UPDATE,
DATA_SORT,
DATA_PAGE,
DATA_SEARCH,
OPTION_UPDATE,
}
public VascFrontendEventType[] getEventTypes();
/**
* Is executed when the type of event is fired.
* @param entry
* @param type
* @param data
*/
public void vascEvent(VascEntry entry,Object data);
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import java.io.Serializable;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryRecordCreator extends Serializable {
public Object newRecord(VascEntry entry) throws Exception;
public Class<?> getObjectClass();
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
import com.idcanet.vasc.core.VascEntry;
/**
*
* @author Willem Cazander
* @version 1.0 May 13, 2009
*/
public interface VascEntryResourceImageResolver {
public Object getImageValue(VascEntry entry,String key);
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.entry;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public interface VascEntryResourceResolver {
public String getTextValue(String key,Object...params);
}

View file

@ -0,0 +1,81 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class VascColumnValueModelListener implements VascValueModelListener {
private VascEntryField vascEntryField = null;
private Object bean = null;
public VascColumnValueModelListener() {
}
public VascColumnValueModelListener(VascEntryField vascEntryField,Object bean) {
setVascEntryField(vascEntryField);
setBean(bean);
}
public void valueUpdate(VascValueModel model) throws VascException {
vascEntryField.getVascEntryFieldValue().setValue(vascEntryField, bean, model.getValue());
}
/**
* @return the vascEntryField
*/
public VascEntryField getVascEntryField() {
return vascEntryField;
}
/**
* @param vascEntryField the vascEntryField to set
*/
public void setVascEntryField(VascEntryField vascEntryField) {
this.vascEntryField = vascEntryField;
}
/**
* @return the bean
*/
public Object getBean() {
return bean;
}
/**
* @param bean the bean to set
*/
public void setBean(Object bean) {
this.bean = bean;
}
}

View file

@ -0,0 +1,67 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 May 21, 2009
*/
public class VascOptionValueModelListener implements VascValueModelListener {
private VascEntryField vascEntryField = null;
public VascOptionValueModelListener() {
}
public VascOptionValueModelListener(VascEntryField vascEntryField) {
setVascEntryField(vascEntryField);
}
public void valueUpdate(VascValueModel model) throws VascException {
String key = vascEntryField.getBackendName();
Object value = model.getValue();
vascEntryField.getVascEntry().setEntryParameter(key, value);
}
/**
* @return the vascEntryField
*/
public VascEntryField getVascEntryField() {
return vascEntryField;
}
/**
* @param vascEntryField the vascEntryField to set
*/
public void setVascEntryField(VascEntryField vascEntryField) {
this.vascEntryField = vascEntryField;
}
}

View file

@ -0,0 +1,109 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class VascSelectItem {
private String label = null;
private Object value = null;
private String keyValue = null;
private boolean disabled = false;
public VascSelectItem() {
}
public VascSelectItem(String label,Object value) {
setLabel(label);
setValue(value);
}
public VascSelectItem(String label,Object value,String keyValue) {
setLabel(label);
setValue(value);
setKeyValue(keyValue);
}
/**
* @return the label
*/
public String getLabel() {
return label;
}
/**
* @param label the label to set
*/
public void setLabel(String label) {
this.label = label;
}
/**
* @return the value
*/
public Object getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(Object value) {
this.value = value;
}
/**
* @return the keyValue
*/
public String getKeyValue() {
return keyValue;
}
/**
* @param keyValue the keyValue to set
*/
public void setKeyValue(String keyValue) {
this.keyValue = keyValue;
}
/**
* @return the disabled
*/
public boolean isDisabled() {
return disabled;
}
/**
* @param disabled the disabled to set
*/
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
}

View file

@ -0,0 +1,69 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import java.io.Serializable;
import java.util.List;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascSelectItemModel extends Serializable {
/**
* Creates an SelectItem list.
* @param entry
* @return
* @throws VascException
*/
public List<VascSelectItem> 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);
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public interface VascUIActionComponent extends VascUIComponent {
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
/**
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2008
*/
public interface VascUIActionComponentListener {
}

View file

@ -0,0 +1,64 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascUIComponent {
// required ui components
static public final String VASC_LABEL = "VascLabel";
static public final String VASC_TEXT = "VascText";
static public final String VASC_LIST = "VascList";
static public final String VASC_BUTTON = "VascButton";
// optional ui Components
static public final String VASC_TEXTAREA = "VascTextArea";
static public final String VASC_BOOLEAN = "VascBoolean";
static public final String VASC_DATE = "VascDate";
static public final String VASC_COLOR = "VascColor";
static public final String[] requiredUIComponents = {VASC_LABEL,VASC_TEXT,VASC_LIST,VASC_BUTTON};
public Object createComponent(VascEntry entry,VascEntryField entryField,VascValueModel model,Object gui) throws VascException;
public void setErrorText(String text);
public String getErrorText();
public void setDisabled(boolean disabled);
public boolean isDisabled();
public void setRendered(boolean rendered);
public boolean isRendered();
}

View file

@ -0,0 +1,81 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public class VascValueModel {
private Object value = null;
private List<VascValueModelListener> listeners = null;
private VascValueModel parentModel = null;
public VascValueModel() {
listeners = new ArrayList<VascValueModelListener>(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);
}
}
}

View file

@ -0,0 +1,43 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.core.ui;
import java.util.EventListener;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 12, 2007
*/
public interface VascValueModelListener extends EventListener {
public void valueUpdate(VascValueModel model) throws VascException;
}

View file

@ -0,0 +1,436 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.Collections;
import java.util.Comparator;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFieldSet;
import com.idcanet.vasc.core.VascEntryFieldType;
import com.idcanet.vasc.core.VascEntryFinalizer;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.VascLinkEntryType;
import com.idcanet.vasc.core.actions.VascAction;
/**
* Checks for minimal needed stuff
* and fills up the rest.
*
*
* @author Willem Cazander
* @version 1.0 Sep 14, 2008
*/
public class DefaultVascBackedEntryFinalizer implements VascEntryFinalizer {
/**
* @see com.idcanet.vasc.core.VascEntryFinalizer#finalizeVascEntry(com.idcanet.vasc.core.VascEntry)
*/
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
// First Check if we all have ids
String id = entry.getId();
if (id==null) {
throw new IllegalArgumentException("The VascEntry need an id.");
}
if (entry.getBackendId()==null) {
throw new IllegalArgumentException("The VascEntry need an backendId in entryId: "+id);
}
if (entry.getVascEntryFields().size()==0) {
throw new IllegalArgumentException("We need at least one VascEntryField in entryId: "+id);
}
for (VascEntryField vef:entry.getVascEntryFields()) {
if (vef.getId()==null) {
throw new IllegalArgumentException("All VascEntryField need an id in entryId: "+id);
}
}
for (VascEntryField vef:entry.getListOptions()) {
if (vef.getId()==null) {
throw new IllegalArgumentException("All listOption VascEntryField to have an id in entryId: "+id);
}
}
// Check if backendId is valid
VascBackend back = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
if (back==null) {
throw new IllegalArgumentException("The VascEntry backendId is not found in backends: '"+entry.getBackendId()+"' in entryId: "+id);
}
// Fill up all not field i18n keys
// entry fields
if (entry.getName()==null) {
entry.setName("vasc.entry."+id+".name");
}
if (entry.getImage()==null) {
entry.setImage("vasc.entry."+id+".image");
}
if (entry.getHelpId()==null) {
entry.setHelpId("vasc.entry."+id+".helpId");
}
if (entry.getListDescription()==null) {
entry.setListDescription("vasc.entry."+id+".listDescription");
}
if (entry.getListImage()==null) {
entry.setListImage("vasc.entry."+id+".listImage");
}
if (entry.getEditDescription()==null) {
entry.setEditDescription("vasc.entry."+id+".editDescription");
}
if (entry.getEditImage()==null) {
entry.setEditImage("vasc.entry."+id+".editImage");
}
if (entry.getDeleteDescription()==null) {
entry.setDeleteDescription("vasc.entry."+id+".deleteDescription");
}
if (entry.getDeleteImage()==null) {
entry.setDeleteImage("vasc.entry."+id+".deleteImage");
}
if (entry.getCreateDescription()==null) {
entry.setCreateDescription("vasc.entry."+id+".createDescription");
}
if (entry.getCreateImage()==null) {
entry.setCreateImage("vasc.entry."+id+".createImage");
}
// boolean view helper
if (entry.isVascDisplayOnly()) {
entry.setVascAdminCreate(false);
entry.setVascAdminDelete(false);
entry.setVascAdminEdit(false);
}
// optional field sets
for (VascEntryFieldSet s:entry.getVascEntryFieldSets()) {
// check id
String sid = s.getId();
if (sid==null) {
throw new IllegalArgumentException("All VascEntryFieldSet need an id in entryId: "+id);
}
// check if refenced ids are avalible
for (String fid:s.getVascEntryFieldIds()) {
if (entry.getVascEntryFieldById(fid)==null) {
throw new IllegalArgumentException("VascEntryFieldSet "+sid+" has non excisting field id: "+fid+" in entryId: "+id);
}
}
// fill up properties
if (s.getName()==null) {
s.setName("vasc.entry."+id+"."+sid+".name");
}
if (s.getDescription()==null) {
s.setDescription("vasc.entry."+id+"."+sid+".description");
}
if (s.getImage()==null) {
s.setImage("vasc.entry."+id+"."+sid+".image");
}
if (s.getHelpId()==null) {
s.setHelpId("vasc.entry."+id+"."+sid+".helpId");
}
if (s.getStyleEdit()==null) {
s.setStyleEdit("vasc.entry."+id+"."+sid+".styleEdit");
}
if (s.getStyleList()==null) {
s.setStyleList("vasc.entry."+id+"."+sid+".styleEdit");
}
}
// Set defaults field Id for key ad display
if (entry.getPrimaryKeyFieldId()==null) {
entry.setPrimaryKeyFieldId(entry.getVascEntryFields().get(0).getId());
}
if (entry.getDisplayNameFieldId()==null) {
entry.setDisplayNameFieldId(entry.getVascEntryFields().get(0).getId());
}
// Check fields
int orderIndex = 0;
for (VascEntryField vef:entry.getVascEntryFields()) {
String vid = vef.getId();
// set manual stuff
if (vef.getBackendName()==null) {
vef.setBackendName(vid);
}
if (vef.getVascEntry()==null) {
vef.setVascEntry(entry);
}
//System.out.println("Field: "+vef.getId()+" order: "+vef.getOrderIndex()+" else: "+orderIndex);
if (vef.getOrderIndex()==null) {
vef.setOrderIndex(orderIndex);
}
orderIndex = orderIndex+100;
// fill up properties
if (vef.getName()==null) {
vef.setName("vasc.entry."+id+"."+vid+".name");
}
if (vef.getDescription()==null) {
vef.setDescription("vasc.entry."+id+"."+vid+".description");
}
if (vef.getImage()==null) {
vef.setImage("vasc.entry."+id+"."+vid+".image");
}
if (vef.getHelpId()==null) {
vef.setHelpId("vasc.entry."+id+"."+vid+".helpId");
}
if (vef.getStyleEdit()==null) {
vef.setStyleEdit("vasc.entry."+id+"."+vid+".styleEdit");
}
if (vef.getStyleList()==null) {
vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
}
//if (vef.getDefaultValue()==null) {
// vef.setDefaultValue("vasc.entry."+id+"."+vid+".defaultValue");
//}
if (vef.getView()==null) {
vef.setView(true);
}
if (vef.getList()==null) {
vef.setList(true);
}
if (vef.getCreate()==null) {
vef.setCreate(true);
}
if (vef.getEdit()==null) {
vef.setEdit(true);
}
if (vef.getEditReadOnly()==null) {
vef.setEditReadOnly(false);
}
if (vef.getVascEntryFieldValue()==null) {
VascBackend back2 = vascController.getVascBackendController().getVascBackendById( entry.getBackendId() );
vef.setVascEntryFieldValue(back2.provideVascEntryFieldValue(vef));
}
if (vef.getVascEntryFieldType()==null) {
Object defValue = vef.getDefaultValue();
if (defValue != null) {
for (String typeId: vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeIds()) {
VascEntryFieldType type = vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById(typeId);
if (type.getAutoDetectClass()!=null) {
if (type.getAutoDetectClass().isAssignableFrom(defValue.getClass())) {
vef.setVascEntryFieldType(type);
break;
}
}
}
}
if (vef.getVascEntryFieldType()==null) {
vef.setVascEntryFieldType(vascController.getVascEntryFieldTypeController().getVascEntryFieldTypeById("TextField"));
}
//vef.setStyleList("vasc.entry."+id+"."+vid+".styleEdit");
}
//for (VascValidator vv:vef.getVascValidators()) {
//}
}
class OrderIndexComparator implements Comparator<VascEntryField> {
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;
}
}

View file

@ -0,0 +1,69 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.HashMap;
import java.util.Map;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendControllerLocal;
/**
*
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
*/
public class DefaultVascBackendController implements VascBackendControllerLocal {
private Map<String,VascBackend> backends = null;
public DefaultVascBackendController() {
backends = new HashMap<String,VascBackend>(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);
}
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.AbstractVascBackendState;
/**
*
*
* @author Willem Cazander
* @version 1.0 May 26, 2009
*/
public class DefaultVascBackendState extends AbstractVascBackendState {
private static final long serialVersionUID = 1L;
}

View file

@ -0,0 +1,119 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.VascBackendController;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntryController;
import com.idcanet.vasc.core.VascEntryFieldTypeController;
import com.idcanet.vasc.core.VascEventChannelController;
import com.idcanet.vasc.core.VascUserRoleController;
/**
*
*
* @author Willem Cazander
* @version 1.0 Sep 11, 2008
*/
public class DefaultVascController implements VascController {
private VascBackendController vascBackendController = null;
private VascEntryController vascEntryController = null;
private VascEntryFieldTypeController vascEntryFieldTypeController = null;
private VascEventChannelController vascEventChannelController = null;
private VascUserRoleController vascUserRoleController = null;
/**
* @return the vascEventChannelController
*/
public VascEventChannelController getVascEventChannelController() {
return vascEventChannelController;
}
/**
* @param vascEventChannelController the vascEventChannelController to set
*/
public void setVascEventChannelController(VascEventChannelController vascEventChannelController) {
this.vascEventChannelController = vascEventChannelController;
}
/**
* @return the vascBackendController
*/
public VascBackendController getVascBackendController() {
return vascBackendController;
}
/**
* @param vascBackendController the vascBackendController to set
*/
public void setVascBackendController(VascBackendController vascBackendController) {
this.vascBackendController = vascBackendController;
}
/**
* @return the vascEntryController
*/
public VascEntryController getVascEntryController() {
return vascEntryController;
}
/**
* @param vascEntryController the vascEntryController to set
*/
public void setVascEntryController(VascEntryController vascEntryController) {
this.vascEntryController = vascEntryController;
}
/**
* @return the vascEntryFieldController
*/
public VascEntryFieldTypeController getVascEntryFieldTypeController() {
return vascEntryFieldTypeController;
}
/**
* @param vascEntryFieldController the vascEntryFieldController to set
*/
public void setVascEntryFieldTypeController(VascEntryFieldTypeController vascEntryFieldTypeController) {
this.vascEntryFieldTypeController = vascEntryFieldTypeController;
}
/**
* @return the vascUserRoleController
*/
public VascUserRoleController getVascUserRoleController() {
return vascUserRoleController;
}
/**
* @param vascUserRoleController the vascUserRoleController to set
*/
public void setVascUserRoleController(VascUserRoleController vascUserRoleController) {
this.vascUserRoleController = vascUserRoleController;
}
}

View file

@ -0,0 +1,770 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascBackendFilter;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFieldSet;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.actions.ColumnVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.actions.VascAction;
import com.idcanet.vasc.core.entry.VascEntryBackendEventListener;
import com.idcanet.vasc.core.entry.VascEntryFieldEventChannel;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
/**
* VascEntry
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascEntry implements VascEntry {
private static final long serialVersionUID = 1L;
private String id = null;
private String name = null;
private String helpId = null;
private String image = null;
private String listDescription = null;
private String listImage = null;
private String editDescription = null;
private String editImage = null;
private String deleteDescription = null;
private String deleteImage = null;
private String createDescription = null;
private String createImage = null;
private String primaryKeyFieldId = null;
private String displayNameFieldId = null;
private boolean vascDisplayOnly = false;
private boolean vascAdminList = true;
private boolean vascAdminEdit = true;
private boolean vascAdminCreate = true;
private boolean vascAdminDelete = true;
private List<VascEntryField> vascFields = null;
private List<RowVascAction> rowActions = null;
private List<ColumnVascAction> columnActions = null;
private List<GlobalVascAction> globalActions = null;
private List<VascEntryFieldSet> vascEntryFieldSets = null;
private List<VascLinkEntry> vascLinkEntries = null;
private Map<String,Object> entryParameters = null;
private VascEntryFieldEventChannel vascEntryFieldEventChannel = null;
private List<Class<VascEntryFrontendEventListener>> eventEntryFrontendEventListeners = null;
private List<Class<VascEntryBackendEventListener>> eventEntryBackendEventListeners = null;
private List<VascEntryField> listOptions = null;
private List<VascBackendFilter> backendFilters = null;
private String backendId = null;
private VascFrontendData vascFrontendData = null;
/**
* Te constructor
*/
public DefaultVascEntry() {
vascFields = new ArrayList<VascEntryField>(20);
rowActions = new ArrayList<RowVascAction>(10);
columnActions = new ArrayList<ColumnVascAction>(10);
globalActions = new ArrayList<GlobalVascAction>(10);
vascEntryFieldSets = new ArrayList<VascEntryFieldSet>(10);
vascLinkEntries = new ArrayList<VascLinkEntry>(10);
entryParameters = new HashMap<String,Object>(10);
eventEntryFrontendEventListeners = new ArrayList<Class<VascEntryFrontendEventListener>>(10);
eventEntryBackendEventListeners = new ArrayList<Class<VascEntryBackendEventListener>>(10);
listOptions = new ArrayList<VascEntryField>(5);
backendFilters = new ArrayList<VascBackendFilter>(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<VascEntryField> 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<RowVascAction> 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<ColumnVascAction> 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<GlobalVascAction> 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<VascEntryFieldSet> 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<VascLinkEntry> 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<String> getEntryParameterKeys() {
return new ArrayList<String>(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<VascEntryBackendEventListener> listener) {
eventEntryBackendEventListeners.add(listener);
}
/**
* Returns the list of VascEntryBackendEventListener
* @return
*/
public List<Class<VascEntryBackendEventListener>> getVascEntryBackendEventListeners() {
return eventEntryBackendEventListeners;
}
/**
* Added an VascEntryFrontendEventListener
* @param listener The class of the event listener.
*/
public void addVascEntryFrontendEventListener(Class<VascEntryFrontendEventListener> listener) {
eventEntryFrontendEventListeners.add(listener);
}
/**
* Returns the list of VascEntryFrontendEventListener
* @return
*/
public List<Class<VascEntryFrontendEventListener>> getVascEntryFrontendEventListeners() {
return eventEntryFrontendEventListeners;
}
public void addListOption(VascEntryField listOption) {
if (listOption==null) {
throw new NullPointerException("can not add null listOption.");
}
listOptions.add(listOption);
}
public List<VascEntryField> getListOptions() {
return listOptions;
}
public void addVascBackendFilter(VascBackendFilter filter) {
backendFilters.add(filter);
}
public List<VascBackendFilter> getVascBackendFilters() {
return backendFilters;
}
}

View file

@ -0,0 +1,103 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryControllerLocal;
import com.idcanet.vasc.core.VascException;
/**
*
*
* @author Willem Cazander
* @version 1.0 Sep 18, 2008
*/
public class DefaultVascEntryController implements VascEntryControllerLocal {
private Map<String,VascEntry> entries = null;
public DefaultVascEntryController() {
entries = new HashMap<String,VascEntry>();
}
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<String> getVascEntryIds() {
List<String> result = new ArrayList<String>(entries.keySet());
Collections.sort(result); // lets do abc for consistance behauvior.
return result;
}
/**
* Retuns only the adminList table entries
*/
public List<String> getVascEntryAdminIds() {
List<String> adminIds = new ArrayList<String>(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;
}
}

View file

@ -0,0 +1,614 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFieldType;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.validators.VascValidator;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascEntryField implements VascEntryField {
private static final long serialVersionUID = 1L;
private VascEntry vascEntry = null;
private String id = null;
private String backendName = null;
private String displayName = null;
private VascEntryFieldType vascEntryFieldType = null;
private VascEntryFieldValue vascEntryFieldValue = null;
private List<VascValidator> 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<VascValidator>(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<VascValidator> 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;
}
}

View file

@ -0,0 +1,226 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.VascEntryFieldSet;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascEntryFieldSet implements VascEntryFieldSet {
private String id = null;
private String name = null;
private String description = null;
private String helpId = null;
private String image = null;
private String styleList = null;
private String styleEdit = null;
private boolean collapsed = false;
private boolean optional = false;
private List<String> vascEntryFieldIds = null;
public DefaultVascEntryFieldSet() {
vascEntryFieldIds = new ArrayList<String>(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<String> 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);
}
}

View file

@ -0,0 +1,16 @@
/**
*
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.AbstractVascEntryState;
/**
* Holds all state values
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
public class DefaultVascEntryState extends AbstractVascEntryState {
private static final long serialVersionUID = 1L;
}

View file

@ -0,0 +1,114 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.Locale;
import java.util.ResourceBundle;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendFilter;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.impl.entry.DefaultVascEntryResourceResolver;
import com.idcanet.vasc.impl.entry.VascValidatorsValidatorService;
import com.idcanet.vasc.impl.type.DefaultVascEntryFieldTypeController;
/**
* Default Vasc Factory for creating some base object plumming for vasc useage.
*
* @author Willem Cazander
* @version 1.0 Dec 15, 2009
*/
public class DefaultVascFactory {
static public VascController getDefaultVascController(Long userId,String userName,String...roles) throws VascException {
// config full controller for local jvm use
DefaultVascController c = new DefaultVascController();
DefaultVascBackendController vascBackendController = new DefaultVascBackendController();
c.setVascBackendController(vascBackendController);
DefaultVascEntryController vascEntryController = new DefaultVascEntryController();
c.setVascEntryController(vascEntryController);
DefaultVascEntryFieldTypeController vascEntryFieldTypeController = new DefaultVascEntryFieldTypeController();
c.setVascEntryFieldTypeController(vascEntryFieldTypeController);
DefaultVascUserRoleController vascUserRoleController = new DefaultVascUserRoleController(userId,userName,roles);
c.setVascUserRoleController(vascUserRoleController);
return c;
}
static public VascFrontendData getDefaultVascFrontendData(String resourceBundle,Locale locale) {
ResourceBundle bundle = ResourceBundle.getBundle(resourceBundle, locale);
return getDefaultVascFrontendData(bundle);
}
static public VascFrontendData getDefaultVascFrontendData(ResourceBundle resourceBundle) {
DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData(); // controller is set by vasc
vascFrontendData.setVascEntryResourceResolver(new DefaultVascEntryResourceResolver(resourceBundle));
vascFrontendData.setVascFrontendHelper(new DefaultVascFrontendHelper());
//vascFrontendData.setVascEntryResourceImageResolver(new ImageResources());
vascFrontendData.setVascEntryState(new DefaultVascEntryState());
vascFrontendData.getVascEntryState().setVascBackendState(new DefaultVascBackendState());
vascFrontendData.getVascEntryState().getVascBackendState().setPageSize(100); // default page size is zero aka disabled
vascFrontendData.getVascEntryState().getVascBackendState().setPageSizeMax(1000); // max 1k records on screen.
vascFrontendData.addVascValidatorService(new VascValidatorsValidatorService()); // normal vasc validators
return vascFrontendData;
}
static public VascBackend getProxyVascBackend(VascEntry entry) {
// Get the real backend
VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendController().getVascBackendById(entry.getBackendId());
// logs all actions log logger
backend = new VascBackendProxyTimerLogger(backend,entry);
// only cached one result, checks for paramater differnce
backend = new VascBackendProxyCache(backend,entry);
for (VascBackendFilter filter:entry.getVascBackendFilters()) {
filter.initFilter(entry);
backend = new VascBackendProxyFilter(backend,entry,filter);
}
if (backend.isSearchable()==false) {
backend = new VascBackendProxySearch(backend,entry);
}
if (backend.isSortable()==false) {
backend = new VascBackendProxySort(backend,entry);
}
if (backend.isPageable()==false) {
backend = new VascBackendProxyPaged(backend,entry);
}
return backend;
}
}

View file

@ -0,0 +1,275 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascEntryFinalizer;
import com.idcanet.vasc.core.VascEntryState;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontend;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.core.VascFrontendHelper;
import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.core.entry.VascEntryResourceImageResolver;
import com.idcanet.vasc.core.entry.VascEntryResourceResolver;
import com.idcanet.vasc.core.ui.VascUIComponent;
/**
*
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class DefaultVascFrontendData implements VascFrontendData {
private VascFrontend vascFrontend = null;
private VascEntryFinalizer vascEntryFinalizer = null;
private VascFrontendHelper vascFrontendHelper = null;
private VascEntryResourceResolver vascEntryResourceResolver = null;
private VascEntryResourceImageResolver vascEntryResourceImageResolver = null;
private Map<String,String> uiComponents = null;
private VascController vascController = null;
private Map<VascEntryFrontendEventListener.VascFrontendEventType,List<VascEntryFrontendEventListener>> vascEntryFrontendEventListeners = null;
private VascEntryState state = null;
private Map<VascEntryField,VascUIComponent> fieldComps = null;
private Map<VascEntryField,Object> fieldEditors = null;
private List<VascEntryFieldValidatorService> validatorServices = null;
public DefaultVascFrontendData() {
uiComponents = new HashMap<String,String>(8);
fieldComps = new HashMap<VascEntryField,VascUIComponent>(8);
fieldEditors = new HashMap<VascEntryField,Object>(8);
validatorServices = new ArrayList<VascEntryFieldValidatorService>(4);
vascEntryFrontendEventListeners = new HashMap<VascEntryFrontendEventListener.VascFrontendEventType,List<VascEntryFrontendEventListener>>(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<VascEntryFieldValidatorService> 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<VascEntryFrontendEventListener> clazz:entry.getVascEntryFrontendEventListeners()) {
VascEntryFrontendEventListener listener = clazz.newInstance();
addVascEntryFrontendEventListener(listener);
}
}
public void addVascEntryFrontendEventListener(VascEntryFrontendEventListener listener) {
for (VascEntryFrontendEventListener.VascFrontendEventType type:listener.getEventTypes()) {
List<VascEntryFrontendEventListener> list = vascEntryFrontendEventListeners.get(type);
if (list==null) {
list = new ArrayList<VascEntryFrontendEventListener>(10);
vascEntryFrontendEventListeners.put(type, list);
}
list.add(listener);
}
}
public List<VascEntryFrontendEventListener> getVascEntryFrontendEventListener(VascEntryFrontendEventListener.VascFrontendEventType type) {
List<VascEntryFrontendEventListener> list = vascEntryFrontendEventListeners.get(type);
if (list==null) {
return new ArrayList<VascEntryFrontendEventListener>(0);
}
return list;
}
}

View file

@ -0,0 +1,49 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryFinalizer;
import com.idcanet.vasc.core.VascException;
/**
*
* @author Willem Cazander
* @version 1.0 Sep 14, 2008
*/
public class DefaultVascFrontendEntryFinalizer implements VascEntryFinalizer {
/**
* @see com.idcanet.vasc.core.VascEntryFinalizer#finalizeVascEntry(com.idcanet.vasc.core.VascEntry)
*/
public VascEntry finalizeVascEntry(VascEntry entry,VascController vascController) throws VascException {
return entry;
}
}

View file

@ -0,0 +1,535 @@
/*
* Copyright 2004-2010 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;
import com.idcanet.vasc.core.VascBackendFilter;
import com.idcanet.vasc.core.VascBackendPageNumber;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontendHelper;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.VascLinkEntryType;
import com.idcanet.vasc.core.VascUserRoleController;
import com.idcanet.vasc.core.actions.GlobalVascAction;
import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.entry.VascEntryFieldValidatorService;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener;
import com.idcanet.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
import com.idcanet.vasc.core.ui.VascUIComponent;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
public class DefaultVascFrontendHelper implements VascFrontendHelper {
private Logger logger = Logger.getLogger(DefaultVascFrontendHelper.class.getName());
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderView(com.idcanet.vasc.core.VascEntryField)
*/
public boolean renderView(VascEntryField field) {
if (field.getView()==false) {
return false;
}
return true;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderCreate(com.idcanet.vasc.core.VascEntryField)
*/
public boolean renderCreate(VascEntryField field) {
if (renderView(field)==false) {
return false;
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesCreate()!=null && u.hasRole(field.getRolesCreate())) {
return true;
}
if (field.getCreate()) {
return true;
}
return false;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderEdit(com.idcanet.vasc.core.VascEntryField)
*/
public boolean renderEdit(VascEntryField field) {
if (renderView(field)==false) {
return false;
}
if (field.getVascEntry().getVascFrontendData().getVascEntryState().isEditCreate()) {
if (renderCreate(field)==false) {
return false;
}
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesEdit()!=null && u.hasRole(field.getRolesEdit())) {
return true;
}
if (field.getEdit()) {
return true;
}
return false;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderEditReadOnly(com.idcanet.vasc.core.VascEntryField)
*/
public boolean renderEditReadOnly(VascEntryField field) {
if (renderView(field)==false) {
return false;
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesEditReadOnly()!=null && u.hasRole(field.getRolesEditReadOnly())) {
return true;
}
if (field.getEditReadOnly()) {
return true;
}
return false;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderList(com.idcanet.vasc.core.VascEntryField)
*/
public boolean renderList(VascEntryField field) {
if (renderView(field)==false) {
return false;
}
VascUserRoleController u = field.getVascEntry().getVascFrontendData().getVascController().getVascUserRoleController();
if (field.getRolesList()!=null && u.hasRole(field.getRolesList())) {
return true;
}
if (field.getList()) {
return true;
}
return false;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderGlobalVascAction(com.idcanet.vasc.core.actions.GlobalVascAction)
*/
public boolean renderGlobalVascAction(GlobalVascAction action) {
return true;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#renderRowVascAction(com.idcanet.vasc.core.actions.RowVascAction)
*/
public boolean renderRowVascAction(RowVascAction action) {
return true;
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#fireVascEvent(com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType, java.lang.Object)
*/
public void fireVascEvent(VascEntry entry,VascFrontendEventType type, Object data) {
List<VascEntryFrontendEventListener> 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<VascLinkEntry> getVascLinkEntryByType(VascEntry entry,VascLinkEntryType type) {
List<VascLinkEntry> result = new ArrayList<VascLinkEntry>(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<VascBackendPageNumber> getVascBackendPageNumbers(VascEntry entry) {
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(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 (index<entry.getVascFrontendData().getVascEntryState().getEntryDataList().size()) {
entry.getVascFrontendData().getVascEntryState().getEntryDataList().remove(index);
return index;
}
}
} catch (VascException e) {
handleException(entry,e);
}
return 0; // make better (0=top of list)
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#mergeObject(com.idcanet.vasc.core.VascEntry)
*/
public Object mergeObject(VascEntry entry) {
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
Object result = null;
try {
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_PRE_UPDATE,object);
int index = removeObjectFromDataList(entry,object);
// merge object on backend
result = entry.getVascFrontendData().getVascEntryState().getVascBackend().merge(object);
// put object thrue the filters
for (VascBackendFilter filter:entry.getVascBackendFilters()) {
result = filter.filterObject(result);
}
// put object back in list
entry.getVascFrontendData().getVascEntryState().getEntryDataList().add(index, result);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_POST_UPDATE,result);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE,result);
} catch (Exception e) {
handleException(entry,e);
}
return result;
}
/**
* Deletes the selected row object from the list and fires event.
* @param entry
* @param object
*/
public void deleteObject(VascEntry entry) {
Object object = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
try {
entry.getVascFrontendData().getVascEntryState().getVascBackend().delete(object);
} catch (Exception e) {
handleException(entry,e);
}
removeObjectFromDataList(entry,object);
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_DELETE, object);
fireVascEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.DATA_LIST_UPDATE, object);
}
/**
* @see com.idcanet.vasc.core.VascFrontendHelper#refreshData(com.idcanet.vasc.core.VascEntry)
*/
public void refreshData(VascEntry entry) {
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
try {
// check and correct max page size
if (entry.getVascFrontendData().getVascEntryState().getVascBackendState().getPageSize()>entry.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<String> 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<String> error = new ArrayList<String>(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<String> 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<RowVascAction> getMultiRowActions(VascEntry entry) {
List<RowVascAction> result = new ArrayList<RowVascAction>(5);
for (RowVascAction a:entry.getRowActions()) {
if (a.isMultiRowAction()) {
result.add(a);
}
}
return result;
}
}

View file

@ -0,0 +1,161 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascLinkEntry;
import com.idcanet.vasc.core.VascLinkEntryType;
/**
* The DefaultVascLinkEntry
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class DefaultVascLinkEntry implements VascLinkEntry {
private static final long serialVersionUID = 1L;
private String id = null;
private String vascEntryId = null;
private Map<String,String> entryParameterFieldIds = new HashMap<String,String>(3);
private Map<String,String> entryCreateFieldValues = new HashMap<String,String>(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<String> getEntryParameterFieldIdKeys() {
return new ArrayList<String>(entryParameterFieldIds.keySet());
}
public String getEntryCreateFieldValue(String valueFieldId) {
return entryCreateFieldValues.get(valueFieldId);
}
public void addEntryCreateFieldValue(String valueFieldId,String selectedFieldId) {
entryCreateFieldValues.put(valueFieldId, selectedFieldId);
}
public List<String> getEntryCreateFieldValueKeys() {
return new ArrayList<String>(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;
}
}

View file

@ -0,0 +1,293 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.entry.VascEntryFieldValue;
import com.idcanet.vasc.core.ui.VascSelectItem;
import com.idcanet.vasc.core.ui.VascSelectItemModel;
/**
* The DefaultVascSelectItemModel
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class DefaultVascSelectItemModel implements VascSelectItemModel {
private static final long serialVersionUID = 1L;
private String entryId = null;
private String keyFieldId = null;
private String displayFieldId = null;
private String nullLabel = null;
private String nullKeyValue = null;
private Boolean returnKeyValue = null;
private Map<String,String> entryParameterFieldIds = new HashMap<String,String>(3);
private Boolean useParentFields = null;
/**
* @see com.idcanet.vasc.core.ui.VascSelectItemModel#getVascSelectItems(com.idcanet.vasc.core.VascEntry)
*/
public List<VascSelectItem> getVascSelectItems(VascEntry currentEntry) throws VascException {
List<VascSelectItem> result = new ArrayList<VascSelectItem>(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<String> getEntryParameterFieldIdKeys() {
return new ArrayList<String>(entryParameterFieldIds.keySet());
}
/**
* @return the useParentFields
*/
public Boolean getUseParentFields() {
return useParentFields;
}
/**
* @param useParentFields the useParentFields to set
*/
public void setUseParentFields(Boolean useParentFields) {
this.useParentFields = useParentFields;
}
}

View file

@ -0,0 +1,106 @@
/*
* Copyright 2004-2007 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.VascUserRoleController;
/**
* Simple default user controller for wrapping user info into vasc
*
*
* @author Willem Cazander
* @version 1.0 Mar 13, 2009
*/
public class DefaultVascUserRoleController implements VascUserRoleController {
private Long userId = null;
private String userName = null;
private List<String> 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<String>(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<String> 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;
}
}

View file

@ -0,0 +1,103 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
* Does simple caching for the data.
*
* @author Willem Cazander
* @version 1.0 Nov 19, 2009
*/
public class VascBackendProxyCache extends AbstractVascBackendProxy {
private Long records = null;
private List<Object> data = null;
private String dataSearchString = null;
private Map<String,Object> dataState = null;
public VascBackendProxyCache(VascBackend backend,VascEntry entry) {
super(backend);
dataState = new HashMap<String,Object>(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<Object> 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;
}
}

View file

@ -0,0 +1,80 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendFilter;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
* Simple filter support
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class VascBackendProxyFilter extends AbstractVascBackendProxy {
private long records = 0;
private VascBackendFilter filter = null;
public VascBackendProxyFilter(VascBackend backend,VascEntry entry,VascBackendFilter filter) {
super(backend);
this.filter=filter;
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
@Override
public List<Object> execute(VascBackendState state) throws VascException {
List<Object> result = backend.execute(state);
if (filter==null) {
return result;
}
List<Object> search = new ArrayList<Object>(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;
}
}

View file

@ -0,0 +1,90 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.util.ArrayList;
import java.util.List;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
* Simulates a real pages backend.
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class VascBackendProxyPaged extends AbstractVascBackendProxy {
private long records = 0;
public VascBackendProxyPaged(VascBackend backend,VascEntry entry) {
super(backend);
}
/**
* @see com.idcanet.vasc.core.VascBackend#isPageable()
*/
@Override
public boolean isPageable() {
return true;
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
@Override
public List<Object> execute(VascBackendState state) throws VascException {
List<Object> allData = backend.execute(state);
int pageSize = state.getPageSize();
if (pageSize==0) {
records = allData.size();
return allData;
}
List<Object> paged = new ArrayList<Object>(state.getPageSize());
int off = state.getPageIndex()*pageSize;
int offMax = off+state.getPageSize();
for (int i=off;i<offMax;i++) {
if (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;
}
}

View file

@ -0,0 +1,125 @@
/*
* Copyright 2004-2008 IDCA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
* the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY IDCA AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IDCA OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the authors and
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
*/
package com.idcanet.vasc.impl;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.idcanet.vasc.core.AbstractVascBackendProxy;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendState;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascException;
/**
* Simple text search
*
* @author Willem Cazander
* @version 1.0 Oct 27, 2007
*/
public class VascBackendProxySearch extends AbstractVascBackendProxy {
private long records = 0;
public VascBackendProxySearch(VascBackend backend,VascEntry entry) {
super(backend);
}
/**
* @see com.idcanet.vasc.core.VascBackend#isSearchable()
*/
@Override
public boolean isSearchable() {
return true;
}
/**
* @see com.idcanet.vasc.core.VascBackend#execute(VascBackendState state)
*/
@Override
public List<Object> execute(VascBackendState state) throws VascException {
List<Object> 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<Object> search = new ArrayList<Object>(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;
}
}

Some files were not shown because too many files have changed in this diff Show more