Package com.centraview.email

Examples of com.centraview.email.RuleList


      // now get the list from the ListGenerator
      ListGenerator lg = ListGenerator.getListGenerator(dataSource);
      String searchString = "";

    RuleList rulesList = null;
      // If we are setting the Advance Search Flag to True means we already processed the List with Advance Search condition. So we don't need to get the list once again.
    if (sessionRulesList != null && sessionRulesList.getAdvanceSearchFlag() == true)
    {
      rulesList = (RuleList) sessionRulesList;
      }
      else{
          rulesList = (RuleList)lg.getRuleList(individualID, accountID.intValue(), startAt, endAt, searchString, listPrefs.getSortElement(),sortType);
    }

      Set keySet = rulesList.keySet();
      Iterator it =  keySet.iterator();
      while (it.hasNext())
      {
        try
        {
          String key = (String)it.next();
          ListElement ele = (ListElement)rulesList.get(key);
          StringMember nameField = (StringMember)ele.get("Name");
          nameField.setRequestURL("goTo('" + request.getContextPath() + "/mail/ViewRule.do?ruleID=" + ele.getElementID() + "')");
        }catch(Exception e){ }
      }
View Full Code Here


   * @param preference The preference its a collection of information to Sort in Ascending/Descending Order, Sort on particular column & searchstring
   * @return A Display List of email rules casted to RuleList.
   */
  public DisplayList getRuleList(int individualID, int accountID, HashMap preference)
  {
    RuleList rulesList = new RuleList();
    CVDal cvdal = new CVDal(this.dataSource);
    try {
      rulesList = (RuleList)this.getRuleList(individualID, accountID, preference, cvdal);
    }catch(Exception e){
      System.out.println("[Exception][MailEJB] Exception thrown in getNumberOfAccountsForUser(): " + e.toString());
View Full Code Here

    String sortType = "";
    if (sort == 'D'){
    sortType = " DESC";
  }

    RuleList rulesList = new RuleList();

    try {
    String appendQueryCondition = "";
      String query = "SELECT ruleID, name, description, enabled FROM emailrule WHERE accountID=? "+appendQueryCondition+" ORDER BY " + sortmem + sortType;
      cvdal.setSqlQuery(query);
      cvdal.setInt(1, accountID);

      Collection results = cvdal.executeQuery();

      if (results != null) {
        Iterator iter = results.iterator();
        int i = 0;
        while (iter.hasNext()) {
          i++;
          HashMap row = (HashMap)iter.next();
          int ruleID = ((Number)row.get("ruleID")).intValue();
          IntMember ruleIDfield = new IntMember("RuleID", ruleID, 10, "", 'T', true, 10);
          StringMember name = new StringMember("RuleName", (String)row.get("name"), 10, "", 'T', true);
          StringMember description = new StringMember("Description", (String)row.get("description"), 10, "", 'T', false);
          StringMember enabled = new StringMember("EnabledStatus", (String)row.get("enabled"), 10, "", 'T', false);

          RuleListElement ele  = new RuleListElement(ruleID);

          ele.put("RuleID", ruleIDfield);
          ele.put("Name", name);
          ele.put("Description", description);
          ele.put("Enabled", enabled);

          StringBuffer sb = new StringBuffer("00000000000");
          sb.setLength(11);
          String str = (new Integer(i)).toString();
          sb.replace((sb.length() - str.length()), (sb.length()), str);
          String newOrd = sb.toString();

          rulesList.put(newOrd, ele);
        }
        rulesList.setTotalNoOfRecords(rulesList.size());
        rulesList.setListType("Rule");
      }   // end if (result != null)
    }catch(Exception e){
      System.out.println("[Exception][MailEJB] Exception thrown in getNumberOfAccountsForUser(): " + e.toString());
      // e.printStackTrace();
    }finally{
View Full Code Here

  public RuleList getRuleList(int userID, int accountID, int startATparam, int EndAtparam,
      String searchString, String sortColumn, char sortType)
  {
    if ((searchString != null) && ((searchString.trim()).length() > 0)) {
      RuleList dl = new RuleList();
      dl.setStartAT(startATparam);
      dl.setEndAT(EndAtparam);
      dl.setSortMember(sortColumn);
      dl.setSortType(sortType);
      dl.setSearchString(searchString);
      dl.setListType("Rule");
      dl.setSortMember(sortColumn);
      long currentListID = this.getNextListID();
      dl.setListID(currentListID);

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

      return this.getRuleList(userID, accountID, dl);
    } else {
      RuleList 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(sortType));
        HashMap listMap = null;

        try {
          MailHome home = (MailHome)CVUtility.getHomeObject("com.centraview.mail.MailHome", "Mail");
          Mail remote = (Mail)home.create();
          remote.setDataSource(this.dataSource);

          returnDL = (RuleList)remote.getRuleList(userID, accountID, hm);
        } catch (Exception e) {
          System.out.println("[Exception] ListGenerator.getRuleList: " + e.toString());
          // e.printStackTrace();
        }

        returnDL.setListType("Rule");
        returnDL.setTotalNoOfRecords(returnDL.size());
        long currentListID = this.getNextListID();
        returnDL.setListID(currentListID);
        returnDL.setSortType(sortType);
        returnDL.setStartAT(startATparam);
        returnDL.setEndAT(EndAtparam);
        returnDL.setPrimaryTable("emailrule");
        returnDL.setSortMember(sortColumn);

        if (searchString != null && searchString.startsWith("SIMPLE :")) {
          returnDL.setSearchString(searchString);
          returnDL.search();
        }

        RuleList emptyDL = createEmptyObject(returnDL);
        emptyDL.setTotalNoOfRecords(returnDL.getTotalNoOfRecords());
        emptyDL.setListID(currentListID);
        emptyDL.setListType("Rule");
        emptyDL.setStartAT(returnDL.getStartAT());
        emptyDL.setEndAT(returnDL.getEndAT());

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

      } catch (Exception e) {
        System.out.println("[Exception][MarketingListEJB] Exception thrown in x: " + e);
View Full Code Here

    }
  } // end getRuleList(int,int,int,int,String,String)

  public RuleList getRuleList(int userid, int accountID, DisplayList DLparam)
  {
    RuleList returnDL = null;
    RuleList paramDL = (RuleList)DLparam;

    int listSize = paramDL.getTotalNoOfRecords();
    int startAT = paramDL.getStartAT();
    int EndAt = paramDL.getEndAT();

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

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

    try {
      MailHome home = (MailHome)CVUtility.getHomeObject("com.centraview.mail.MailHome", "Mail");
      Mail remote = (Mail)home.create();
      remote.setDataSource(this.dataSource);
      returnDL = (RuleList)remote.getRuleList(userid, accountID, hm);
    } catch (Exception e) {
      System.out.println("[Exception] ListGenerator.getRuleList: " + e.toString());
      // e.printStackTrace();
    }
    // long currentListID = this.getNextListID();
    // returnDL.setListID(currentListID);
    returnDL.setListType("Rule");
    returnDL.setTotalNoOfRecords(returnDL.size());
    returnDL.setListID(paramDL.getListID());
    returnDL.setStartAT(paramDL.getStartAT());
    returnDL.setEndAT(paramDL.getEndAT());
    returnDL.setSortType(paramDL.getSortType());
    returnDL.setSortMember(paramDL.getSortMember());

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

  /**
   * this method creates empty Object
   */
  public RuleList createEmptyObject(RuleList list)
  {
    RuleList dummy = new RuleList();
    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;
  }
View Full Code Here

    int startat           = startATparam.intValue();
    int endat             = EndAtparam.intValue();
    int begainindex       = Math.max(startat - 100, 1);
    int endindex          = endat + 100;

    RuleList DL           = new RuleList();
    DL.setSortMember(sortmem);
    CVDal cvdl            = new CVDal(dataSource);

    if (searchString == null)
    {
      searchString = "";
    }



    String appendStr      = "";
    if (searchString.startsWith("SIMPLE :"))
    {
      searchString = searchString.substring(8);
      appendStr = " WHERE emailrules.ruleid like '%" + searchString + "%'   OR rulename like '%" + searchString + "%' OR description like  '%" + searchString + "%' OR enabledstatus like  '%" + searchString + "%' ";
    }

  if ((null != searchString) && (searchString.startsWith("ADVANCE:")))
  {
    int searchIndex = (searchString.toUpperCase()).indexOf("WHERE");
    appendStr = " AND "+ searchString.substring((searchIndex+5),searchString.length())+" ";
  }

    if (sorttype == 'A')
    {
      String str  = "Select ruleid , rulename, description , enabledstatus from emailrules ,emailaccount where emailrules.accountid=emailaccount.accountid and emailaccount.owner="+userId+" " + appendStr + " ORDER BY " + sortmem + " LIMIT " + (begainindex - 1) + " , " + (endindex + 1) + ";";
      cvdl.setSqlQuery(str);
    }
    else
    {
      String str1  = "Select ruleid , rulename, description , enabledstatus from emailrules ,emailaccount where emailrules.accountid=emailaccount.accountid and emailaccount.owner="+userId+" " + appendStr + " ORDER BY " + sortmem + " DESC LIMIT " + (begainindex - 1) + " , " + (endindex + 1) + ";";
      cvdl.setSqlQuery(str1);
    }

    Collection v = cvdl.executeQuery();
    cvdl.clearParameters();
    cvdl.destroy();

    Iterator it           = v.iterator();
    TimeZone tz           = TimeZone.getTimeZone("IST");
    int i                 = 0;

    while (it.hasNext())
    {
      i++;
      HashMap hm           = (HashMap) it.next();

      int RuleID           = ((Long) hm.get("ruleid")).intValue();
      IntMember intmem     = new IntMember("RuleID", RuleID, 10, "", 'T', true, 10);
      StringMember one     = new StringMember("RuleName", (String) hm.get("rulename"), 10, "", 'T', true);
      StringMember two     = new StringMember("Description", (String) hm.get("description"), 10, "", 'T', false);
      StringMember three   = new StringMember("EnabledStatus", (String) hm.get("enabledstatus"), 10, "", 'T', false);

      //BooleanMember three= new BooleanMember( "Enabled", true ,10 , "" , 'T' , false ,20  );

      RuleListElement ele  = new RuleListElement(RuleID);

      ele.put("RuleID", intmem);
      ele.put("RuleName", one);
      ele.put("Description", two);
      ele.put("EnabledStatus", three);

      //added by Sameer for generating fixed length sort key from i
      StringBuffer sb      = new StringBuffer("00000000000");
      sb.setLength(11);
      String str           = (new Integer(i)).toString();
      sb.replace((sb.length() - str.length()), (sb.length()), str);
      String newOrd        = sb.toString();

      DL.put(newOrd, ele);
      DL.setTotalNoOfRecords(DL.size());
      DL.setListType("Rule");
      DL.setBeginIndex(begainindex);
      DL.setEndIndex(endindex);
    }
    return DL;
  }
View Full Code Here

  */
  public RuleList getRuleList( int userId, HashMap preference ) throws AuthorizationFailedException
  {
    if(!CVUtility.isModuleVisible("Email",userId, this.dataSource))
      throw new AuthorizationFailedException("Email- getRuleList");
    RuleList  rulelist = null;
    try
    {
      InitialContext ic = CVUtility.getInitialContext();
      EmailLocalHome home = (EmailLocalHome)ic.lookup("local/EmailList");
      EmailLocal remote =  home.create();
View Full Code Here

TOP

Related Classes of com.centraview.email.RuleList

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.