Package java.util

Examples of java.util.StringTokenizer


        request.setAttribute(AccountConstantKeys.TYPEOFOPERATION,"ShowPurchaseOrder");
      }//end of if ( typeOfOperation != null &&  typeOfOperation.equals("ShowPurchaseOrder"))
      else if ( typeOfOperation != null && typeOfOperation.equals("REMOVEITEM") )
      {
        String removeIDs = request.getParameter("removeID");
        StringTokenizer st;
        Iterator itr;
        Vector removeKeys = new Vector();

        itemLines = ((PurchaseOrderForm)form).getItemLines();
        if (itemLines != null)
        {
          st = new StringTokenizer(removeIDs, ",");
          while (st.hasMoreTokens())
          {
            String str = st.nextToken();
            int removeToken = Integer.parseInt(str);

            itr = itemLines.keySet().iterator();
            while (itr.hasNext())
            {
              Object obj = itr.next();
              ItemElement ILE = (ItemElement)itemLines.get(obj);
              IntMember ItemId = (IntMember)ILE.get("ItemId");
              Integer currItemId = (Integer)ItemId.getMemberValue();
              if ( currItemId.intValue() == removeToken)
              {
                String status = ILE.getLineStatus();
                if (status.equals("Active"))
                {
                  ILE.setLineStatus("Deleted");
                }//end of if (status.equals("Active"))
                else if (status.equals("New"))
                {
                  removeKeys.add(obj);
                }// end of else if (status.equals("New"))
              }//end of if ( currItemId.intValue() == removeToken)
            }//end of while (itr.hasNext())
          }//end of while (st.hasMoreTokens())

          for(int i=0; i<removeKeys.size(); i++)
          {
            itemLines.remove(removeKeys.get(i));
          }// end of for(int i=0; i<removeKeys.size(); i++)
        }// end of if (itemLines != null)

        ((PurchaseOrderForm)form).setItemLines(itemLines);
        request.setAttribute(AccountConstantKeys.TYPEOFOPERATION,"REMOVEITEM");
      }//end of else if ( typeOfOperation != null && typeOfOperation.equals("REMOVEITEM") )
      /*ADD item*/
      else if ( typeOfOperation != null && typeOfOperation.equals("ADDITEM") )
      {

        String newItemID = request.getParameter("theitemid");
        ItemList IL = null ;
        ListGenerator lg = ListGenerator.getListGenerator(dataSource);//get the List Generator object for Listing
        IL = (ItemList )lg.getItemList( individualID , 1, 10 , "" , "ItemID");//called when the request for the list is for first time

        StringTokenizer st;
        String token, nextItr;

        if (newItemID != null)
        {
          st = new StringTokenizer(newItemID, ",");
          itemLines = ((PurchaseOrderForm)form).getItemLines();

          if(itemLines == null)
          itemLines = new ItemLines();
          int counter = itemLines.size();
          while (st.hasMoreTokens())
          {
            token   = (String)st.nextToken();
            int intToken = Integer.parseInt(token);

            Iterator itr = IL.keySet().iterator();
            while (itr.hasNext())
            {
View Full Code Here


        }*/
        //System.out.println("strLiteratureId[0] :: "+strLiteratureId[0]);

        if (!strLiteratureId.equals(""))
        {
          StringTokenizer stid = new StringTokenizer(strLiteratureId,",");
          StringTokenizer stName = new StringTokenizer(names,",");
          String strId = "";
          String strName = "";
          while(stid.hasMoreTokens())
          {
            strId = stid.nextToken();
            strName = stName.nextToken();
            if (!strId.equals("")){
              int id = Integer.parseInt(strId);
              literaturenamevec.add(new DDNameValue(id,strName));
            }
          }
View Full Code Here

    //to
    ArrayList toarray = new ArrayList();
    String to  = (String) dynaForm.get( "composeTo" );

    StringTokenizer st = new StringTokenizer( to , "," );
    while ( st.hasMoreTokens())
    {
      toarray.add( new MailAddress( st.nextToken() ) );
    }
    mailMessage.setTo( toarray );


    //cc
    ArrayList ccarray = new ArrayList();
    String cc = (String) dynaForm.get( "composeCc" );

    StringTokenizer stcc = new StringTokenizer( cc , "," );
    while ( stcc.hasMoreTokens())
    {
      ccarray.add(new MailAddressstcc.nextToken()  ) );
    }
    mailMessage.setCc( ccarray );

    //bcc
    ArrayList bccarray = new ArrayList();
    String bcc = (String ) dynaForm.get( "composeBcc" );

    StringTokenizer stbcc = new StringTokenizer( bcc , "," );
    while ( stbcc.hasMoreTokens())
    {
      bccarray.add( new MailAddress( stbcc.nextToken() ) );
    }
    mailMessage.setBcc(bccarray);

    //message subject
    String subject = (String) dynaForm.get( "composeSubject" );
View Full Code Here

        request.setAttribute("ItemLines",of.getItemLines());
      }
     
      if (typeOfOperation != null && typeOfOperation.equals("REMOVEITEM")) {
        String removeIDs = request.getParameter("removeID");
        StringTokenizer st;
        Iterator itr;
        Vector removeKeys = new Vector();
       
        ((OrderForm)form).convertArrayToItemLines();
        ((OrderForm)form).convertFormbeanToValueObject("edit");
       
        ItemLines itemLines = ((OrderForm)form).getItemLines();
        if (itemLines != null) {
          st = new StringTokenizer(removeIDs, ",");
          while (st.hasMoreTokens()) {
            String str = st.nextToken();
            int removeToken = Integer.parseInt(str);
           
            itr = itemLines.keySet().iterator();
            while (itr.hasNext()) {
              Object obj = itr.next();
              ItemElement ILE = (ItemElement)itemLines.get(obj);
              IntMember ItemId = (IntMember)ILE.get("ItemId");
              Integer currItemId = (Integer)ItemId.getMemberValue();
              if (currItemId.intValue() == removeToken) {
                String status = ILE.getLineStatus();
                if (status.equals("Active")) {
                  ILE.setLineStatus("Deleted");
                } else if (status.equals("New")) {
                  removeKeys.add(obj);
                }
              }
            }
          }   // end while (st.hasMoreTokens())
         
          for (int i = 0; i < removeKeys.size(); i++) {
            itemLines.remove(removeKeys.get(i));
          }
        }
       
        ((OrderForm)form).setJurisdictionVec(taxJurisdiction);
        ((OrderForm)form).setItemLines(itemLines);
        request.setAttribute("ItemLines",itemLines);
      }
     
      if (typeOfOperation != null && typeOfOperation.equals("ADDITEM")) {
        String newItemID = request.getParameter("theitemid");
        ItemList IL = null;
        ListGenerator lg = ListGenerator.getListGenerator(dataSource);
        IL = (ItemList)lg.getItemList(individualID, 1, 10, "", "ItemID");
       
        OrderForm orderForm = (OrderForm)form;
        orderForm.convertArrayToItemLines();
        orderForm.convertFormbeanToValueObject("edit");
       
        StringTokenizer st;
        String token, nextItr;
       
        if (newItemID != null) {
          st = new StringTokenizer(newItemID, ",");
          ItemLines itemLines = (orderForm).getItemLines();
          Integer intJurisdictionID = (orderForm).getJurisdictionID();
          int jurisdictionID = intJurisdictionID.intValue();
         
          if (itemLines == null) {
            itemLines = new ItemLines();
          }
          int counter = itemLines.size();
         
          while (st.hasMoreTokens()) {
            token = (String)st.nextToken();
            int intToken = Integer.parseInt(token);
           
            Iterator itr = IL.keySet().iterator();
            while (itr.hasNext()) {
              nextItr = (String)itr.next();
View Full Code Here

      Object ret = null;
      Method method = null;
      String value = "";
      Class classCV[] = new Class[1];

      StringTokenizer st;
      String tmp = "";
      String tmpXML = "";
      String className = getValueOfNodeByTagName(configXML, TAG_VONAME);
      classCV[0] = Class.forName(className);

      Node met = null;
      NodeList listItem = configXML.getChildNodes();

      int length = listItem.getLength();

      for (int i = 0; i < length; i++)
      {

        tagName = listItem.item(i).getNodeName();

        if (tagName.equals("#text") || !listItem.item(i).hasAttributes())
          continue;

        NamedNodeMap attr = listItem.item(i).getAttributes();

        if (attr.getNamedItem("cvtoaa") != null)
        {
          tmpXML = getAAfromCV(objectCV, attr, classCV, tagName);

          if (!tmpXML.trim().equals(""))
            xml += tmpXML;

          continue;
        }

        if (attr.getNamedItem("xml") != null)
        {
          configForQBXML = getDocumentFromString(getDocumentFromString(attr.getNamedItem("xml").getNodeValue()).getElementsByTagName(attr.getNamedItem("tag").getNodeValue()).item(0).toString());

          tmpXML = forwardXML(classCV, attr, objectCV, className, configForQBXML);

          if (!tmpXML.trim().equals(""))
            xml += "<" + tagName + ">" + tmpXML + "</" + tagName + "> \n";

          continue;
        }
        met = attr.getNamedItem("get");
        method = classCV[0].getMethod(met.getNodeValue(), null);
        ret = method.invoke(objectCV, null);

        if (ret != null)
        {
          value = ret.toString();
          if (met.getNodeValue().equalsIgnoreCase("getExternalID"))
          {
            xml += "<" + tagName + ">" + value + "</" + tagName + "> \n";
            xml += "<EditSequence>" + hm.get(value) + "</EditSequence> \n";

            continue;
          }
        } else
          continue;

        if (value.equals(""))
          continue;

        if (tagName.equals("OpenBalance"))
        {
          st = new StringTokenizer(value, ".");

          value = st.nextToken();
          if (!st.hasMoreElements())
            value += ".00";
          else
          {
            tmp = st.nextToken();
            if (tmp.length() < 2)
              tmp += "0";
            value += "." + tmp;
          }
        }
View Full Code Here

      value = value.substring(0, 19);

      return Timestamp.valueOf(value);
    } else if (className.equals("int") || className.equals("java.lang.Integer"))
    {
      StringTokenizer st = new StringTokenizer(value, ".");
      value = st.nextToken();
      return new Integer(value);
    } else if (className.equals("boolean") || className.equals("java.lang.Boolean"))
    {
      return new Boolean(value);
    } else if (className.equals("double") || className.equals("java.lang.Double"))
    {
      StringTokenizer st = new StringTokenizer(value, ",");
      value = st.nextToken();

      if (st.hasMoreElements())
        value += st.nextToken();

      return new Double(value);
    } else if (className.equals("float") || className.equals("java.lang.Float"))
    {
      StringTokenizer st = new StringTokenizer(value, ",");
      value = st.nextToken();

      if (st.hasMoreElements())
        value += st.nextToken();

      return new Float(value);
    }

    else if (className.equals("java.sql.Date"))
    {
      java.sql.Date date = java.sql.Date.valueOf(value);
      return new java.sql.Date(date.getYear() + 1900, date.getMonth(), date.getDate());
    } else if (className.equals("java.util.Date"))
    {
      value = value.replace('T', ' ');
      value = value.replace('+', ' ');
      value = value.substring(0, 19);

      return new java.util.Date(Timestamp.valueOf(value).getTime());
    } else if (className.equals("long") || className.equals("java.lang.Long"))
    {
      StringTokenizer st = new StringTokenizer(value, ",");
      value = st.nextToken();

      if (st.hasMoreElements())
        value += st.nextToken();

      return new Long(value);
    }

    return value;
View Full Code Here

   */
  public String getTagsFromValue(String value)
  {
    String qbTags = "";

    StringTokenizer st = new StringTokenizer(value, ",");

    int i = 0;
    String temp = "";
    while (st.hasMoreTokens())
    {
      temp = (String)st.nextToken();

      if (i == 0 && temp.length() != 0)
        qbTags = qbTags + "<Addr1>" + temp + "</Addr1>";
      else if (i == 1 && temp.length() != 0)
        qbTags = qbTags + "<Addr2>" + temp + "</Addr2>";
View Full Code Here

      else
      {
        strIndividualId = (String) request.getParameter("Individualid");
      }

      StringTokenizer st = new StringTokenizer(strIndividualId, ",");

      String[] strIndividuals = new String[st.countTokens()];
      int count = 0;

      while (st.hasMoreTokens())
      {
        strIndividuals[count] = st.nextToken();
        count++;
      }

      // call ejb to insert record
      // initialize hashmap
View Full Code Here

          othTableNames = othTableNames +" , "+ othName;
           
        }
        clause = clause + " ) ";
      }
      StringTokenizer parse = new StringTokenizer(othTableNames, ",");

      while (parse.hasMoreTokens ())
      {
         tableSet.add(parse.nextToken().toString());
      }
 
     
      searchClause = searchClause +" "+clause;
      pop1 = pop2;     
View Full Code Here

  private Vector getDate(String sfromDate)
  {
    Vector vecDate1 = new Vector();
    Vector vecDate2 = new Vector();
    Vector vecFin = new Vector();
    StringTokenizer stok1 = new StringTokenizer(sfromDate, ",");

    while (stok1.hasMoreTokens())
    {
      String sToken = stok1.nextToken();
      vecDate1.add(sToken);
    }

    String stok2 = (String) vecDate1.get(0);
    StringTokenizer sTokens1 = new StringTokenizer(stok2, " ");

    while (sTokens1.hasMoreTokens())
    {
      String sToken = sTokens1.nextToken();
      vecDate2.add(sToken.trim());
    }

    vecFin.add(getMonth(vecDate2.get(0))); //month
    vecFin.add(vecDate2.get(1)); //day
View Full Code Here

TOP

Related Classes of java.util.StringTokenizer

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.