Package java.text

Examples of java.text.SimpleDateFormat$CompiledField


      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
        timeZone = "EST";

      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);


      if(request.getParameter("rowId") != null)
        expenseID = Integer.parseInt((String)request.getParameter("rowId"));
      else
        expenseID = expenseForm.getExpenseID();

      String typeOfOperation = request.getParameter(AccountConstantKeys.TYPEOFOPERATION);

      /*
      Remove item
      */
      if(typeOfOperation != null &&  typeOfOperation.equals("REMOVEITEM") )
      {
        String removeIDs = request.getParameter("removeID");
        StringTokenizer st;
        Iterator itr;
        Vector removeKeys = new Vector();

        itemLines = expenseForm.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)

        expenseForm.setItemLines(itemLines);
        request.setAttribute("expenseform",expenseForm);
      }// end of 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 = (expenseForm).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())
            {
              nextItr = (String)itr.next();
              ListElement ile = (ListElement)IL.get(nextItr);
              IntMember smid = (IntMember)ile.get("ItemID");
              Integer listItemid = (Integer)smid.getMemberValue();

              if ( listItemid.intValue() == intToken )
              {

                StringMember smName = (StringMember)ile.get("Name"); // name = description
                String name = (String) smName.getMemberValue();

                StringMember smSku  = (StringMember) ile.get("SKU");
                String sku = (String)smSku.getMemberValue();
                FloatMember dmprice  = (FloatMember) ile.get("Price");

                float price = Float.parseFloat((dmprice.getMemberValue()).toString());

                int id = ile.getElementID();

                IntMember LineId = new IntMember("LineId",0,'D',"",'T',false,20);
                IntMember ItemId = new IntMember("ItemId",id,'D',"",'T',false,20);
                IntMember  Quantity = new IntMember("Quantity",1,'D',"",'T',false,20);
                FloatMember  PriceEach = new FloatMember("Price",new Float(price),'D',"",'T',false,20);
                StringMember SKU = new StringMember("SKU",sku,'D',"",'T',false);
                StringMember Description = new StringMember("Description",name,'D',"",'T',false);
                FloatMember  PriceExtended = new FloatMember("PriceExtended",new Float(0.0f),'D',"",'T',false,20);

                ItemElement ie = new ItemElement(0);
                ie.put ("LineId",LineId);
                ie.put ("ItemId",ItemId);
                ie.put ("SKU",SKU);
                ie.put ("Description",Description);
                ie.put ("Quantity",Quantity);
                ie.put ("Price",PriceEach);
                ie.put ("PriceExtended",PriceExtended);

                ie.setLineStatus("New");
                counter += 1;
                itemLines.put(new Integer(counter), ie);
                break;
              }// end of if ( listItemid.intValue() == intToken )
            }// end of while (itr.hasNext())
          }// end of while (st.hasMoreTokens())
          expenseForm.setItemLines(itemLines);
        }// end of if(newItemID != null)
        request.setAttribute("expenseform",expenseForm);
      }// end of else if(typeOfOperation != null && typeOfOperation.equals("ADDITEM") )
      else   if (expenseID == 0)
      {

        expenseForm =  (ExpenseForm) form;

        String projectTitle = (String) request.getParameter("projectTitle");
        String projectID = (String) request.getParameter("projectID");
        if(projectTitle != null && !projectTitle.equals("") && !projectTitle.equals("null")){
          expenseForm.setProject(projectTitle);
        }//end of if(projectTitle != null && !projectTitle.equals("") && !projectTitle.equals("null"))
        if(projectID != null && !projectID.equals("") && !projectID.equals("null")){
          expenseForm.setProjectID(projectID);
        }//end of if(projectID != null && !projectID.equals("") && !projectID.equals("null"))

        String opportunityName = (String) request.getParameter("opportunityName");
        String opportunityID = (String) request.getParameter("opportunityID");
        if(opportunityName != null && !opportunityName.equals("") && !opportunityName.equals("null")){
          expenseForm.setOpportunity(opportunityName);
        }//end of if(opportunityName != null && !opportunityName.equals("") && !opportunityName.equals("null"))
        if(opportunityID != null && !opportunityID.equals("") && !opportunityID.equals("null")){
          expenseForm.setOpportunityID(opportunityID);
        }//end of if(opportunityID != null && !opportunityID.equals("") && !opportunityID.equals("null"))

        expenseForm.convertItemLines();
        request.setAttribute("expenseform", expenseForm);
      }// end of else   if (expenseID == 0)
      else if ((request.getParameter("rowId") != null))
      {

        AccountFacade remote =(AccountFacade)accountFacadeHome.create();
        remote.setDataSource(dataSource);

        ExpenseVO expenseVO = remote.getExpenseVO(expenseID,individualID);

        expenseForm.setExpenseID(expenseID);

        expenseForm.setGlAccountID(""+expenseVO.getGlAccountIDValue());

        expenseForm.setStrAmount(""+expenseVO.getAmount());
        expenseForm.setTitle(expenseVO.getTitle());
        expenseForm.setExpenseDescription(expenseVO.getExpenseDescription());

        expenseForm.setEntity(expenseVO.getEntity());
        expenseForm.setEntityID(""+expenseVO.getEntityIDValue());

        java.sql.Date date = expenseVO.getDateEntered();

        expenseForm.setDateEntered(dForm.format(date));

        String expStatus = expenseVO.getStatus();

        if(expStatus.equalsIgnoreCase("Paid"))
          expenseForm.setStatusID(""+1);
View Full Code Here


          ItemElement ie = new ItemElement();
          IntMember     InvoiceId = new IntMember("InvoiceId",invoiceID[i],'D',"",'T',false,20);
          String invNumStr = "";
          StringMember   InvoiceNum = new StringMember("InvoiceNum",invoiceNum[i],'D',"",'T',false);

          DateFormat   df = new SimpleDateFormat("yyyy-mm-dd") ;
          java.util.Date InvoiceDate = new java.util.Date();
          try{
            InvoiceDate = df.parse(invDateStr[i]) ;
          }
          catch (Exception e){
            e.printStackTrace();
          }
          DateMember invoiceDate = new DateMember ("Date",InvoiceDate,10,"",'T',false,1,"EST");
View Full Code Here

            CvFolderVO homeFld = remoteFile.getHomeFolder(individualID);

            int rn = (new Random()).nextInt();
            Calendar c = Calendar.getInstance();
            java.util.Date dt = c.getTime();
            DateFormat df = new SimpleDateFormat("MM_dd_yyyy");
            String dateStamp = df.format(dt);

            CvFileVO flvo = new CvFileVO();
            flvo.setTitle("Print Template_" + rn);
            flvo.setName("Template_" + "_" + rn + "_" + dateStamp + ".html");
            Message[1] = "Template_" + "_" + rn + "_" + dateStamp + ".html";
View Full Code Here

        int attachmentFolderID = attachmentFolderVO.getFolderId();
        int newFileID = -1;

        // somehow create a file using CvFileFacade, and get a CvFileVO from that.
        CvFileVO fileVO = new CvFileVO();
        SimpleDateFormat df = new SimpleDateFormat("MMMM_dd_yyyy_hh_mm_ss_S");
        String prependDate = df.format(new Date());
        fileVO.setName("OriginalMessage_#" + messageID.intValue() + "_" + prependDate + ".html");
        fileVO.setTitle("OriginalMessage_#" + messageID.intValue());
        fileVO.setDescription("");
        fileVO.setFileSize(0.0f);   // float
        fileVO.setVersion("1.0");
View Full Code Here

      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
      timeZone = "EST";
       
      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);
           
      String rowId = request.getParameter("rowId");
      if(rowId == null){
        rowId = (String) request.getAttribute("rowId");
      }
      int invID = Integer.parseInt(rowId);
     
      InventoryForm invenForm =  new InventoryForm();
      InventoryVO inventoryVO = null;
     
      InventoryHome hm = (InventoryHome)CVUtility.getHomeObject("com.centraview.account.inventory.InventoryHome","Inventory");
      Inventory remote =(Inventory)hm.create();
      remote.setDataSource(dataSource);

      inventoryVO = remote.getInventory( individualID ,invID );
     
      ItemVO itemVO = inventoryVO.getItemVO();
     
      if (itemVO != null)
      {
        invenForm.setItemName(itemVO.getItemName());
        String itemid = new String();
        itemid = String.valueOf(itemVO.getItemId());
        invenForm.setItemID(itemid);
      }
     
      EntityVO entityVO = null;
     
      entityVO = inventoryVO.getVendorVO();
      if (entityVO != null)
      {
        invenForm.setVendorName(entityVO.getName());
        invenForm.setVendorID(String.valueOf(entityVO.getContactID()));
      }
     
      entityVO = inventoryVO.getSoldToVO();
      if (entityVO != null)
      {
        invenForm.setSoldToName(entityVO.getName());
        invenForm.setSoldToID(String.valueOf(entityVO.getContactID()));
      }
   
      invenForm.setIdentifier(inventoryVO.getStrIdentifier());
      invenForm.setLocationName(inventoryVO.getStrLocation());
      invenForm.setLocationID(String.valueOf(inventoryVO.getIntLocationID()));
     
      entityVO = inventoryVO.getManufacturerVO();
      if (entityVO != null)
      {
        invenForm.setManufacturer(entityVO.getName());
        invenForm.setManufactureID(String.valueOf(entityVO.getContactID()));
      }
             
      invenForm.setDescription(inventoryVO.getStrDescription());
     
      java.sql.Timestamp timeStamp = (java.sql.Timestamp)inventoryVO.getModified();
      java.sql.Date date = (java.sql.Date)inventoryVO.getCreated();
             
      if(inventoryVO.getCreated()!= null)       
      invenForm.setCreated(dForm.format(date));
     
      if(inventoryVO.getModified() != null)
      invenForm.setModified(dForm.format(timeStamp));
     
      if(inventoryVO.getStrStatus() != null)
      invenForm.setStatus(inventoryVO.getStrStatus());               
     
      invenForm.setStatusID(String.valueOf(inventoryVO.getIntStatusID()));               
