request.delAttribute("TYPE_ORDER");
request.setAttribute("TYPE_ORDER",currentTypOrder);
}
InitializerIFace serviceInitializer = (InitializerIFace) service;
RequestContextIFace serviceRequestContext = (RequestContextIFace) service;
int pagedRows = 10;
SourceBean rowsSourceBean = null;
pagedRows = Integer.parseInt((String) serviceInitializer.getConfig().getAttribute("ROWS"));
paginator.setPageSize(pagedRows);
SourceBean statement = (SourceBean) serviceInitializer.getConfig().getAttribute("QUERIES.SELECT_QUERY");
try {
aSession = HibernateUtil.currentSession();
tx = aSession.beginTransaction();
Connection jdbcConnection = aSession.connection();
DataConnection dataConnection = getDataConnection(jdbcConnection);
rowsSourceBean =
(SourceBean) DelegatedQueryExecutor.executeQuery(
serviceRequestContext.getRequestContainer(),
serviceRequestContext.getResponseContainer(),
dataConnection,
statement,
"SELECT");
} catch (HibernateException he) {
logException(he);
if (tx != null)
tx.rollback();
throw new EMFUserError(EMFErrorSeverity.ERROR, 100);
} finally {
if (aSession != null) {
if (aSession.isOpen()) aSession.close();
}
}
List rowsVector = null;
if (rowsSourceBean != null)
rowsVector = rowsSourceBean.getAttributeAsList(DataRow.ROW_TAG);
if (rowsSourceBean == null) {
EMFErrorHandler engErrorHandler = serviceRequestContext.getErrorHandler();
engErrorHandler.addError(new EMFUserError(EMFErrorSeverity.INFORMATION, 10001));
}
else
for (int i = 0; i < rowsVector.size(); i++)
paginator.addRow(rowsVector.get(i));
ListIFace list = new GenericList();
list.setPaginator(paginator);
// filter the list
Object valuefilterObj = (Object)request.getAttribute(SpagoBIConstants.VALUE_FILTER);
String valuefilter = null;
if(valuefilterObj!=null){
valuefilter = valuefilterObj.toString();
}
//String valuefilter = (String)request.getAttribute(SpagoBIConstants.VALUE_FILTER);
if (valuefilter != null) {
String columnfilter = (String) request
.getAttribute(SpagoBIConstants.COLUMN_FILTER);
String typeFilter = (String) request
.getAttribute(SpagoBIConstants.TYPE_FILTER);
String typeValueFilter = (String) request
.getAttribute(SpagoBIConstants.TYPE_VALUE_FILTER);
list = filterList(list, valuefilter, typeValueFilter, columnfilter, typeFilter, serviceRequestContext.getErrorHandler());
}
return list;
}