}
session.setAttribute("dbid", marketingListId);
UserObject userObject = (UserObject)session.getAttribute("userobject");
int individualId = userObject.getIndividualID();
ListPreference listPreference = userObject.getListPreference("Entity");
ListView view = listPreference.getListView(String.valueOf(listPreference.getDefaultView()));
ValueListParameters listParameters = null;
ValueListParameters requestListParameters = (ValueListParameters)request
.getAttribute("listParameters");
if (requestListParameters == null) // build up new Parameters
{
listParameters = new ValueListParameters(ValueListConstants.ENTITY_LIST_TYPE, listPreference
.getRecordsPerPage(), 1);
} else { // paging or sorting or something, use the parameters from the
// request.
listParameters = requestListParameters;
}
if (listParameters.getSortColumn() == 0) {
FieldDescriptor sortField = (FieldDescriptor)ValueListConstants.entityViewMap
.get(listPreference.getSortElement());
listParameters.setSortColumn(sortField.getQueryIndex());
if (listPreference.getsortOrder()) {
listParameters.setSortDirection("ASC");
} else {
listParameters.setSortDirection("DESC");
}
}
String filter = null;
String filterParameter = request.getParameter("filter");
if (filterParameter != null) {
filter = (String)session.getAttribute("listFilter");
// We don't want to add filter on the List in following condition
// 1) if user is seleting the All List will be identified by -1
// then we shouldn't apply the filter on list.
if (marketingListId != null && !marketingListId.equals("-1")) {
filter = filter + " AND list = " + marketingListId;
}
request.setAttribute("appliedSearch", filterParameter);
} else {
// Filter by the marketing List.
filter = "SELECT entity.entityId FROM entity ";
// We don't want to add filter on the List in following condition
// 1) if user is seleting the All List will be identified by -1
// then we shouldn't apply the filter on list.
if (marketingListId != null && !marketingListId.equals("-1")) {
filter += " WHERE list = " + marketingListId;
}
session.removeAttribute("listFilter");
}
listParameters.setFilter(filter);
// TODO remove crappy map between old views and new views.
Vector viewColumns = view.getColumns();
ArrayList columns = new ArrayList();
// We the Action Type is Entity's Lookup then we must have
// to set the columns which we are going to look
if (actionType != null && actionType.equals("lookup")) {
Vector lookupViewColumns = new Vector();