How to add a VO in vector ,Using Vectors and VO

Actully I have to add a Patch in a working live application it is somthing like this:
it having an VO as
ProductVO product_vo=new ProductVO();
this Product VO having all produt i.e. item code here entries.
Vector vectMasterProductName=new Vector();
String product=null;
double sumTotal = 0;
vectMasterProductName=order_dao.getMasterProductNames();// This vectot contains all the products inthe database
now the old code was :
for (Iterator iterator = vectProduct_vo.iterator(); iterator.hasNext();){
     product_vo=(ProductVO)iterator.next();
     sumTotal=sumTotal+product_vo.getLineTotal();
     product = product_vo.getItemCode();
     }//end for
     //System.out.println("Sumtotal:"+sumTotal);
but this was not handling the case when product_vo is populated with the same itemCode more then one time, now we have to add all the quantities together for the same tpe of peoduct.
when I do this as following:
int count=0;double itemNumber = 0;
     for (int i=0;i<vectProduct_vo.size();i++){
          product_vo=(ProductVO)vectProduct_vo.elementAt(i);
if(vectProduct_vo != null){ 
     itemNumber =product_vo.getQuantity();
     sumTotal=sumTotal+product_vo.getLineTotal();
for(int j=i+1;j<vectProduct_vo.size();j++){
     product_vo1=(ProductVO)vectProduct_vo.elementAt(j);
if(product_vo != null && product_vo.getItemCode().equals(product_vo1.getItemCode())){
     itemNumber=itemNumber+product_vo1.getQuantity();
     vectProduct_vo.set(j,null);
vectProduct_vo.removeElement(null);
System.out.println("Itemcode and Quanity "+product_vo.getItemCode()+": " + itemNumber );
count++;
     order_dao.insertProducts(orderID,vectProduct_vo);
It is working fine for the first item in the vector but after that the vector having no values i.e. I am getting nll pointer exception.I need all the values in the vector but in the same manner as I discussed before that same type of item marg together with the quantity.
Please guide me for the same.
Many thanks It is very very urgent now.

yes you are corrct that it is an old approach but my roject required it.
the vector is properly getting values but when I am using the vector.removeElementAt(j) whole vetor is gettiing null value .. after this I am getting null pointer exception. actully this poduct_VO is populaed through XML comming from other system.
ProductVO extends BaseVO{
     private String itemCode;//same as ProductName
     private double quantity;
     private double itemUnitPrice;
     private String itemDescription;
     private double lineTotal;
     private String itemPremiumDiscount;
     private double itemPremiumDiscountAmount;
     private String productIndicator;
and some getter setter methods.
and the code is same as i discussed first.
what I was trying to change the code for multiple values as
for (int i=0;i<vectProduct_vo.size();i++)
product_vo=(ProductVO)vectProduct_vo.elementAt(i);
if(vectProduct_vo != null)
itemNumber =product_vo.getQuantity();
sumTotal=sumTotal+product_vo.getLineTotal();
for(int j=i+1;j<vectProduct_vo.size();j++){
product_vo1=(ProductVO)vectProduct_vo.elementAt(j);
if(product_vo != null && product_vo.getItemCode().equals(product_vo1.getItemCode()))
{                                             itemNumber=itemNumber+product_vo1.getQuantity();
vectProduct_vo.set(j,null);
vectProduct_vo.removeElement(null);
System.out.println("Itemcode and Quanity "+product_vo.getItemCode()+": " + itemNumber );
count++;
and if I am using removeElementAt(j) the outpou is totally diffrent.
The above code is working fine while i am working in a local environment but fales in the project.
Vector is not populted after one element population.
please help me out, I m not getting the exact way.
     order_dao.insertProducts(orderID,vectProduct_vo);

Similar Messages

  • How to add private APN operator profile using Intune and OMA-URI

    Hi
    Is it possible to add to the Windows Phone 8 and 8.1 private APN operator profile using Microsoft Intune and OMA-URI ?
    Thanks
    Maciek
    MNiemczycki

    No, the Enterprise Mobile Device Management client in Windows Phone 8 and 8.1 does not provide access to any CSP for configuring APN operator profile.
    Eric Fleck, Windows Store and Windows Phone Developer Support. If you would like to provide feedback or suggestions for future improvements to the Windows Phone SDK please go to http://wpdev.uservoice.com/ where you can post your suggestions and/or cast
    your votes for existing suggestions.

  • How to add an image over another using af:image

    How to add an image over another using af:image
    Thanks,
    Veera

    i have a image which is black strip. i have added that to af:image
    <af:image source="image1" id="image" />
    on the black strip, i need to add company logo.
    how to achieve it.
    Thanks,
    Veera.

  • How to add target to jmsSystemResource MBean using JMX

    Does anybody know how to add target to jmsSystemResource MBean using JMX in WebLogic 9.0?(I am not using WSLT) I always get "NoSuchMethodException":
              [jmsServer] Caused by: java.lang.NoSuchMethodException: addTarget(weblogic.management.configuration.
              TargetMBean,) for com.bea:Name=admin01DefaultJMSServer,Type=JMSSystemResource

    go to the object which u want to compare
    go to->version management->select the TR request no->and select remote comparision there->and give the system where u need to compare this object
    and next press compare
    hope it will work
    cheer
    s.janagar

  • HT5654 how to add videos to the ipad using the latest version of itunes

    how to add videos to the ipad using the latest version of itunes ?

    Hello zaraa90,
    After reviewing your post, I have located an article that can help with syncing content. It contains a number of troubleshooting steps and helpful advice for the issue you are experiencing:
    Sync your iPhone, iPad and iPod with iTunes using USB
    Thank you for contributing to Apple Support Communities.
    Cheers,
    BobbyD

  • How to add discussions to Collaboration Room using Rooms API

    Hi All,
    How to add discussions to any room using the Rooms API?
    I looked at the NW04s javadocs, but could not find which would help?
    Any pointers will be appreciated.
    Regards,Sandip

    Hi All,
    Any help!
    Any help from SAP? Are the discussion APIs available?
    Any input is appreciated. Thanks
    Regards
    Sandip
    Message was edited by:
            Sandip Agarwal

  • How to add Mac27" to existing home network? and read files on other PC computers (Window7)

    How to add Mac27" to existing home network? and read files on other PC computers (Window7).
    type of connection:
    All computer (PC & Mac) connect to router (ethernet or wireless), then connect to internet.
    condition:
    internet works fine on all computer (PC & Mac).
    existing 4 PC communicate well (share files & printers),
    my problem:
    can NOT add Mac into existing home network.
    I tried SYSTEM PREFERENCES, then NETWORK, then ......... several times
    could not make it work.
    pleas help.

    Ah, it looks like I should have read your title more carefully. Are the  files on the PCs that you want to share with your iMac in a shared folder?
    If not, follow the steps on this page to set up shares from Windows 7.
    If that is already set up, connect to the share from the iMac using this article.

  • How do I close a JInternalFrame when using subclasses and a separate cla...

    The heading should be: How do I close a JInternalFrame when using subclasses and a separate class for the actionListener?
    I have just created a JInternalFrame appclication and now I want to structure up my code. I have a Superclass that contains the usual settings for the two JInternalFrame:s, and the two subclasses with frame specific information. Both the JInternalFrames use the same OK button. I want to have the actionListener outside the classes to avoid repetition of code. But the dispose()-function does not work properly, it does not close the opened JInternalFrame. What�s wrong?
    class Superclass extends JFrame
         JButton b= new JButton("ok");    
         Superclass()
    class Subclass1 extends Superclass
         Subclass1 ()
              add(ok);
           ok.addActionListener(new Listener());
    class Subclass2 extends Superclass
         Subclass2 ()
              add(ok);
           ok.addActionListener(new Listener());
    class Listener extends Superclass implements ActionListener
         public void actionPerformed(ActionEvent e)
                   dispose();
    }How do I controll in the Listener class that the button in Subclass1 is beeing pressed?

    First of all I think I misunderstood your question. You said you had two internal frames, so I thought you wanted to close the internal frame.
    It now looks to me like you want to close the entire JFrame, which makes the code even a little easier. Something like:
    JComponent component = (JComponent)event.getSource();
    JFrame frame = (JFrame)SwingUtilities.windowForComponent( component );
    frame.dispose();
    Ok, I will make a try:
    public static Container getAncestorOfClass(Class c, Component comp)
    w.getAncestorOfClass(w, this); Fiirst you need to learn the basics of reading the API.
    "getAncestorOfClass()" is a static method. That means you don't use a variable to invoke the method. You use the class itself.
    "w" is a variable, which is a JFrame, but that is not what the first parameter should be. The first parameter is a "Class".
    "this" will refer to your Listener class, but you need the Component that generated the ActionEvent.
    When I thought you wanted to close an internal frame then the code would have been something like:
    JComponent component = (JComponent)event.getSource();
    Container container = SwingUtilities.getAncesterOfClass( JInternalFrame.class, component );
    JInternalFrame internalFrame = (JInternalFrame)container;
    internalFrame.invokeSomeMethodHere();If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
    http://homepage1.nifty.com/algafield/sscce.html

  • I need to know how I will create a dynamic website using php and mysql

    I need to know how will I create a dynamic website using php and mysql that people could have the abilities of registering in the website, and modify their profile where they can add their pictures and everything. apart from that, they should have the ability to search about other member. hope to here more from you.

    If you are a right-brained creative, and have no previous experience or propensity to be able to understand coding and database "stuff", and/or if your time can be better spent on other skills, I recommend you save your sanity and hire a developer... or at least the first time around. I have been attempting to grasp this for years... and have a library of marked up books to prove my efforts, all while trying to keep up with an ongoing client base that is always cramped. It's a wonder I still have my sanity... then again, I might not be the best person to determine that. Others might question it.
    That said, I still plan to master php... one of these days.

  • I know how to add lyrics to a song in iTunes and then see them on my iPod. But now I'm interested in watching those lyrics on my windows pc...can I and how do I do that ?

    I know how to add lyrics to a song in iTunes and then see them on my iPod. But now I'm interested in watching those lyrics on my windows pc...can I ? What do I do so than I can see the lyrics of the song while it plays ?

    This is the correct behavior. When you play a song, the play count and last played time gets updated. When you resync the iPod, the track gets copied to the iPod to update these new changed fields.
    There is no fix for this, this is what it is supposed to do.

  • How to add URLs in apage without using edit mode

    Hello everybody.
    We have Portal 9.0.4.1 under Solaris, and we are just beggining using it :-)
    We created a section for links (to urls) in the home page of each user. We would like our users to add links to their most used pages (for example, metalink.oracle.com), but we do not want them to enter in edit mode, we would like some functionallity like the "add portlet" in the customize option.
    Any help will be very apreciated.
    Thanks in advance.
    Lisandro

    The example is generic and not hardcoded to any region on the page ... but has the same "warning" that Mark mentioned about this example not working in future versions if Oracle changes the URL structure:
    The Add Item example shows how to create a new item type ...adding an item of this type to any region allows you to add content to that region
    The Edit Item example show how to show a edit link or icon next to the item in view mode.
    Add Item
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    This code sample shows how to create an item allows the content contributor to add items to the page group/page/region that the sample item is placed in.
    If you want your content contributor to add items to multiple regions on a page, add the sample item to all regions that you wish to expose this functionality in.
    Step 1: Create a PL/SQL procedure
    Create the following procedure:
    Create or Replace Procedure <schema>.ADDITEM_URL
    p_itemid IN VARCHAR2,
    p_pageid IN VARCHAR2,
    p_siteid IN VARCHAR2)
    as
    v_url varchar2(2000);
    v_region varchar2(2000);
    v_looplink varchar2(2000);
    v_host varchar2(2000);
    begin
    select folder_region_id into v_region
    from portal.wwsbr_all_items
    where id = p_itemid and
    caid = p_siteid;
    if instr(portal.wwctx_api.get_host, ':') = 0 then
    v_host := portal.wwctx_api.get_host;
    else
    v_host := substr(portal.wwctx_api.get_host,
    1,
    (instr(portal.wwctx_api.get_host, ':')-1))
    || '%3A'
    || substr(portal.wwctx_api.get_host,
    (instr(portal.wwctx_api.get_host, ':')+1));
    end if;
    v_looplink := 'http%3A%2F%2F'
    || v_host
    || '%2Fportal%2Fpage%3F_pageid%3D'
    || p_siteid
    || '%2C'
    || p_pageid
    || '%26_dad%3D'
    || portal.wwctx_api.get_dad_name
    || '%26_schema%3D'
    || portal.wwctx_api.get_product_schema
    || '&p_containerpageid='
    || p_pageid;
    v_url := portal.wwctx_api.get_base_url
    || 'portal.wwv_additem.selectitemtype?'
    || 'p_cornerid=' || p_pageid
    || '&p_siteid=' || p_siteid
    || '&p_regionid=' || v_region
    || '&p_looplink=' || v_looplink;
    htp.p('<a href="' || v_url || "><img src="/images/additem.gif"</a>');
    exception
    when others then
    htp.p('error');
    end;
    Once the procedure has been created, grant EXECUTE permission to PUBLIC.
    Step 2: Create a custom item type
    This custom item type will be associated with the PL/SQL procedure created above. Placing an item of this type on a page will give the content contributor something to click on while the page is in view mode to call the add item wizard.
    Go to the Procedures tab of the new item type and associate with PL/SQL procedure.
    Ensure the “Display Procedure Results With Item” checkbox is checked.
    Step 3: Add item of type “Add_Item” to a page.
    1.     Configure the Page Group to allow items of your new type to be added
    2.     Add an item of type “add_item” to your page.
    3.     For the region containing your new item, in the properties, ensure the “Associated Functions” attribute is in the Displayed Attributes list.
    Edit Item
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    This code sample draws an Edit icon for content contributors to click on while the page is in view mode to edit the item with the default Edit Item wizard.
    Step 1: Create a PL/SQL procedure
    Create or Replace Procedure <schema>.EDITITEM_URL
    p_itemid IN VARCHAR2,
    p_pageid IN VARCHAR2,
    p_siteid IN VARCHAR2)
    as
    v_looplink varchar2(2000);
    v_url varchar2(2000);
    v_subtype varchar2(2000);
    v_itemtype varchar2(2000);
    v_catid varchar2(2000);
    v_catcaid varchar2(2000);
    v_parentid varchar2(2000);
    v_host varchar2(2000);
    begin
    select subtype
    ,itemtype
    ,category_id
    ,category_caid
    ,parent_item_id
    into v_subtype
    ,v_itemtype
    ,v_catid
    ,v_catcaid
    ,v_parentid
    from portal.wwsbr_all_items
    where id = p_itemid and
    caid = p_siteid;
    if instr(portal.wwctx_api.get_host, ':') = 0 then
    v_host := portal.wwctx_api.get_host;
    else
    v_host := substr(portal.wwctx_api.get_host,
    1,
    (instr(portal.wwctx_api.get_host, ':')-1))
    || '%3A'
    || substr(portal.wwctx_api.get_host,
    (instr(portal.wwctx_api.get_host, ':')+1));
    end if;
    v_looplink := 'http%3A%2F%2F'
    || v_host
    || '%2Fportal%2Fpage%3F_pageid%3D'
    || p_siteid
    || '%2C'
    || p_pageid
    || '%26_dad%3D'
    || portal.wwctx_api.get_dad_name
    || '%26_schema%3D'
    || portal.wwctx_api.get_product_schema
    || '&p_containerpageid='
    || p_pageid;
    v_url := portal.wwctx_api.get_base_url
    || 'portal.wwv_edit_tab.edititem?'
    || 'p_thingid=' || p_itemid
    || '&p_cornerid=' || p_pageid
    || '&p_siteid=' || p_siteid
    || '&p_subtype=' || v_subtype
    || '&p_itemtype=' || v_itemtype
    || '&p_topicid=' || v_catid
    || '&p_topicsiteid=' || v_catcaid
    || '&p_cornerlinkid='
    || '&p_parentid=' || v_parentid
    || '&p_action=update'
    || '&p_currcornerid=' || p_pageid
    || '&p_language='
    || portal.wwctx_api.get_nls_language
    || '&p_looplink=' || v_looplink;
    htp.p('<a href="' || v_url || "><img src="/images/ed-item.gif"</a>');
    exception
    when others then
    null;
    end;
    Step 2: Associate Procedure with Item Types
    For every item type that you wish to supply an edit icon to show while the page is in view mode, call the EDITITEM_URL procedure created in the step above.
    Step 3: Show Associated Function attribute
    In order for the procedure associated with the item type to execute, you must ensure the region properties are set on the Style/Attributes tab have the Associated Function listed as one of the Displayed Attributes.

  • How to add phone number to MBP using Mtn Lion OS X 10.8.3

    I have Ipad , Iphone 4s and a mbp using the OS 10.8.3
    I have no idea of how to add my phone number to the list of available options to send iMessages from my MBP.
    I only have emails.
    Any suggestions..
    Thanks in advance.

    Hi,
    The presumption in the Linked article is that the Apple ID has been added to the iPhone before it is added elsewhere including the Mac version.
    If you have not already done so then add the ID to the iPhone.
    If after a few minutes the Mac version has not had the pop to say the iPhone is using it's Number and the Apple ID then restart the app on the Mac.
    7:58 PM      Saturday; March 30, 2013
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.3)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • How to add language to a 9780 using Mac desktop software

    Hi, I recently updated my Bold 9780 on Mac and the updated deleted all my languages, I need to know, how to add language using mac desktop software.

    Hello hjmatias and welcome to the BlackBerry Support Community Forums.
    You can use the Desktop Software for Mac, available for download at www.blackberry.com/mac to install additional languages.
    Here is an article from the BlackBerry Technical Solution Center that will take you through the steps to add applications: KB19937
    -HMthePirate
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • How to add HD & rating icon for use on ATV2

    I have a few movies in my library that have an "HD" icon and a rating icon (PG-13, R etc). Some movies do not have this and while I am converting mine from MKV format to M4V was wondering how I could add these, as well as a description and genre to the file (rather than manually using, "get info").
    Any ideas?

    No ideas anyone?

  • How to add fragment in jsf page using include tag in jdeveloper

    Hi all
    Can you tell me wat is syntax of using include tag .or how to add fragment in jsf page ..
    Edited by: 947228 on Jul 18, 2012 5:01 AM

    Hi,
    Why do you want to do that?
    Check [url https://blogs.oracle.com/jheadstart/entry/avoid_use_of_jspinclude_where]this out before proceeding further.
    Btw, always mention your JDev version, clear usecase to get help.
    -Arun

  • How to add a barcode font for use in Web Intelligence (WebI) XIR2 and 3x?

    Anyone have the steps to add a barcode font to WebI XIR2 and 3x?  Not finding a good KBase on it and was also wondering if there any "gotchas" in terms of printing and exporting to .pdf.
    Thanks.

    Hi Kevin,
    Also, if the solution provided in the previous post doesn't helps you then try the following solution.
    Following are the steps to apply barcode font (IDAutomationHC39M):
    1) In Windows Explorer, browse to the following folder:
    -- C:\Windows\Fonts
    2) On the File menu click Install New Font then browse to the font you want to install.
    3) Edit the properties on the fonts you have just added:
    In the "Embedding" tab, you should get a property like "Preview & Print embedding allowed".
    But, nothing related to a license limitation regarding the embedding, else, you will not be allowed to use the added fonts in PDF or XLS generation.
    4) Once the above points have been done:
    -- Copy the .ttf fonts you want to use in the following XIR2 folder:
    <BO_INSTALL_DIR>\Business Objects\j2sdk1.4.2_08\jre\lib\fonts
    5) Add the following entries into the fontalias.xml file, which is in the following folder:
    <BO_INSTALL_DIR>\Business Objects\BusinessObjects Enterprise 11.5\win32_x86\fonts
    The template looks like the following one:
    <FONT NAME="IDAutomationHC39M">
    <FONTFAMILY PLATFORM="ttf" NAME="IDAutomationHC39M (IDAutomationHC39M)">
    <FONTATTRIBUTE BOLD="false" ITALIC="false" LOGICAL="IDAutomationHC39M" PHYSICAL="IDAutomationHC39M.ttf"/>
    </FONTFAMILY>
    <FONTFAMILY PLATFORM="win" NAME="IDAutomationHC39M"/>
    <FONTFAMILY PLATFORM="java" NAME="IDAutomationHC39M"/>
    <FONTFAMILY PLATFORM="html" NAME="IDAutomationHC39M"/>
    </FONT>
    6) Add the following entries into the u2018i18n.xmlu2019 file, which is in the following folder:
    <BO_INSTALL_DIR>\Business Objects\BusinessObjects Enterprise 11.5\win32_x86\scripts
    You have different sections in this i81n.xml file.
    -- Under the first section
    <I18N>
    <FontFinder>
    <font key=u201DIDAutomationHC39Mu201D value=u201DIDAutomationHC39Mu201D/>
    u2026u2026u2026u2026u2026u2026u2026u2026u2026..
    </ FontFinder>
    < FontFinder2>
    <font key=u201DIDAutomationHC39Mu201D value=u201DIDAutomationHC39Mu201D/>
    u2026u2026u2026u2026u2026u2026u2026u2026u2026..
    </ FontFinder2>
    -- Under the u2018font_aliasingu2019 section
    <font_aliasing>
    <T1>
    u2026u2026u2026u2026.
    </T1>
    <TTF>
    u2026..
    <font name=u201DIDAutomationHC39Mu201D>
    <os type=u201Dallu201D>
    <Attributs style=u201D0u201D filename=u201DIDAutomationHC39M.ttfu201D encoding=u201Du201D aliaspsname =u201CIDAutomationHC39Mu201D/>
    u2026
    </os>
    </TTF>
    7) Save the both files.
    8) Restart the Businessobjects servers or local computer.
    9) Login in to infoview and create a new web intelligence report by using the Java Report Panel or Html Report Panel;
    10) In the left pane, select the "Cell Format Properties": you will notice that an entry "IDAutomationHC39M" has been added into the font dropdown list.
    Just test the above u2018IDAutomationHC39Mu2019 barcode font, at your end and update me with the results.
    Regards,
    Sarbhjeet Kaur

Maybe you are looking for