Removed old total fetch method.
This commit is contained in:
parent
5bbd8e4ef3
commit
e14b484ca5
|
@ -23,9 +23,10 @@
|
|||
package net.forwardfire.vasc.backend;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* AbstractVascBackend.
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 2, 2007
|
||||
|
@ -59,14 +60,14 @@ abstract public class AbstractVascBackend<DATA_OBJECT extends Serializable> impl
|
|||
@Override
|
||||
public void startBackend() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#stopBackend()
|
||||
*/
|
||||
@Override
|
||||
public void stopBackend() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#isReadOnly()
|
||||
*/
|
||||
|
@ -74,7 +75,7 @@ abstract public class AbstractVascBackend<DATA_OBJECT extends Serializable> impl
|
|||
public boolean isReadOnly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#isPageable()
|
||||
*/
|
||||
|
@ -83,14 +84,6 @@ abstract public class AbstractVascBackend<DATA_OBJECT extends Serializable> impl
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#fetchTotalExecuteSize(VascBackendState state)
|
||||
*/
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#isSearchable()
|
||||
*/
|
||||
|
@ -122,7 +115,7 @@ abstract public class AbstractVascBackend<DATA_OBJECT extends Serializable> impl
|
|||
public long doRecordMoveDownById(VascBackendState state,Object primaryId) throws VascBackendException {
|
||||
return 0l;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#doRecordMoveUpById(java.lang.Object)
|
||||
*/
|
||||
|
@ -130,23 +123,7 @@ abstract public class AbstractVascBackend<DATA_OBJECT extends Serializable> impl
|
|||
public long doRecordMoveUpById(VascBackendState state,Object primaryId) throws VascBackendException {
|
||||
return 0l;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#executePageSummary()
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> executePageSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#executeTotalSummary()
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> executeTotalSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#hasPageSummary()
|
||||
*/
|
||||
|
@ -154,7 +131,7 @@ abstract public class AbstractVascBackend<DATA_OBJECT extends Serializable> impl
|
|||
public boolean hasPageSummary() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#hasTotalSummary()
|
||||
*/
|
||||
|
|
|
@ -35,7 +35,11 @@ import java.util.Map;
|
|||
public final class DefaultVascBackendResult<DATA_OBJECT extends Serializable> extends AbstractVascBackendResult<DATA_OBJECT> {
|
||||
|
||||
public DefaultVascBackendResult(List<DATA_OBJECT> pageData) {
|
||||
this(pageData,-1,null,null);
|
||||
this(pageData,-1);
|
||||
}
|
||||
|
||||
public DefaultVascBackendResult(List<DATA_OBJECT> pageData,long totalSize) {
|
||||
this(pageData,totalSize,null,null);
|
||||
}
|
||||
|
||||
public DefaultVascBackendResult(List<DATA_OBJECT> pageData, long totalSize,
|
||||
|
|
|
@ -77,12 +77,6 @@ public interface VascBackend<DATA_OBJECT extends Serializable> {
|
|||
* @return
|
||||
*/
|
||||
public boolean isPageable();
|
||||
|
||||
/**
|
||||
* Returns the total amount of records.
|
||||
* @return
|
||||
*/
|
||||
public long fetchTotalExecuteSize(VascBackendState state);
|
||||
|
||||
/**
|
||||
* Defines if the backend supports pageing
|
||||
|
@ -100,8 +94,6 @@ public interface VascBackend<DATA_OBJECT extends Serializable> {
|
|||
|
||||
|
||||
public boolean hasPageSummary();
|
||||
public Map<String,Object> executePageSummary();
|
||||
|
||||
public boolean hasTotalSummary();
|
||||
public Map<String,Object> executeTotalSummary();
|
||||
}
|
||||
|
|
|
@ -75,11 +75,13 @@ public class XpqlHibernateVascBackend<DATA_OBJECT extends Serializable> extends
|
|||
Session getHibernateSession() {
|
||||
return hibernateSessionProvider.getHibernateSession();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@Override
|
||||
public VascBackendResult<DATA_OBJECT> execute(VascBackendState state) throws VascBackendException {
|
||||
|
||||
return new DefaultVascBackendResult<DATA_OBJECT>(executeList(state),fetchTotalExecuteSize(state));
|
||||
}
|
||||
|
||||
private List<DATA_OBJECT> executeList(VascBackendState state) throws VascBackendException {
|
||||
// Copy parameters
|
||||
for (String key:state.getDataParameterKeys()) {
|
||||
Object value = state.getDataParameter(key);
|
||||
|
@ -111,7 +113,7 @@ public class XpqlHibernateVascBackend<DATA_OBJECT extends Serializable> extends
|
|||
List<DATA_OBJECT> data = q.list();
|
||||
s.getTransaction().commit();
|
||||
|
||||
return new DefaultVascBackendResult<DATA_OBJECT>(data);
|
||||
return data;
|
||||
} finally {
|
||||
if (s!=null) {
|
||||
//em.close();
|
||||
|
@ -202,12 +204,8 @@ public class XpqlHibernateVascBackend<DATA_OBJECT extends Serializable> extends
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#fetchTotalExecuteSize(VascBackendState state)
|
||||
*/
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
|
||||
private long fetchTotalExecuteSize(VascBackendState state) {
|
||||
Session s = getHibernateSession();
|
||||
try {
|
||||
s.getTransaction().begin();
|
||||
|
|
|
@ -76,9 +76,13 @@ public class XpqlPersistanceVascBackend<DATA_OBJECT extends Serializable> extend
|
|||
return entityManagerProvider.getEntityManager();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public VascBackendResult<DATA_OBJECT> execute(VascBackendState state) throws VascBackendException {
|
||||
return new DefaultVascBackendResult<DATA_OBJECT>(executeList(state),fetchTotalExecuteSize(state));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<DATA_OBJECT> executeList(VascBackendState state) throws VascBackendException {
|
||||
|
||||
// Copy parameters
|
||||
for (String key:state.getDataParameterKeys()) {
|
||||
|
@ -112,8 +116,7 @@ public class XpqlPersistanceVascBackend<DATA_OBJECT extends Serializable> extend
|
|||
if (emTransaction) {
|
||||
em.getTransaction().commit();
|
||||
}
|
||||
VascBackendResult<DATA_OBJECT> result = new DefaultVascBackendResult<DATA_OBJECT>(data);
|
||||
return result;
|
||||
return data;
|
||||
} finally {
|
||||
if (em!=null) {
|
||||
//em.close();
|
||||
|
@ -205,12 +208,8 @@ public class XpqlPersistanceVascBackend<DATA_OBJECT extends Serializable> extend
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#fetchTotalExecuteSize(VascBackendState state)
|
||||
*/
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
|
||||
private long fetchTotalExecuteSize(VascBackendState state) {
|
||||
EntityManager em = getEntityManager();
|
||||
try {
|
||||
Query q = em.createQuery(queryTotal.toPreparedSQL(queryTotal));
|
||||
|
|
|
@ -140,12 +140,8 @@ public class MetaModelVascBackend extends AbstractVascBackend<Row> {
|
|||
public boolean isSortable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.AbstractVascBackend#fetchTotalExecuteSize(net.forwardfire.vasc.backend.VascBackendState)
|
||||
*/
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
|
||||
private long fetchTotalExecuteSize(VascBackendState state) {
|
||||
Schema schema = dataContext.getDefaultSchema();
|
||||
Table t = schema.getTableByName(table);
|
||||
Query q = createFilterQuery(state,t,true);
|
||||
|
@ -213,6 +209,10 @@ public class MetaModelVascBackend extends AbstractVascBackend<Row> {
|
|||
|
||||
@Override
|
||||
public VascBackendResult<Row> execute(VascBackendState state) throws VascBackendException {
|
||||
return new DefaultVascBackendResult<Row>(executeList(state),fetchTotalExecuteSize(state));
|
||||
}
|
||||
|
||||
private List<Row> executeList(VascBackendState state) throws VascBackendException {
|
||||
Schema schema = dataContext.getDefaultSchema();
|
||||
Table t = schema.getTableByName(table);
|
||||
if (t==null) {
|
||||
|
@ -243,7 +243,7 @@ public class MetaModelVascBackend extends AbstractVascBackend<Row> {
|
|||
DataSet ds = crudDataContext.executeQuery(q);
|
||||
result.addAll(ds.toRows());
|
||||
ds.close();
|
||||
return new DefaultVascBackendResult<Row>(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
DataSet ds = dataContext.executeQuery(q);
|
||||
|
@ -261,7 +261,7 @@ public class MetaModelVascBackend extends AbstractVascBackend<Row> {
|
|||
}
|
||||
ds.close();
|
||||
|
||||
return new DefaultVascBackendResult<Row>(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -85,11 +85,7 @@ public class MongodbVascBackend extends AbstractVascBackend<BasicDBObject> {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.AbstractVascBackend#fetchTotalExecuteSize(net.forwardfire.vasc.backend.VascBackendState)
|
||||
*/
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
private long fetchTotalExecuteSize(VascBackendState state) {
|
||||
DBCollection coll = getDBCollection();
|
||||
DBObject query = createFilterQuery(state);
|
||||
long result = coll.count(query);
|
||||
|
@ -105,9 +101,13 @@ public class MongodbVascBackend extends AbstractVascBackend<BasicDBObject> {
|
|||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VascBackendResult<BasicDBObject> execute(VascBackendState state) throws VascBackendException {
|
||||
return new DefaultVascBackendResult<BasicDBObject>(executeList(state),fetchTotalExecuteSize(state));
|
||||
}
|
||||
|
||||
private List<BasicDBObject> executeList(VascBackendState state) throws VascBackendException {
|
||||
DBCollection coll = getDBCollection();
|
||||
DBObject query = createFilterQuery(state);
|
||||
DBCursor cur = coll.find(query);
|
||||
|
@ -120,7 +120,7 @@ public class MongodbVascBackend extends AbstractVascBackend<BasicDBObject> {
|
|||
DBObject row = cur.next();
|
||||
result.add((BasicDBObject)row);
|
||||
}
|
||||
return new DefaultVascBackendResult<BasicDBObject>(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
package net.forwardfire.vasc.backend.proxy;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
|
@ -94,14 +93,6 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy {
|
|||
return backend.isReadOnly();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#fetchTotalExecuteSize(VascBackendState state)
|
||||
*/
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
return backend.fetchTotalExecuteSize(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#isSortable()
|
||||
*/
|
||||
|
@ -215,22 +206,6 @@ abstract public class AbstractVascBackendProxy implements VascBackendProxy {
|
|||
return backend.isRecordMoveable();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#executePageSummary()
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> executePageSummary() {
|
||||
return backend.executePageSummary();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#executeTotalSummary()
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> executeTotalSummary() {
|
||||
return backend.executeTotalSummary();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#hasPageSummary()
|
||||
*/
|
||||
|
|
|
@ -38,7 +38,6 @@ import net.forwardfire.vasc.backend.VascBackendState;
|
|||
*/
|
||||
public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
||||
|
||||
private Long records = null;
|
||||
private VascBackendResult<Serializable> data = null;
|
||||
private String searchString = null;
|
||||
private Map<String,Object> dataState = null;
|
||||
|
@ -89,7 +88,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
changed = true;
|
||||
}
|
||||
sortDir = state.isSortAscending();
|
||||
|
||||
|
||||
if (state.getPageSizeMax()==pageSizeMax) {
|
||||
changed = true;
|
||||
}
|
||||
|
@ -139,15 +138,6 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
boolean changed = isStateChanged(state);
|
||||
if (records==null | changed) {
|
||||
records = backend.fetchTotalExecuteSize(state);
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object)
|
||||
*/
|
||||
|
@ -156,7 +146,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
requestFlush = true;
|
||||
super.delete(object);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object)
|
||||
*/
|
||||
|
@ -165,7 +155,7 @@ public class VascBackendProxyCache extends AbstractVascBackendProxy {
|
|||
requestFlush = true;
|
||||
return super.merge(object);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object)
|
||||
*/
|
||||
|
|
|
@ -72,7 +72,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addVascEntryBackendEventListener(VascEntryBackendEventListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
super.delete(object);
|
||||
fireVascEvent(VascBackendEventType.POST_DELETE,object);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveDownById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object)
|
||||
*/
|
||||
|
@ -124,7 +124,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
fireVascEvent(VascBackendEventType.POST_MOVE_DOWN,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveUpById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object)
|
||||
*/
|
||||
|
@ -135,7 +135,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
fireVascEvent(VascBackendEventType.POST_MOVE_UP,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#execute(net.forwardfire.vasc.backend.VascBackendState)
|
||||
*/
|
||||
|
@ -146,18 +146,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
fireVascEvent(VascBackendEventType.POST_EXECUTE,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#fetchTotalExecuteSize(net.forwardfire.vasc.backend.VascBackendState)
|
||||
*/
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
fireVascEvent(VascBackendEventType.PRE_TOTAL_EXECUTE_SIZE,state);
|
||||
Long result = super.fetchTotalExecuteSize(state);
|
||||
fireVascEvent(VascBackendEventType.POST_TOTAL_EXECUTE_SIZE,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object)
|
||||
*/
|
||||
|
@ -168,7 +157,7 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
fireVascEvent(VascBackendEventType.POST_MERGE,result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object)
|
||||
*/
|
||||
|
@ -177,5 +166,5 @@ public class VascBackendProxyEventExecutor extends AbstractVascBackendProxy {
|
|||
fireVascEvent(VascBackendEventType.PRE_PERSIST,object);
|
||||
super.persist(object);
|
||||
fireVascEvent(VascBackendEventType.POST_PERSIST,object);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,7 +41,6 @@ import net.forwardfire.vasc.core.VascEntry;
|
|||
*/
|
||||
public class VascBackendProxyFilter extends AbstractVascBackendProxy {
|
||||
|
||||
private long records = 0;
|
||||
private List<VascProxyFilter> filters = null;
|
||||
|
||||
/**
|
||||
|
@ -97,12 +96,6 @@ public class VascBackendProxyFilter extends AbstractVascBackendProxy {
|
|||
}
|
||||
}
|
||||
}
|
||||
records = search.size();
|
||||
return new DefaultVascBackendResult<Serializable>(search);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
return records;
|
||||
return new DefaultVascBackendResult<Serializable>(search,search.size());
|
||||
}
|
||||
}
|
|
@ -39,8 +39,6 @@ import net.forwardfire.vasc.backend.VascBackendState;
|
|||
*/
|
||||
public class VascBackendProxyPaged extends AbstractVascBackendProxy {
|
||||
|
||||
private long records = 0;
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#clone()
|
||||
*/
|
||||
|
@ -77,7 +75,6 @@ public class VascBackendProxyPaged extends AbstractVascBackendProxy {
|
|||
VascBackendResult<Serializable> allData = backend.execute(state);
|
||||
int pageSize = state.getPageSize();
|
||||
if (pageSize==0) {
|
||||
records = allData.getPageData().size();
|
||||
return allData;
|
||||
}
|
||||
List<Serializable> paged = new ArrayList<Serializable>(state.getPageSize());
|
||||
|
@ -90,12 +87,6 @@ public class VascBackendProxyPaged extends AbstractVascBackendProxy {
|
|||
Serializable o = allData.getPageData().get(i);
|
||||
paged.add(o);
|
||||
}
|
||||
records = allData.getPageData().size();
|
||||
return new DefaultVascBackendResult<Serializable>(paged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
return records;
|
||||
return new DefaultVascBackendResult<Serializable>(paged,allData.getPageData().size());
|
||||
}
|
||||
}
|
|
@ -137,9 +137,4 @@ public class VascBackendProxySearch extends AbstractVascBackendProxy {
|
|||
//records = search.size();
|
||||
return new DefaultVascBackendResult<Serializable>(search);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
return backend.fetchTotalExecuteSize(state);
|
||||
}
|
||||
}
|
|
@ -69,17 +69,6 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long fetchTotalExecuteSize(VascBackendState state) {
|
||||
long t1 = System.currentTimeMillis();
|
||||
try {
|
||||
return backend.fetchTotalExecuteSize(state);
|
||||
} finally {
|
||||
long t2 = System.currentTimeMillis();
|
||||
logger.log(logLevel,"vasc-fetchTotalExecuteSize backend: "+getId()+" in "+(t2-t1)+" ms");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveDownById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object)
|
||||
*/
|
||||
|
@ -93,7 +82,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
logger.log(logLevel,"vasc-doRecordMoveDownById backend: "+getId()+" in "+(t2-t1)+" ms");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#doRecordMoveUpById(net.forwardfire.vasc.backend.VascBackendState, java.lang.Object)
|
||||
*/
|
||||
|
@ -107,7 +96,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
logger.log(logLevel,"vasc-doRecordMoveUpById backend: "+getId()+" in "+(t2-t1)+" ms");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#delete(java.lang.Object)
|
||||
*/
|
||||
|
@ -121,7 +110,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
logger.log(logLevel,"vasc-delete backend: "+getId()+" in "+(t2-t1)+" ms");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#merge(java.lang.Object)
|
||||
*/
|
||||
|
@ -135,7 +124,7 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
logger.log(logLevel,"vasc-merge backend: "+getId()+" in "+(t2-t1)+" ms");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.proxy.AbstractVascBackendProxy#persist(java.lang.Object)
|
||||
*/
|
||||
|
@ -149,14 +138,14 @@ public class VascBackendProxyTimerLogger extends AbstractVascBackendProxy {
|
|||
logger.log(logLevel,"vasc-persist backend: "+getId()+" in "+(t2-t1)+" ms");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the logLevel
|
||||
*/
|
||||
public Level getLogLevel() {
|
||||
return logLevel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param logLevel the logLevel to set
|
||||
*/
|
||||
|
|
|
@ -42,7 +42,6 @@ public interface VascEntryBackendEventListener extends Serializable {
|
|||
PRE_DELETE,
|
||||
PRE_PROVIDE_FIELD_VALUE,
|
||||
PRE_PROVIDE_RECORD_CREATOR,
|
||||
PRE_TOTAL_EXECUTE_SIZE,
|
||||
PRE_MOVE_DOWN,
|
||||
PRE_MOVE_UP,
|
||||
|
||||
|
@ -52,7 +51,6 @@ public interface VascEntryBackendEventListener extends Serializable {
|
|||
POST_DELETE,
|
||||
POST_PROVIDE_FIELD_VALUE,
|
||||
POST_PROVIDE_RECORD_CREATOR,
|
||||
POST_TOTAL_EXECUTE_SIZE,
|
||||
POST_MOVE_DOWN,
|
||||
POST_MOVE_UP
|
||||
}
|
||||
|
|
|
@ -65,8 +65,7 @@ public class SetParameterBackendListener implements VascEntryBackendEventListene
|
|||
VascBackendEventType.PRE_MERGE,
|
||||
VascBackendEventType.PRE_MOVE_DOWN,
|
||||
VascBackendEventType.PRE_MOVE_UP,
|
||||
VascBackendEventType.PRE_PERSIST,
|
||||
VascBackendEventType.PRE_TOTAL_EXECUTE_SIZE
|
||||
VascBackendEventType.PRE_PERSIST
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.Date;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.backend.VascBackendResult;
|
||||
import net.forwardfire.vasc.backend.VascBackendState;
|
||||
import net.forwardfire.vasc.backend.proxy.VascProxyFilter;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
|
@ -225,25 +226,25 @@ public class DefaultVascFrontendActions implements VascFrontendActions {
|
|||
}
|
||||
}
|
||||
|
||||
// Always update total records
|
||||
Long total = entry.getVascFrontendController().getVascEntryState().getVascBackend().fetchTotalExecuteSize(backendState);
|
||||
entry.getVascFrontendController().getVascEntryState().setTotalBackendRecords(total);
|
||||
VascBackendResult<Serializable> result;
|
||||
try {
|
||||
result = entry.getVascFrontendController().getVascEntryState().getVascBackend().execute(backendState);
|
||||
} catch (VascBackendException ve) {
|
||||
throw new VascFrontendException(ve);
|
||||
}
|
||||
|
||||
// Set data in frontend
|
||||
entry.getVascFrontendController().getVascEntryState().setEntryDataList(result.getPageData());
|
||||
entry.getVascFrontendController().getVascEntryState().setTotalBackendRecords(result.getTotalSize());
|
||||
|
||||
// check if we need to change the current page if table size if changed in between
|
||||
int pages = new Long(total/backendState.getPageSize()).intValue();
|
||||
int pages = new Long(result.getTotalSize()/backendState.getPageSize()).intValue();
|
||||
if (backendState.getPageIndex() > pages) {
|
||||
backendState.setPageIndex(pages);
|
||||
}
|
||||
|
||||
try {
|
||||
// Execute to get data.
|
||||
entry.getVascFrontendController().getVascEntryState().setEntryDataList(entry.getVascFrontendController().getVascEntryState().getVascBackend().execute(backendState).getPageData());
|
||||
|
||||
// Fire event post read
|
||||
entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_READ, null);
|
||||
} catch (VascBackendException ve) {
|
||||
throw new VascFrontendException(ve);
|
||||
}
|
||||
// Fire event post read
|
||||
entry.getVascFrontendController().fireVascFrontendEvent(entry,VascEntryFrontendEventListener.VascFrontendEventType.POST_READ, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -174,9 +174,6 @@ public class VascExportServlet extends HttpServlet {
|
|||
VascEntryLocal ve = (VascEntryLocal)vc.getVascEntryConfigController().configVascEntry(vc, entryId);
|
||||
vc.getVascEntryConfigController().configVascFrontendController(vc, ve);
|
||||
|
||||
// Update total every time first
|
||||
Long total = ve.getVascFrontendController().getVascEntryState().getVascBackend().fetchTotalExecuteSize(ve.getVascFrontendController().getVascEntryState().getVascBackendState());
|
||||
ve.getVascFrontendController().getVascEntryState().setTotalBackendRecords(total);
|
||||
VascEntryExport ex = vc.getVascEntryConfigController().getVascEntryExporterById(exportId);
|
||||
VascEntryExportWriter exw = ex.createExportWriter();
|
||||
exw.doInit(ex, ve);
|
||||
|
|
Loading…
Reference in a new issue