Annotation of Examples/EnterpriseObjects/Validation/Validation.subproj/ValidatingDelegate.h, revision 1.1

1.1     ! root        1: #import <eointerface/eointerface.h>
        !             2: 
        !             3: @interface ValidatingDelegate : Object
        !             4: {
        !             5:     BOOL validatesImmediately;   // validate when change is made, or only when they 
        !             6:                                  // try to save?
        !             7: }
        !             8: 
        !             9: - (void)setValidatesImmediately:(BOOL)yn;
        !            10: - (BOOL)validatesImmediately;
        !            11:     // retuns whether the delegate will perform validation checks on user changes
        !            12:     // on a per-field basis.  If not, check are performed before insert/update/delete.
        !            13: 
        !            14: - (NSDictionary *)controller:(EOController *)controller willSaveEdits: (NSDictionary *)edits toObject:object;
        !            15:     // to perform validation on changes to objects as they are made.
        !            16: 
        !            17: - (EODataSourceOperationDelegateResponse)controller:(EOController *)controller
        !            18:     willInsertObject:object
        !            19:     inDataSource:dataSource;
        !            20:     // Used to ask object if it's ready to be inserted.
        !            21:     // By default we will try to validate all of its properties.
        !            22: 
        !            23: - (EODataSourceOperationDelegateResponse)controller:(EOController *)controller
        !            24:     willUpdateObject:object
        !            25:     inDataSource:dataSource;
        !            26:     // Used to ask object if it's ready to be updated.
        !            27:     // By default we will try to validate all of its properties.
        !            28: 
        !            29: - (EODataSourceOperationDelegateResponse)controller:(EOController *)controller
        !            30:     willDeleteObject:object
        !            31:     inDataSource:dataSource;
        !            32:     // to ask object if it can be deleted.
        !            33: 
        !            34: - (void)reportValidationErrors:(NSDictionary *)errors forObject:object
        !            35:                   inController:(EOController *)controller;
        !            36:     // Called by delegate to report validate error.  Default implementation displays
        !            37:     // a panel.  Subclassers may want to update a status line in the window, or
        !            38:     // just beep.
        !            39: @end
        !            40: 
        !            41: 
        !            42: @interface NSObject (ValidationProtocols)
        !            43: // An EO can implement some or all of these methods to play a roll in its validation
        !            44: - (NSArray *)keysToValidate;
        !            45:     // Return list of property names that must be valid before object can be
        !            46:     // inserted or updated.  Default implementation returns an empty array.
        !            47:     // Better implementations might scan the runtime information in the
        !            48:     // receiver for methods of the form validateXXXX:.
        !            49:     // For EOs that keep a pointer to their entity (provided in
        !            50:     // initWithPrimaryKey:entity) this method could return the classPropertyNames.
        !            51: 
        !            52: - (NSDictionary *)validForDataSource:(id <EODataSources>)dataSource;
        !            53:     // should return nil if object is valid for insert and update,
        !            54:     // or a dictionary of key/error message pair describing the problem if not.
        !            55:     // The default implementation returns
        !            56:     // [self validateValuesInDictionary:[self valuesForKeys:[self keysToValidate]]]
        !            57: - (NSDictionary *)validForInsertInDataSource:(id <EODataSources>)dataSource;
        !            58:     // should return nil if object is valid for insert, or a dictionary of key/error message
        !            59:     // pair describing the problem if not.  The default implementation calls
        !            60:     // [self validForDataSource:dataSource]
        !            61: 
        !            62: - (NSDictionary *)validForUpdateInDataSource:(id <EODataSources>)dataSource;
        !            63:     // should return nil if object is valid for update, or a dictionary of key/error message
        !            64:     // pair describing the problem if not.  The default implementation calls
        !            65:     // [self validForDataSource:dataSource]
        !            66: 
        !            67: - (NSDictionary *)validForDeleteInDataSource:(id <EODataSources>)dataSource;
        !            68:     // should return nil if object is valid for insert, or a dictionary of key/error message
        !            69:     // pair describing the problem if not.  The default implementation returns nil.
        !            70: @end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.