Split backend to backend api.
This commit is contained in:
parent
4bd244f4e5
commit
a13719f008
1
pom.xml
1
pom.xml
|
@ -34,6 +34,7 @@
|
|||
<module>vasc-core-ejb3-client</module>
|
||||
<module>vasc-core-ejb3-server</module>
|
||||
<module>vasc-export</module>
|
||||
<module>vasc-opt</module>
|
||||
</modules>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<version>0.4.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>vasc-backend</artifactId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<packaging>pom</packaging>
|
||||
<name>vasc-backend</name>
|
||||
<description>vasc-backend</description>
|
||||
|
@ -15,5 +16,6 @@
|
|||
<module>vasc-backend-mongodb</module>
|
||||
<module>vasc-backend-jdbc</module>
|
||||
<module>vasc-backend-metamodel</module>
|
||||
<module>vasc-backend-api</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
23
vasc-backend/vasc-backend-api/.project
Normal file
23
vasc-backend/vasc-backend-api/.project
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-backend-api</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
18
vasc-backend/vasc-backend-api/pom.xml
Normal file
18
vasc-backend/vasc-backend-api/pom.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend</artifactId>
|
||||
<version>0.4.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>vasc-backend-api</artifactId>
|
||||
<name>vasc-backend-api</name>
|
||||
<description>vasc-backend-api</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.x4o</groupId>
|
||||
<artifactId>x4o-driver</artifactId>
|
||||
<version>${x4o.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -24,9 +24,6 @@ package net.forwardfire.vasc.backend;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
|
@ -110,14 +107,14 @@ abstract public class AbstractVascBackend implements VascBackend {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#doRecordMoveDownById(java.lang.Object)
|
||||
*/
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException {
|
||||
return 0l;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#doRecordMoveUpById(java.lang.Object)
|
||||
*/
|
||||
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
|
||||
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascBackendException {
|
||||
return 0l;
|
||||
}
|
||||
|
|
@ -20,9 +20,8 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.impl;
|
||||
package net.forwardfire.vasc.backend;
|
||||
|
||||
import net.forwardfire.vasc.backend.AbstractVascBackendControllerLocal;
|
||||
|
||||
/**
|
||||
* DefaultVascBackendController stores the vasc backends.
|
|
@ -20,9 +20,8 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.impl;
|
||||
package net.forwardfire.vasc.backend;
|
||||
|
||||
import net.forwardfire.vasc.backend.AbstractVascBackendState;
|
||||
|
||||
/**
|
||||
* Holds the state for the backend
|
|
@ -25,13 +25,6 @@ package net.forwardfire.vasc.backend;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
|
@ -45,32 +38,30 @@ public interface VascBackend {
|
|||
public void startBackend();
|
||||
public void stopBackend();
|
||||
|
||||
public List<Object> execute(VascBackendState state) throws VascException;
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException;
|
||||
|
||||
public boolean isReadOnly();
|
||||
|
||||
public void persist(Object object) throws VascException;
|
||||
public void persist(Object object) throws VascBackendException;
|
||||
|
||||
public Object merge(Object object) throws VascException;
|
||||
public Object merge(Object object) throws VascBackendException;
|
||||
|
||||
public void delete(Object object) throws VascException;
|
||||
public void delete(Object object) throws VascBackendException;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new Field acces obj the the given field entry.
|
||||
* note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle.
|
||||
* @param field
|
||||
* @return
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field);
|
||||
public VascEntryFieldValue provideVascEntryFieldValue();
|
||||
|
||||
/**
|
||||
* Creates a new RecordCreater obj the the given entry.
|
||||
* note: Do not use inline class here because it needs to be seriabable and the backend is not seriabbzle.
|
||||
* @param vascEntry
|
||||
* @return
|
||||
*/
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry);
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator();
|
||||
|
||||
/**
|
||||
* Defines if the backend supports sorting
|
||||
|
@ -101,8 +92,8 @@ public interface VascBackend {
|
|||
* @return
|
||||
*/
|
||||
public boolean isRecordMoveable();
|
||||
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException;
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException;
|
||||
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascBackendException;
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException;
|
||||
|
||||
|
||||
public boolean isPageSummary();
|
|
@ -20,44 +20,32 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.impl.entry;
|
||||
package net.forwardfire.vasc.backend;
|
||||
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* BeanVascEntryRecordCreator creates an new instance Object from a defined objectClass.
|
||||
* VascBackendException wraps the backend exception.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
* @version 1.0 Nov 22, 2013
|
||||
*/
|
||||
public class BeanVascEntryRecordCreator implements VascEntryRecordCreator {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Class<?> objectClass = null;
|
||||
@SuppressWarnings("serial")
|
||||
public class VascBackendException extends Exception {
|
||||
|
||||
public BeanVascEntryRecordCreator() {
|
||||
|
||||
public VascBackendException() {
|
||||
}
|
||||
|
||||
public BeanVascEntryRecordCreator(Class<?> objectClass) {
|
||||
setObjectClass(objectClass);
|
||||
public VascBackendException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public Object newRecord(VascEntry entry) throws VascException {
|
||||
try {
|
||||
return objectClass.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new VascException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
public VascBackendException(Exception e) {
|
||||
super(e);
|
||||
}
|
||||
|
||||
public Class<?> getObjectClass() {
|
||||
return objectClass;
|
||||
}
|
||||
public void setObjectClass(Class<?> objectClass) {
|
||||
this.objectClass=objectClass;
|
||||
public VascBackendException(String message,Exception e) {
|
||||
super(message,e);
|
||||
}
|
||||
}
|
|
@ -20,13 +20,10 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.core.entry;
|
||||
package net.forwardfire.vasc.backend;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
||||
/**
|
||||
* VascEntryFieldValue
|
||||
|
@ -36,9 +33,9 @@ import net.forwardfire.vasc.core.VascException;
|
|||
*/
|
||||
public interface VascEntryFieldValue extends Serializable {
|
||||
|
||||
public Object getValue(VascEntryField field,Object record) throws VascException;
|
||||
public Object getValue(String backendName,Object record) throws VascBackendException;
|
||||
|
||||
public String getDisplayValue(VascEntryField field,Object record) throws VascException;
|
||||
public String getDisplayValue(String backendName,Object record) throws VascBackendException;
|
||||
|
||||
public void setValue(VascEntryField field,Object record,Object value) throws VascException;
|
||||
public void setValue(String backendName,Object record,Object value) throws VascBackendException;
|
||||
}
|
|
@ -20,14 +20,10 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.core.entry;
|
||||
package net.forwardfire.vasc.backend;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -36,7 +32,7 @@ import net.forwardfire.vasc.core.VascException;
|
|||
*/
|
||||
public interface VascEntryRecordCreator extends Serializable {
|
||||
|
||||
public Object newRecord(VascEntry entry) throws VascException;
|
||||
public Object newRecord() throws VascBackendException;
|
||||
|
||||
public Class<?> getObjectClass();
|
||||
}
|
|
@ -22,9 +22,9 @@
|
|||
|
||||
package net.forwardfire.vasc.backend.data;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
|
||||
import org.x4o.xml.element.DefaultElementObjectPropertyValue;
|
||||
|
||||
|
@ -40,34 +40,34 @@ public class BeanVascEntryFieldValue implements VascEntryFieldValue {
|
|||
private DefaultElementObjectPropertyValue bean = new DefaultElementObjectPropertyValue();
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object)
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(java.lang.String, java.lang.Object)
|
||||
*/
|
||||
public Object getValue(VascEntryField field, Object record) throws VascException {
|
||||
if (field==null) {
|
||||
throw new NullPointerException("Can't get value of null field.");
|
||||
}
|
||||
if (field.getBackendName()==null) {
|
||||
throw new NullPointerException("Can't get value of null backendName field.");
|
||||
public Object getValue(String backendName, Object record) throws VascBackendException {
|
||||
if (backendName==null) {
|
||||
throw new NullPointerException("Can't get value of null backendName.");
|
||||
}
|
||||
if (record==null) {
|
||||
throw new NullPointerException("Can't get value of null object.");
|
||||
}
|
||||
try {
|
||||
Object o = bean.getProperty(record,field.getBackendName());
|
||||
Object o = bean.getProperty(record,backendName);
|
||||
return o;
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
throw new VascBackendException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object)
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(java.lang.String, java.lang.Object)
|
||||
*/
|
||||
public String getDisplayValue(VascEntryField field, Object record) throws VascException {
|
||||
Object value = getValue(field,record);
|
||||
public String getDisplayValue(String backendName, Object record) throws VascBackendException {
|
||||
Object value = getValue(backendName,record);
|
||||
if (value==null) {
|
||||
return "";
|
||||
}
|
||||
return value.toString();
|
||||
|
||||
/* TODO: move
|
||||
if (field.getDisplayName()==null) {
|
||||
if (value instanceof String) {
|
||||
return (String)value;
|
||||
|
@ -81,27 +81,25 @@ public class BeanVascEntryFieldValue implements VascEntryFieldValue {
|
|||
}
|
||||
return ""+result;
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
throw new VascBackendException(e);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object, java.lang.Object)
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(java.lang.String, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public void setValue(VascEntryField field, Object record,Object value) throws VascException {
|
||||
if (field==null) {
|
||||
throw new NullPointerException("Can't set value of null field.");
|
||||
}
|
||||
if (field.getBackendName()==null) {
|
||||
throw new NullPointerException("Can't set value of null backendName field.");
|
||||
public void setValue(String backendName, Object record,Object value) throws VascBackendException {
|
||||
if (backendName==null) {
|
||||
throw new NullPointerException("Can't set value of null backendName.");
|
||||
}
|
||||
if (record==null) {
|
||||
throw new NullPointerException("Can't set value of null object.");
|
||||
}
|
||||
try {
|
||||
bean.setProperty(record, field.getBackendName(), value);
|
||||
bean.setProperty(record, backendName, value);
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
throw new VascBackendException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,9 +22,9 @@
|
|||
|
||||
package net.forwardfire.vasc.backend.data;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
|
||||
|
||||
/**
|
||||
* BeanVascEntryRecordCreator creates a new backend record based on class object.
|
||||
|
@ -48,13 +48,13 @@ public class BeanVascEntryRecordCreator implements VascEntryRecordCreator {
|
|||
return resultClass;
|
||||
}
|
||||
|
||||
public Object newRecord(VascEntry entry) throws VascException {
|
||||
public Object newRecord() throws VascBackendException {
|
||||
try {
|
||||
return resultClass.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new VascException(e);
|
||||
throw new VascBackendException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new VascException(e);
|
||||
throw new VascBackendException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,9 +24,9 @@ package net.forwardfire.vasc.backend.data;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
|
||||
|
||||
/**
|
||||
* MapVascEntryFieldValue provides get/set support on Map record object.
|
||||
|
@ -39,28 +39,25 @@ public class MapVascEntryFieldValue implements VascEntryFieldValue {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object)
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(java.lang.String, java.lang.Object)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getValue(VascEntryField field, Object record) throws VascException {
|
||||
if (field==null) {
|
||||
throw new NullPointerException("Can't get value of null field.");
|
||||
}
|
||||
if (field.getBackendName()==null) {
|
||||
public Object getValue(String backendName, Object record) throws VascBackendException {
|
||||
if (backendName==null) {
|
||||
throw new NullPointerException("Can't get value of null backendName field.");
|
||||
}
|
||||
if (record==null) {
|
||||
throw new NullPointerException("Can't get value of null object.");
|
||||
}
|
||||
Map<String,Object> map = (Map<String,Object>)record;
|
||||
Object fieldValue = map.get(field.getBackendName());
|
||||
Object fieldValue = map.get(backendName);
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object)
|
||||
*/
|
||||
public String getDisplayValue(VascEntryField field, Object record) throws VascException {
|
||||
public String getDisplayValue(String field, Object record) throws VascBackendException {
|
||||
Object fieldValue = getValue(field,record);
|
||||
if (fieldValue==null) {
|
||||
fieldValue = "";
|
||||
|
@ -69,12 +66,12 @@ public class MapVascEntryFieldValue implements VascEntryFieldValue {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object, java.lang.Object)
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(java.lang.String, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setValue(VascEntryField field, Object record,Object value) throws VascException {
|
||||
public void setValue(String backendName, Object record,Object value) throws VascBackendException {
|
||||
Map<String,Object> map = (Map<String,Object>)record;
|
||||
map.put(field.getBackendName(), value);
|
||||
map.put(backendName, value);
|
||||
}
|
||||
|
||||
}
|
|
@ -25,9 +25,9 @@ package net.forwardfire.vasc.backend.data;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
|
||||
|
||||
/**
|
||||
* MapVascEntryRecordCreator creates a new HashMap for Map based record backends.
|
||||
|
@ -43,7 +43,7 @@ public class MapVascEntryRecordCreator implements VascEntryRecordCreator {
|
|||
return Map.class;
|
||||
}
|
||||
|
||||
public Object newRecord(VascEntry entry) throws VascException {
|
||||
public Object newRecord() throws VascBackendException {
|
||||
return new HashMap<String,Object>(10);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc-backend</artifactId>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<version>0.4.2-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
@ -11,8 +11,13 @@
|
|||
<description>vasc-backend-jdbc</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||
<artifactId>vasc-lib-xpql</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -31,15 +31,12 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.AbstractVascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.backend.data.MapVascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.data.MapVascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -83,7 +80,7 @@ public class JdbcVascBackend extends AbstractVascBackend {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
|
||||
*/
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
JdbcConnectionProvider prov = getJdbcConnectionProvider();
|
||||
List<Object> result = new ArrayList<Object>(50);
|
||||
Connection connection = null;
|
||||
|
@ -103,7 +100,7 @@ public class JdbcVascBackend extends AbstractVascBackend {
|
|||
result.add(map);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
throw new VascBackendException(e);
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
try {
|
||||
|
@ -118,33 +115,33 @@ public class JdbcVascBackend extends AbstractVascBackend {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object)
|
||||
*/
|
||||
public Object merge(Object object) throws VascException {
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object)
|
||||
*/
|
||||
public void persist(Object object) throws VascException {
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#delete(java.lang.Object)
|
||||
*/
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField)
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
public VascEntryFieldValue provideVascEntryFieldValue() {
|
||||
return new MapVascEntryFieldValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry)
|
||||
*/
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator() {
|
||||
return new MapVascEntryRecordCreator();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,14 +31,12 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.AbstractVascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.backend.data.MapVascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.data.MapVascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.xpql.query.QueryParameterValue;
|
||||
|
||||
|
||||
|
@ -94,7 +92,7 @@ public class JdbcVascBackendXpql extends AbstractVascBackend {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
|
||||
*/
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
// Copy parameters
|
||||
for (String key:state.getDataParameterKeys()) {
|
||||
Object value = state.getDataParameter(key);
|
||||
|
@ -126,7 +124,7 @@ public class JdbcVascBackendXpql extends AbstractVascBackend {
|
|||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
throw new VascBackendException(e);
|
||||
} finally {
|
||||
if (c!=null) {
|
||||
try {
|
||||
|
@ -140,33 +138,33 @@ public class JdbcVascBackendXpql extends AbstractVascBackend {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object)
|
||||
*/
|
||||
public Object merge(Object object) throws VascException {
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object)
|
||||
*/
|
||||
public void persist(Object object) throws VascException {
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#delete(java.lang.Object)
|
||||
*/
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField)
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue()
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
public VascEntryFieldValue provideVascEntryFieldValue() {
|
||||
return new MapVascEntryFieldValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry)
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator()
|
||||
*/
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator() {
|
||||
return new MapVascEntryRecordCreator();
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc-backend</artifactId>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<version>0.4.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>vasc-backend-jpa</artifactId>
|
||||
|
@ -10,8 +10,13 @@
|
|||
<description>vasc-backend-jpa</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||
<artifactId>vasc-lib-xpql</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
package net.forwardfire.vasc.backends.jpa;
|
||||
|
||||
import net.forwardfire.vasc.backend.AbstractVascBackend;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
|
||||
import org.hibernate.Session;
|
||||
|
||||
|
@ -41,7 +41,7 @@ abstract public class AbstractHibernateVascBackend extends AbstractVascBackend
|
|||
*/
|
||||
abstract Session getHibernateSession();
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
Session s = getHibernateSession();
|
||||
try {
|
||||
s.getTransaction().begin();
|
||||
|
@ -57,7 +57,7 @@ abstract public class AbstractHibernateVascBackend extends AbstractVascBackend
|
|||
}
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
Session s = getHibernateSession();
|
||||
try {
|
||||
s.getTransaction().begin();
|
||||
|
@ -74,7 +74,7 @@ abstract public class AbstractHibernateVascBackend extends AbstractVascBackend
|
|||
}
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
Session s = getHibernateSession();
|
||||
try {
|
||||
s.getTransaction().begin();
|
||||
|
|
|
@ -22,13 +22,10 @@
|
|||
|
||||
package net.forwardfire.vasc.backends.jpa;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
import net.forwardfire.vasc.backend.AbstractVascBackend;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -41,7 +38,7 @@ abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend
|
|||
|
||||
abstract EntityManager getEntityManager();
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
EntityManager s = getEntityManager();
|
||||
try {
|
||||
if (emTransaction) {
|
||||
|
@ -58,7 +55,7 @@ abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend
|
|||
}
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
EntityManager s = getEntityManager();
|
||||
try {
|
||||
if (emTransaction) {
|
||||
|
@ -76,7 +73,7 @@ abstract public class AbstractPersistenceVascBackend extends AbstractVascBackend
|
|||
}
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
EntityManager s = getEntityManager();
|
||||
try {
|
||||
if (emTransaction) {
|
||||
|
|
|
@ -24,14 +24,12 @@ package net.forwardfire.vasc.backends.jpa;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.backend.data.BeanVascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.data.BeanVascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.xpql.query.QueryParameterValue;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
|
@ -75,11 +73,11 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
|
||||
// Copy parameters
|
||||
for (String key:state.getDataParameterKeys()) {
|
||||
Object value = state.getDataParameter(key);
|
||||
Object value = state.getDataParameter(key);
|
||||
query.setQueryParameter(key, value);
|
||||
if (queryTotal!=null) {
|
||||
queryTotal.setQueryParameter(key, value);
|
||||
|
@ -116,17 +114,17 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField)
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue()
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
public VascEntryFieldValue provideVascEntryFieldValue() {
|
||||
BeanVascEntryFieldValue result = new BeanVascEntryFieldValue();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry)
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator()
|
||||
*/
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator() {
|
||||
return new BeanVascEntryRecordCreator(resultClass);
|
||||
}
|
||||
|
||||
|
@ -230,7 +228,7 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
|
|||
* @see net.forwardfire.vasc.backend.AbstractVascBackend#doRecordMoveDownById(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException {
|
||||
long result = 0l;
|
||||
if (queryMoveDown!=null) {
|
||||
Session s = getHibernateSession();
|
||||
|
@ -299,7 +297,7 @@ public class XpqlHibernateVascBackend extends AbstractHibernateVascBackend {
|
|||
* @see net.forwardfire.vasc.backend.AbstractVascBackend#doRecordMoveUpById(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
|
||||
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascBackendException {
|
||||
long result = 0l;
|
||||
if (queryMoveUp!=null) {
|
||||
Session s = getHibernateSession();
|
||||
|
|
|
@ -27,14 +27,12 @@ import java.util.List;
|
|||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.backend.data.BeanVascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.data.BeanVascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.xpql.query.QueryParameterValue;
|
||||
|
||||
|
||||
|
@ -78,7 +76,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend
|
|||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
|
||||
// Copy parameters
|
||||
for (String key:state.getDataParameterKeys()) {
|
||||
|
@ -121,17 +119,17 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField)
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue()
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
public VascEntryFieldValue provideVascEntryFieldValue() {
|
||||
VascEntryFieldValue result = new BeanVascEntryFieldValue();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry)
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator()
|
||||
*/
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator() {
|
||||
VascEntryRecordCreator result = new BeanVascEntryRecordCreator(resultClass);
|
||||
return result;
|
||||
}
|
||||
|
@ -236,7 +234,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend
|
|||
* @see net.forwardfire.vasc.core.AbstractVascBackend#doRecordMoveDownById(VascBackendState state,java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException {
|
||||
long result = 0l;
|
||||
if (queryMoveDown!=null) {
|
||||
EntityManager em = getEntityManager();
|
||||
|
@ -299,7 +297,7 @@ public class XpqlPersistanceVascBackend extends AbstractPersistenceVascBackend
|
|||
* @see net.forwardfire.vasc.core.AbstractVascBackend#doRecordMoveUpById(VascBackendState state,java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
|
||||
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascBackendException {
|
||||
long result = 0l;
|
||||
if (queryMoveUp!=null) {
|
||||
EntityManager em = getEntityManager();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc-backend</artifactId>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<version>0.4.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>vasc-backend-ldap</artifactId>
|
||||
|
@ -10,8 +10,8 @@
|
|||
<description>vasc-backend-ldap</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -29,15 +29,12 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.AbstractVascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.backend.data.MapVascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.data.MapVascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
||||
import com.novell.ldap.LDAPAttribute;
|
||||
import com.novell.ldap.LDAPAttributeSet;
|
||||
|
@ -53,7 +50,7 @@ import com.novell.ldap.LDAPSearchResults;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 4, 2008
|
||||
*/
|
||||
public class LdapVascBackend extends AbstractVascBackend {
|
||||
public class LdapVascBackend extends AbstractVascBackend {
|
||||
|
||||
|
||||
private LdapConnectionProvider ldapConnectionProvider = null;
|
||||
|
@ -81,7 +78,7 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#execute()
|
||||
*/
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
LdapConnectionProvider prov = getLdapConnectionProvider();
|
||||
LDAPConnection connection = prov.getLdapConnection();
|
||||
List<Object> result = new ArrayList<Object>(50);
|
||||
|
@ -125,7 +122,7 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
result.add(map);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
throw new VascBackendException(e);
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
|
@ -137,7 +134,7 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object)
|
||||
*/
|
||||
public Object merge(Object object) throws VascException {
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
LdapConnectionProvider prov = getLdapConnectionProvider();
|
||||
LDAPConnection connection = prov.getLdapConnection();
|
||||
try {
|
||||
|
@ -209,7 +206,7 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
|
||||
return object;
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
throw new VascBackendException(e);
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
|
@ -220,7 +217,7 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object)
|
||||
*/
|
||||
public void persist(Object object) throws VascException {
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
Map<String,Object> map = (Map)object;
|
||||
LdapConnectionProvider prov = getLdapConnectionProvider();
|
||||
LDAPConnection connection = prov.getLdapConnection();
|
||||
|
@ -246,7 +243,7 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
}
|
||||
connection.add(entry);
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
throw new VascBackendException(e);
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
|
@ -257,7 +254,7 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#delete(java.lang.Object)
|
||||
*/
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
LdapConnectionProvider prov = getLdapConnectionProvider();
|
||||
LDAPConnection connection = prov.getLdapConnection();
|
||||
try {
|
||||
|
@ -280,7 +277,7 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
LDAPEntry entry = searchResults.next();
|
||||
connection.delete(entry.getDN());
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
throw new VascBackendException(e);
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
|
@ -289,16 +286,16 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry)
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator()
|
||||
*/
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator() {
|
||||
return new MapVascEntryRecordCreator();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField)
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue()
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
public VascEntryFieldValue provideVascEntryFieldValue() {
|
||||
return new MapVascEntryFieldValue();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc-backend</artifactId>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<version>0.4.2-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
@ -11,8 +11,8 @@
|
|||
<description>vasc-backend-metamodel</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -43,16 +43,14 @@ import org.eobjects.metamodel.schema.Schema;
|
|||
import org.eobjects.metamodel.schema.Table;
|
||||
|
||||
import net.forwardfire.vasc.backend.AbstractVascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.backend.metamodel.crud.CrudDataContext;
|
||||
import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRow;
|
||||
import net.forwardfire.vasc.backend.metamodel.crud.CrudDataContextImpl;
|
||||
import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRowMapImpl;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* MetaModelVascBackend provides vasc backend for metamodel.
|
||||
|
@ -212,11 +210,11 @@ public class MetaModelVascBackend extends AbstractVascBackend {
|
|||
return q;
|
||||
}
|
||||
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
Schema schema = dataContext.getDefaultSchema();
|
||||
Table t = schema.getTableByName(table);
|
||||
if (t==null) {
|
||||
throw new VascException("Could not get meta table for: '"+table+"'.");
|
||||
throw new VascBackendException("Could not get meta table for: '"+table+"'.");
|
||||
}
|
||||
Query q = createFilterQuery(state,t,false);
|
||||
if (isSortable() && state.getSortField() != null) {
|
||||
|
@ -265,32 +263,32 @@ public class MetaModelVascBackend extends AbstractVascBackend {
|
|||
return result;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
if (crudDataContext==null) {
|
||||
return;
|
||||
}
|
||||
crudDataContext.persist((UpdateableRow) object);
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
if (crudDataContext==null) {
|
||||
return object;
|
||||
}
|
||||
return crudDataContext.merge((UpdateableRow) object);
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
if (crudDataContext==null) {
|
||||
return;
|
||||
}
|
||||
crudDataContext.delete((UpdateableRow) object);
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
public VascEntryFieldValue provideVascEntryFieldValue() {
|
||||
return new RowVascEntryFieldValue();
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator() {
|
||||
return new RowVascEntryRecordCreator(crudDataContext,crudDataContext.getDefaultSchema().getTableByName(table));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,34 +3,30 @@ package net.forwardfire.vasc.backend.metamodel;
|
|||
import org.eobjects.metamodel.data.Row;
|
||||
import org.eobjects.metamodel.query.SelectItem;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRow;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
public class RowVascEntryFieldValue implements VascEntryFieldValue {
|
||||
|
||||
private static final long serialVersionUID = -806674640688182132L;
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object)
|
||||
* @see net.forwardfire.vasc.backend.VascEntryFieldValue#getValue(java.lang.String, java.lang.Object)
|
||||
*/
|
||||
public Object getValue(VascEntryField field, Object record) throws VascException {
|
||||
if (field==null) {
|
||||
throw new NullPointerException("Can't get value of null field.");
|
||||
}
|
||||
if (field.getBackendName()==null) {
|
||||
throw new NullPointerException("Can't get value of null backendName field.");
|
||||
public Object getValue(String backendName, Object record) throws VascBackendException {
|
||||
if (backendName==null) {
|
||||
throw new NullPointerException("Can't get value of null backendName.");
|
||||
}
|
||||
if (record==null) {
|
||||
throw new NullPointerException("Can't get value of null object.");
|
||||
}
|
||||
if (record instanceof UpdateableRow) {
|
||||
UpdateableRow row = (UpdateableRow)record;
|
||||
return row.getValue(field.getBackendName());
|
||||
return row.getValue(backendName);
|
||||
}
|
||||
Row row = (Row)record;
|
||||
Object fieldValue = row.getValue(indexOf(field.getBackendName(),row));
|
||||
Object fieldValue = row.getValue(indexOf(backendName,row));
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
|
@ -49,10 +45,10 @@ public class RowVascEntryFieldValue implements VascEntryFieldValue {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object)
|
||||
* @see net.forwardfire.vasc.backend.VascEntryFieldValue#getDisplayValue(java.lang.String, java.lang.Object)
|
||||
*/
|
||||
public String getDisplayValue(VascEntryField field, Object record) throws VascException {
|
||||
Object fieldValue = getValue(field,record);
|
||||
public String getDisplayValue(String backendName, Object record) throws VascBackendException {
|
||||
Object fieldValue = getValue(backendName,record);
|
||||
if (fieldValue==null) {
|
||||
fieldValue = "";
|
||||
}
|
||||
|
@ -60,12 +56,12 @@ public class RowVascEntryFieldValue implements VascEntryFieldValue {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#setValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object, java.lang.Object)
|
||||
* @see net.forwardfire.vasc.backend.VascEntryFieldValue#setValue(java.lang.String, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public void setValue(VascEntryField field, Object record,Object value) throws VascException {
|
||||
public void setValue(String backendName, Object record,Object value) throws VascBackendException {
|
||||
if (record instanceof UpdateableRow) {
|
||||
UpdateableRow row = (UpdateableRow)record;
|
||||
row.setValue(field.getBackendName(), value);
|
||||
row.setValue(backendName, value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,11 +2,10 @@ package net.forwardfire.vasc.backend.metamodel;
|
|||
|
||||
import org.eobjects.metamodel.schema.Table;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.backend.metamodel.crud.CrudDataContext;
|
||||
import net.forwardfire.vasc.backend.metamodel.crud.UpdateableRow;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
public class RowVascEntryRecordCreator implements VascEntryRecordCreator {
|
||||
|
||||
|
@ -23,7 +22,7 @@ public class RowVascEntryRecordCreator implements VascEntryRecordCreator {
|
|||
return UpdateableRow.class;
|
||||
}
|
||||
|
||||
public Object newRecord(VascEntry entry) throws VascException {
|
||||
public Object newRecord() throws VascBackendException {
|
||||
return dataContext.createRow(table);
|
||||
}
|
||||
}
|
|
@ -30,10 +30,5 @@
|
|||
<element tag="xmlDomDataContext" objectClass="net.forwardfire.vasc.backend.metamodel.MetaModelDataContextXmlDom"/>
|
||||
|
||||
<element tag="jndiDataContext" objectClass="net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJndiDataContext"/>
|
||||
|
||||
<element tag="schemaAutoEntry" objectClass="net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry">
|
||||
<configurator id="schemaAutoEntry-SchemaAutoEntryElementConfigurator" bean.class="net.forwardfire.vasc.backend.metamodel.x4o.SchemaAutoEntryElementConfigurator" configAction="true"/>
|
||||
</element>
|
||||
|
||||
</namespace>
|
||||
</root:module>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc-backend</artifactId>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<version>0.4.2-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
@ -11,8 +11,8 @@
|
|||
<description>vasc-backend-mongodb</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-core</artifactId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -27,13 +27,10 @@ import java.util.List;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.AbstractVascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
|
||||
import com.mongodb.DB;
|
||||
import com.mongodb.DBCollection;
|
||||
|
@ -108,7 +105,7 @@ public class MongodbVascBackend extends AbstractVascBackend {
|
|||
return query;
|
||||
}
|
||||
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
DBCollection coll = getDBCollection();
|
||||
DBObject query = createFilterQuery(state);
|
||||
DBCursor cur = coll.find(query);
|
||||
|
@ -124,12 +121,12 @@ public class MongodbVascBackend extends AbstractVascBackend {
|
|||
return result;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
DBCollection coll = getDBCollection();
|
||||
coll.insert((DBObject)object);
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
DBCollection coll = getDBCollection();
|
||||
DBObject row = (DBObject)object;
|
||||
DBObject query = new BasicDBObject();
|
||||
|
@ -139,18 +136,18 @@ public class MongodbVascBackend extends AbstractVascBackend {
|
|||
return object;
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
DBCollection coll = getDBCollection();
|
||||
DBObject query = new BasicDBObject();
|
||||
query.put("_id",((DBObject)object).get("_id"));
|
||||
coll.remove(query); // remove by _id
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
public VascEntryFieldValue provideVascEntryFieldValue() {
|
||||
return new MongodbVascEntryFieldValue();
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator() {
|
||||
return new MongodbVascEntryRecordCreator();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,8 @@
|
|||
|
||||
package net.forwardfire.vasc.backend.mongodb;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
|
||||
|
@ -39,18 +37,18 @@ public class MongodbVascEntryFieldValue implements VascEntryFieldValue {
|
|||
|
||||
private static final long serialVersionUID = -7371273796529818557L;
|
||||
|
||||
public Object getValue(VascEntryField field, Object record) throws VascException {
|
||||
public Object getValue(String backendName, Object record) throws VascBackendException {
|
||||
BasicDBObject row = (BasicDBObject)record;
|
||||
Object data = row.get(field.getBackendName());
|
||||
Object data = row.get(backendName);
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getDisplayValue(VascEntryField field, Object record) throws VascException {
|
||||
public String getDisplayValue(String field, Object record) throws VascBackendException {
|
||||
return ""+getValue(field,record);
|
||||
}
|
||||
|
||||
public void setValue(VascEntryField field, Object record, Object value) throws VascException {
|
||||
public void setValue(String backendName, Object record, Object value) throws VascBackendException {
|
||||
BasicDBObject row = (BasicDBObject)record;
|
||||
row.put(field.getBackendName(), value);
|
||||
row.put(backendName, value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,8 @@
|
|||
|
||||
package net.forwardfire.vasc.backend.mongodb;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
|
||||
import com.mongodb.BasicDBObject;
|
||||
|
||||
|
@ -40,7 +38,7 @@ public class MongodbVascEntryRecordCreator implements VascEntryRecordCreator {
|
|||
|
||||
private static final long serialVersionUID = -9213830731796787384L;
|
||||
|
||||
public Object newRecord(VascEntry entry) throws VascException {
|
||||
public Object newRecord() throws VascBackendException {
|
||||
return new BasicDBObject();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,21 +22,14 @@
|
|||
|
||||
package net.forwardfire.vasc.ejb3;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
|
||||
/**
|
||||
* VascServiceRemoteBackend wraps VascBasckend to the ejb3 context.
|
||||
|
@ -58,9 +51,8 @@ public class VascServiceRemoteBackend implements VascBackend {
|
|||
}
|
||||
this.vascManager=vascManager;
|
||||
this.backendId=backendId;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void startBackend() {
|
||||
}
|
||||
public void stopBackend() {
|
||||
|
@ -74,151 +66,120 @@ public class VascServiceRemoteBackend implements VascBackend {
|
|||
// we cant change id
|
||||
}
|
||||
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
|
||||
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveDownById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
|
||||
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascBackendException {
|
||||
Object[] args = new Object[2];
|
||||
args[0]=state;
|
||||
args[1]=primaryId;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "doRecordMoveUpById", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "execute", args);
|
||||
return (List<Object>)result;
|
||||
}
|
||||
|
||||
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=state;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "fetchTotalExecuteSize", args);
|
||||
return (Long)result;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPageable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
|
||||
public boolean isRecordMoveable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isRecordMoveable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
|
||||
public boolean isSearchable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSearchable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
|
||||
public boolean isSortable() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isSortable", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
public Object merge(Object object) throws VascException {
|
||||
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "merge", args);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws VascException {
|
||||
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
Object[] args = new Object[1];
|
||||
args[0]=object;
|
||||
vascManager.invokeBackendMethod(backendId, "delete", args);
|
||||
}
|
||||
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
try {
|
||||
field = ((VascEntryFieldLocal)field).clone(); // RM...
|
||||
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(field);
|
||||
objOutstream.close();
|
||||
int objectSize = dataArray.size();
|
||||
System.out.println("Writing obj to field: "+objectSize);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=field;
|
||||
|
||||
@Override
|
||||
public VascEntryFieldValue provideVascEntryFieldValue() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryFieldValue", args);
|
||||
return (VascEntryFieldValue)result;
|
||||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
VascEntryLocal clone = null;
|
||||
try {
|
||||
clone = ((VascEntryLocal)vascEntry).clone();
|
||||
clone.setVascFrontendController(null);
|
||||
clone.setVascEntryFieldEventChannel(null);
|
||||
} catch (CloneNotSupportedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
ByteArrayOutputStream dataArray = new ByteArrayOutputStream(256); // it grows when needed
|
||||
ObjectOutputStream objOutstream = new ObjectOutputStream(dataArray);
|
||||
objOutstream.writeObject(clone);
|
||||
objOutstream.close();
|
||||
//int objectSize = dataArray.size();
|
||||
//System.out.println("Writing obj to entry: "+objectSize);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Object[] args = new Object[1];
|
||||
args[0]=clone;
|
||||
|
||||
@Override
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "provideVascEntryRecordCreator", args);
|
||||
return (VascEntryRecordCreator)result;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> executePageSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "executePageSummary", args);
|
||||
return (Map<String, Object>)result;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> executeTotalSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "executeTotalSummary", args);
|
||||
return (Map<String, Object>)result;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPageSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isPageSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
|
||||
public boolean isTotalSummary() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isTotalSummary", args);
|
||||
return (Boolean)result;
|
||||
}
|
||||
|
||||
|
||||
public boolean isReadOnly() {
|
||||
Object[] args = new Object[0];
|
||||
Object result = vascManager.invokeBackendMethod(backendId, "isReadOnly", args);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-jpa</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
<version>${x4o.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||
<artifactId>vasc-lib-xpql</artifactId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -26,13 +26,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryRecordCreator;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
||||
/**
|
||||
* VascBackendProxy to implement missing features of the backend.
|
||||
|
@ -107,14 +105,14 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy {
|
|||
* @throws Exception
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
|
||||
*/
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
return backend.execute(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#delete(java.lang.Object)
|
||||
*/
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
backend.delete(object);
|
||||
}
|
||||
|
||||
|
@ -135,29 +133,29 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object)
|
||||
*/
|
||||
public Object merge(Object object) throws VascException {
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
return backend.merge(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object)
|
||||
*/
|
||||
public void persist(Object object) throws VascException {
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
backend.persist(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue(net.forwardfire.vasc.core.VascEntryField)
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue()
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue(VascEntryField field) {
|
||||
return backend.provideVascEntryFieldValue(field);
|
||||
public VascEntryFieldValue provideVascEntryFieldValue() {
|
||||
return backend.provideVascEntryFieldValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator(net.forwardfire.vasc.core.VascEntry)
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryRecordCreator()
|
||||
*/
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
return backend.provideVascEntryRecordCreator(vascEntry);
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator() {
|
||||
return backend.provideVascEntryRecordCreator();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,14 +175,14 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.core.VascBackend#doRecordMoveDownById(VascBackendState state,java.lang.Object)
|
||||
*/
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascException {
|
||||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException {
|
||||
return backend.doRecordMoveDownById(state,primaryId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.VascBackend#doRecordMoveUpById(VascBackendState state,java.lang.Object)
|
||||
*/
|
||||
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascException {
|
||||
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascBackendException {
|
||||
return backend.doRecordMoveUpById(state,primaryId);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* Does simple caching for the data.
|
||||
|
@ -130,7 +130,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
|
||||
*/
|
||||
@Override
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
boolean changed = isStateChanged(state);
|
||||
if (data==null | changed) {
|
||||
data = backend.execute(state);
|
||||
|
@ -151,7 +151,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
requestFlush = true;
|
||||
super.delete(object);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object merge(Object object) throws VascException {
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
requestFlush = true;
|
||||
return super.merge(object);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void persist(Object object) throws VascException {
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
requestFlush = true;
|
||||
super.persist(object);
|
||||
}
|
||||
|
|
|
@ -26,11 +26,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryBackendEventListener.VascBackendEventType;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* Holds !! and fires the backend event listeners.
|
||||
|
@ -105,7 +105,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
fireVascEvent(VascBackendEventType.PRE_DELETE,object);
|
||||
super.delete(object);
|
||||
fireVascEvent(VascBackendEventType.POST_DELETE,object);
|
||||
|
@ -115,7 +115,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveDownById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascException {
|
||||
public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascBackendException {
|
||||
fireVascEvent(VascBackendEventType.PRE_MOVE_DOWN,primaryId);
|
||||
Long result = super.doRecordMoveDownById(state, primaryId);
|
||||
fireVascEvent(VascBackendEventType.POST_MOVE_DOWN,result);
|
||||
|
@ -126,7 +126,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveUpById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascBackendException {
|
||||
fireVascEvent(VascBackendEventType.PRE_MOVE_UP,primaryId);
|
||||
Long result = super.doRecordMoveUpById(state, primaryId);
|
||||
fireVascEvent(VascBackendEventType.POST_MOVE_UP,result);
|
||||
|
@ -137,7 +137,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#execute(net.forwardfire.vasc.backend.VascBackendState)
|
||||
*/
|
||||
@Override
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
fireVascEvent(VascBackendEventType.PRE_EXECUTE,state);
|
||||
List<Object> result = super.execute(state);
|
||||
fireVascEvent(VascBackendEventType.POST_EXECUTE,result);
|
||||
|
@ -159,7 +159,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object merge(Object object) throws VascException {
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
fireVascEvent(VascBackendEventType.PRE_MERGE,object);
|
||||
Object result = super.merge(object);
|
||||
fireVascEvent(VascBackendEventType.POST_MERGE,result);
|
||||
|
@ -170,7 +170,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void persist(Object object) throws VascException {
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
fireVascEvent(VascBackendEventType.PRE_PERSIST,object);
|
||||
super.persist(object);
|
||||
fireVascEvent(VascBackendEventType.POST_PERSIST,object);
|
||||
|
|
|
@ -26,12 +26,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendFilter;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Simple filter support
|
||||
|
@ -42,7 +39,7 @@ import net.forwardfire.vasc.core.VascException;
|
|||
public class VascBackendProxyFilter extends AbstractVascBackendProxy {
|
||||
|
||||
private long records = 0;
|
||||
private List<VascBackendFilter> filters = null;
|
||||
private List<VascProxyFilter> filters = null;
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#clone()
|
||||
|
@ -59,7 +56,7 @@ public class VascBackendProxyFilter extends AbstractVascBackendProxy {
|
|||
public void initProxy(VascBackend backend, VascEntry entry) {
|
||||
super.initProxy(backend,entry);
|
||||
filters = entry.getVascBackendFilters();
|
||||
for (VascBackendFilter filter:filters) {
|
||||
for (VascProxyFilter filter:filters) {
|
||||
filter.initFilter(entry);
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +76,7 @@ public class VascBackendProxyFilter extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
|
||||
*/
|
||||
@Override
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
List<Object> result = backend.execute(state);
|
||||
if (filters==null) {
|
||||
return result;
|
||||
|
@ -89,7 +86,7 @@ public class VascBackendProxyFilter extends AbstractVascBackendProxy {
|
|||
}
|
||||
List<Object> search = new ArrayList<Object>(result.size()/2);
|
||||
for (Object o:result) {
|
||||
for (VascBackendFilter filter:filters) {
|
||||
for (VascProxyFilter filter:filters) {
|
||||
Object r = filter.filterObject(o);
|
||||
if (r!=null) {
|
||||
search.add(r);
|
||||
|
|
|
@ -25,8 +25,8 @@ package net.forwardfire.vasc.backend.proxy;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* Simulates a real pages backend.
|
||||
|
@ -70,7 +70,7 @@ public class VascBackendProxyPaged extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
|
||||
*/
|
||||
@Override
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
List<Object> allData = backend.execute(state);
|
||||
int pageSize = state.getPageSize();
|
||||
if (pageSize==0) {
|
||||
|
|
|
@ -25,10 +25,10 @@ package net.forwardfire.vasc.backend.proxy;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* Simple text search
|
||||
|
@ -70,7 +70,7 @@ public class VascBackendProxySearch extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
|
||||
*/
|
||||
@Override
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
List<Object> result = backend.execute(state);
|
||||
if (state.getSearchString()==null) {
|
||||
return result;
|
||||
|
@ -82,8 +82,8 @@ public class VascBackendProxySearch extends AbstractVascBackendProxy {
|
|||
List<Object> search = new ArrayList<Object>(result.size()/4);
|
||||
for (Object record:result) {
|
||||
for (VascEntryField field:entry.getVascEntryFields()) {
|
||||
VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue(field);
|
||||
Object value = fieldValue.getValue(field, record);
|
||||
VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue();
|
||||
Object value = fieldValue.getValue(field.getBackendName(), record);
|
||||
if (value==null) {
|
||||
continue; // can't search null values.
|
||||
}
|
||||
|
|
|
@ -26,11 +26,10 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* Add an sortware sort an a backend
|
||||
|
@ -74,14 +73,13 @@ public class VascBackendProxySort extends AbstractVascBackendProxy {
|
|||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public List<Object> execute(final VascBackendState state) throws VascException {
|
||||
public List<Object> execute(final VascBackendState state) throws VascBackendException {
|
||||
List<Object> result = backend.execute(state);
|
||||
if (state.getSortField()==null) {
|
||||
return result;
|
||||
}
|
||||
try {
|
||||
final VascEntryField field = getVascEntryFieldByBackendName(state.getSortField());
|
||||
final VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue(((VascEntryFieldLocal)field).clone()); // TODO fixme
|
||||
final VascEntryField field = getVascEntryFieldByBackendName(state.getSortField());
|
||||
final VascEntryFieldValue fieldValue = backend.provideVascEntryFieldValue();
|
||||
Collections.sort(result, new Comparator<Object>() {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int compare(Object o1, Object o2) {
|
||||
|
@ -89,11 +87,11 @@ public class VascBackendProxySort extends AbstractVascBackendProxy {
|
|||
Comparable c1 = null;
|
||||
Comparable c2 = null;
|
||||
if (field.getDisplayName()!=null) {
|
||||
c1 = fieldValue.getDisplayValue(field, o1);
|
||||
c2 = fieldValue.getDisplayValue(field, o2);
|
||||
c1 = fieldValue.getDisplayValue(field.getBackendName(), o1);
|
||||
c2 = fieldValue.getDisplayValue(field.getBackendName(), o2);
|
||||
} else {
|
||||
c1 = (Comparable)fieldValue.getValue(field, o1);
|
||||
c2 = (Comparable)fieldValue.getValue(field, o2);
|
||||
c1 = (Comparable)fieldValue.getValue(field.getBackendName(), o1);
|
||||
c2 = (Comparable)fieldValue.getValue(field.getBackendName(), o2);
|
||||
}
|
||||
if (c1==null & c2==null) {
|
||||
return 0;
|
||||
|
@ -122,20 +120,12 @@ public class VascBackendProxySort extends AbstractVascBackendProxy {
|
|||
} else {
|
||||
return c2.compareTo(c1);
|
||||
}
|
||||
} catch (VascException e) {
|
||||
} catch (VascBackendException e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
} catch (CloneNotSupportedException e1) {
|
||||
throw new VascException(e1);
|
||||
} // TODO: check serialable stuff again
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -26,8 +26,8 @@ import java.util.List;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* Does simple timer logging for the backend actions.
|
||||
|
@ -58,7 +58,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.VascBackend#execute(VascBackendState state)
|
||||
*/
|
||||
@Override
|
||||
public List<Object> execute(VascBackendState state) throws VascException {
|
||||
public List<Object> execute(VascBackendState state) throws VascBackendException {
|
||||
long t1 = System.currentTimeMillis();
|
||||
try {
|
||||
return backend.execute(state);
|
||||
|
@ -83,7 +83,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveDownById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascException {
|
||||
public long doRecordMoveDownById(VascBackendState state, Object primaryId) throws VascBackendException {
|
||||
long t1 = System.currentTimeMillis();
|
||||
try {
|
||||
return backend.doRecordMoveDownById(state, primaryId);
|
||||
|
@ -97,7 +97,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveUpById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascException {
|
||||
public long doRecordMoveUpById(VascBackendState state, Object primaryId) throws VascBackendException {
|
||||
long t1 = System.currentTimeMillis();
|
||||
try {
|
||||
return backend.doRecordMoveUpById(state, primaryId);
|
||||
|
@ -111,7 +111,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void delete(Object object) throws VascException {
|
||||
public void delete(Object object) throws VascBackendException {
|
||||
long t1 = System.currentTimeMillis();
|
||||
try {
|
||||
backend.delete(object);
|
||||
|
@ -125,7 +125,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object merge(Object object) throws VascException {
|
||||
public Object merge(Object object) throws VascBackendException {
|
||||
long t1 = System.currentTimeMillis();
|
||||
try {
|
||||
return backend.merge(object);
|
||||
|
@ -139,7 +139,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void persist(Object object) throws VascException {
|
||||
public void persist(Object object) throws VascBackendException {
|
||||
long t1 = System.currentTimeMillis();
|
||||
try {
|
||||
backend.persist(object);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.backend;
|
||||
package net.forwardfire.vasc.backend.proxy;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
|
||||
|
@ -31,7 +31,7 @@ import net.forwardfire.vasc.core.VascEntry;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 28, 2009
|
||||
*/
|
||||
public interface VascBackendFilter {
|
||||
public interface VascProxyFilter {
|
||||
|
||||
/**
|
||||
* Inits the filter
|
||||
|
@ -48,5 +48,5 @@ public interface VascBackendFilter {
|
|||
* @return
|
||||
* @throws CloneNotSupportedException
|
||||
*/
|
||||
public VascBackendFilter clone() throws CloneNotSupportedException;
|
||||
public VascProxyFilter clone() throws CloneNotSupportedException;
|
||||
}
|
|
@ -25,8 +25,8 @@ package net.forwardfire.vasc.core;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.base.AbstractVascBaseIdRoleCrudOrderMetaLocal;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.validators.VascValidator;
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendFilter;
|
||||
import net.forwardfire.vasc.backend.proxy.VascProxyFilter;
|
||||
import net.forwardfire.vasc.core.actions.ColumnVascAction;
|
||||
import net.forwardfire.vasc.core.actions.ColumnVascActionLocal;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
|
@ -82,7 +82,7 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL
|
|||
private Map<String,List<String>> eventEntryFrontendEventListeners = null;
|
||||
private List<String> eventEntryBackendEventListeners = null;
|
||||
private List<VascEntryListOptionLocal> vascEntryListOptions = null;
|
||||
private List<VascBackendFilter> backendFilters = null;
|
||||
private List<VascProxyFilter> backendFilters = null;
|
||||
private Map<String,List<String>> eventEntryFrontendActions = null;
|
||||
|
||||
private String backendId = null;
|
||||
|
@ -105,7 +105,7 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL
|
|||
eventEntryFrontendEventListeners = new HashMap<String,List<String>>(10);
|
||||
eventEntryBackendEventListeners = new ArrayList<String>(10);
|
||||
vascEntryListOptions = new ArrayList<VascEntryListOptionLocal>(10);
|
||||
backendFilters = new ArrayList<VascBackendFilter>(3);
|
||||
backendFilters = new ArrayList<VascProxyFilter>(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -175,7 +175,7 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL
|
|||
optionClone.setVascEntry(clone);
|
||||
clone.addVascEntryListOption(optionClone);
|
||||
}
|
||||
for (VascBackendFilter filter:backendFilters) {
|
||||
for (VascProxyFilter filter:backendFilters) {
|
||||
clone.addVascBackendFilter(filter.clone());
|
||||
}
|
||||
for (String key:eventEntryFrontendActions.keySet()) {
|
||||
|
@ -883,11 +883,11 @@ abstract public class AbstractVascEntryLocal extends AbstractVascBaseIdRoleCrudL
|
|||
}
|
||||
|
||||
|
||||
public void addVascBackendFilter(VascBackendFilter filter) {
|
||||
public void addVascBackendFilter(VascProxyFilter filter) {
|
||||
backendFilters.add(filter);
|
||||
}
|
||||
|
||||
public List<VascBackendFilter> getVascBackendFilters() {
|
||||
public List<VascProxyFilter> getVascBackendFilters() {
|
||||
return backendFilters;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ package net.forwardfire.vasc.core;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendFilter;
|
||||
import net.forwardfire.vasc.backend.proxy.VascProxyFilter;
|
||||
import net.forwardfire.vasc.core.actions.ColumnVascAction;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||
|
@ -229,7 +229,7 @@ public interface VascEntry extends VascBaseIdRoleCrud {
|
|||
|
||||
public VascEntryListOption getVascEntryListOptionById(String listOptionId);
|
||||
|
||||
public List<VascBackendFilter> getVascBackendFilters();
|
||||
public List<VascProxyFilter> getVascBackendFilters();
|
||||
|
||||
public List<String> getVascEntryFrontendActionsByType(String frontendType);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ package net.forwardfire.vasc.core;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.base.VascBaseIdRoleCrudOrderMeta;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.validators.VascValidator;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
package net.forwardfire.vasc.core;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.base.VascBaseIdRoleCrudOrderMetaLocal;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.validators.VascValidator;
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ package net.forwardfire.vasc.core;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendFilter;
|
||||
import net.forwardfire.vasc.backend.proxy.VascProxyFilter;
|
||||
import net.forwardfire.vasc.core.actions.ColumnVascActionLocal;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascActionLocal;
|
||||
import net.forwardfire.vasc.core.actions.RowVascActionLocal;
|
||||
|
@ -260,7 +260,7 @@ public interface VascEntryLocal extends VascEntry,VascBaseIdRoleCrudLocal {
|
|||
|
||||
public Collection<VascEntryListOptionLocal> getVascEntryListOptionsLocal();
|
||||
|
||||
public void addVascBackendFilter(VascBackendFilter filter);
|
||||
public void addVascBackendFilter(VascProxyFilter filter);
|
||||
|
||||
public void addVascEntryFrontendAction(String actionClass,String frontendType);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.forwardfire.vasc.backend.VascBackendState;
|
|||
import net.forwardfire.vasc.frontend.VascFrontendActions;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendControllerLocal;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendDataSelector;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPager;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPageInfo;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendUserController;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendUserSettingController;
|
||||
|
||||
|
@ -24,7 +24,7 @@ public interface VascInterfaceLoader {
|
|||
|
||||
|
||||
|
||||
public VascFrontendPager createVascFrontendPagerImpl(VascEntry entry);
|
||||
public VascFrontendPageInfo createVascFrontendPagerImpl(VascEntry entry);
|
||||
public VascFrontendActions createVascFrontendActionsImpl(VascEntry entry);
|
||||
public VascFrontendDataSelector createVascFrontendDataSelectorImpl(VascEntry entry);
|
||||
public VascFrontendUserController createVascFrontendUserControllerImpl(VascEntry entry);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
package net.forwardfire.vasc.core.ui;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
@ -45,7 +46,11 @@ public class VascColumnValueModelListener implements VascValueModelListener {
|
|||
}
|
||||
|
||||
public void valueUpdate(VascValueModel model) throws VascException {
|
||||
vascEntryField.getVascEntryFieldValue().setValue(vascEntryField, bean, model.getValue());
|
||||
try {
|
||||
vascEntryField.getVascEntryFieldValue().setValue(vascEntryField.getBackendName(), bean, model.getValue());
|
||||
} catch (VascBackendException e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,8 +27,6 @@ import java.util.EventListener;
|
|||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
|
|
|
@ -65,9 +65,9 @@ public interface VascFrontendController {
|
|||
public VascFrontendActions getVascFrontendActions();
|
||||
|
||||
/**
|
||||
* @return the vascFrontendPager
|
||||
* @return the vascFrontendPageInfo
|
||||
*/
|
||||
public VascFrontendPager getVascFrontendPager();
|
||||
public VascFrontendPageInfo getVascFrontendPageInfo();
|
||||
|
||||
/**
|
||||
* @return the VascFrontendHelper
|
||||
|
|
|
@ -41,9 +41,9 @@ public interface VascFrontendControllerLocal extends VascFrontendController {
|
|||
public void setVascFrontendActions(VascFrontendActions vascFrontendActions);
|
||||
|
||||
/**
|
||||
* @param vascFrontendPager the vascFrontendPager to set
|
||||
* @param vascFrontendPageInfo the vascFrontendPageInfo to set
|
||||
*/
|
||||
public void setVascFrontendPager(VascFrontendPager vascFrontendPager);
|
||||
public void setVascFrontendPageInfo(VascFrontendPageInfo vascFrontendPager);
|
||||
|
||||
/**
|
||||
* @param vascEntryResourceResolver the vascEntryResourceResolver to set
|
||||
|
|
|
@ -24,17 +24,15 @@ package net.forwardfire.vasc.frontend;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
|
||||
/**
|
||||
* VascFrontendPager has some info about the pageing data models
|
||||
*
|
||||
* note all the get properties for different el parsers.
|
||||
* TODO: fix all the get properties for different el parsers.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 22, 2012
|
||||
*/
|
||||
public interface VascFrontendPager extends VascFrontendEntry {
|
||||
public interface VascFrontendPageInfo extends VascFrontendEntry {
|
||||
|
||||
public long getPageStartCount();
|
||||
public long getPageStopCount();
|
||||
|
@ -47,9 +45,9 @@ public interface VascFrontendPager extends VascFrontendEntry {
|
|||
public boolean getHasExtendedPageMode();
|
||||
public boolean getHasExtendedPageModeCenter();
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesFromBackend();
|
||||
public List<VascBackendPageNumber> getTablePagesNormal();
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedBegin();
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedCenter();
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedEnd();
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesFromBackend();
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesNormal();
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesExtendedBegin();
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesExtendedCenter();
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesExtendedEnd();
|
||||
}
|
|
@ -20,25 +20,40 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.backend;
|
||||
|
||||
package net.forwardfire.vasc.frontend;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Small class to wrap page number and the selected page number.
|
||||
* note: this can be removed when JSF has the combined EL.
|
||||
* Small class to wrap page number and the selected page number. note: this can
|
||||
* be removed when JSF has the combined EL.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Apr 25, 2006
|
||||
*/
|
||||
public class VascBackendPageNumber implements Serializable {
|
||||
public class VascFrontendPageInfoNumber implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Integer pageNumber = null;
|
||||
private Boolean selected = false;
|
||||
public VascBackendPageNumber(Integer pageNumber) { this.pageNumber=pageNumber; }
|
||||
public Integer getPageNumber() { return pageNumber; }
|
||||
public Boolean getSelected() { return selected; }
|
||||
public Boolean getNotSelected() { return !selected; }
|
||||
public void setSelected(Boolean selected) { this.selected=selected; }
|
||||
|
||||
public VascFrontendPageInfoNumber(Integer pageNumber) {
|
||||
this.pageNumber = pageNumber;
|
||||
}
|
||||
|
||||
public Integer getPageNumber() {
|
||||
return pageNumber;
|
||||
}
|
||||
|
||||
public Boolean getSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public Boolean getNotSelected() {
|
||||
return !selected;
|
||||
}
|
||||
|
||||
public void setSelected(Boolean selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
}
|
|
@ -29,8 +29,10 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import net.forwardfire.vasc.backend.DefaultVascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxy;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
|
@ -45,7 +47,6 @@ import net.forwardfire.vasc.core.VascInterfaceKeyFrontend;
|
|||
import net.forwardfire.vasc.core.VascInterfaceLoader;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendControllerLocal;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendEntry;
|
||||
|
@ -216,7 +217,7 @@ public class DefaultVascEntryConfigController implements VascEntryConfigControll
|
|||
entry.setVascFrontendController(controller); // <------ This is the end result.
|
||||
|
||||
// Add some generic frontend impl code.
|
||||
controller.setVascFrontendPager( loader.createVascFrontendPagerImpl(entry));
|
||||
controller.setVascFrontendPageInfo( loader.createVascFrontendPagerImpl(entry));
|
||||
controller.setVascFrontendActions( loader.createVascFrontendActionsImpl(entry));
|
||||
controller.setVascFrontendDataSelector( loader.createVascFrontendDataSelectorImpl(entry));
|
||||
controller.setVascFrontendUserController( loader.createVascFrontendUserControllerImpl(entry));
|
||||
|
@ -253,7 +254,7 @@ public class DefaultVascEntryConfigController implements VascEntryConfigControll
|
|||
// Fetch all data field value impl for this backend.
|
||||
for (VascEntryField field:entry.getVascEntryFields()) {
|
||||
if (field.getVascEntryFieldValue()==null) {
|
||||
VascEntryFieldValue v = backend.provideVascEntryFieldValue(field);
|
||||
VascEntryFieldValue v = backend.provideVascEntryFieldValue();
|
||||
((VascEntryFieldLocal)field).setVascEntryFieldValue(v);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
package net.forwardfire.vasc.impl;
|
||||
|
||||
import net.forwardfire.vasc.backend.DefaultVascBackendController;
|
||||
import net.forwardfire.vasc.backend.DefaultVascBackendState;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxyCache;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxyEventExecutor;
|
||||
import net.forwardfire.vasc.backend.proxy.VascBackendProxyFilter;
|
||||
|
|
|
@ -36,7 +36,7 @@ import net.forwardfire.vasc.core.VascInterfaceLoader;
|
|||
import net.forwardfire.vasc.frontend.VascFrontendActions;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendControllerLocal;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendDataSelector;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPager;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPageInfo;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendUserController;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendUserSettingController;
|
||||
|
||||
|
@ -121,8 +121,8 @@ public class DefaultVascInterfaceLoader implements VascInterfaceLoader {
|
|||
/**
|
||||
* @see net.forwardfire.vasc.core.VascInterfaceLoader#createVascFrontendPagerImpl()
|
||||
*/
|
||||
public VascFrontendPager createVascFrontendPagerImpl(VascEntry entry) {
|
||||
return (VascFrontendPager)createImpl(VascInterfaceKeyFrontend.VASC_FRONTEND_PAGER,entry);
|
||||
public VascFrontendPageInfo createVascFrontendPagerImpl(VascEntry entry) {
|
||||
return (VascFrontendPageInfo)createImpl(VascInterfaceKeyFrontend.VASC_FRONTEND_PAGER,entry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.impl.entry;
|
||||
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
import org.x4o.xml.element.DefaultElementObjectPropertyValue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class BeanPropertyVascEntryFieldValue implements VascEntryFieldValue {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String property = null;
|
||||
|
||||
private DefaultElementObjectPropertyValue helper = null;
|
||||
|
||||
public BeanPropertyVascEntryFieldValue() {
|
||||
helper = new DefaultElementObjectPropertyValue();
|
||||
}
|
||||
public BeanPropertyVascEntryFieldValue(String property) {
|
||||
this();
|
||||
setProperty(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.column.VascColumnValue#getValue(net.forwardfire.vasc.core.column.VascTableColumn, java.lang.Object)
|
||||
*/
|
||||
public Object getValue(VascEntryField column,Object record) throws VascException {
|
||||
if(getProperty()==null) {
|
||||
return null;
|
||||
}
|
||||
if(getProperty().equals("")) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return helper.getProperty(record, getProperty());
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.entry.VascEntryFieldValue#getDisplayValue(net.forwardfire.vasc.core.VascEntryField, java.lang.Object)
|
||||
*/
|
||||
public String getDisplayValue(VascEntryField field, Object record) throws VascException {
|
||||
return ""+getValue(field,record); // not supported
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.core.column.VascColumnValue#setValue(net.forwardfire.vasc.core.column.VascTableColumn, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public void setValue(VascEntryField column, Object record,Object value) throws VascException {
|
||||
if(getProperty()==null) {
|
||||
return;
|
||||
}
|
||||
if(getProperty().equals("")) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
helper.setProperty(record, getProperty(),value);
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the property
|
||||
*/
|
||||
public String getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param property the property to set
|
||||
*/
|
||||
public void setProperty(String property) {
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -25,8 +25,9 @@ package net.forwardfire.vasc.impl.frontend;
|
|||
import java.util.Date;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendFilter;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.proxy.VascProxyFilter;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
|
@ -58,10 +59,8 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_CREATE, null);
|
||||
Object object;
|
||||
try {
|
||||
object = entry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryRecordCreator(((VascEntryLocal)entry).clone()).newRecord(entry);
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new VascFrontendException(e);
|
||||
} catch (VascException e) {
|
||||
object = entry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryRecordCreator().newRecord();
|
||||
} catch (VascBackendException e) {
|
||||
throw new VascFrontendException(e);
|
||||
}
|
||||
if (object==null) {
|
||||
|
@ -72,7 +71,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
continue; // no default value to set.
|
||||
}
|
||||
try {
|
||||
Object value = field.getVascEntryFieldValue().getValue(field, object);
|
||||
Object value = field.getVascEntryFieldValue().getValue(field.getBackendName(), object);
|
||||
if (value!=null) {
|
||||
continue; // value is already set by backend creator.
|
||||
}
|
||||
|
@ -84,8 +83,8 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
}
|
||||
}
|
||||
logger.finer("Setting default value for: "+field.getName()+" def: "+defaultValue);
|
||||
field.getVascEntryFieldValue().setValue(field, object, defaultValue);
|
||||
} catch (VascException ve) {
|
||||
field.getVascEntryFieldValue().setValue(field.getBackendName(), object, defaultValue);
|
||||
} catch (VascBackendException ve) {
|
||||
throw new VascFrontendException(ve);
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +92,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
return object;
|
||||
}
|
||||
|
||||
protected int removeObjectFromDataList(Object object) throws VascException {
|
||||
protected int removeObjectFromDataList(Object object) throws VascBackendException {
|
||||
int indexOld = entry.getVascFrontendController().getVascEntryState().getEntryDataList().indexOf(object);
|
||||
if (entry.getVascFrontendController().getVascEntryState().getEntryDataList().remove(object)) {
|
||||
return indexOld; // java worked well for use
|
||||
|
@ -102,14 +101,14 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
// remove only work on (jpa)beans with an overrided equals method.
|
||||
// we lets do the search ourselfs here because we should know the primary key value
|
||||
VascEntryField field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
|
||||
Object idObject = field.getVascEntryFieldValue().getValue(field, object);
|
||||
Object idObject = field.getVascEntryFieldValue().getValue(field.getBackendName(), object);
|
||||
|
||||
// is only null when creating objects
|
||||
if (idObject!=null) {
|
||||
int index = 0;
|
||||
for (Object o:entry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
|
||||
field = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
|
||||
Object id = field.getVascEntryFieldValue().getValue(field, o);
|
||||
Object id = field.getVascEntryFieldValue().getValue(field.getBackendName(), o);
|
||||
if (idObject.equals(id)) {
|
||||
break;
|
||||
}
|
||||
|
@ -146,32 +145,35 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
}
|
||||
|
||||
protected Object saveObject(boolean persist) throws VascException {
|
||||
Object object = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
Object result = null;
|
||||
|
||||
entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_UPDATE,object);
|
||||
int index = removeObjectFromDataList(object);
|
||||
|
||||
// save object on backend
|
||||
if (persist) {
|
||||
entry.getVascFrontendController().getVascEntryState().getVascBackend().persist(object);
|
||||
result = object; // TODO: fix persist
|
||||
entry.getVascFrontendController().getVascEntryState().setTotalBackendRecords(1+entry.getVascFrontendController().getVascEntryState().getTotalBackendRecords());
|
||||
} else {
|
||||
result = entry.getVascFrontendController().getVascEntryState().getVascBackend().merge(object);
|
||||
try {
|
||||
Object object = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
Object result = null;
|
||||
|
||||
entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.PRE_UPDATE,object);
|
||||
int index = removeObjectFromDataList(object);
|
||||
|
||||
// save object on backend
|
||||
if (persist) {
|
||||
entry.getVascFrontendController().getVascEntryState().getVascBackend().persist(object);
|
||||
result = object; // TODO: fix persist
|
||||
entry.getVascFrontendController().getVascEntryState().setTotalBackendRecords(1+entry.getVascFrontendController().getVascEntryState().getTotalBackendRecords());
|
||||
} else {
|
||||
result = entry.getVascFrontendController().getVascEntryState().getVascBackend().merge(object);
|
||||
}
|
||||
|
||||
// put object thrue the filters
|
||||
for (VascProxyFilter filter:entry.getVascBackendFilters()) {
|
||||
result = filter.filterObject(result);
|
||||
}
|
||||
|
||||
// put object back in list
|
||||
entry.getVascFrontendController().getVascEntryState().getEntryDataList().add(index, result);
|
||||
entry.getVascFrontendController().getVascEntryState().setEntryDataObject(null);
|
||||
entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_UPDATE,result);
|
||||
return result;
|
||||
} catch (VascBackendException e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
|
||||
// put object thrue the filters
|
||||
for (VascBackendFilter filter:entry.getVascBackendFilters()) {
|
||||
result = filter.filterObject(result);
|
||||
}
|
||||
|
||||
// put object back in list
|
||||
entry.getVascFrontendController().getVascEntryState().getEntryDataList().add(index, result);
|
||||
entry.getVascFrontendController().getVascEntryState().setEntryDataObject(null);
|
||||
entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_UPDATE,result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -189,7 +191,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
entry.getVascFrontendController().getVascEntryState().setEntryDataObject(null);
|
||||
entry.getVascFrontendController().getVascEntryState().setTotalBackendRecords(entry.getVascFrontendController().getVascEntryState().getTotalBackendRecords()-1);
|
||||
entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_DELETE, object);
|
||||
} catch (VascException ve) {
|
||||
} catch (VascBackendException ve) {
|
||||
throw new VascFrontendException(ve);
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +236,7 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
|
||||
// Fire event post read
|
||||
entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_READ, null);
|
||||
} catch (VascException ve) {
|
||||
} catch (VascBackendException ve) {
|
||||
throw new VascFrontendException(ve);
|
||||
}
|
||||
}
|
||||
|
@ -285,9 +287,9 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
if (entry.getVascFrontendController().getVascEntryState().getVascBackend().isRecordMoveable()) {
|
||||
try {
|
||||
VascEntryField p = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
|
||||
Object primaryId = p.getVascEntryFieldValue().getValue(p, record);
|
||||
Object primaryId = p.getVascEntryFieldValue().getValue(p.getBackendName(), record);
|
||||
entry.getVascFrontendController().getVascEntryState().getVascBackend().doRecordMoveUpById(entry.getVascFrontendController().getVascEntryState().getVascBackendState(),primaryId);
|
||||
} catch (VascException ve) {
|
||||
} catch (VascBackendException ve) {
|
||||
throw new VascFrontendException(ve);
|
||||
}
|
||||
|
||||
|
@ -303,9 +305,9 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
|
||||
try {
|
||||
VascEntryField p = entry.getVascEntryFieldById(entry.getPrimaryKeyFieldId());
|
||||
Object primaryId = p.getVascEntryFieldValue().getValue(p, record);
|
||||
Object primaryId = p.getVascEntryFieldValue().getValue(p.getBackendName(), record);
|
||||
entry.getVascFrontendController().getVascEntryState().getVascBackend().doRecordMoveDownById(entry.getVascFrontendController().getVascEntryState().getVascBackendState(),primaryId);
|
||||
} catch (VascException ve) {
|
||||
} catch (VascBackendException ve) {
|
||||
throw new VascFrontendException(ve);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ import net.forwardfire.vasc.frontend.VascFrontendActions;
|
|||
import net.forwardfire.vasc.frontend.VascFrontendControllerLocal;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendDataSelector;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendHelper;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPager;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPageInfo;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendUserController;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendUserSettingController;
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class DefaultVascFrontendController implements VascFrontendControllerLoca
|
|||
|
||||
private VascFrontend vascFrontend = null;
|
||||
private VascFrontendActions vascFrontendActions = null;
|
||||
private VascFrontendPager vascFrontendPager = null;
|
||||
private VascFrontendPageInfo vascFrontendPageInfo = null;
|
||||
private VascEntryConfigFinalizer vascEntryFinalizer = null;
|
||||
private VascFrontendHelper vascFrontendHelper = null;
|
||||
private VascEntryResourceResolver vascEntryResourceResolver = null;
|
||||
|
@ -121,15 +121,15 @@ public class DefaultVascFrontendController implements VascFrontendControllerLoca
|
|||
/**
|
||||
* @return the vascFrontendPager
|
||||
*/
|
||||
public VascFrontendPager getVascFrontendPager() {
|
||||
return vascFrontendPager;
|
||||
public VascFrontendPageInfo getVascFrontendPageInfo() {
|
||||
return vascFrontendPageInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vascFrontendPager the vascFrontendPager to set
|
||||
*/
|
||||
public void setVascFrontendPager(VascFrontendPager vascFrontendPager) {
|
||||
this.vascFrontendPager = vascFrontendPager;
|
||||
public void setVascFrontendPageInfo(VascFrontendPageInfo vascFrontendPageInfo) {
|
||||
this.vascFrontendPageInfo = vascFrontendPageInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,13 +26,14 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryLink;
|
||||
import net.forwardfire.vasc.core.VascEntryLinkType;
|
||||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValidatorService;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendHelper;
|
||||
|
@ -107,11 +108,15 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
|
|||
}
|
||||
|
||||
Object objectSelected = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
Object objectValue = field.getVascEntryFieldValue().getValue(field, objectSelected);
|
||||
for (VascEntryFieldValidatorService s:entry.getVascFrontendController().getVascValidatorServices()) {
|
||||
error.addAll(s.validateObjectField(field, objectSelected, objectValue));
|
||||
try {
|
||||
Object objectValue = field.getVascEntryFieldValue().getValue(field.getBackendName(), objectSelected);
|
||||
for (VascEntryFieldValidatorService s:entry.getVascFrontendController().getVascValidatorServices()) {
|
||||
error.addAll(s.validateObjectField(field, objectSelected, objectValue));
|
||||
}
|
||||
return error;
|
||||
} catch (VascBackendException e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -192,8 +197,8 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
|
|||
VascEntryFieldValue ve = v.getVascEntryFieldValue();
|
||||
String result = "no-data";
|
||||
try {
|
||||
result = ve.getDisplayValue(v, row);
|
||||
} catch (VascException e) {
|
||||
result = ve.getDisplayValue(v.getBackendName(), row);
|
||||
} catch (VascBackendException e) {
|
||||
throw new RuntimeException("Could not get selected name DisplayValue: "+e.getMessage(),e);
|
||||
}
|
||||
return result;
|
||||
|
@ -213,8 +218,8 @@ public class DefaultVascFrontendHelper implements VascFrontendHelper {
|
|||
VascEntryFieldValue ve = v.getVascEntryFieldValue();
|
||||
String result = "no-data";
|
||||
try {
|
||||
result = ve.getDisplayValue(v, row);
|
||||
} catch (VascException e) {
|
||||
result = ve.getDisplayValue(v.getBackendName(), row);
|
||||
} catch (VascBackendException e) {
|
||||
throw new RuntimeException("Could not get parent name DisplayValue: "+e.getMessage(),e);
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -25,11 +25,11 @@ package net.forwardfire.vasc.impl.frontend;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPager;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPageInfo;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -38,15 +38,15 @@ import net.forwardfire.vasc.frontend.VascFrontendPager;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 22, 2012
|
||||
*/
|
||||
public class DefaultVascFrontendPager implements VascFrontendPager {
|
||||
public class DefaultVascFrontendPager implements VascFrontendPageInfo {
|
||||
|
||||
//private Logger logger = Logger.getLogger(DefaultVascFrontendPager.class.getName());
|
||||
private VascEntry entry = null;
|
||||
private List<VascBackendPageNumber> pagesAll = null;
|
||||
private List<VascFrontendPageInfoNumber> pagesAll = null;
|
||||
|
||||
public void init(VascEntry entry) {
|
||||
this.entry=entry;
|
||||
pagesAll = new ArrayList<VascBackendPageNumber>(0);
|
||||
pagesAll = new ArrayList<VascFrontendPageInfoNumber>(0);
|
||||
entry.getVascFrontendController().addVascEntryFrontendEventListener(new DefaultVascFrontendPagerEventListener());
|
||||
}
|
||||
|
||||
|
@ -138,8 +138,8 @@ public class DefaultVascFrontendPager implements VascFrontendPager {
|
|||
return true;
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesFromBackend() {
|
||||
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(30);
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesFromBackend() {
|
||||
List<VascFrontendPageInfoNumber> result = new ArrayList<VascFrontendPageInfoNumber>(30);
|
||||
VascBackendState state = entry.getVascFrontendController().getVascEntryState().getVascBackendState();
|
||||
if (state.getPageSize()==0) {
|
||||
return result; // paging disabled
|
||||
|
@ -150,7 +150,7 @@ public class DefaultVascFrontendPager implements VascFrontendPager {
|
|||
}
|
||||
int pages = new Long(total/state.getPageSize()).intValue();
|
||||
for (int i=0;i<=pages;i++) {
|
||||
VascBackendPageNumber pn = new VascBackendPageNumber(i);
|
||||
VascFrontendPageInfoNumber pn = new VascFrontendPageInfoNumber(i);
|
||||
if (state.getPageIndex()==i) {
|
||||
pn.setSelected(true);
|
||||
}
|
||||
|
@ -159,16 +159,16 @@ public class DefaultVascFrontendPager implements VascFrontendPager {
|
|||
return result;
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesNormal() {
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesNormal() {
|
||||
if (getHasExtendedPageMode()) {
|
||||
return new ArrayList<VascBackendPageNumber>(0);
|
||||
return new ArrayList<VascFrontendPageInfoNumber>(0);
|
||||
} else {
|
||||
return pagesAll;
|
||||
}
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedBegin() {
|
||||
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(6);
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesExtendedBegin() {
|
||||
List<VascFrontendPageInfoNumber> result = new ArrayList<VascFrontendPageInfoNumber>(6);
|
||||
if (pagesAll.size()>0) {
|
||||
result.add(pagesAll.get(0));
|
||||
}
|
||||
|
@ -200,8 +200,8 @@ public class DefaultVascFrontendPager implements VascFrontendPager {
|
|||
return result;
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedEnd() {
|
||||
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(6);
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesExtendedEnd() {
|
||||
List<VascFrontendPageInfoNumber> result = new ArrayList<VascFrontendPageInfoNumber>(6);
|
||||
int pages = pagesAll.size();
|
||||
int page = entry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
int off = pages-page;
|
||||
|
@ -224,8 +224,8 @@ public class DefaultVascFrontendPager implements VascFrontendPager {
|
|||
return result;
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedCenter() {
|
||||
List<VascBackendPageNumber> result = new ArrayList<VascBackendPageNumber>(3);
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesExtendedCenter() {
|
||||
List<VascFrontendPageInfoNumber> result = new ArrayList<VascFrontendPageInfoNumber>(3);
|
||||
int page = entry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
if (page>0 && pagesAll.size() > page-1) {
|
||||
result.add(pagesAll.get(page-1));
|
||||
|
|
|
@ -27,17 +27,17 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.DefaultVascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryFieldLocal;
|
||||
import net.forwardfire.vasc.core.VascEntryLocal;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.ui.VascSelectItem;
|
||||
import net.forwardfire.vasc.core.ui.VascSelectItemModel;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.impl.DefaultVascBackendState;
|
||||
|
||||
/**
|
||||
* The DefaultVascSelectItemModel
|
||||
|
@ -135,14 +135,14 @@ public class VascSelectItemModelEntry implements VascSelectItemModel {
|
|||
}
|
||||
VascEntryField field = fieldOrg.clone();
|
||||
field.getVascValidators().clear();
|
||||
VascEntryFieldValue v = fieldEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue(field);
|
||||
VascEntryFieldValue v = fieldEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue();
|
||||
|
||||
Object record = fieldEntry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
if (record==null) {
|
||||
//System.out.println("could not get selected records from state.");
|
||||
continue;
|
||||
}
|
||||
Object value = v.getValue(fieldOrg, record);
|
||||
Object value = v.getValue(fieldOrg.getBackendName(), record);
|
||||
|
||||
//System.out.println("Set entry paras name: "+paraName+" value: "+value+" class: "+value.getClass().getName());
|
||||
state.setDataParameter(paraName, value);
|
||||
|
@ -155,7 +155,7 @@ public class VascSelectItemModelEntry implements VascSelectItemModel {
|
|||
VascEntryField fieldClone = key.clone();
|
||||
fieldClone.getVascValidators().clear();
|
||||
|
||||
VascEntryFieldValue v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone);
|
||||
VascEntryFieldValue v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue();
|
||||
key.setVascEntryFieldValue(v);
|
||||
}
|
||||
if (dis.getVascEntryFieldValue()==null) {
|
||||
|
@ -163,15 +163,15 @@ public class VascSelectItemModelEntry implements VascSelectItemModel {
|
|||
VascEntryField fieldClone = dis.clone();
|
||||
fieldClone.getVascValidators().clear();
|
||||
|
||||
VascEntryFieldValue v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue(fieldClone);
|
||||
VascEntryFieldValue v = currentEntry.getVascFrontendController().getVascEntryState().getVascBackend().provideVascEntryFieldValue();
|
||||
dis.setVascEntryFieldValue(v);
|
||||
}
|
||||
|
||||
|
||||
// execute
|
||||
for (Object o:back.execute(state)) {
|
||||
Object keyId = key.getVascEntryFieldValue().getValue(key, o);
|
||||
String nameId = dis.getVascEntryFieldValue().getDisplayValue(dis, o);
|
||||
Object keyId = key.getVascEntryFieldValue().getValue(key.getBackendName(), o);
|
||||
String nameId = dis.getVascEntryFieldValue().getDisplayValue(dis.getBackendName(), o);
|
||||
if (returnKeyValue!=null && false==returnKeyValue) {
|
||||
VascSelectItem item = new VascSelectItem(nameId,o,""+keyId);
|
||||
result.add(item);
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
parentClass="net.forwardfire.vasc.core.VascEntryLocal" childClass="net.forwardfire.vasc.core.VascEntryLinkLocal"
|
||||
addMethod="addVascEntryLink" getMethod="getVascEntryLinksLocal"
|
||||
/>
|
||||
<!--
|
||||
<eld:classBindingHandler id="VascEntryLocal-VascBackendFilter"
|
||||
parentClass="net.forwardfire.vasc.core.VascEntryLocal" childClass="net.forwardfire.vasc.backend.VascBackendFilter"
|
||||
addMethod="addVascBackendFilter" getMethod="getVascBackendFilters"
|
||||
/>
|
||||
/> -->
|
||||
<eld:classBindingHandler id="VascEntryLocal-GlobalVascAction"
|
||||
parentClass="net.forwardfire.vasc.core.VascEntryLocal" childClass="net.forwardfire.vasc.core.actions.GlobalVascAction"
|
||||
addMethod="addGlobalAction" getMethod="getGlobalActionsLocal"
|
||||
|
@ -139,11 +140,5 @@
|
|||
<eld:element tag="stringRegexValidator" objectClass="net.forwardfire.vasc.validators.VascStringRegexValidator"/>
|
||||
<eld:element tag="stringZipCodeValidator" objectClass="net.forwardfire.vasc.validators.VascStringZipCodeValidator"/>
|
||||
|
||||
|
||||
<eld:element tag="virtualVascBackend" objectClass="net.forwardfire.vasc.backend.VirtualVascBackend">
|
||||
<eld:configurator id="virtualVascBackend-VascBackendElementConfigurator" bean.class="net.forwardfire.vasc.impl.x4o.VascBackendElementConfigurator" configAction="true"/>
|
||||
<eld:elementParent tag="root" uri="http://vasc.forwardfire.net/xml/ns/vasc-root"/>
|
||||
</eld:element>
|
||||
|
||||
</eld:namespace>
|
||||
</root:module>
|
|
@ -2,6 +2,7 @@
|
|||
<vasc:root xmlns:vasc="http://vasc.forwardfire.net/xml/ns/vasc-root"
|
||||
xmlns:v="http://vasc.forwardfire.net/xml/ns/vasc-lang"
|
||||
xmlns:mm="http://vasc.forwardfire.net/xml/ns/vasc-backend-metamodel"
|
||||
xmlns:omm="http://vasc.forwardfire.net/xml/ns/vasc-opt-metamodel"
|
||||
xmlns:td="http://vasc.forwardfire.net/xml/ns/vasc-tech-demo"
|
||||
>
|
||||
|
||||
|
@ -40,10 +41,10 @@
|
|||
<mm:jndiDataContext el.id="mmdc5" jndiName="java:mmdc/server/conf/web.xml"/>
|
||||
|
||||
<!-- Auto config schema from MetaModel backends. -->
|
||||
<mm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc1}" entryPrefix="AdminConfServer" />
|
||||
<mm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc2}" entryPrefix="AdminConfLogServer" />
|
||||
<mm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc3}" entryPrefix="AdminConfLogAccess" />
|
||||
<mm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc4}" entryPrefix="AdminConfConfig" />
|
||||
<mm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc5}" entryPrefix="AdminConfWeb" />
|
||||
<omm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc1}" entryPrefix="AdminConfServer" />
|
||||
<omm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc2}" entryPrefix="AdminConfLogServer" />
|
||||
<omm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc3}" entryPrefix="AdminConfLogAccess" />
|
||||
<omm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc4}" entryPrefix="AdminConfConfig" />
|
||||
<omm:schemaAutoEntry vascGroupId="tech-server" dataContextProvider="${mmdc5}" entryPrefix="AdminConfWeb" />
|
||||
|
||||
</vasc:root>
|
|
@ -14,7 +14,7 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-metamodel</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
|
|
@ -103,22 +103,22 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-ldap</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-mongodb</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-metamodel</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-jdbc</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
@ -138,8 +138,13 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.lib</groupId>
|
||||
<artifactId>vasc-lib-editor</artifactId>
|
||||
<groupId>net.forwardfire.vasc.opt</groupId>
|
||||
<artifactId>vasc-opt-editor</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc.opt</groupId>
|
||||
<artifactId>vasc-opt-metamodel</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -45,8 +45,9 @@ import net.forwardfire.vasc.demo.server.tomcat.TomcatService;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 May 3, 2012
|
||||
*/
|
||||
public class VascTechDemoStartup {
|
||||
public enum VascTechDemoStartup {
|
||||
|
||||
INSTANCE;
|
||||
private Logger logger = null;
|
||||
private ServerConfigService serverConfigService = null;
|
||||
private DatabaseService databaseService = null;
|
||||
|
@ -54,16 +55,15 @@ public class VascTechDemoStartup {
|
|||
private VascControllerService vascControllerService = null;
|
||||
private ServerGuiService swingGuiService = null;
|
||||
private VascTechDemoBuildInfo buildInfo = null;
|
||||
static private VascTechDemoStartup instance = null;
|
||||
private volatile boolean shutdownOnce = false;
|
||||
|
||||
/**
|
||||
* Starts this VascTechDemo instance
|
||||
* @param args
|
||||
*/
|
||||
static public void main(String[] args) {
|
||||
instance = new VascTechDemoStartup();
|
||||
instance.initialize(args);
|
||||
instance.startup();
|
||||
INSTANCE.initialize(args);
|
||||
INSTANCE.startup();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -220,10 +220,10 @@ public class VascTechDemoStartup {
|
|||
}
|
||||
|
||||
public void shutdown() {
|
||||
if (instance==null) {
|
||||
if (shutdownOnce) {
|
||||
return;
|
||||
}
|
||||
|
||||
shutdownOnce = true;
|
||||
Thread t = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
|
@ -238,8 +238,6 @@ public class VascTechDemoStartup {
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
} finally {
|
||||
instance = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -248,7 +246,7 @@ public class VascTechDemoStartup {
|
|||
}
|
||||
|
||||
static public VascTechDemoStartup getInstance() {
|
||||
return instance;
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public boolean isMavenRun() {
|
||||
|
|
|
@ -105,7 +105,7 @@ public class VascControllerService {
|
|||
VascDriver driver = VascDriver.getInstance();
|
||||
X4OReader<VascController> reader = driver.createReader();
|
||||
driver.addVascController(reader, vascController);
|
||||
reader.readResource("net/forwardfire/vasc/lib/editor/vasc-edit.xml");
|
||||
reader.readResource("net/forwardfire/vasc/opt/editor/vasc-editor.xml");
|
||||
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
|
||||
vascController.getVascEventChannelController().fireEvent(VascEventControllerType.LOAD_ENTRIES_AFTER, vascController);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import javax.swing.JLabel;
|
|||
import javax.swing.JPanel;
|
||||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextCsv;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.opt.metamodel.MetaModelSchemaAutoEntry;
|
||||
|
||||
/**
|
||||
* JDialogMetaCsv Add and runs MetaModel Schema Auto Entry code.
|
||||
|
|
|
@ -24,7 +24,6 @@ package net.forwardfire.vasc.demo.server.ui.load;
|
|||
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextJdbc;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelDataContextMongodb;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelSchemaAutoEntry;
|
||||
import net.forwardfire.vasc.backend.metamodel.MetaModelVascBackend;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
|
@ -33,6 +32,7 @@ import net.forwardfire.vasc.core.VascEntryFieldType;
|
|||
import net.forwardfire.vasc.core.VascEntryLink;
|
||||
import net.forwardfire.vasc.core.VascEntryLinkType;
|
||||
import net.forwardfire.vasc.impl.ui.VascSelectItemModelEntry;
|
||||
import net.forwardfire.vasc.opt.metamodel.MetaModelSchemaAutoEntry;
|
||||
|
||||
import org.x4o.xml.io.sax.ext.ContentWriterXml;
|
||||
import org.xml.sax.SAXException;
|
||||
|
@ -68,7 +68,6 @@ public class LoadVascXmlWriter {
|
|||
autoEntry.setEntryPrefix(model.name);
|
||||
autoEntry.setDataContextProvider(model.dcProvider);
|
||||
autoEntry.getTables().addAll(model.tables);
|
||||
|
||||
autoEntry.autoFillResult(vc);
|
||||
|
||||
xmlWriter.startDocument();
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-metamodel</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.io.OutputStream;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||
|
@ -67,7 +68,11 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
|
|||
for (int dataIndex=0;dataIndex<dataSize;dataIndex++) {
|
||||
Object o = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(dataIndex);
|
||||
doExportRowStart(o);
|
||||
doExportRowFields(o);
|
||||
try {
|
||||
doExportRowFields(o);
|
||||
} catch (VascBackendException e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
doExportRowEnd(o,(dataIndex==dataSize-1));
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +99,7 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
|
|||
abstract protected void doExportRowStart(Object row) throws IOException;
|
||||
abstract protected void doExportRowEnd(Object row,boolean isLast) throws IOException;
|
||||
|
||||
protected void doExportRowFields(Object row) throws IOException,VascException {
|
||||
protected void doExportRowFields(Object row) throws IOException,VascBackendException {
|
||||
// todo: rm me and use data selector
|
||||
List<VascEntryField> fieldList = new ArrayList<VascEntryField>(getVascEntry().getVascEntryFields());
|
||||
int fields = fieldList.size();
|
||||
|
@ -104,5 +109,5 @@ abstract public class AbstractVascEntryExportWriter implements VascEntryExportWr
|
|||
}
|
||||
}
|
||||
|
||||
abstract protected void doExportRowField(Object row,VascEntryField field,boolean isLast) throws IOException,VascException;
|
||||
abstract protected void doExportRowField(Object row,VascEntryField field,boolean isLast) throws IOException,VascBackendException;
|
||||
}
|
|
@ -25,8 +25,8 @@ package net.forwardfire.vasc.export.generic;
|
|||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* VascEntryExporterCsv writes data to csv output format.
|
||||
|
@ -132,9 +132,9 @@ public class VascEntryExportWriterCsv extends AbstractVascEntryExportWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascException {
|
||||
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascBackendException {
|
||||
p.write(quoteChar.toCharType());
|
||||
p.write(c.getVascEntryFieldValue().getDisplayValue(c, o));
|
||||
p.write(c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
|
||||
p.write(quoteChar.toCharType());
|
||||
if (isLast==false) {
|
||||
p.write(separatorChar.toCharType());
|
||||
|
|
|
@ -25,8 +25,8 @@ package net.forwardfire.vasc.export.generic;
|
|||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
/**
|
||||
* VascEntryExportWriterXml writes entry data to xml format.
|
||||
|
@ -74,14 +74,14 @@ public class VascEntryExportWriterXml extends AbstractVascEntryExportWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascException {
|
||||
protected void doExportRowField(Object o, VascEntryField c,boolean isLast) throws VascBackendException {
|
||||
if (xmlTree) {
|
||||
p.write("\t\t<"+c.getId()+"><![CDATA[");
|
||||
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
|
||||
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
|
||||
p.write("]]></"+c.getId()+">\n");
|
||||
} else {
|
||||
p.write("\t\t<column name=\""+c.getId()+"\"><![CDATA[");
|
||||
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c, o));
|
||||
p.write(""+c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
|
||||
p.write("]]></column>\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendDataSelector.EntryFieldSelectType;
|
||||
import net.forwardfire.vasc.lib.jr4o.data.AbstractJRDynamicDataSource;
|
||||
import net.sf.jasperreports.engine.JRException;
|
||||
|
@ -75,13 +75,13 @@ public class JRDynamicDataSourceVascEntry extends AbstractJRDynamicDataSource {
|
|||
for (Object o:vascEntry.getVascFrontendController().getVascEntryState().getEntryDataList()) {
|
||||
List<String> row = new ArrayList<String>(30);
|
||||
for (VascEntryField c:fields) {
|
||||
row.add(c.getVascEntryFieldValue().getDisplayValue(c, o));
|
||||
row.add(c.getVascEntryFieldValue().getDisplayValue(c.getBackendName(), o));
|
||||
}
|
||||
data.add(row);
|
||||
}
|
||||
}
|
||||
} catch (VascException ve) {
|
||||
throw new RuntimeException(ve);
|
||||
} catch (VascBackendException ve) {
|
||||
throw new RuntimeException(ve); // TODO: replace me
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ import java.util.Map;
|
|||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JSONValue;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.export.generic.AbstractVascEntryExportWriter;
|
||||
|
||||
/**
|
||||
|
@ -107,9 +107,9 @@ public class VascEntryExportWriterJson extends AbstractVascEntryExportWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExportRowField(Object row, VascEntryField field,boolean isLast) throws VascException {
|
||||
protected void doExportRowField(Object row, VascEntryField field,boolean isLast) throws VascBackendException {
|
||||
String key = field.getId();
|
||||
Object data = field.getVascEntryFieldValue().getValue(field, row);
|
||||
Object data = field.getVascEntryFieldValue().getValue(field.getBackendName(), row);
|
||||
rowData.put(key, data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,11 +34,11 @@ import javax.swing.JPanel;
|
|||
import javax.swing.JTextField;
|
||||
import javax.swing.ListCellRenderer;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendException;
|
||||
|
||||
/**
|
||||
|
@ -162,10 +162,10 @@ public class SwingActionPanel extends JPanel implements VascEntryFrontendEventLi
|
|||
|
||||
init = true;
|
||||
|
||||
long pageSize = entry.getVascFrontendController().getVascFrontendPager().getPageSize();
|
||||
long pageStart = entry.getVascFrontendController().getVascFrontendPager().getPageStartCount();
|
||||
long pageStop = entry.getVascFrontendController().getVascFrontendPager().getPageStopCount();
|
||||
long pageTotalCount = entry.getVascFrontendController().getVascFrontendPager().getPageTotalRecordCount();
|
||||
long pageSize = entry.getVascFrontendController().getVascFrontendPageInfo().getPageSize();
|
||||
long pageStart = entry.getVascFrontendController().getVascFrontendPageInfo().getPageStartCount();
|
||||
long pageStop = entry.getVascFrontendController().getVascFrontendPageInfo().getPageStopCount();
|
||||
long pageTotalCount = entry.getVascFrontendController().getVascFrontendPageInfo().getPageTotalRecordCount();
|
||||
String format = "Results %1$d-%2$d from %3$d rows";
|
||||
resultLabel.setText(String.format(format, pageStart, pageStop, pageTotalCount));
|
||||
rowNumberField.setText(""+pageSize);
|
||||
|
@ -173,9 +173,9 @@ public class SwingActionPanel extends JPanel implements VascEntryFrontendEventLi
|
|||
gotoDirectPage.removeAllItems();
|
||||
gotoDirectPage.addItem("Goto...");
|
||||
|
||||
List<VascBackendPageNumber> pages = vascEntry.getVascFrontendController().getVascFrontendPager().getTablePagesFromBackend();
|
||||
List<VascFrontendPageInfoNumber> pages = vascEntry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesFromBackend();
|
||||
int i=0;
|
||||
for (VascBackendPageNumber page:pages) {
|
||||
for (VascFrontendPageInfoNumber page:pages) {
|
||||
//pages.setRowIndex(i);
|
||||
//VascBackendPageNumber page = (VascBackendPageNumber)getTablePagesDataModel().getRowData();
|
||||
// = new SelectItem();
|
||||
|
|
|
@ -31,9 +31,9 @@ import javax.swing.JButton;
|
|||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber;
|
||||
|
||||
/**
|
||||
* SwingPagerPanel renders dynamic pager for swing.
|
||||
|
@ -70,11 +70,11 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis
|
|||
public void actionPerformed(ActionEvent e) {
|
||||
int pageIndex = vascEntry.getVascFrontendController().getVascEntryState().getVascBackendState().getPageIndex();
|
||||
if (next) {
|
||||
if (vascEntry.getVascFrontendController().getVascFrontendPager().getHasPageNextAction()) {
|
||||
if (vascEntry.getVascFrontendController().getVascFrontendPageInfo().getHasPageNextAction()) {
|
||||
vascEntry.getVascFrontendController().getVascFrontendActions().pageAction(pageIndex+1);
|
||||
}
|
||||
} else {
|
||||
if (vascEntry.getVascFrontendController().getVascFrontendPager().getHasPagePreviousAction()) {
|
||||
if (vascEntry.getVascFrontendController().getVascFrontendPageInfo().getHasPagePreviousAction()) {
|
||||
vascEntry.getVascFrontendController().getVascFrontendActions().pageAction(pageIndex-1);
|
||||
}
|
||||
}
|
||||
|
@ -91,13 +91,13 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis
|
|||
result.removeAll();
|
||||
|
||||
|
||||
if (entry.getVascFrontendController().getVascFrontendPager().getHasExtendedPageMode()) {
|
||||
if (entry.getVascFrontendController().getVascFrontendPageInfo().getHasExtendedPageMode()) {
|
||||
JButton prev = new JButton("Previous");
|
||||
prev.addActionListener(new NextAction(false));
|
||||
prev.setEnabled(entry.getVascFrontendController().getVascFrontendPager().getHasPagePreviousAction());
|
||||
prev.setEnabled(entry.getVascFrontendController().getVascFrontendPageInfo().getHasPagePreviousAction());
|
||||
result.add(prev);
|
||||
List<VascBackendPageNumber> pages = entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedBegin();
|
||||
for(VascBackendPageNumber page:pages) {
|
||||
List<VascFrontendPageInfoNumber> pages = entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedBegin();
|
||||
for(VascFrontendPageInfoNumber page:pages) {
|
||||
JButton but = new JButton(""+page.getPageNumber());
|
||||
but.addActionListener(this);
|
||||
if (page.getSelected()!=null && page.getSelected()) {
|
||||
|
@ -106,9 +106,9 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis
|
|||
result.add(but);
|
||||
}
|
||||
result.add(new JLabel("..."));
|
||||
if (entry.getVascFrontendController().getVascFrontendPager().getHasExtendedPageModeCenter()) {
|
||||
pages = entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedCenter();
|
||||
for(VascBackendPageNumber page:pages) {
|
||||
if (entry.getVascFrontendController().getVascFrontendPageInfo().getHasExtendedPageModeCenter()) {
|
||||
pages = entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedCenter();
|
||||
for(VascFrontendPageInfoNumber page:pages) {
|
||||
JButton but = new JButton(""+page.getPageNumber());
|
||||
but.addActionListener(this);
|
||||
if (page.getSelected()!=null && page.getSelected()) {
|
||||
|
@ -118,8 +118,8 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis
|
|||
}
|
||||
result.add(new JLabel("..."));
|
||||
}
|
||||
pages = entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedEnd();
|
||||
for(VascBackendPageNumber page:pages) {
|
||||
pages = entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedEnd();
|
||||
for(VascFrontendPageInfoNumber page:pages) {
|
||||
JButton but = new JButton(""+page.getPageNumber());
|
||||
but.addActionListener(this);
|
||||
if (page.getSelected()!=null && page.getSelected()) {
|
||||
|
@ -128,16 +128,16 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis
|
|||
result.add(but);
|
||||
}
|
||||
JButton next = new JButton("Next");
|
||||
next.setEnabled(entry.getVascFrontendController().getVascFrontendPager().getHasPageNextAction());
|
||||
next.setEnabled(entry.getVascFrontendController().getVascFrontendPageInfo().getHasPageNextAction());
|
||||
next.addActionListener(new NextAction(true));
|
||||
result.add(next);
|
||||
} else {
|
||||
JButton prev = new JButton("Previous");
|
||||
prev.addActionListener(new NextAction(false));
|
||||
prev.setEnabled(entry.getVascFrontendController().getVascFrontendPager().getHasPagePreviousAction());
|
||||
prev.setEnabled(entry.getVascFrontendController().getVascFrontendPageInfo().getHasPagePreviousAction());
|
||||
result.add(prev);
|
||||
List<VascBackendPageNumber> pages = entry.getVascFrontendController().getVascFrontendPager().getTablePagesNormal();
|
||||
for(VascBackendPageNumber page:pages) {
|
||||
List<VascFrontendPageInfoNumber> pages = entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesNormal();
|
||||
for(VascFrontendPageInfoNumber page:pages) {
|
||||
JButton but = new JButton(""+page.getPageNumber());
|
||||
but.addActionListener(this);
|
||||
if (page.getSelected()!=null && page.getSelected()) {
|
||||
|
@ -146,7 +146,7 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis
|
|||
result.add(but);
|
||||
}
|
||||
JButton next = new JButton("Next");
|
||||
next.setEnabled(entry.getVascFrontendController().getVascFrontendPager().getHasPageNextAction());
|
||||
next.setEnabled(entry.getVascFrontendController().getVascFrontendPageInfo().getHasPageNextAction());
|
||||
next.addActionListener(new NextAction(true));
|
||||
result.add(next);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import javax.swing.JLabel;
|
|||
import javax.swing.JPanel;
|
||||
import javax.swing.SpringLayout;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
|
@ -115,7 +116,7 @@ public class SwingVascEditDialog extends JPanel {
|
|||
//System.out.println("Could not get VascEntryFieldValue for fieldID: "+fieldId);
|
||||
continue;
|
||||
}
|
||||
Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
|
||||
Object selectedValue = v.getVascEntryFieldValue().getValue(v.getBackendName(), selected);
|
||||
|
||||
// set data parameter on new vasc entry
|
||||
ee.getVascFrontendController().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue);
|
||||
|
@ -127,7 +128,7 @@ public class SwingVascEditDialog extends JPanel {
|
|||
Object selectedValue = selected;
|
||||
if (selectedfieldId!=null) {
|
||||
VascEntryField v = ee.getVascEntryFieldById(selectedfieldId);
|
||||
selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
|
||||
selectedValue = v.getVascEntryFieldValue().getValue(v.getBackendName(), selected);
|
||||
}
|
||||
|
||||
// create listener for new objects
|
||||
|
@ -172,7 +173,11 @@ public class SwingVascEditDialog extends JPanel {
|
|||
|
||||
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
|
||||
model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c));
|
||||
model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
|
||||
try {
|
||||
model.setValue(c.getVascEntryFieldValue().getValue(c.getBackendName(), bean));
|
||||
} catch (VascBackendException e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
Object g = editor.createComponent(entry,c,model,body);
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ import javax.swing.table.TableCellRenderer;
|
|||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryListOption;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
|
@ -71,7 +72,6 @@ import net.forwardfire.vasc.core.ui.VascOptionValueModelListener;
|
|||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
import net.forwardfire.vasc.core.ui.VascValueModel;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
|
||||
import net.forwardfire.vasc.frontend.AbstractVascFrontend;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendController;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendException;
|
||||
|
@ -161,7 +161,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
if (entry.getDisplayNameFieldId()!=null) {
|
||||
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
|
||||
|
||||
Object vv = v.getVascEntryFieldValue().getValue(v, rowBean);
|
||||
Object vv = v.getVascEntryFieldValue().getValue(v.getBackendName(), rowBean);
|
||||
if (vv==null) {
|
||||
beanValue="";
|
||||
} else {
|
||||
|
@ -177,7 +177,9 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
|
||||
entry.getVascFrontendController().getVascFrontendHelper().editReadOnlyUIComponents(entry);
|
||||
panels.openVascView(editPanel,entry);
|
||||
|
||||
|
||||
} catch (VascBackendException ve) {
|
||||
throw new VascFrontendException(ve);
|
||||
} catch (VascException ve) {
|
||||
throw new VascFrontendException(ve);
|
||||
}
|
||||
|
@ -189,11 +191,11 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
|
||||
try {
|
||||
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
|
||||
beanValue = ""+v.getVascEntryFieldValue().getValue(v, rowBean);
|
||||
beanValue = ""+v.getVascEntryFieldValue().getValue(v.getBackendName(), rowBean);
|
||||
if (beanValue.length()>30) {
|
||||
beanValue=beanValue.substring(0, 30);
|
||||
}
|
||||
} catch (VascException ve) {
|
||||
} catch (VascBackendException ve) {
|
||||
throw new VascFrontendException(ve);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ public class SwingVascTableModel extends AbstractTableModel implements VascEntry
|
|||
//if (vtc.getVascColumnRenderer()!=null) {
|
||||
// return vtc.getVascColumnRenderer().rendererColumn(vtc,bean);
|
||||
//} else {
|
||||
return ""+vtc.getVascEntryFieldValue().getValue(vtc,bean);
|
||||
return ""+vtc.getVascEntryFieldValue().getValue(vtc.getBackendName(),bean);
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
return "Error";
|
||||
|
|
|
@ -24,11 +24,11 @@ package net.forwardfire.vasc.frontend.swt;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.ui.VascSelectItem;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
|
@ -128,10 +128,10 @@ public class SwtActionPanel implements VascEntryFrontendEventListener {
|
|||
public void vascEvent(VascEntry entry,Object dataNotUsed) {
|
||||
vascEvent = true;
|
||||
|
||||
long pageSize = entry.getVascFrontendController().getVascFrontendPager().getPageSize();
|
||||
long pageStart = entry.getVascFrontendController().getVascFrontendPager().getPageStartCount();
|
||||
long pageStop = entry.getVascFrontendController().getVascFrontendPager().getPageStopCount();
|
||||
long pageTotalCount = entry.getVascFrontendController().getVascFrontendPager().getPageTotalRecordCount();
|
||||
long pageSize = entry.getVascFrontendController().getVascFrontendPageInfo().getPageSize();
|
||||
long pageStart = entry.getVascFrontendController().getVascFrontendPageInfo().getPageStartCount();
|
||||
long pageStop = entry.getVascFrontendController().getVascFrontendPageInfo().getPageStopCount();
|
||||
long pageTotalCount = entry.getVascFrontendController().getVascFrontendPageInfo().getPageTotalRecordCount();
|
||||
String format = "Results %1$d-%2$d from %3$d rows";
|
||||
resultLabel.setText(String.format(format, pageStart, pageStop, pageTotalCount));
|
||||
resultLabel.redraw();
|
||||
|
@ -140,9 +140,9 @@ public class SwtActionPanel implements VascEntryFrontendEventListener {
|
|||
|
||||
pageBox.removeAll();
|
||||
pageBox.add("Goto...");
|
||||
List<VascBackendPageNumber> pages = entry.getVascFrontendController().getVascFrontendPager().getTablePagesFromBackend();
|
||||
List<VascFrontendPageInfoNumber> pages = entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesFromBackend();
|
||||
int i=0;
|
||||
for (VascBackendPageNumber page:pages) {
|
||||
for (VascFrontendPageInfoNumber page:pages) {
|
||||
pageBox.add("page: "+page.getPageNumber()+" "+(i*pageSize)+"-"+((i*pageSize)+pageSize));
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -24,11 +24,11 @@ package net.forwardfire.vasc.frontend.swt;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFrontendEventListener.VascFrontendEventType;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
package net.forwardfire.vasc.frontend.swt;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.ui.VascColumnValueModelListener;
|
||||
|
@ -125,8 +126,8 @@ public class SwtVascEditDialog extends Dialog {
|
|||
String name = null;
|
||||
try {
|
||||
Object bean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
name = dis.getVascEntryFieldValue().getDisplayValue(dis, bean);
|
||||
} catch (VascException e) {
|
||||
name = dis.getVascEntryFieldValue().getDisplayValue(dis.getBackendName(), bean);
|
||||
} catch (VascBackendException e) {
|
||||
throw new RuntimeException("Could not display value from "+entry.getId(),e);
|
||||
}
|
||||
|
||||
|
@ -174,7 +175,11 @@ public class SwtVascEditDialog extends Dialog {
|
|||
|
||||
VascUIComponent editor = c.getVascEntryFieldType().provideEditorUIComponent(i,c);
|
||||
model = new VascValueModel(c.getVascEntryFieldType().provideEditorVascValueModel(i,c));
|
||||
model.setValue(c.getVascEntryFieldValue().getValue(c, bean));
|
||||
try {
|
||||
model.setValue(c.getVascEntryFieldValue().getValue(c.getBackendName(), bean));
|
||||
} catch (VascBackendException e) {
|
||||
throw new VascException(e);
|
||||
}
|
||||
model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
Control edit = (Control )editor.createComponent(entry,c,model,body);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.io.OutputStream;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryListOption;
|
||||
|
@ -636,7 +637,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
|
||||
//if (vtc.getVascColumnRenderer()==null) {
|
||||
try {
|
||||
return vtc.getVascEntryFieldValue().getDisplayValue(vtc,bean);
|
||||
return vtc.getVascEntryFieldValue().getDisplayValue(vtc.getBackendName(),bean);
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.WARNING,"Error in get value: '"+vtc.getVascEntryFieldValue()+"' error: "+e.getMessage(),e);
|
||||
return "Err";
|
||||
|
|
|
@ -90,6 +90,6 @@ public class JSFVascEntryEventListener implements VascEntryFrontendEventListener
|
|||
ValueExpression ve2 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".tableDataModel.wrappedData}", Object.class);
|
||||
ve2.setValue(FacesContext.getCurrentInstance().getELContext(), result);
|
||||
ValueExpression ve3 = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{"+entrySupportVar+".tablePagesDataModel.wrappedData}", Object.class);
|
||||
ve3.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendController().getVascFrontendPager().getTablePagesFromBackend());
|
||||
ve3.setValue(FacesContext.getCurrentInstance().getELContext(), entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesFromBackend());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ import javax.servlet.ServletOutputStream;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendPageNumber;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascEntryState;
|
||||
|
@ -60,6 +59,7 @@ import net.forwardfire.vasc.core.actions.GlobalVascAction;
|
|||
import net.forwardfire.vasc.core.actions.RowVascAction;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExport;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryExportWriter;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendPageInfoNumber;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendException;
|
||||
import net.forwardfire.vasc.impl.actions.AddRowAction;
|
||||
import net.forwardfire.vasc.impl.actions.DeleteRowAction;
|
||||
|
@ -198,14 +198,14 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
|
||||
|
||||
public long getPageTotalRecordCount() {
|
||||
return entry.getVascFrontendController().getVascFrontendPager().getPageTotalRecordCount();
|
||||
return entry.getVascFrontendController().getVascFrontendPageInfo().getPageTotalRecordCount();
|
||||
}
|
||||
|
||||
public long getPageStartCount() {
|
||||
return entry.getVascFrontendController().getVascFrontendPager().getPageStartCount();
|
||||
return entry.getVascFrontendController().getVascFrontendPageInfo().getPageStartCount();
|
||||
}
|
||||
public long getPageStopCount() {
|
||||
return entry.getVascFrontendController().getVascFrontendPager().getPageStopCount();
|
||||
return entry.getVascFrontendController().getVascFrontendPageInfo().getPageStopCount();
|
||||
}
|
||||
|
||||
public List<SelectItem> getGlobalExportItems() {
|
||||
|
@ -237,7 +237,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
int pageSize = getVascEntry().getVascFrontendController().getVascEntryState().getVascBackendState().getPageSize();
|
||||
for (int i=0;i<getTablePagesDataModel().getRowCount();i++) {
|
||||
getTablePagesDataModel().setRowIndex(i);
|
||||
VascBackendPageNumber page = (VascBackendPageNumber)getTablePagesDataModel().getRowData();
|
||||
VascFrontendPageInfoNumber page = (VascFrontendPageInfoNumber)getTablePagesDataModel().getRowData();
|
||||
s = new SelectItem();
|
||||
String name = i18nMap.get("generic.vasc.jsf.table.page.name");
|
||||
String description = i18nMap.get("generic.vasc.jsf.table.page.description");
|
||||
|
@ -251,27 +251,27 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
}
|
||||
|
||||
public boolean getHasOnlySinglePage() {
|
||||
return entry.getVascFrontendController().getVascFrontendPager().getHasOnlySinglePage();
|
||||
return entry.getVascFrontendController().getVascFrontendPageInfo().getHasOnlySinglePage();
|
||||
}
|
||||
|
||||
public boolean getHasExtendedPageMode() {
|
||||
return entry.getVascFrontendController().getVascFrontendPager().getHasExtendedPageMode();
|
||||
return entry.getVascFrontendController().getVascFrontendPageInfo().getHasExtendedPageMode();
|
||||
}
|
||||
|
||||
public boolean getHasExtendedPageModeCenter() {
|
||||
return entry.getVascFrontendController().getVascFrontendPager().getHasExtendedPageModeCenter();
|
||||
return entry.getVascFrontendController().getVascFrontendPageInfo().getHasExtendedPageModeCenter();
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedBegin() {
|
||||
return entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedBegin();
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesExtendedBegin() {
|
||||
return entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedBegin();
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedEnd() {
|
||||
return entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedEnd();
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesExtendedEnd() {
|
||||
return entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedEnd();
|
||||
}
|
||||
|
||||
public List<VascBackendPageNumber> getTablePagesExtendedCenter() {
|
||||
return entry.getVascFrontendController().getVascFrontendPager().getTablePagesExtendedCenter();
|
||||
public List<VascFrontendPageInfoNumber> getTablePagesExtendedCenter() {
|
||||
return entry.getVascFrontendController().getVascFrontendPageInfo().getTablePagesExtendedCenter();
|
||||
}
|
||||
|
||||
private String getComponentType(UIComponent comp) {
|
||||
|
@ -507,11 +507,11 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
}
|
||||
|
||||
public boolean getHasPageNextAction() {
|
||||
return entry.getVascFrontendController().getVascFrontendPager().getHasPageNextAction();
|
||||
return entry.getVascFrontendController().getVascFrontendPageInfo().getHasPageNextAction();
|
||||
}
|
||||
|
||||
public boolean getHasPagePreviousAction() {
|
||||
return entry.getVascFrontendController().getVascFrontendPager().getHasPagePreviousAction();
|
||||
return entry.getVascFrontendController().getVascFrontendPageInfo().getHasPagePreviousAction();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import javax.faces.component.UIComponent;
|
|||
import javax.faces.component.UIComponentBase;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascController;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
|
@ -349,7 +350,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
logger.warning("Could not get VascEntryFieldValue for fieldID: "+fieldId);
|
||||
continue;
|
||||
}
|
||||
Object selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
|
||||
Object selectedValue = v.getVascEntryFieldValue().getValue(v.getBackendName(), selected);
|
||||
|
||||
// set data parameter on new vasc entry
|
||||
//was; entry.getVascFrontendController().getVascEntryState().getVascBackendState().setDataParameter(parameterName, selectedValue);
|
||||
|
@ -362,7 +363,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
Object selectedValue = selected;
|
||||
if (selectedfieldId!=null) {
|
||||
VascEntryField v = getVascEntry().getVascEntryFieldById(selectedfieldId);
|
||||
selectedValue = v.getVascEntryFieldValue().getValue(v, selected);
|
||||
selectedValue = v.getVascEntryFieldValue().getValue(v.getBackendName(), selected);
|
||||
}
|
||||
|
||||
// create listener for new objects
|
||||
|
@ -398,8 +399,8 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
public void vascEvent(VascEntry entry,Object data) {
|
||||
VascEntryField field = entry.getVascEntryFieldById(fieldId);
|
||||
try {
|
||||
field.getVascEntryFieldValue().setValue(field, data, value);
|
||||
} catch (VascException e) {
|
||||
field.getVascEntryFieldValue().setValue(field.getBackendName(), data, value);
|
||||
} catch (VascBackendException e) {
|
||||
throw new VascFrontendException(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,9 +25,10 @@ package net.forwardfire.vasc.frontend.web.jsf;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.entry.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendDataSelector.EntryFieldSelectType;
|
||||
|
||||
|
@ -83,10 +84,10 @@ public class VascDataBackendBean implements Serializable {
|
|||
VascEntryField field = getFieldIdByIndex(entry,index);
|
||||
VascEntryFieldValue value = field.getVascEntryFieldValue();
|
||||
if (isRealValue()) {
|
||||
return value.getValue(field, record);
|
||||
return value.getValue(field.getBackendName(), record);
|
||||
}
|
||||
return value.getDisplayValue(field, record);
|
||||
} catch (VascException e) {
|
||||
return value.getDisplayValue(field.getBackendName(), record);
|
||||
} catch (Exception e) {
|
||||
return "Error: "+e.getMessage();
|
||||
}
|
||||
}
|
||||
|
@ -95,8 +96,8 @@ public class VascDataBackendBean implements Serializable {
|
|||
try {
|
||||
VascEntryField field = getFieldIdByIndex(entry,index);
|
||||
VascEntryFieldValue value = field.getVascEntryFieldValue();
|
||||
value.setValue(field, record,valueObject);
|
||||
} catch (VascException e) {
|
||||
value.setValue(field.getBackendName(), record,valueObject);
|
||||
} catch (VascBackendException e) {
|
||||
throw new RuntimeException("Could not set value on record.",e);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue