How Do I Use Generics with Framework Extension Classes?

Hi Guys and Gals,
I've been writing alot of duplicate code lately for ViewObjects that are all basically the same. So it occurred to me that perhaps I could put shared code in a Framework Extension Class. My problem lies in the fact that I do quite a bit of class casting as well. I thought perhaps Generics could come to the rescue. But uh ... I don't really know anything about them, which makes asking the right questions or even researching difficult.
Here's an example of what I would like to accomplish.
I have many different Master-Detail ViewObjects which are all pretty much the same. For example ...
PurchaseOrder (1-*) PoRows
SalesOrder (1-*) SoRows
Invoice (1-*) InvoiceRows
etc...
Here is sample code for the PurchaseOrder / PoRows
  public void cancelDocument()
    RowIterator ri = this.getPoRowsVO();  // access the detail view object
    RowSetIterator rsi = ((RowSet)ri).createRowSetIterator(null);
    while(rsi.hasNext())
      PoRowsVORowImpl next = (PoRowsVORowImpl)rsi.next();
      next.cancelRow();  // call a detail view object method exposed to the client
    rsi.closeRowSetIterator();
  }However, these two lines are cause for ponderance
     1.  RowIterator ri = this.getPoRowsVO();
     2.  PoRowsVORowImpl next = (PoRowsVORowImpl)rsi.next();Which leads me to two questions:
1) How do I access the Detail part of the relationship in a framwork extension class generically?
2) If I have to cast, is there a way to read the class type through reflection and cast using a generic method with what I've found?
I would think writing common methods in a Framework Extension class would really help make maintaining my code easier, and I could see how it would be a powerful tool. But how would one get around these ViewObject specific problems?
Will

