Referencing another class with multiple types.

Here's my code:
import java.io.*;
import java.util.Scanner;
class CH3_13
    public static void main ( String args[] )
        Scanner input = new Scanner( System.in );
     // Invoice MyInvoice = new Invoice();
     /* myInvoice.displayInvoice();*/   }   
class Invoice
{   private String partNumber;
    private String partDescription;
    int quantity;
    double pricePerItem;
    public Invoice( String pNumber, String description, int qNumber, double price)
        partNumber = pNumber;
        partDescription = description;
        setQuantity( qNumber );
        setPricePerItem ( price );   }
      public void setPartNumber ( String pNumber )
      {   partNumber = pNumber;   }
      public String getPartNumber ()
      {   return partNumber;   }
      public void setPartDescription ( String description )
      {   partDescription = description;   }
      public String getPartDescription ()
      {   return partDescription;   }
      public void setQuantity ( int qNumber )
      {   quantity = ( qNumber < 0 ) ? 0 : qNumber;   }
      public int getQuantity ()
      {   return quantity;   }
      public void setPricePerItem ( double price )
      {   pricePerItem = ( price < 0.0) ? 0.0 : price;   }
      public double getPricePerItem ()
      {   return pricePerItem;   }
      public double getInvoiceAmount()
      {   return getQuantity() * getPricePerItem();   }
       public void displayInvoice ()
      {   System.out.println("The part number is" + getPartNumber() );
          System.out.println("The part description is" + getPartDescription() );
          System.out.println("The quantity number is" + getQuantity() );
          System.out.println("The price per item is" + getPricePerItem() );
          System.out.println("The invoice amount is" + getInvoiceAmount() );   }          
}The problem is.. I cannot use the line:
// Invoice MyInvoice = new Invoice(); (it's commented out for that reason)
... because it seems I cannot reference it because the Invoice class has multiple types defined in it. As this is the case, is there anyway, I'd be able to get that line to compile?

I am not sure of this is what you are looking for but I would definitely suggest some real refactoring here. First of all the part no. name description donot belong to the invoice class so they need to go into a different class named part no. Secondly you need to identify the relationship which I would say would be has a relationship between invoice and part. A many to many relationship. SInce its many to many I would guess it would need to be biderectional associaition.
However if we have a defined no. of parts in the inventory I would suggest using the reference objects, by predefining them and loading them into memory to ensure that if every time an invoice has a part, a new part object is not created.

Similar Messages

  • FecthAccounts on resources with multiple types of accounts

    Hello,
    I'm customizing the rename user form so I can modify some account attributes that are related to
    accountId and rename them in a propper way. For getting all account attributes on all resources I set
    fetchAccounts form property to true but only attributes on resources whose identity template is
    simple - It's not a resource with multiple types of accounts - are retrieved.
    The attributes of the resource with a setup of multiple types of accounts are not retrieved with fecthAccounts
    set to true. Has that happened to you ?
    Any clue ?
    Thanks,
    Pablo C.

    You can use Correlation Id for this Purpose. Producer should set Correlation id while posting the message and Consumer can check for Correlation id while dequeue.
    I did have this requirement before and used correlation id for it.
    http://sriworks.wordpress.com/2009/10/22/conditional-dequeue-mq-adapter/
    Or Just Accept Opaque Payload and tweak in BPEL Process using TranslateFromNative function.

  • .How to instantiate the innerclass from another class with coded eg.

    How to instantiate the innerclass from another class(both for static & non static) please give me an eg with coding.

    It's just a preference, but I like writing factory methods:
    public class Outer {
        public class Inner {}
        public static class StaticInner {}
        public Inner innerInstance() {
            return new Inner();
        public static StaticInner staticInnerInstance() {
            return new StaticInner();
        public static void main(String[] args) {
            Outer.StaticInner si = Outer.staticInnerInstance();
            Outer outer = new Outer();
            Outer.Inner i = outer.innerInstance();
    }Often, for me, the inner class implements an interface, and the factory method
    lets you hide the implementation class:
    public class Outer {
        private class Inner implements Runnable {
            public void run() {}
        public Runnable runnerInstance() {
            return new Inner();
        public static void main(String[] args) {
            Outer outer = new Outer();
            Runnable r = outer.runnerInstance();
    }

  • Vectors with multiple types of objects

    Ok, this is what i need. I have a main class, EquationVector, and i have four smaller classes, MathPrimitive, which is abstract and all of the following classes extend, Number which just holds numbers, Operator which takes care of what type it is and what to do, and Variable, which knows its value, its coef and its power. I use the MathPrimitive class because all of the other classes need to have a common getType() method, plus it holds static values for all the possible types. What i need is some sort of storage method that is dynamically resizeable, and can handle multiple types of objects. I tried vector, but it doesnt work, even when i cast. I want to be able to do something to the effect of
    myArray.elementAt(index).getOperatorType()
    and be able to get the operator type if its an operator, but at the same time be able to do
    myArray.elementAt(index).getCoef()
    and be able to get the coeficient if its a variable. I'm not sure if this is actually possible, so if anybody has any good ideas i would be really apreciative. Thank you.

    Vector will absolutely work, as will ArrayList
    You just better make sure you know what kind of objects are at what slots in the vector.
    opType = ((MathPrimitive) myArray.elementAt(index)).getOperatorType();
    If you don't know what type of object is at a particular slot you can always use
    Object o = myArray.elementAt(index);
    if (o instanceof MathPrimitive)
    else
    ....

  • "Get All Descendents" Method with multiple "Type" inputs

    Hi,
    Is there any way, so that I can specify multiple "Type" to Get All Descendents Method invoke node.
    For example if I need to get all descendents of "Folder" and "VI" type.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

    Try "(VI,Folder)" and post back please
    No help..!!
    @ tst
    Call it twice.
    That option I had figured out, but I need the references of All Descendents (Folders and VIs) in the order of they appear in the project.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • Need help with generic class with comparable type

    Hi. I'm at University, and I have some coursework to do on writing a generic class which offers ordered binary trees of items which implement the comparable interface.
    I cant get the code to compile which I have written.
    I get the error: OBTComparable.java uses unchecked or unsafe operations
    this is the more detailed information of the error when I compile with -Xlint:unchecked
    OBTComparable.java:62: warning: [unchecked] unchecked call to insert(OBTType) as
    a member of the raw type OBTComparable
    left.insert(insertValue);
    ^
    OBTComparable.java:64: warning: [unchecked] unchecked call to insert(OBTType) as
    a member of the raw type OBTComparable
    right.insert(insertValue);
    ^
    OBTComparable.java:75: warning: [unchecked] unchecked call to find(OBTType) as a
    member of the raw type OBTComparable
    return left.find(findValue);
    ^
    OBTComparable.java:77: warning: [unchecked] unchecked call to find(OBTType) as a
    member of the raw type OBTComparable
    return right.find(findValue);
    ^
    and here is my code for the class
    public class OBTComparable<OBTType extends Comparable<OBTType>>
      // A tree is either empty or not
      private boolean empty;
      // If the tree is not empty then it has
      // a value, a left and a right.
      // These are not used it empty == true
      private OBTType value;
      private OBTComparable left;
      private OBTComparable right;
      // Create an empty tree.
      public OBTComparable()
        setEmpty();
      } // OBTComparable
      // Make this tree into an empty tree.
      private void setEmpty()
        empty = true;
        value = null; // arbitrary
        left = null;
        right = null;
      } // setEmpty
      // See if this is an empty (Sub)tree.
      public boolean isEmpty()
      { return empty; }
      // Get the value which is here.
      public OBTType getValue()
      { return value; }
      // Get the left sub-tree.
      public OBTComparable getLeft()
      { return left; }
      // Get the right sub-tree.
      public OBTComparable getRight()
      { return right; }
      // Store a value at this position in the tree.
      private void setValue(OBTType requiredValue)
        if (empty)
          empty = false;
          left = new OBTComparable<OBTType>(); // Makes a new empty tree.
          right = new OBTComparable<OBTType>(); // Makes a new empty tree.
        } // if
        value = requiredValue;
      } // setValue
      // Insert a value, allowing multiple instances.
      public void insert(OBTType insertValue)
        if (empty)
          setValue(insertValue);
        else if (insertValue.compareTo(value) < 0)
          left.insert(insertValue);
        else
          right.insert(insertValue);
      } // insert
      // Find a value
      public boolean find(OBTType findValue)
        if (empty)
          return false;
        else if (findValue.equals(value))
          return true;
        else if (findValue.compareTo(value) < 0)
          return left.find(findValue);
        else
          return right.find(findValue);
      } // find
    } // OBTComparableI am unsure how to check the types of OBTType I am comparing, I know this is the error. It is the insert method and the find method that are causing it not to compile, as they require comparing one value to another. How to I put the check in the program to see if these two are of the same type so they can be compared?
    If anyone can help me with my problem that would be great!
    Sorry for the long post, I just wanted to put in all the information I know to make it easier for people to answer.
    Thanks in advance
    David

    I have good news and undecided news.
    First the good news. Your code has compiled. Those are warnings not errors. A warning is the compiler's way of saying "I understand what you are asking but maybe you didn't fully think through the consequences and I just thought I would let you know that...[something] "
    In this case it's warning you that you aren't using generics. But like I said this isn't stopping it from compiling.
    The undecided news is the complier is warning you about not using generics. Are you supposed to use generics for this assignment. My gut says no and if that's true then you have no problem. If you are supposed to use generics well then you have some more work.

  • How to get instance of Class with its type parameters

    Hi,
    Have any of you folks been dealing with generics long enough to show me how this should be written? Or point me to the answer (I have searched as well as I could).
    I boiled down my situation to the included sample code, which is long only because of the inserted comments. And while boiling I accidentally came across a surprise solution (a bug?), but would obviously prefer a smoother solution.
    My Questions (referred to in the code comments):
    #1. Is there a way to get my parameterized type (classarg) without resorting to using the bogus (proto) object?
    #2. Can anyone understand why the "C" and "D" attempts are different? (All I did was use an intermediate variable????) Is this a bug?
    Thanks so much for any input.
    /Mel
    class GenericWeird
       /* a generic class -- just an example */
       static class CompoundObject<T1,T2>
          CompoundObject(T1 primaryObject, T2 secondaryObject)
       /* another generic class -- its main point is that its constr requires its type class */
       static class TypedThing<ValueType>
          TypedThing(Class<ValueType> valuetypeclass)
       // here I just try to create a couple of TypedThings
       public static void main(String[] args)
          // take it for granted that I need to instantiate these two objects:
          TypedThing<String>                        stringTypedThing = null;
          TypedThing<CompoundObject<String,String>> stringstringTypedThing = null;
          // To instantiate stringTypedThing is easy...
          stringTypedThing = new TypedThing<String>(String.class);
          // ...but to instantiate stringstringTypedThing is more difficult to call the constructor
          Class<CompoundObject<String,String>> classarg = null;
          // classarg has got to be declared to this type
          //    otherwise there will rightfully be compiler error about the constructor call below
          // This method body illustrates my questions
          classarg = exploringHowToGetTheArg();
          // the constructor call
          stringstringTypedThing = new TypedThing<CompoundObject<String,String>>(classarg);
       } // end main method
       // try compiling this method with only one of A,B,C,D sections uncommented at a time
       private static Class<CompoundObject<String,String>> exploringHowToGetTheArg()
          Class<CompoundObject<String,String>> classarg = null;
          /* Exhibit A: */
      ////     classarg = CompoundObject.class;
             results in compiler error "incompatible types"
             found   : java.lang.Class<GenericWeird.CompoundObject>
             required: java.lang.Class<GenericWeird.CompoundObject<java.lang.String,java.lang.String>>
                   classarg = CompoundObject.class;
                                            ^
             I understand this.  But how to get the type information?
          /* It's obnoxious, but it looks like I will have to construct a temporary
              prototype instance of type
                 CompoundObject<String,String>
              in order to get an instance of
                 Class<CompoundObject<String,String>>
              (see my Question #1) */
          CompoundObject<String,String> proto = new CompoundObject<String,String>("foo", "fum");
          /* Exhibit B: */
      ////     classarg = proto.getClass();
             results in compiler error: "incompatible types"
             found   : java.lang.Class<capture of ? extends GenericWeird.CompoundObject>
             required: java.lang.Class<GenericWeird.CompoundObject<java.lang.String,java.lang.String>>
                   classarg = proto.getClass();
                                            ^
          /* Exhibit C: */
      ////     classarg = proto.getClass().asSubclass(proto.getClass());
             results in compiler error: "incompatible types"
             found   : java.lang.Class<capture of ? extends capture of ? extends GenericWeird.CompoundObject>
             required: java.lang.Class<GenericWeird.CompoundObject<java.lang.String,java.lang.String>>
                   classarg = proto.getClass().asSubclass(proto.getClass());
                                                         ^
          /* Exhibit D: (notice the similarity to C!): */
      ////     Class tmp1 = proto.getClass();
      ////     classarg = tmp1.asSubclass(tmp1);
          /* It compiles (see my Question #2) */
          return classarg;
       } // end method exploringHowToGetTheArg()
    } // end class GenericWeird

    Thanks so much, Bruce. (Oh my goodness, how would I have ever come up with that on my own?)
    So in summary
    This doesn't compile:
          classarg = (Class<CompoundObject<String,String>>)CompoundObject.class;but these do compile:
          classarg = (Class<CompoundObject<String,String>>)(Class)CompoundObject.class;or
          Class coclass = (Class)CompoundObject.class;
          classarg = (Class<CompoundObject<String,String>>)coclass;And this doesn't compile:
           classarg = proto.getClass().asSubclass(proto.getClass());but this does:
           Class tmp1 = proto.getClass();
           classarg = tmp1.asSubclass(tmp1);

  • Comparing files in a folder with those in another folder with multiple subfolders

    is there a non-terminal tool that i can buy that will do the following?:
    i want to compare the files that are nicely sorted into nested sub-folders and sub-sub folder in /one/ folder with those that are sitting - in bulk - in another folder.
    effectively i want to then /delete/ the duplicated files in the /bulk/ folder and sort the remaining files - the ones that are not dupes - in with the files that are already sorted. i don't want to delete the files that i already filed obviously and I only want to add the files that are not dupes.
    i'm dealing with pdf's in this case.
    TIA

    hotwheels 22 wrote:
    i wonder if anyone has tried Araxis Merge?
    Merge for Mac is here
    <http://www.araxis.com/merge_mac/index.html>
    It does folder sync -- and there are quite a few other folder sync tools out there. But that's not what you asked.
    files that are nicely sorted into nested sub-folders and sub-sub folder […]
    sort the remaining files […] in with the files that are already sorted
    That's not folder sync'ing. I doubt you'll find an app which does that out-of-the-box.

  • Problem referencing to methods with generic type parameters

    Assuming I have an interface like to following:
    public interface Test <T> {
    void test ( T arg0 );
    void test ( T arg0, Object arg1 );
    I would like to reference to both "test"-methods using "{@link #test(T)}" and "{@link #test(T,Object)}".But this generates an error telling me "test(T)" and "test(T,Object)" cannot be found.
    Changing T to Object in the documentation works and has as interesing effect. The generated link text is "test(Object)" but the generated link is "test(T)".
    Am I somehow wrong? Or is this a known issue? And is there a workaround other than using "Object" instead of "T"?

    Hi,
    I bumped into the same problem when documenting a generic.
    After quite a while of search your posting led me to the solution.
    My code goes something like this:
    public class SomeIterator<E> implements Iterator<E> {
      public SomeIterator(E[] structToIterate) {
    }When I tried to use @see or @link with the constructor Javadoc never found it.
    After I changed the documentation code to
    @see #SomeIterator(Object[])it worked.
    Since both taglets offer the use of a label, one can easily use these to produce comments that look correct:
    @see #SomeIterator(Object[]) SomeIterator(E[])CU
    Froestel

  • Building Binary Searh Tree with multiple types (hint hint Generics?)

    I have built binary search trees before and even wanted to build a B+ tree for primary indexes but my Professor suggested limiting to BST.
    My question is can I build a BST with a generic type parameterized code using Comparable and Generics to help me insert numeric and non-numeric (String) type nodes using the requirement that anything less than the root go left, greater than or equal to the root go right. There will be no duplicates.
    This is definitely new territory for me so any help is appreciated.

    Always Learning wrote:
    I have a Comparable<Object> x I would like to compareTo(Some other Comparable<Object>) but I know I am going about this all wrong.
    Essentially I want to be able to compare String lexicographically or integers/floats in order to properly insert them into a binary search tree and I wanted to use the Java language constructs of the Comparable interface and possibly generics to do it.
    This would result in a simple String1.compareTo(String2) or int1.compareTo(int2) etc.So it sounds like you actually have a Comparable<T>; or possibly a Comparable<String>, where all your types are first converted to Strings (however, in the case of ints, that probably means adding leading '0's).
    The generics tutorial suggests that you use Comparable<? super T> in cases of arbitrarily comparable items; however, I think you first need to decide how your comparisons are going to be done. For example, how does a String compare to an Integer in your scenario?
    Winston

  • Yet another iCloud with multiple Apple IDs question

    I have a Mac, iPhone 3G, and an iPad 2. My wife has an iPod. I have historically synced via the desktop, and my music, calendar, contacts, etc. have shared just fine. I have a Mobile Me account which may or may not be doing anything for me. I understand it's going away anyhow.
    Two of my devices share the same Apple ID, and one has a different ID. I don't know what my wife's iPod has for an Apple ID. One of the Apple IDs is a @me.com address.
    I have set things up for iCloud, trying to have my calendar, photos, etc. come alive at once like they do in the commercials. After hours reading others' frustrations on here, I still am unsure how to proceed.
    I can't change my @me.com AppleID because that is apparently against the rules. I can't add my other email address as a secondary address, because I am informed that that address is already verified as being in use (of course it is, by me). It won't let me change my other Apple ID to an @me.com address because that is also apparently against the rules.
    Is there ANY solution that let's me keep syncing my music, plus let's me sync my calendar, contacts, photos, etc. in the Cloud? I don't want to lose any of my current information.

    Thanks for the quick reply.  I don't think it helps me.
    My Mac and iphone have the same Apple ID.  I innocently created a different AppleID when I bought my iPad. ([email protected]).  I want them to sync automatically. They don't because they have different "clouds."
    I don't want to have to log in to sync everything.  If that were the case, I would just go on syncing every night via the Mac. Is there a way to get to where my iPad syncs with the other two?
    Am I missing something simple here?

  • Copying from one iphoto library to another/working with multiple libraries

    hi-
    my current workflow involves having a 'master library' on one of my external HDs where i store ALL of my images (35,000+) and a 'working library' in my macbook pro where i dump most recent pics first. typically i dump to the working library & then about every 3 months, i burn those events onto disc(s) from within iphoto, open my master library and copy from the disc into the master library. then i will seasonally clear the working library out other than a few portfolio items i may want to keep there.
    in the past, when i copied onto the disc and then into the master library, the event names and ratings would copy over too (although if i'd keyworded them, that would get screwed up, so i stopped). now it's not working! the correct event names and ratings show up on the disc, but they are not copying into the master library. i believe this is since i upgraded to ilife 09.
    any ideas? it is essential to my current workflow to preserve those event names and ratings. i turned 'autosplit' off in preferences. i tried turning it on. anyone else have experience working with more than one library like this?

    thanks larry, i'll check it out and let you know if that solves it. should the free version be sufficient? looks like this could be a really big help if it actually works, cuz i would like to create a 3rd and 4th library for other purposes but not if it's just going to make things more of a pain for me.
    i assume this should help with the keyword issue i was having before too? (if i keyworded pics in my working library, the keywords on those pics once copied to the master library would be wrong, it would apply other keywords sometimes, most of the time...)
    i appreciate your help.
    - artis

  • Deleting data from another table with multiple conditions

    Hi frnds
    I need to delete some data from a table based on multiple condition I tried following sql but its deleteing some rows which is not meeting the criteria which is really dangerours. When i trying = operator it returns ORa- 01427 single -row subquery returns more than one row
    delete from GL_TXNS
    where TRN_DT in (Select trn_Dt from GL_MAT)
    and BR in (select ac_branch from GL_MAT)
    and CODE in (select CODE T from GL_MAT)
    and (lcy_amt in (select lcy_amt from GL_MAT) or
    fcy_amt in(select fcy_amt from GL_MAT)
    rgds
    ramya

    My answer is the same as Avinash's but I will explain a little bit more.
    ORa- 01427 single -row subquery returns more than one rowmeans that you have a subquery that Oracle is expecting one value from that is returning multiple values. In your case you need one value for the equijoin ("=") and you are getting more than one value back. The error happens even if all the values are the same - multiple values being returned will cause the error.
    The solution is to either allow multiple values to be returned (say, use the IN condition istead of "=") or only return one value if possible (say, forcing one value by using DISTINCT, GROUP BY, or a WHERE clause condition of ROWNUM=1) - but these workarounds must be checked carefully to make sure they work correctkly

  • Burning CDs with multiple types of files

    How do you burn iTunes songs and pdf documents to the same disk?

    This would be done on My MacBook, not a Nano.  Haha

  • Passing a parameter from one class to another class in the same package

    Hi.
    I am trying to pass a parameter from one class to another class with in a package.And i am Getting the variable as null every time.In the code there is two classes.
    i. BugWatcherAction.java
    ii.BugWatcherRefreshAction.Java.
    We have implemented caching in the front-end level.But according to the business logic we need to clear the cache and again have to access the database after some actions are happened.There are another class file called BugwatcherPortletContent.java.
    So, we are dealing with three java files.The database interaction is taken care by the portletContent.java file.Below I am giving the code for the perticular function in the bugwatcherPortletContent.java:
    ==============================================================
    public Object loadContent() throws Exception {
    Hashtable htStore = new Hashtable();
    JetspeedRunData rundata = this.getInputData();
    String pId = this.getPorletId();
    PortalLogger.logDebug(" in the portlet content: "+pId);
    pId1=pId;//done by sraha
    htStore.put("PortletId", pId);
    htStore.put("BW_HOME_URL",CommonUtil.getMessage("BW.Home.Url"));
    htStore.put("BW_BUGVIEW_URL",CommonUtil.getMessage("BW.BugView.Url"));
    HttpServletRequest request = rundata.getRequest();
    PortalLogger.logDebug(
    "BugWatcherPortletContent:: build normal context");
    HttpSession session = null;
    int bugProfileId = 0;
    Hashtable bugProfiles = null;
    Hashtable bugData = null;
    boolean fetchProfiles = false;
    try {
    session = request.getSession(true);
    // Attempting to get the profiles from the session.
    //If the profiles are not present in the session, then they would have to be
    // obtained from the database.
    bugProfiles = (Hashtable) session.getAttribute("Profiles");
    //Getting the selected bug profile id.
    String bugProfileIdObj = request.getParameter("bugProfile" + pId);
    // Getting the logged in user
    String userId = request.getRemoteUser();
    if (bugProfiles == null) {
    fetchProfiles = true;
    if (bugProfileIdObj == null) {
    // setting the bugprofile id as -1 indicates "all profiles" is selected
    bugProfileIdObj =(String) session.getAttribute("bugProfileId" + pId);
    if (bugProfileIdObj == null) {
    bugProfileId = -1;
    else {
    bugProfileId = Integer.parseInt(bugProfileIdObj);
    else {
    bugProfileId = Integer.parseInt(bugProfileIdObj);
    session.setAttribute(
    ("bugProfileId" + pId),
    Integer.toString(bugProfileId));
    //fetching the bug list
    bugData =BugWatcherAPI.getbugList(userId, bugProfileId, fetchProfiles);
    PortalLogger.logDebug("BugWatcherPortletContent:: got bug data");
    if (bugData != null) {
    Hashtable htProfiles = (Hashtable) bugData.get("Profiles");
    } else {
    htStore.put("NoProfiles", "Y");
    } catch (CodedPortalException e) {
    htStore.put("Error", CommonUtil.getErrMessage(e.getMessage()));
    PortalLogger.logException
    ("BugWatcherPortletContent:: CodedPortalException!!",e);
    } catch (Exception e) {
    PortalLogger.logException(
    "BugWatcherPortletContent::Generic Exception!!",e);
    htStore.put(     "Error",CommonUtil.getErrMessage(ErrorConstantsI.GET_BUGLIST_FAILED));
    if (fetchProfiles) {
    bugProfiles = (Hashtable) bugData.get("Profiles");
    session.setAttribute("Profiles", bugProfiles);
    // putting the stuff in the context
    htStore.put("Profiles", bugProfiles);
    htStore.put("SelectedProfile", new Integer(bugProfileId));
    htStore.put("bugs", (ArrayList) bugData.get("Bugs"));
    return htStore;
    =============================================================
    And I am trying to call this function as it can capable of fetching the data from the database by "getbugProfiles".
    In the new class bugWatcherRefreshAction.java I have coded a part of code which actually clears the caching.Below I am giving the required part of the code:
    =============================================================
    public void doPerform(RunData rundata, Context context,String str) throws Exception {
    JetspeedRunData data = (JetspeedRunData) rundata;
    HttpServletRequest request = null;
    //PortletConfig pc = portlet.getPortletConfig();
    //String userId = request.getRemoteUser();
    /*String userId = ((JetspeedUser)rundata.getUser()).getUserName();//sraha on 1/4/05
    String pId = request.getParameter("PortletId");
    PortalLogger.logDebug("just after pId " +pId);  */
    //Calling the variable holding the value of portlet id from BugWatcherAction.java
    //We are getting the portlet id here , through a variable from BugWatcherAction.java
    /*BugWatcherPortletContent bgAct = new BugWatcherPortletContent();
    String portletID = bgAct.pId1;
    PortalLogger.logDebug("got the portlet ID in bugwatcherRefreshAction:---sraha"+portletID);*/
    // updating the bug groups
    Hashtable result = new Hashtable();
    try {
    request = data.getRequest();
    String userId = ((JetspeedUser)data.getUser()).getUserName();//sraha on 1/4/05
    //String pId = (String)request.getParameter("portletId");
    //String pId = pc.getPorletId();
    PortalLogger.logDebug("just after pId " +pId);
    PortalLogger.logDebug("after getting the pId-----sraha");
    result =BugWatcherAPI.getbugList(profileId, userId);
    PortalLogger.logDebug("select the new bug groups:: select is done ");
    context.put("SelectedbugGroups", profileId);
    //start clearing the cache
    ContentCacheContext cacheContext = getCacheContext(rundata);
    PortalLogger.logDebug("listBugWatcher Caching - removing markup content - before removecontent");
    // remove the markup content from cache.
    PortletContentCache.removeContent(cacheContext);
    PortalLogger.logDebug("listBugWatcher Caching-removing markup content - after removecontent");
    //remove the backend content from cache
    CacheablePortletData pdata =(CacheablePortletData) PortletCache.getCacheable(PortletCacheHelper.getUserHandle(((JetspeedUser)data.getUser()).getUserName()));
    PortalLogger.logDebug("listBugWatcher Caching User: " +((JetspeedUser)data.getUser()).getUserName());
    PortalLogger.logDebug("listBugWatcher Caching pId: " +pId);
    if (pdata != null)
    // User's data found in cache!
    PortalLogger.logDebug("listBugWatcher Caching -inside pdata!=null");
    pdata.removeObject(PortletCacheHelper.getUserPortletHandle(((JetspeedUser)data.getUser()).getUserName(),pId));
    PortalLogger.logDebug("listBugWatcher Caching -inside pdata!=null- after removeObject");
    PortalLogger.logDebug("listBugWatcher Caching -finish calling the remove content code");
    //end clearing the cache
    // after clearing the caching calling the data from the database taking a fn from the portletContent.java
    PortalLogger.logDebug("after clearing cache---sraha");
    BugWatcherPortletContent bugwatchportcont = new BugWatcherPortletContent();
    Hashtable httable= new Hashtable();
    httable=(Hashtable)bugwatchportcont.loadContent();
    PortalLogger.logDebug("after making the type casting-----sraha");
    Set storeKeySet = httable.keySet();
    Iterator itr = storeKeySet.iterator();
    while (itr.hasNext()) {
    String paramName = (String) itr.next();
    context.put(paramName, httable.get(paramName));
    PortalLogger.logDebug("after calling the databs data from hashtable---sraha");
    } catch (CodedPortalException e) {
    PortalLogger.logException("bugwatcherRefreshAction:: Exception- ",e);
    context.put("Error", CommonUtil.getErrMessage(e.getMessage()));
    catch (Exception e) {
    PortalLogger.logException("bugwatcherRefreshAction:: Exception- ",e);
    context.put(     "Error",CommonUtil.getErrMessage(ErrorConstantsI.EXCEPTION_CODE));
    try {
    ((JetspeedRunData) data).setCustomized(null);
    if (((JetspeedRunData) data).getCustomized() == null)
    ActionLoader.getInstance().exec(data,"controls.EndCustomize");
    catch (Exception e)
    PortalLogger.logException("bugwatcherRefreshAction", e);
    ===============================================================
    In the bugwatcher Action there is another function called PostLoadContent.java
    here though i have found the portlet Id but unable to fetch that in the bugWatcherRefreshAction.java . I am also giving the code of that function under the bugWatcherAction.Java
    ================================================
    // Get the PortletData object from intermediate store.
    CacheablePortletData pdata =(CacheablePortletData) PortletCache.getCacheable(PortletCacheHelper.getUserHandle(
    //rundata.getRequest().getRemoteUser()));
    ((JetspeedUser)rundata.getUser()).getUserName()));
    pId1 = (String)portlet.getID();
    PortalLogger.logDebug("in the bugwatcher action:"+pId1);
    try {
    Hashtable htStore = null;
    // if PortletData is available in store, get current portlet's data from it.
    if (pdata != null) {
    htStore =(Hashtable) pdata.getObject(     PortletCacheHelper.getUserPortletHandle(
    ((JetspeedUser)rundata.getUser()).getUserName(),portlet.getID()));
    //Loop through the hashtable and put its elements in context
    Set storeKeySet = htStore.keySet();
    Iterator itr = storeKeySet.iterator();
    while (itr.hasNext()) {
    String paramName = (String) itr.next();
    context.put(paramName, htStore.get(paramName));
    bugwatcherRefreshAction bRefAc = new bugwatcherRefreshAction();
    bRefAc.doPerform(pdata,context,pId1);
    =============================================================
    So this is the total scenario for the fetching the data , after clearing the cache and display that in the portal.I am unable to do that.Presently it is still fetching the data from the cache and it is not going to the database.Even the portlet Id is returning as null.
    I am unable to implement that thing.
    If you have any insight about this thing, that would be great .As it is very urgent a promt response will highly appreciated.Please send me any pointers or any issues for this I am unable to do that.
    Please let me know as early as possible.
    Thanks and regards,
    Santanu Raha.

    Have you run it in a debugger? That will show you exactly what is happening and why.

Maybe you are looking for

  • Data is not updating correctly in the cube 0PA_C01

    Hi, I am facing one problem in the Cube 0PA_C01 related to the "Headcount and Personnel Actions" in the HCM module. I have loaded all the master data and transaction data in the cube and i activate the queries also but when I am executing the queries

  • Help with Photo Downloader in PE6

    Is there any way I can stop downloader shutting down when I download only part of the contents of my camera card? I download to My Pictures on my Pc (using Windows XP) creating folders then verifying and deleting files. As soon as I confirm the delet

  • Lightroom 2.2 not importing changes or collections...

    I have a new desktop with Lightroom 2.2 installed. I have Lightroom 2.2 on my laptop. I am copying catalogs and files from my old laptop to a flash drive and loading them onto my new desktop. The catalogs are showing up with all the images but my col

  • Best way to transfer a 10g database from HP9000 to Linux Redhat?

    What is the best way to transfer a 10g databasse from HP9000 to Linux Redhat?

  • How to add a transaction code in SAP?

    Hello, i just installed SAP NetWeaver Application Server ABAP 7.03 SP04. but when i login with a admin user that i created, i dont see any transaction codes under acoounting folder. 1-) how can i add transactions codes to SAP? ( to add invoice, order