How do I make a copy of a view model? (10.1.3.4)

I have an application where it is important to maintain records for multiple reasons even if they have been edited, inactivated, or deleted. They way my organization does this for edit is that if a record is modified, we leave that record as it is and change a status field, then create a new record with the new values. This is a common paradigm with many businesses.
We have decided that for some of our pages with multiple complex many-to-many relationships that instead of trying to handle this complexity at the time of committal, that it would be a lot easier just to duplicate our business model when entering the page in edit mode. The question is, is there any easy way to do that sticking with a model-centric view? How would I make duplicates of these views in the application module in such a way that I can roleback if an error occurs?
In short, the business requirement is that I have a page where if I click an edit button, it will bring up a copy an uncommitted new copy of the model. This copy needs to go away if the screen is navigated away from or some error happens during the commit.
If it helps, you can think of my page as the USERS, PRODUCTS, EXPERTISE_AREAS in the SRDemo schema. My USERS and PRODUCTS tables have an additional STATUS field that is initially active but gets set to ‘inactive’ when a modified version of it is committed. We have two views, one is a UserVO and the other is a ProductsExpertiseAreasVO with an associated viewlink using userId. The edit webpage shows some input fields for the attributes of the UserVO for a single userId and a table of the associated ProductsExpertiseAreasVOs.
Thank you,
- Joe
Edited by: JoeScheirich on Mar 16, 2010 9:53 AM