Hi,
you are correct, Generics has a different meaning in Java then what you ask for.
Actually to access a detail row set from a parent row, you can use code like this:
    public void voRowCancel(){
        for (int i = 0; i < this.getAttributeCount(); i++)
               if(this.getStructureDef().getAttributeDef(i).getAttributeKind() == AttributeDef.ATTR_ASSOCIATED_ROWITERATOR){
                 RowSet rs = (RowSet) this.getAttribute(i);
                // ... to do ...
    }However, the code you invoke is on a custom implementation class, which makes it difficult to get to this from here.
Frank

Similar Messages

  • How do we create certificate with .pem extension using keytool

    Hai all,
    please tell me the procedure to create certificates using keytool with .pem extension.

    I dont think keytool can do this, try OpenSSL:
    openssl pkcs12 -in test.p12 -out test.pem
    David

  • Shall we use SRDemo Framework Extension Classes in 11G R1?

    Hi,
    I just installed 11G R1 and reading developer guides. For development with 10.1.3.3 release I was using the Framework extension classes from SRDemo to base BC's on. Those methods includes many base functionality such as setManagerowsByKey, case-insensitive search, some bind variables initialized, and so on. Shall we continue to use them for 11G R1? To keep currency of viewobjects after rollback, I use the method proposed by Steeve Muench's blog entry which contains beforeRollback and afterRollBack methods on the base viewobject and exposing row state to client . shall I continue to use it?
    Best Regards,

    Salim,
    If those methods provide functionality that you like - I don't see why you shouldn't continue to use them.
    John

  • How can I use TrueSequenceFactory with multiple sequences

    In the post "How to use existing Oracle sequences using KODO" answered
    by Marc Prud'hommeaux a "sample code" was given. But seems to me that
    example will only work with a single Oracle sequence for the entire
    system. Is this right?
    How can I use TrueSequenceFactory with primary-keys and their
    respective existing sequences? Can you (SolarMetric guys) provide me a
    sample code?

    The problem is that you are using application-identity. When you
    specify an objectid-class, we treat is automatically as application
    identity. To resolve this, I would recommend removing both the
    objectid-class and identity-type atributes from your class. With
    "objectid-class" in place, we asssume that you wil take care of identity.
    Eduardo Bobsin Machado wrote:
    I'm using Kodo 2.4.0, Oracle 9i, JBoss 3.0.4, the Kodo jars are in the
    JBoss' lib/ext.
    Well, I'll show what I have...
    This is the script of my table:
    CREATE TABLE LINEUP_VOYAGE (
    VOYAGEID NUMBER (10) NOT NULL,
    VESSEL_NAME VARCHAR2 (1000) NOT NULL,
    CONSTRAINT PK_LINEUP_VOYAGE
    PRIMARY KEY ( VOYAGEID ) ) ;
    This is an excerpt of my .jdo file:
    <class name="LineupVoyage" objectid-class="LineupVoyageId"
    identity-type="datastore">
    <extension vendor-name="kodo" key="table" value="LINEUP_VOYAGE"/>
    <extension vendor-name="kodo" key="sequence"
    value="LINEUP_VOYAGEID_SEQ"/>
    <extension vendor-name="kodo" key="pk-column" value="VOYAGEID"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <field name="vesselName">
    <extension vendor-name="kodo" key="data-column"
    value="VESSEL_NAME"/>
    </field>
    <!--field name="id" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="VOYAGEID"/>
    </field-->
    </class>
    As you can see, the "id" field is commented.
    And this is my class:
    package br.com.fertimport.entity;
    import java.util.*;
    public class LineupVoyage {
         private String vesselName;
    //     private long id;
    //     public LineupVoyage(long id) { this.id = id; }
    //     public long getId() { return id; }
    //     public void setId(long id) { this.id = id; }
         public String getVesselName() { return vesselName; }
         public void setVesselName (String vesselName) { this.vesselName =
    vesselName; }
    The "id" attribute is commented.
    Now the questions...
    To use ClassSequenceFactory must the identity-type of my entities be
    application or datastore?
    Is the "objectid-class" parameter required in this case?
    As you see, all references to the "id" property are commented. Can I
    use this property to represent my object id?
    If not, how can I identify my object with something like a long?
    The last question is related to my architecture: one VM with the EJBs
    (entity and session) and another VM with the web classes and JSPs,
    connected by a session facade. I don't want to use any Kodo or JDO stuff
    in the web tier. Is this possible?
    Stephen Kim
    [email protected]
    SolarMetric, Inc.
    http://www.solarmetric.com

  • I gave my old iPad to my daughter without restoring it to original configuration, how can she use it with her iTunes?

    I gave my old iPad to my daughter without restoring it to original configuration, how can she use it with her iTunes?

    try
    http://support.apple.com/kb/ht2589

  • How can I use LCCS with ActionScript 3 and Flash CS4?

    Hi,
    Using Stratus I was able to create an an application using Action Script 3 and Flash CS4.  The sample code on the Adobe site was quite straight forward and easy to understand.  I now want to switch over to  LCCS but can't find anything any where on how to use Action Script 3 and Flash CS4 with LCCS.  Do I need to know Flex to be able to use LCCS?  Everything was quite simple and easy to understand with Stratus and makes complete sense.  But LCCS is really confusing.  Is there any sample code on how to establish a connection in Action Script 3 and then stream from a webcam to a client.  There is nothing in the  LCCS SDK that covers Flash and Action Script 3.  Please help!  I found the link below on some forum but it takes me nowhere.
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=75 9&threadid=1407833&enterthread=y

    Thanks Arun!
    Date: Thu, 29 Apr 2010 11:44:10 -0600
    From: [email protected]
    To: [email protected]
    Subject: How can I use LCCS with ActionScript 3 and Flash CS4?
    Hi,
    Welcome to the LCCS world.
    Please refer to the SDK's sampleApps folder. There would be an app called FlashUserList. The app demonstrates how LCCS can be used with Flash CS4. Its a  pretty basic app, but should help you moving.
    We are trying to improve our efforts to help developers in understanding our samples. Please do let us know if we can add something that would help others.
    Thanks
    Arun
    >

  • How can I use Bluetooth with another devices?

    How can I use Bluetooth with another devices?

    You can set up your FaceTime account in Settings > FaceTime.

  • How do I use tether with droid ultra, keep getting message to call verizon. Do Verizon charge or have to somehow change my account?

    How do I use tether with droid ultra, keep getting message to call verizon. Do Verizon charge or have to somehow change my account?

    Verizon Wireless Customer Support wrote:
    Hi there JByrd,
    Let's take a closer look into this. What plan are you currently on? If you are on the More Everything plan, then you shouldn't have to do anything additional. If you are on the Nationwide plan it is an additional $20 a month for 2 GB of data. Let us know what plan you have. Thanks!
    ErinW_VZW
    Follow us on Twitter @VZWSupport
    Hey Erin how about you confirm to Elector and others that you HAVE to pay for tethering on Nationwide plans and that if you are using a 3rd tethering app to bypass paying you are violating the terms of service. They don't seem to believe me.

  • How can i use ipad with apple tv

    How can i use ipad with appletv

    Assuming both devices are on the same network and that AirPlay is not turned off on the Apple TV, then simply tap on the screen when you are watching content you wish to stream to your Apple TV, then tap the airplay icon that appears in the control bar, choose the Apple TV from the menu that appears.
    When displaying the content you wish to mirror on the iPad 2 (or better), iPad Mini, iPhone 4S (or better), double tap the home button (quickly) and swipe the bottom row of apps to the right to reveal the playback controls, tap the AirPlay icon and select your Apple TV from the list of available devices.

  • How do I use windows with my mac

    How do I use windows with my imac?  I need to know which program I need.

    use the built in boot camp or a program such as Parallels or VMware Fusion.

  • HT204053 how do i use icloud with mac os x 10.6.8?

    how do i use icloud with mac os x 10.6.8?

    how do i use icloud with mac os x 10.6.8?

  • How to open a file with the extension x3f (sigma)

    how to open a file with the extension x3f (sigma)?

    RAW data from the following Sigma cameras is currently supported:
    DP1
    DP1s
    DP2
    SD9
    SD10
    SD14
    If your camera is among these, then simply import the photo as usual. https://helpx.adobe.com/lightroom/help/importing-photos-lightroom-basic-workflow.html

  • FAQ: How do I use Revel with the Elements 12 Organizer (Mobile Albums)?

    FAQ: How do I use Revel with Photoshop Elements 12 Mobile Albums?
    Photoshop Elements lets you upload your media to Adobe® Revel and then access it from any device. Media already present in your Revel libraries is downloaded into Elements Organizer, so that you can work with it. Adobe Revel is an app that lets you store your media in the cloud and share it privately or publicly. See the links below for additional informtion about using Elements 11 and Premiere Elements 12 with Revel.
    If you check the option to make all your Elements photos and videos available in Mobile Albums, then Elements will move everything over to Mobile Albums, and upload it all to your Revel Library. Note that with mobile albums if you delete an image it will be deleted inElements and Revel.
    If you have some mobile albums that you only want in elements and you have already made them mobile albums, there is a way to move them back. You can drag and drop a mobile album onto a local category. Media in the mobile album is downloaded as it exists in Revel and stored locally. Subsequentally, the downloaded media is deleted from Revel. You can select one or more of the photos in the Elements Organizer and right click on one of them and select Remove From Revel at the bottom of the list. That will move them out of Revel, and keep them in the Elements Organizer.
    WHATS NEW:
    http://helpx.adobe.com/premiere-elements/using/whats-new.html
    http://helpx.adobe.com/photoshop-elements/using/whats-new.html
    PHOTOSHOP ELEMENTS 12:
    http://helpx.adobe.com/photoshop-elements/topics.html
    http://helpx.adobe.com/pdf/elements-organizer_reference.pdf
    http://tv.adobe.com/show/learn-photoshop-elements-12/
    http://tv.adobe.com/watch/learn-photoshop-elements-12/setting-up-your-mobile-albums/
    http://helpx.adobe.com/photoshop-elements/topics/getting-started-tutorials.html
    http://tv.adobe.com/show/learn-photoshop-elements-12/
    http://helpx.adobe.com/pdf/photoshop-elements_reference.pdf
    http://helpx.adobe.com/photoshop-elements/topics/getting-started-tutorials.html
    PREMIERE ELEMENTS 12:
    http://helpx.adobe.com/premiere-elements/topics.html
    http://helpx.adobe.com/premiere-elements/using/sharing-publish-share-panel.html
    http://tv.adobe.com/watch/learn-premiere-elements-12/sharing-albums-on-the-web/
    http://tv.adobe.com/watch/learn-premiere-elements-12/setting-up-your-mobile-albums/

    Also, bear in mind that few users of the full version of Photoshop are familiar with Photoshop Elements or Organizer, so many of us won't even know exactly what you mean.
    I have to get back on this, Just recently bought Elements and Premiere for Mac (actually more for fun and possible use for a minor workshop, not for my professional workflow) and only had a short glance at it.
    Just glanced at it again (still briefly) but there is a difference that you can't use in Bridge.  Organizer has some shortcuts to fix images and creates a new version of the original.
    This is not possible in Bridge. Also the Output Module in Bridge has a different approach to the create section in Organizer.
    For me Bridge is the right tool and I'm sure "tweetybird" will benefit also after having learned a bit.
    Especially the menu tools/Photoshop and the options in there will give better results (and far more control) to 'fix' ( I rather speak of optimize ) files to your satisfaction
    But If you still need options from the create section that you will not have in the Output Module there is no objection to use Organizer for this by pointing it to the folder with finished files.
    Its just a matter of the right tool for the right job

  • HT201407 i have a vodafone iphone5 - how can i use it with an O2 card? can I unlock?

    I have an iphone5 on a vodafone contract. How can i use it with an o2 sim and how can i unlock?

    Only the carrier to which the phone is locked to can unlock your phone, call your carrier and ask them if they will.

  • How can I use iCloud with Pages?

    How can I use iCloud with Pages?  Not offered as a Save option.

    You are stating you have MacOs 10.6.8 and iCloud isn't available with that system.

Maybe you are looking for

  • Confirmation That I Understand What I Can and Cannot Do With Adobe Reader XI and Adobe Acrobat Pro XI

    I am new to working with Adobe Acrobat Pro XI and Adobe Reader XI.  Based on research I have done and questions answered in the Adobe Communities and Forum, I wanted to make sure I understand the limitations of these two products before I report back

  • HOw do I create a wap page

    HELP! my company would like a wml page so that if someone opens our home page from a mobile phone, they get the wml version of our home page. Can anyone tell me: 1) what tool I need to create a wml page 2) How I put the browser check code on the home

  • I click "install" in app store, "installing" briefly flashes then nothing

    Just got a new ipad 3rd gen. Logged into App Store with Apple ID I've been using on all my devices, but with this particular iPad, whenever I click to install an app, the "installing" button appears briefly, but then no download happens.

  • Post Upgrade Activity: db6_update_db script

    Hi Experts, I've already upgraded db2 version from 9.1 to 9.7 but I am stuck in post upgrade activity where I need to run the db6_update_db script. Question to this procedure: "Copy the file db6_update_db.bat (Windows) from the relevant operating sys

  • Additional custom field on the assignments tab KO01

    Hi Geeks , I have  a requirement to add a new custom field to the assignments tab of the tcode KO01. This new field is not available in the structure CI_AUFK . Is it achievable via enhancement COOPA003 ? If yes , then how ? . A <removed by moderator>