View Full Code Here

      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
      timeZone = "EST";
       
      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);
           
      // forward to jsp page
      FORWARD_final = FORWARD_editinventory;

    } catch (Exception e)
View Full Code Here

      String timeZone    = userPref.getTimeZone();
      if(timeZone == null)
      timeZone = "EST";
       
      GregorianCalendar gCal = new GregorianCalendar(TimeZone.getTimeZone(timeZone));
      SimpleDateFormat dForm = new SimpleDateFormat(dateFormat);
      dForm.setCalendar(gCal);
           

      int invID = Integer.parseInt((String)request.getParameter("rowId"));
       
      InventoryForm invenForm =  new InventoryForm();
      InventoryVO inventoryVO = null;
     
      InventoryHome hm = (InventoryHome)CVUtility.getHomeObject("com.centraview.account.inventory.InventoryHome","Inventory");
      Inventory remote =(Inventory)hm.create();
      remote.setDataSource(dataSource);

      inventoryVO = remote.getInventory( individualID ,invID );
     
      ItemVO itemVO = inventoryVO.getItemVO();
     
      if (itemVO != null)
      {
        invenForm.setItemName(itemVO.getItemName());
        String itemid = new String();
        itemid = String.valueOf(itemVO.getItemId());
        invenForm.setItemID(itemid);
      }
     
      EntityVO entityVO = null;
     
      entityVO = inventoryVO.getVendorVO();
      if (entityVO != null)
      {
        invenForm.setVendorName(entityVO.getName());
        invenForm.setVendorID(String.valueOf(entityVO.getContactID()));
      }
     
      entityVO = inventoryVO.getSoldToVO();
      if (entityVO != null)
      {
        invenForm.setSoldToName(entityVO.getName());
        invenForm.setSoldToID(String.valueOf(entityVO.getContactID()));
      }
   
      invenForm.setIdentifier(inventoryVO.getStrIdentifier());
      invenForm.setLocationName(inventoryVO.getStrLocation());
      invenForm.setLocationID(String.valueOf(inventoryVO.getIntLocationID()));
     
      entityVO = inventoryVO.getManufacturerVO();
      if (entityVO != null)
      {
        invenForm.setManufacturer(entityVO.getName());
        invenForm.setManufactureID(String.valueOf(entityVO.getContactID()));
      }
             
      invenForm.setDescription(inventoryVO.getStrDescription());
     
      java.sql.Timestamp timeStamp = (java.sql.Timestamp)inventoryVO.getModified();
      java.sql.Date date = (java.sql.Date)inventoryVO.getCreated();
             
      if(inventoryVO.getCreated()!= null)       
      invenForm.setCreated(dForm.format(date));
     
      if(inventoryVO.getModified() != null)
      invenForm.setModified(dForm.format(timeStamp));
     
      if(inventoryVO.getStrStatus() != null)
      invenForm.setStatus(inventoryVO.getStrStatus());               
     
      invenForm.setStatusID(String.valueOf(inventoryVO.getIntStatusID()));               
