public void awakeFromInsertion(EOEditingContext context) {
        super.awakeFromInsertion(context);
        if (value() == null) {
            setValue(new BigDecimal("500"));
        }
}
}

This is very appropriate for setting default values in any WebObjects application, no matter the type.  For D2W this code would exist in your custom subclass of your enterprise object (on the server-side class, of course, since only server-side exists in D2W).  This code would then continue to work just fine as you move from your D2W prototype application to your production web application.

The primary purpose of the awakeFromInsertion() method is to keep enterprise object initialization logic inside the model layer of the MVC design pattern.  This enhances the reusability of your business logic.
 
On Nov 7, 2005, at 4:44 PM, Pete Rive wrote:

Hi to all you WO masters of the universe,

I am a newbie trying to build a D2W app. I started out looking at a Java Client app but decided to change to a D2W.

I am trying to customise some business logic that will allow automatically include  a value when a new record is added to the database. In Direct to Java I used the following code on the App server which did what I wanted it to do:

public void awakeFromInsertion(EOEditingContext context) {
        super.awakeFromInsertion(context);
        if (value() == null) {
            setValue(new BigDecimal("500"));
        }
}
}

ie. When any new record was added it would automatically have a value "500".

However, I can't work out whether this code is appropriate for a Direct to Web app and what Java file to annotate eg Application.Java, DirectAction.Java etc ? I have started to try and learn Java to work it out but it could take awhile.

Does anyone have any suggestions?

Cheers
Pete

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to