DisplayList displaylistSession = ( DisplayList )session.getAttribute( "displaylist") ;
DisplayList displaylist = ( DisplayList )request.getAttribute( "displaylist") ;
EntityList DL = new EntityList();
ListGenerator lg = ListGenerator.getListGenerator(dataSource);
if( displaylist == null )
{
String searchString = "ADVANCE:SELECT entityid FROM vendor ";
DL = ( EntityList )lg.getEntityList( userobjectd.getIndividualID(), 1,listpreference.getRecordsPerPage() , searchString ,listpreference.getSortElement());
if (DL == null)
{
DL = new EntityList();
}
DisplayList DL1 = lg.getDisplayList(DL.getListID() );
DL1.setListType("Vendor");
DL.setListType("Vendor");
DL.setPrimaryTable("vendor");
DL1.setTotalNoOfRecords(DL.size());
DL.setTotalNoOfRecords(DL.size());
}
else
{
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)
{
DL = (EntityList)displaylistSession;
DL.setListType("Vendor");
DL.setPrimaryTable("vendor");
DL.setTotalNoOfRecords(DL.size());
request.setAttribute("displaylist" , displaylistSession );
}
else
{
DL = ( EntityList )lg.getEntityList( displaylist );
DisplayList DL1 = lg.getDisplayList(DL.getListID() );
DL1.setListType("Vendor");
DL.setListType("Vendor");
DL.setPrimaryTable("vendor");
DL1.setTotalNoOfRecords(DL.size());
DL.setTotalNoOfRecords(DL.size());
}
}
Set listkey = DL.keySet();
Iterator it = listkey.iterator();
while( it.hasNext() )
{
String str = ( String )it.next();
StringMember sm=null;
ListElement ele = ( ListElement )DL.get( str );
sm = ( StringMember )ele.get("Name" );
sm.setRequestURL("openPopup('ViewEntityDetail.do?rowId="+ele.getElementID()+"&listId="+DL.getListID()+"')");
sm = ( StringMember )ele.get("PrimaryContact" );
IntMember im = (IntMember) ele.get("IndividualID");
sm.setRequestURL("openPopup('ViewIndividualDetail.do?rowId="+((Integer)im.getMemberValue()).intValue()+"&listId="+DL.getListID()+"')");
sm = ( StringMember )ele.get("Website");
sm.setRequestURL("openWindowWithTool('"+sm.getDisplayString()+"')");
sm = ( StringMember )ele.get("Email" );
sm.setRequestURL("openWindows('mail/Compose.do?to="+sm.getDisplayString()+"',720,585,'')");
}