View Full Code Here

          int ownerId = (ownerIdObject == null) ? 0 : ownerIdObject.intValue();
          int createdById = (createdByIdObject == null) ? 0 : createdByIdObject.intValue();
          int modifiedById = (modifiedByIdObject == null) ? 0 : modifiedByIdObject.intValue();
          String searchName = (String) searchHashMap.get("SearchName");

          SimpleDateFormat mysqlDateFormat =
            new SimpleDateFormat("yyyy-MM-dd kk:mm:ss");

          searchVO.setSearchID(savedSearchID.intValue());
          searchVO.setName(searchName);
          searchVO.setModuleID(moduleID.intValue());
          searchVO.setOwner(this.getIndividualVO(ownerId));
          searchVO.setOwnerID(ownerId);
          searchVO.setCreatedBy(this.getIndividualVO(createdById));
          searchVO.setCreatedByID(createdById);
          searchVO.setModifiedBy(this.getIndividualVO(modifiedById));
          searchVO.setModifiedByID(modifiedById);

          try {
            String createdDateString = (searchHashMap.get("CreationDate")).toString();
            Date createdDate = mysqlDateFormat.parse(createdDateString);
            searchVO.setCreationDate(createdDate);
          } catch (Exception e) {
            searchVO.setCreationDate(new Date());
          }
          try {
            String modifiedDateString = (searchHashMap.get("ModifiedDate")).toString();
            Date modifiedDate = mysqlDateFormat.parse(modifiedDateString);
            searchVO.setModifiedDate(modifiedDate);
          } catch (Exception e) {
            searchVO.setModifiedDate(new Date());
          }
          searchVO.setSearchCriteria(
View Full Code Here

     *
     * WARNING: "localdateandtime-offset" <br /> means: localdateandtime == GMT - offset
     * @see http://www.w3.org/TR/NOTE-datetime
     */
    public static Date fromDateTime(String dateAsString) throws ParseException {
        SimpleDateFormat df = new SimpleDateFormat(utcDateTimeFormatString);

        if (dateAsString.length() == 19)
            // without Z, assume UTC
            dateAsString += "+0000";
        else if (dateAsString.indexOf(':', 20) > -1)
            //xsd:dateTime
            //Java parser couldn't process hh:mm => copy to hhmm
            dateAsString = dateAsString.substring(0, 22) + dateAsString.substring(23);
        else if (dateAsString.indexOf('Z', 19) > -1)
            //xsd:dateTime
            //Java parser couldn't process the chars if they end with Z
            //-> no offset to UTC
            dateAsString = dateAsString.substring(0, 19) + "+0000";
        else if (dateAsString.length() < 19)
            throw new IllegalArgumentException(
                    "DateTime has to be in the following format:" + utcDateTimeFormatString);

        return df.parse(dateAsString);
    }
View Full Code Here

     * This method reads the specified string as date.
     * The info about the time zone will be neglected (e.g. -07:00).
     */
    public static Date fromLocalDateTime(String dateAsString)
            throws ParseException {
        SimpleDateFormat df = new SimpleDateFormat(localDateTimeFormatString);

        if (dateAsString.length() >= 19)
            dateAsString = dateAsString.substring(0, 19);

        return df.parse(dateAsString);
    }
View Full Code Here

TOP

Related Classes of java.text.SimpleDateFormat$CompiledField

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.