Package com.centraview.support.knowledgebase

Examples of com.centraview.support.knowledgebase.KnowledgebaseList


      ListGenerator lg = ListGenerator.getListGenerator(dataSource);
      int records = listPrefs.getRecordsPerPage();
      String sortElement = listPrefs.getSortElement();
      boolean customerViewFlag = true;
      KnowledgebaseList kbList = (KnowledgebaseList)lg.getKnowledgebaseList(individualID, 1, records, "", sortElement, categoryID,customerViewFlag);

      Set listkey = kbList.keySet();
      Iterator iter = listkey.iterator();
      while (iter.hasNext())
      {
        String key = (String)iter.next();
        ListElement row = (ListElement)kbList.get(key);

        int elementID = row.getElementID();

        StringMember categoryField = (StringMember)row.get("CatKB");
        String type = categoryField.getDisplayString();

        StringMember nameField = (StringMember)row.get("Name");

        if (type.equals(SupportConstantKeys.CATEGORY))
        {
          // if the list element is a category, then we need to link to KBList.do
          nameField.setRequestURL("KBList.do?categoryID=" + elementID);
          categoryField.setRequestURL("KBList.do?categoryID=" + elementID);
        }else if (type.equals(SupportConstantKeys.KBELEMENT)){
          // if the list element is a KB entry, then we need to link to ViewKB.do
          nameField.setRequestURL("ViewKB.do?kbID=" + elementID);
          categoryField.setRequestURL("ViewKB.do?kbID=" + elementID);
        }
      }   // end while(iter.hasNext())

      kbList.setCurrentCategoryID(categoryID);
      session.setAttribute("displaylist", kbList);
      request.setAttribute("displaylist", kbList);
    }catch(Exception e){
      System.out.println("[Exception][CV KBListHandler] Exception thrown in execute(): " + e);
      allErrors.add("error.unknownError", new ActionMessage("error.unknownError"));
View Full Code Here


    return questionList;
  }

  public KnowledgebaseList getKnowledgebaseList(int userID, int curCategoryID, HashMap hashmap)
  {
    KnowledgebaseList kblist = null;
    try {
      InitialContext ic = CVUtility.getInitialContext();
      SupportListLocalHome home = (SupportListLocalHome) ic.lookup("local/SupportList");
      SupportListLocal remote = home.create();
      remote.setDataSource(this.dataSource);
View Full Code Here

    int intEndParam = intEnd.intValue();
    int categoryID = intCategoryID.intValue();
    String strOriginal = strSearch;
    int beginIndex = 0;

    KnowledgebaseList kblist = new KnowledgebaseList();
    kblist.setSortMember(strSortMem);

    Vector vec = new Vector();
    CVDal cvdl = new CVDal(dataSource);
    Collection colList = null;

    try
    {
      if (customerViewFlag)
      {
        cvdl.setSqlQueryToNull();
        String str = "select 'KBELEMENT' as Catkb,kb.kbid ID,kb.title Name, " + "kb.created DateCreated,kb.updated DateUpdated,kb.category  " + "from knowledgebase kb where category=?  and kb.publishToCustomerView='YES' union  " + "select 'CATEGORY' as Catkb,cat.catid ID,cat.title Name, "
            + "cat.created DateCreated,cat.Modified DateUpdated,cat.parent  " + "from individual indv,category cat where cat.parent=? and cat.publishToCustomerView='YES' ;";
        cvdl.setSqlQuery(str);
        cvdl.setInt(1, categoryID);
        cvdl.setInt(2, categoryID);
        colList = cvdl.executeQuery();
        cvdl.clearParameters();
      } else {
        if (strSearch != null && strSearch.startsWith("ADVANCE:"))
        {
          strSearch = strSearch.substring(8);

          String str = "create TEMPORARY TABLE kblistSearch " + strSearch;
          cvdl.setSqlQueryToNull();
          cvdl.setSqlQuery(str);
          cvdl.executeUpdate();
          cvdl.clearParameters();

          String strQuery = "";
          String sortType = "ASC";

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

          strQuery = "SELECT 'KBELEMENT' AS Catkb, kb.kbid AS ID, kb.title AS Name, " + "kb.created AS DateCreated, kb.updated AS DateUpdated, kb.category " + "FROM knowledgebase kb, kblistSearch kbsearch WHERE kbsearch.kbid=kb.kbid " + "ORDER BY '" + strSortMem + "' " + sortType;

          cvdl.setSqlQueryToNull();
          cvdl.setSqlQuery(strQuery);
          colList = cvdl.executeQuery();
          cvdl.clearParameters();

          cvdl.setSqlQueryToNull();
          cvdl.setSqlQuery("DROP TABLE kblistSearch");
          cvdl.executeUpdate();
        } else {
          String sortType = "ASC";
          if (charSort != 'A')
          {
            sortType = "DESC";
          }

          cvdl.setDynamicQuery("kb.allkb", sortType, strSortMem);
          cvdl.setInt(1, categoryID);
          cvdl.setInt(2, userID);
          cvdl.setInt(3, categoryID);
          cvdl.setInt(4, categoryID);
          cvdl.setInt(5, userID);
          cvdl.setInt(6, categoryID);
          colList = cvdl.executeQuery();
          cvdl.clearParameters();
        }
      }
    } catch (Exception e) {
      logger.debug(" [Exception] SupportListEJB.getKnowledgebaseList " + e);
    } finally {
      cvdl.destroy();
      cvdl = null;
    }

    Iterator it = colList.iterator();

    int i = 0;
    if (colList.size() > 0)
    {
      while (it.hasNext())
      {
        i++;
        HashMap hm = (HashMap)it.next();
        int kbElementID = ((Long)hm.get("ID")).intValue();

        try
        {
          IntMember intKbElementID = new IntMember("ID", kbElementID, 10, "", 'T', false, 10);
          StringMember strName = new StringMember("Name", (String)hm.get("Name"), 10, "", 'T', true);
          StringMember strCatKB = new StringMember("CatKB", (String)hm.get("Catkb"), 10, "", 'T', false);

          Timestamp dtCreated = null;
          Timestamp dtUpdated = null;
          DateMember dmCreated = null;
          DateMember dmUpdated = null;
          String timezoneid = "EST";

          if ((hm.get("DateCreated") != null))
          {
            dtCreated = (Timestamp)hm.get("DateCreated");
            dmCreated = new DateMember("DateCreated", dtCreated, 10, "", 'T', false, 1, timezoneid);
          } else {
            dmCreated = new DateMember("DateCreated", null, 10, "", 'T', false, 1, timezoneid);
          }

          if ((hm.get("DateUpdated") != null))
          {
            dtUpdated = (Timestamp)hm.get("DateUpdated");
            dmUpdated = new DateMember("DateUpdated", dtUpdated, 10, "", 'T', false, 1, timezoneid);
          } else {
            dmUpdated = new DateMember("DateUpdated", null, 10, "", 'T', false, 1, timezoneid);
          }

          KnowledgebaseListElement kblistElement = new KnowledgebaseListElement(kbElementID);

          kblistElement.put("CatKBID", intKbElementID);
          kblistElement.put("Name", strName);
          kblistElement.put("DateCreated", dmCreated);
          kblistElement.put("DateUpdated", dmUpdated);
          kblistElement.put("CatKB", strCatKB);

          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();

          kblist.put(s4, kblistElement);
        } catch (Exception e) {
          logger.debug(" [Exception] SupportListEJB.getKnowldegebaseList " + e);
          e.printStackTrace();
        }
      }
    }

    Vector rootPath = getCategoryRootPath(userID, categoryID);
    kblist.setCustomerViewFlag(customerViewFlag);
    kblist.setCategoryStructure(rootPath);
    kblist.setTotalNoOfRecords(kblist.size());
    kblist.setListType("Knowledgebase");
    kblist.setBeginIndex(beginIndex);
    kblist.setEndIndex(kblist.size());

    return (kblist);
  }
View Full Code Here

  public KnowledgebaseList getKnowledgebaseList(int userID, int startATparam, int EndAtparam,
      String searchString, String sortColumn, int categoryID, boolean customerViewFlag)
      throws CommunicationException, NamingException
  {
    if ((searchString != null) && ((searchString.trim()).length() > 0)) {
      KnowledgebaseList dl = new KnowledgebaseList();
      dl.setStartAT(startATparam);
      dl.setEndAT(EndAtparam);
      dl.setSortMember(sortColumn);
      dl.setSortType('A');
      dl.setSearchString(searchString);
      dl.setListType("Knowledgebase");
      dl.setCurrentCategoryID(categoryID);

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

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

      return (this.getKnowledgebaseList(userID, categoryID, dl));
    } else {
      KnowledgebaseList 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'));
        hm.put("curCategoryID", new Integer(categoryID));
        hm.put("customerViewFlag", new Boolean(customerViewFlag));

        HashMap listMap = null;
        SupportFacadeHome aa = (SupportFacadeHome)CVUtility.getHomeObject(
            "com.centraview.support.supportfacade.SupportFacadeHome", "SupportFacade");
        try {
          SupportFacade remote = (SupportFacade)aa.create();
          remote.setDataSource(this.dataSource);
          returnDL = remote.getKnowledgebaseList(userID, categoryID, hm);
        } catch (Exception e) {
          System.out.println("[Exception] ListGenerator.getKnowledgebaseList: " + e.toString());
          // e.printStackTrace();
        }

        returnDL.setListType("Knowledgebase");
        returnDL.setTotalNoOfRecords(returnDL.size());
        returnDL.setCurrentCategoryID(categoryID);

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

        KnowledgebaseList emptyDL = createEmptyObject(returnDL);
        emptyDL.setTotalNoOfRecords(returnDL.getTotalNoOfRecords());
        emptyDL.setListID(currentListID);
        emptyDL.setListType("Knowledgebase");
        emptyDL.setStartAT(returnDL.getStartAT());
        emptyDL.setEndAT(returnDL.getEndAT());
        emptyDL.setCurrentCategoryID(categoryID);

        displayLists.put(new Long(currentListID), emptyDL);
      } catch (Exception e) {
        System.out.println("[Exception] ListGenerator.getKnowledgebaseList: " + e.toString());
        // e.printStackTrace();
View Full Code Here

   */
  public KnowledgebaseList getKnowledgebaseList(int userid, int categoryID, DisplayList DLparam)
      throws CommunicationException, NamingException
  {

    KnowledgebaseList returnDL = null;
    KnowledgebaseList paramDL = (KnowledgebaseList)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();

    int curCategoryID = paramDL.getCurrentCategoryID();

    HashMap hm = new HashMap();
    hm.put("startATparam", new Integer(Math.max(startAT - 100, 1)));
    hm.put("EndAtparam", new Integer(Math.min(EndAt + 100, listSize)));
    hm.put("searchString", searchString);
    hm.put("sortmem", paramDL.getSortMember());
    hm.put("sortType", new Character(paramDL.getSortType()));
    hm.put("curCategoryID", new Integer(curCategoryID));
    hm.put("customerViewFlag", new Boolean(paramDL.getCustomerViewFlag()));
    SupportFacadeHome aa = (SupportFacadeHome)CVUtility.getHomeObject(
        "com.centraview.support.supportfacade.SupportFacadeHome", "SupportFacade");
    try {
      SupportFacade remote = (SupportFacade)aa.create();
      remote.setDataSource(this.dataSource);
      returnDL = remote.getKnowledgebaseList(userid, categoryID, hm);
    } catch (Exception e) {
      System.out.println("[Exception] ListGenerator.getKnowledgebaseList: " + e.toString());
      // e.printStackTrace();
    }

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

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

   * @param list
   * @return
   */
  public KnowledgebaseList createEmptyObject(KnowledgebaseList list)
  {
    KnowledgebaseList dummy = new KnowledgebaseList();
    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);
    dummy.setCurrentCategoryID(list.getCurrentCategoryID());

    return dummy;
  }// end of createEmptyObject
View Full Code Here

TOP

Related Classes of com.centraview.support.knowledgebase.KnowledgebaseList

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.