long entityID = 0;
long orderID = 0;
try
{
HttpSession session = request.getSession(true);
session.setAttribute("highlightmodule", "account");
String entityidStr = request.getParameter("EntityID");
String orderidStr = request.getParameter("OrderID");
if (entityidStr != null && !entityidStr.equals(""))
entityID = Long.parseLong(entityidStr);
// After performing the logic in the DeleteHanlder, we are generat a new request for the list
// So we will not be carrying the old error. So that we will try to collect the error from the Session variable
// Then destory it after getting the Session value
if (session.getAttribute("listErrorMessage") != null)
{
ActionErrors allErrors = (ActionErrors) session.getAttribute("listErrorMessage");
saveErrors(request, allErrors);
session.removeAttribute("listErrorMessage");
}//end of if (session.getAttribute("listErrorMessage") != null)
if (orderidStr != null && !orderidStr.equals(""))
orderID = Long.parseLong(orderidStr);
request.setAttribute(AccountConstantKeys.TYPEOFSUBMODULE, AccountConstantKeys.INVOICE);
request.setAttribute("body", "list");
com.centraview.common.UserObject userobjectd = (com.centraview.common.UserObject)session.getAttribute("userobject");//get
// the
// user
// object
int individualID = userobjectd.getIndividualID();
ListPreference listpreference = userobjectd.getListPreference("InvoiceHistory");
InvoiceList displaylistSession = null;
InvoiceList displaylist = null;
try
{
displaylistSession = (InvoiceList)session.getAttribute("displaylist");//gets
// the
// list
// from
// session
} catch (Exception e)
{
displaylistSession = null;
}
try
{
displaylist = (InvoiceList)request.getAttribute("displaylist");//gets
// the
// list
// from
// request
} catch (Exception e)
{
displaylist = null;
}
InvoiceList DL = null;
ListGenerator lg = ListGenerator.getListGenerator(dataSource);
if (displaylist == null)
{
int records = listpreference.getRecordsPerPage();//gets the initial
// record per page to
// be displayed from
// listPreference
String sortelement = listpreference.getSortElement();//gets the initial
// sort element
// from
// listPreference
DL = null;
DL = (InvoiceList)lg.getInvoiceList(individualID, 1, records, "", sortelement, entityID, orderID);//called
// when
// the
// request
// for
// the
// list
// is
// for
// first
// time
if (entityidStr != null)
DL.setEntityID(entityID);
if (orderidStr != null)
DL.setOrderID(orderID);
DL = setLinksfunction(DL);
} else
//if(displaylistSession !=null)
{
String searchSession = displaylistSession.getSearchString();
String searchrequest = displaylist.getSearchString();
if (searchSession == null)
searchSession = "";
if (searchrequest == null)
searchrequest = "";
if (((displaylistSession.getListID() == displaylist.getListID()) && (displaylist.getDirtyFlag() == false) && (displaylist.getStartAT() >= displaylistSession.getBeginIndex()) && (displaylist.getEndAT() <= displaylistSession.getEndIndex()) && (displaylist.getSortMember().equals(displaylistSession.getSortMember())) && (displaylist
.getSortType() == (displaylistSession.getSortType()) && (searchSession.equals(searchrequest))))
|| displaylist.getAdvanceSearchFlag() == true)
{
entityID = displaylistSession.getEntityID();
orderID = displaylistSession.getOrderID();
DL = (InvoiceList)displaylistSession;
DL.setEntityID(entityID);
DL.setOrderID(orderID);
} else
{
entityID = displaylistSession.getEntityID();
orderID = displaylistSession.getOrderID();
displaylist.setEntityID(entityID);
displaylist.setOrderID(orderID);
DL = (InvoiceList)lg.getInvoiceList(individualID, displaylist);
DL.setEntityID(entityID);
DL.setOrderID(orderID);
}
DL = setLinksfunction(DL);
}
session.setAttribute("displaylist", DL);
request.setAttribute("displaylist", DL);
// forward to jsp page
FORWARD_final = FORWARD_showinvoicelist;
} catch (Exception e)