Default/Initial values && post validation delegates etc

From: Lachlan Deck (lachla..sh.com.au)
Date: Tue Sep 05 2006 - 04:18:41 EDT

  • Next message: Borut Bolčina: "Re: [ANN] Two new (sub)sites using Cayenne"

    Hi all,

    I've got two questions

    1) Are initial values set with server code propagated to clients when
    an object is created on the client?

    The following url...
    http://cwiki.apache.org/confluence/display/CAY/Setting+Initial+Values

    ... suggests using "public void setPersistenceState(int)" for setting
    initial values when state is NEW. I assume this is the equivalent of
    EOFs awakeFromInsertion(EOEditingContext).

    The above method is not triggered on the client (i.e., it's never
    called) - so my question is whether (in having this code on the
    server) these values will be available initially to the client
    context or not?

    2) Object modifications

    DataContext has event subjects DID_COMMIT, DID_ROLLBACK, WILL_COMMIT
    subjects. Great. Where might I find what objects are available via
    these notifications?

    EOF's delegate has editingContextWillSaveChanges(EOEditingContext)
    where if you throw an exception it will abort the save for the
    context. How might a listener of the WILL_COMMIT changes event
    achieve this? Note: this is not a question about validateForSave.

    More importantly - what's the best mechanism to (post validation but
    pre actual commit) of actually making some final adjustments to an
    object. e.g., something simple such as dateModified field. I know we
    could put this into validateForSave but we call this many times prior
    to saving on the server - actually whenever someone makes a change in
    the gui (in order to highlight what might prevent saving the object).

    setPersistentState seems to be only called one time if the state of
    an object changes. Would the best way of keeping things like
    dateModified and other calculated fields up to date be to overload
    writeProperty?

    Much appreciated. Thanks.

    with regards,

    --
    

    Lachlan Deck lachla..sh.com.au



    This archive was generated by hypermail 2.0.0 : Tue Sep 05 2006 - 04:18:57 EDT