Package com.centraview.account.order

Examples of com.centraview.account.order.OrderList


      com.centraview.common.UserObject  userobjectd = (com.centraview.common.UserObject)session.getAttribute( "userobject" );//get the user object
      int individualID = userobjectd.getIndividualID();
     
      System.out.println("san-OrderLookupHandler-getting OrderList from LG ...");
      ListGenerator lg = ListGenerator.getListGenerator(dataSource);
      OrderList DL = ( OrderList )lg.getOrderList(individualID , 0,0 , "" ,"OrderID");


      /* Commented - by Sandeep
         Search Related Code to be Added afterwords*/
      /*
      String searchStr = req.getParameter("simpleSearch");
      String saveSearchStr = req.getParameter("savedSearch");

      System.out.println(" searchStr in OrderLookupHandler "+searchStr);
      System.out.println(" saveSearchStr  in OrderLookupHandler "+saveSearchStr );

      if(searchStr != null && (searchStr.trim()).length() > 0)
      {
        System.out.println(" In simple Order Lookup search ");
        searchStr = searchStr.trim();
        DL.setSearchString(searchStr);
        DL.search();
      }
      else if (saveSearchStr != null && (saveSearchStr.trim()).length() > 0)
      {
        System.out.println(" In Advance Order Lookup search ");
        String primaryMembetType = DL.getPrimaryMemberType();
        String primaryTable    = DL.getPrimaryTable();

        DataDictionary dd = new DataDictionary();
        String filterQuery = dd.getAdvanceQuery(saveSearchStr,primaryMembetType,primaryTable);

        DL.setSearchString("ADVANCE:"+filterQuery);
        DL = ( OrderList )lg.getOrderList(DL);
      }
      */


      DL.setTotalNoOfRecords( DL.size() );

      System.out.println("san-OrderLookupHandler-got the DL, size = "+DL.size());

      Set listkey = DL.keySet();
      Iterator it =  listkey.iterator();
      /*while( it.hasNext() )
      {
        String str = ( String )it.next();
        System.out.println(str);
View Full Code Here


   */
  public OrderList getOrderList(int individualID, int startATparam, int EndAtparam,
      String searchString, String sortColumn)
  {
    if ((searchString != null) && ((searchString.trim()).length() > 0)) {
      OrderList dl = new OrderList();
      dl.setStartAT(startATparam);
      dl.setEndAT(EndAtparam);
      dl.setSortMember(sortColumn);
      dl.setSortType('A');
      dl.setSearchString(searchString);
      dl.setListType("Order");

      long currentListID = this.getNextListID();
      dl.setListID(currentListID);

      displayLists.put(new Long(currentListID), dl);

      return this.getOrderList(individualID, dl);

    } else {
      OrderList returnDL = null;
      try {
        HashMap hm = new HashMap();
        hm.put("startATparam", new Integer(startATparam));
        hm.put("EndAtparam", new Integer(EndAtparam));
        hm.put("searchString", searchString);
        hm.put("sortmem", sortColumn);
        hm.put("sortType", new Character('A'));

        try {
          AccountListHome aa = (AccountListHome)CVUtility.getHomeObject(
              "com.centraview.account.accountlist.AccountListHome", "AccountList");
          AccountList remote = (AccountList)aa.create();
          remote.setDataSource(this.dataSource);
          returnDL = remote.getOrderList(individualID, hm);
        } catch (Exception e) {
          System.out.println("[Exception] ListGenerator.getOrderList: " + e.toString());
          // e.printStackTrace();
        }

        returnDL.setListType("Order");
        returnDL.setTotalNoOfRecords(returnDL.size());

        long currentListID = this.getNextListID();
        returnDL.setListID(currentListID);
        returnDL.setStartAT(startATparam);
        returnDL.setEndAT(EndAtparam);

        OrderList emptyDL = createEmptyObject(returnDL);
        emptyDL.setTotalNoOfRecords(returnDL.getTotalNoOfRecords());
        emptyDL.setListID(currentListID);
        emptyDL.setListType("Order");
        emptyDL.setStartAT(returnDL.getStartAT());
        emptyDL.setEndAT(returnDL.getEndAT());
        displayLists.put(new Long(currentListID), emptyDL);

      } catch (Exception e) {
        e.printStackTrace();
      }
View Full Code Here

   * @param list
   * @return
   */
  public OrderList createEmptyObject(OrderList list)
  {
    OrderList dummy = new OrderList();
    dummy.setListType(list.getListType());
    dummy.setPrimaryMemberType(list.getPrimaryMemberType());
    dummy.setPrimaryTable(list.getPrimaryTable());
    dummy.setSortMember(list.getSortMember());
    dummy.setSortType(list.getSortType());
    dummy.setPrimaryMember(list.getPrimaryMember());
    dummy.setStartAT(list.getStartAT());
    dummy.setEndAT(list.getEndAT());
    dummy.setBeginIndex(0);
    dummy.setEndIndex(0);
    return dummy;
  }// end of createEmptyObject
View Full Code Here

   * @return
   */
  public OrderList getOrderList(int individualID, DisplayList DLparam)
  {

    OrderList returnDL = null;
    OrderList paramDL = (OrderList)DLparam;
    int listSize = paramDL.getTotalNoOfRecords();
    int startAT = paramDL.getStartAT();
    int EndAt = paramDL.getEndAT();

    String powerString = paramDL.getPowerString();
    String searchString = paramDL.getSearchString();
    String sortColumn = paramDL.getSortMember();

    HashMap hm = new HashMap();
    hm.put("startATparam", new Integer(startAT));
    hm.put("EndAtparam", new Integer(EndAt));
    hm.put("searchString", searchString);
    hm.put("sortmem", DLparam.getSortMember());
    hm.put("sortType", new Character(DLparam.getSortType()));

    try {
      AccountListHome aa = (AccountListHome)CVUtility.getHomeObject(
          "com.centraview.account.accountlist.AccountListHome", "AccountList");
      AccountList remote = (AccountList)aa.create();
      remote.setDataSource(this.dataSource);
      returnDL = remote.getOrderList(individualID, hm);
    } catch (Exception e) {
      System.out.println("[Exception] ListGenerator.getOrderList: " + e.toString());
      // e.printStackTrace();
    }

    returnDL.setListType("Order");
    returnDL.setListID(paramDL.getListID());
    returnDL.setStartAT(paramDL.getStartAT());
    returnDL.setEndAT(paramDL.getEndAT());
    returnDL.setSortType(paramDL.getSortType());
    returnDL.setSearchString(searchString);
    returnDL.setPowerString(powerString);

    if (searchString != null && searchString.startsWith("SIMPLE :"))
      returnDL.search();
View Full Code Here

    char charSort = chrSortType.charValue();
    int intStartParam = intStart.intValue();
    int intEndParam = intEnd.intValue();
    int beginIndex = 0;

    OrderList list = new OrderList();
    list.setSortMember(strSortMem);
    CVDal cvdl = new CVDal(dataSource);
    Collection colList = null;

    //     order by '"+ sortMember +"' "+sortType

    if (charSort == 'A')
    {
      cvdl.setDynamicQuery("account.getorderlist", "ASC", strSortMem);
    }
    else
    {
      cvdl.setDynamicQuery("account.getorderlist", "DESC", strSortMem);
    }

    String sortType = "ASC";

    if (charSort != 'A')
    {
      sortType = "DESC";
    }

    String selectQuery = "SELECT cvorder.orderid AS OrderNO, "
      + "cvorder.entityid, entity.name AS Entity, cvorder.created AS date, "
      + "cvorder.total, cvorder.accountmgr, "
      + "CONCAT(indv1.firstname,' ',indv1.lastname) AS salesrep, "
      + "accountingstatus.title AS status, cvorder.discount, cvorder.creator, "
      + "CONCAT(indv2.firstname, ' ', indv2.lastname) AS creator, cvorder.ponumber ";

    String fromQuery = "FROM cvorder LEFT OUTER JOIN entity ON "
      + "cvorder.entityid = entity.entityid LEFT OUTER JOIN individual indv1 ON "
      + "cvorder.accountmgr = indv1.individualid LEFT OUTER JOIN individual indv2 ON "
      + "cvorder.creator = indv2.individualid LEFT OUTER JOIN accountingstatus ON "
      + "cvorder.status = accountingstatus.statusid ";

    String whereQuery = "WHERE orderstatus !=  'Deleted' ";
    String orderByQuery = " ORDER BY '" + strSortMem + "' " + sortType;

    String listQuery = selectQuery + fromQuery + whereQuery + orderByQuery;


    if ((strSearch != null) && strSearch.startsWith("ADVANCE:"))
    {
      String advSearchstr = strSearch.substring(8);

      cvdl.setSqlQueryToNull();
      cvdl.setSqlQuery("DROP TABLE IF EXISTS `orderlistsearch`;");
      cvdl.executeUpdate();
      cvdl.clearParameters();
      cvdl.setSqlQueryToNull();

      cvdl.setSqlQuery("CREATE TEMPORARY TABLE orderlistsearch " + advSearchstr);
      cvdl.executeUpdate();

      cvdl.setSqlQueryToNull();
      cvdl.clearParameters();

      fromQuery = fromQuery + " , orderlistsearch ";
      whereQuery = whereQuery + " AND cvorder.orderid = orderlistsearch.orderid ";
    }

    listQuery = selectQuery + fromQuery + whereQuery + orderByQuery;

    cvdl.setSqlQuery(listQuery);
    colList = cvdl.executeQuery();
    cvdl.clearParameters();

    cvdl.setSqlQueryToNull();
    cvdl.setSqlQuery("DROP TABLE IF EXISTS orderlistsearch;");
    cvdl.executeUpdate();
    cvdl.clearParameters();
    cvdl.destroy();

    if (colList != null)
    {
      Iterator it = colList.iterator();

      int i = 0;

      while (it.hasNext())
      {
        i++;

        HashMap hm = (HashMap) it.next();
        int id = ((Long) hm.get("OrderNO")).intValue();

        try
        {
          IntMember intListID =
            new IntMember("OrderID", id, 10, "", 'T', false, 10);

          IntMember intorderNo =
            new IntMember("OrderNO", id, 10, "", 'T', true, 10);

          OrderListElement listElement = new OrderListElement(id);

          StringMember strentityName =
            new StringMember("Entity", (String) hm.get("Entity"), 10, "", 'T',
              true);

          id = ((Long) hm.get("entityid")).intValue();

          IntMember entityID =
            new IntMember("EntityID", id, 10, "", 'T', false, 10);

          DateMember date =
            new DateMember("Date",
              new Date(((Timestamp) hm.get("date")).getTime()), 10, "", 'T',
              false, 1, timezoneid);

          DoubleMember total =
            new DoubleMember("Total",
              new Double(Double.parseDouble(hm.get("total").toString())), 10,
              "", 'T', false, 10);

          id = ((Long) hm.get("accountmgr")).intValue();

          IntMember saleID =
            new IntMember("SalesRepID", id, 10, "", 'T', false, 10);

          StringMember salesrep =
            new StringMember("SalesRep", (String) hm.get("salesrep"), 10, "",
              'T', true);
          StringMember status =
            new StringMember("Status", (String) hm.get("status"), 10, "", 'T',
              false);
          DoubleMember discount =
            new DoubleMember("Discount", (Double) hm.get("Discount"), 10, "",
              'T', false, 10);
          StringMember creator =
            new StringMember("Creator", (String) hm.get("creator"), 10, "",
              'T', false);
          StringMember poNumber =
            new StringMember("PONumber", (String) hm.get("ponumber"), 10, "",
              'T', false);

          listElement.put("OrderID", intListID);
          listElement.put("OrderNO", intorderNo);
          listElement.put("Entity", strentityName);
          listElement.put("EntityID", entityID);
          listElement.put("Date", date);
          listElement.put("Total", total);
          listElement.put("SalesRepID", saleID);
          listElement.put("SalesRep", salesrep);
          listElement.put("Status", status);
          listElement.put("Discount", discount);
          listElement.put("Creator", creator);
          listElement.put("PONumber", poNumber);

          StringBuffer stringbuffer = new StringBuffer("00000000000");
          stringbuffer.setLength(11);

          String s3 = (new Integer(i)).toString();
          stringbuffer.replace(stringbuffer.length() - s3.length(),
            stringbuffer.length(), s3);

          String s4 = stringbuffer.toString();

          list.put(s4, listElement);
        }
        catch (Exception e)
        {
          System.out.println(" Exception in getOrderList" + e);

          //e.printStackTrace();
        }
      }
    }

    list.setTotalNoOfRecords(list.size());
    list.setListType("Order");
    list.setBeginIndex(beginIndex);
    list.setEndIndex(list.size());

    return list;
  }
View Full Code Here

TOP

Related Classes of com.centraview.account.order.OrderList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.