So without an easy way to do a proper deep clone that incorporated the extra logic needed in the child view create method, I made a custom AM method to do the cloning for me through calling create:
    public Key cloneParentVO(Key key) {
        Row[] parentRowArray = getParentVO().findByKey(key,1);
        ParentVORowImpl currentParentVORow = (ParentVORowImpl)parentRowArray[0];
        currentParentVORow.setStatus("ARCHIVE");
        // create a clone of the ParentVORow
        AttributeList attributeList = new AttributeListImpl();
        attributeList.setAttribute("Status", "ACTIVE");
        attributeList.setAttribute("ExpireNumOfDays", currentParentVORow.getExpireNumOfDays());
        ParentVORowImpl cloneParentVORow = (ParentVORowImpl)getParentVO().createAndInitRow(attributeList);
        // insert the new ParentVORow into the ParentVO
        getParentVO().insertRow(cloneParentVORow);
        // create a clone of all associated childVOs
        RowIterator childVORowIterator = currentParentVORow.getChildVO();
        childVORowIterator.reset();
        while(childVORowIterator.hasNext()) {
            childVORowImpl childVORow =
                (childVORowImpl)childVORowIterator.next();
            AttributeList attributeList2 = new AttributeListImpl();
            attributeList2.setAttribute("ParentUid", cloneParentVORow.getParentUid());
            attributeList2.setAttribute("Discount", childVORow.getDiscount());
            attributeList2.setAttribute("DiscountMethod", childVORow.getDiscountMethod());
            Row newchildVORowImpl =  cloneParentVORow.getchildVO().createAndInitRow(attributeList2);
            cloneParentVORow.getchildVO().insertRow(newchildVORowImpl);
         return cloneParentVORow.getKey();
    }Everything seems to work great and I can get the new parent view by the returned key and iterate through the new children through the view link accessor.
My problem now is that for reasons beyond my understanding, when I display the new parent and child views on a page, the new parent data displays, but the table that show the child data doesn’t have any rows though I can iterate through the child views just find if I throw in some debug code prior to the PrepareRenderer phase.
    public void prepareRender(LifecycleContext context) {
         MyAMImpl myAMImpl = (MyAMImpl)JSFUtils.getApplicationModuleForDataControl(AppConstants.ADMIN_AM);
         Key key = parentVOIter.getCurrentRow().getKey();
         Key newKey = myAMImpl.cloneCategoryVO(key);
         myAMImpl.getParentVO().findAndSetCurrentRowByKey(newKey, 1);
         super.prepareRender(context);
    }Anyone got any ideas?

Similar Messages

  • I asked this question in iMovie and told it belonged here. When i try to copy homemade movie _TS format it will not auto load in DVD player original does. How do I make a copy that will auto load?

    I asked this question in iMovie and told it belonged here. When i try to copy homemade movie _TS format it will not auto load in DVD player original does. How do I make a copy that will auto load?

    garysm99 wrote:
    Not familiar with structure view. How do I go there?
    click in IDVD on this button

  • How can I make "Call Phones" my default view? Skype 7.6

    Hello,Does anyone know how I can make CALL PHONES my default view. Skype defaults to the SKYPE HOME which is pretty useless.Thank you.Bruce

    Hi ..
    For a specific region, that requires a third party add on called Glims. It's free   > Glims for Safari
    Tutorial | Glims:   Adding a new search engine to Safari
    Frequently Asked Questions | www.MacHangout.com
    To access Glims settings, from your Safari menu bar click Safari > Preferences then select the Glims tab.

  • How can I make a copy of my book project?

    I made a book for myself with photos from our summer holidays. Now I want to make a slightly different version for my mum, with more photos of HER in it. So I wanted to make a copy of my book album, so I can have one version that's the book I made for me and another which is the alternative version for my mum.
    How the heck do I do that though? I can't burn the book album to CD, I can't duplicated the whole folder, and I can't even figure out how to copy all the photos I've used into another folder so I can redo the book layout stuff.
    I really don't want to have to go through all the five hundred photos we took this summer and start from scratch...

    You want to do both in your copy of iPhoto, right?
    Right/control click on the book project and select duplicate and edit the duplicate (book not the folder since the book is more or less how you want it).
    The photos in the book folder are not actual photos, just aliases to the one copy you store in the iPhoto directory, so make a copy of the book and edit that.
    None of the albums in iPhoto are the actual photos. You can make ten albums and put say, 100 identical photos in each one, and the size of the overall iPhoto library doesn't go up. They are just pictures of the photos if that makes sense. If you delete the album, the album is gone but in the library the photos are still all there.

  • How do I make a copy of a Labview 8 project?

    Hello,
    Let's say I have a big, messy, but functional labview 8 project which has host, real-time, and fpga components. 
    I now want to make a copy of it which I'll want to rename and morph into some other similar project.
    What's the right way to do that?  To me it looks tricky because I
    see lots of project files with names derived from the original project,
    and I see a "alias file".
    I'm worried that if I do it wrong, I run the risk of corrupting the original project.
    A similar question can be asked in the context of wishing to make
    working backup copies of projects so that if "today's" version is
    screwed, I can go back to "yesterday's" version.  What's the best
    way to accomplish that?
    Thanks,
    Peter H.

    Bob,
    LabVIEW 8.5 definitely enhances the ability to predict, prevent, and repair cross linking issues.  See this DevZone article for much more information on how this is done.
    With LabVIEW 8.5, you also have a save as option for the project.  If you select this, one of the options is to duplicate the project and its contents.  This way, you can rename the project and it will save all dependancies to the directory you specify.
    Also, 8.5 introduced the ability to merge VIs (similar to merging code in text based with multiple developers).
    You could also use source code control with LabVIEW to keep track of different copies and ensure time isn't wasted editing an older version of a VI (we've all been there...).
    Regards,
    Craig D
    Applications Engineer
    National Instruments

  • How do I make a copy of book draft to show MIL before ordering?

    Hi, I need to make a copy of my iphoto book draft to show my mother-in-law before ordering. I know there's a way to do this, as I did it years ago with another iphoto book. However, I cant remember and I cannot seem to find a recent discussion about it on the boards.
    She can't come to my house to view it. Can I burn it to a disc (?) to take over to her house (she also has a Mac) to view? Or do I have to save it, take it to Staples, and print it out? How do I save it on a disc?
    Thank you!
    CJ

    Save it as a pdf. Right click in the window when viewing the book.
    Regards
    TD

  • How do I make a copy of Audition 2.0 on my desktop - need to reinstall prog. Don't want to lose work

    Hello.  I'm having problems getting into my Audition 2.0 prog.  PC is telling me it is unable to locate component audipp.dll.  Have been advised to reinstall the prog and make a copy on my desktop (so as not to lose valuable files).  Any ideas how I make that copy?  Many thanks world.

    Nelsonwhizz wrote:
    Have been advised to reinstall the prog and make a copy on my desktop (so as not to lose valuable files).
    That doesn't sound like 'advice' to me - the desktop is the last place you want to save anything!
    All you need to do, if you have custom settings in Audition is to do what it says in this AudioMasters thread, uninstall Audition using the Windows uninstaller (you don't need to deactivate) and reinstall it. You won't lose any work, even if you made the mistake of saving it in the Audition install folder, because the uninstaller will only uninstall the program files (it has a list) - anything else gets left.

  • How can I make printed copy of photo CD

    I have a folder of images that I will burn to CD. How can I make a printed copy of those images with text to file with the CD?
    imac g5   Mac OS X (10.3.9)  

    You can print a contact sheet with titles in iPhoto 6. I searched the iPhoto 5 forum and found a workaround from Ken.
    " Instead of Print, Contact Sheet use Share, Export, Web Page. .The "contact sheet" will be the thumbnails so be sure to select the Show title and Show comment boxes. Create a webpage, open it in your browser and print from there."
    And more detailed directions from Elizabeth Kley:
    "Creating Contact Sheet with Titles
    1 - Put the files you want to print in an album and arrange in the order you'd like.
    2 - Go to the File->Export->Web Page menu option.
    3 - While in the Web page window, select the number of thumbnails you'd like across each page (iPhoto will keep you informed on how many pages it will take).
    4 - Click on Show Title under thumbnails and click on Export. Then select the location where you'd like the resulting files to be saved (create a temporary folder to contain them).
    5 - Once saved, go the folder and open the index.html file with your browser. You will get a page with your thumbnails and titles beneath them.
    6 - Print that browser page and you've got your contact sheet with file names (or comments if desired). "
    Is this what you had in mind?

  • How do i make another copy of a disc i have burnt in iDVD?

    A project that was created in iMovie on another computer was then imported into iDVD on my computer in order to burn it (using "One step DVD from Movie"). I now would like to make another copy of this DVD. Can it be done in iDVD?

    blackwaterpark83 wrote:
    .. I now would like to make another copy of this DVD.
    illustrated advice here ...
    http://support.apple.com/kb/HT2059
    *How to copy previously-burned DVD-R video discs*

  • How can I make a COPY/duplicate of an Event in iPhoto11

    I need to make a copy of an 'event' I have in iPhoto on iMac.  I want the original event in tacked; I want to remove photos on the COPY.
    Thanks - Jose

    You can't, really. You could export the photos from iPhoto, then import them as a new event, but that would be pointless.
    Why not just export from the Event? It won't remove the photos from iPhoto you know?
    File -> Export
    This User Tip
    https://discussions.apple.com/docs/DOC-4921
    has details of the options in the Export dialogue.

  • How can I make a copy of the FAQs module or filter on language?

    Hi,
    is it possible to make a copy of the FAQs module? I need to have FAQs in different languages.
    I can add event, photo, news ands media modules but not a new FAQs module.
    I also found that you can add a category and display the FAQs with the filter: cr or individual filter. But where do I add the category name to filter on?

    Solved!
    Quick solution: the ID is used for the category name, so I need to do a time consuming process to find the id.
    Result:
    {module_faq,c,19227,,ajax,}
    Great!

  • Once iDVD has been used to create a DVD, how can I make another copy?

    This may be a rookie question, but because of my bad history with computers, I generally don't like to use too much of my hard drive. I have a lot of family videos in iMovie now, and I want to be able to make a DVD and delete the originals from my hard drive. I also want to be able to make another copy of the DVD later.
    Is there a way to do that with just the Mac or is something else needed...since it seems that I am essentially burning DVDs?

    If you do a 'Save As Disk Image' from within your iDVD project when you have finished it, you will be making a disk image file for that project. Disk image files are self-contained, thus all the media information is encoded into the disk image file. You can then safely delete all the photos, movies, music files that were used to create your iDVD project and still retain the ability to burn more DVDs of that project in the future.
    You use Disk Utility to burn more copies.
    I save disk image files for all of my iDVD projects and place those files on a large external hard drive.

  • How do I make Preview my default PDF viewer?

    When viewing saved PDF files I prefer Preview to Adobe Reader 7.07 because it is easier to make the print larger. Preview used to be the default, but when I updated to Adobe 7.07 it became the default viewer. How do I choose and set my default PDF file viewer?
    iBook G4   Mac OS X (10.4.6)  
    iBook G4    

    Hello,
    The quickest way to make Preview your default PDF viewer is to:
    1) Get Info on a PDF file.
    2) Under open with, select Preview.
    3) Click change all.
    Now all PDF files will open with Preview by default.
    -Jason

  • How do i make abackup copy of Lion with a UBS2?

    I am thinking about downloading Lion, i do not have a external harddrive. So i need to make a backup copy. I have a brand new unused Kingston USB. Once i have copied the software to the USB, where do I install it from? The copy on my USB? Or the original on my desktop? If you can offer any advice on this procedure, I would be grateful because i hardly ever download, and i've never copied anything of this importance before.

    When you download Lion it will put the installer in your Applications folder and present you with an 'install Lion window'. Before clicking on the install screen copy the Lion installer to the USB drive (USB drive needs to have at least 4gb of available space). Eject the USB stick and continue with the installation. Once the Lion install is finished the installer in the applications folder will disappear so you are wise to copy it first.
    Edit: As a side note, from your description it sounds as though you don't have an external back-up of all the important data on your Mac. I'd really recommend getting an external and at least keep a Time Machine backup.
    Legend has it that there are two types of disk drive - one that has failed and one that hasn't failed yet. Having a backup in place will save you a world of pain. I know this for a fact .

  • How can I make a copy of a song, change the album cover of the copy, but have the original stay the same?

    So, this is going to take some time to explain, but I'm going to try it.
    I'm trying to build a compilation playlist with songs from other albums. I want to change the name of the album in the info of the song and the cover for the new playlist. When I do this, the original copy changes as well. I don't want this to happen. Is it possible to avoid this?

    Frankly I would just make your album a playlist and live with the original album names in the individual items.
    If you really want to name them individually you will have to make copies of the files and add them a second time to iTunes.  One easy way to do this is drag the tracks you want to a different drive (it could just be a flash drive).  It will make copies of the files on that other drive. Now drag them back to an empty playlist window.  That way you will be able to keep them separate from the original track until you can rename them.  In dragging back to iTunes it will put a copy in the iTunes folders so you will end up with two copies of the files, the second one for editing.

Maybe you are looking for

  • Closing MBP Without Sleep With External Display

    Greetings. I have just hooked up a Dell 23" flatscreen display to my Macbook Pro. Everything works great... connected it via the DVI cable and it worked immediately. I'd like to be able to turn on my MBP and use the large display exclusively, meaning

  • Error code A12E1

    Has anyone else had this error?

  • Need help on query

    Hi Sir I am facing one issue I am having three columns in a query select cust_name ename1,(select cust_name from [email protected] sj where sj.cust_name= kj.cust_name) ename2 ,(select cust_name from [email protected] sj where sj.cust_name= kj.cust_na

  • How can i do an official unlock

    Need to unlock Iphone 3g and 4

  • HT201240 resetting a user password in mountain lion

    I've installed Mountain Lion, and installed my Time Machine back up.  The problem is that when I try to log in it own't accept my password giving me the message CSSM_ERRCODE_MEMORY_ERROR. I've tried to set up another administor account and it will le