• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Is there a better way to do this
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is there a better way to do this


  • Subject: Is there a better way to do this
  • From: Tom Jones <email@hidden>
  • Date: Thu, 9 Sep 2004 17:20:57 -0500

I have a WOComponent whose purpose is to edit lists of objects that
all descend from  the class Enumeration. Following the design pattern
in the Authors example, when I add an Enumeration, I add it to an
NSArray, and insert it into the editing context. then I create a new
instance of the object. Anyway, this code works, but it seems like
there would be an easier way to accomplish this.

    	Constructor c;
        EOEditingContext ec = session.defaultEditingContext();
        boolean enumerationAdded = false;
        if (!(enumerationList.containsObject(enumeration)))
        {
           enumerationList.addObject(enumeration);
           ec.insertObject(enumeration);
           ec.saveChanges();
           try
           {
               c = enumeration.getClass().getConstructor(new Class[]{});
               enumeration = (Enumerations)c.newInstance(new Object[]{});
           }
           catch (Exception ex)
           {
//TO DO

           }
       }
           return null;
    }

Thanks, Tom
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: Access methods of an EO from within the D2W Rule System
  • Next by Date: resubmitting form data when clicking "back"
  • Previous by thread: Access methods of an EO from within the D2W Rule System
  • Next by thread: resubmitting form data when clicking "back"
  • Index(es):
    • Date
    • Thread