• 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
Re: Several newbish questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Several newbish questions


  • Subject: Re: Several newbish questions
  • From: "Jerry W. Walker" <email@hidden>
  • Date: Thu, 11 Aug 2005 10:44:10 -0400

 
On Aug 11, 2005, at 10:21 AM, Jerome Chan wrote:

1. I would like to implement some form of security on my app. On some forms only User Type A can access. On other forms User Type B. I am currently checking the User Type when the form is submitted but that requires me to call my security check method once manually. Is there a way to automatically check this? I was looking at the api for WOApplication and pageWithName(). Would this be the correct spot to implement this?

There are many ways to do this, but Session is probably your best bet for a start. The session tends to be most directly associated with a given user and can be easily made explicitly so with login.

2. What documents should I look at for information on validating all the fields being entered into a component? Currently, I'm doing it by hand but this is very time consuming.

WO and EOF have an incredible array of validation mechanisms. Here are some notes you might find helpful:

EOF Validation

User interface:
    prevent/discourage user from entering inappropriate data
Formatters:
    formatting
        Only accepts data with valid format
    type coercion
        bad type raises exception
    simple validation
        raises exception and ignores value
        must be different from current value or not assigned
        WOComponent's validationFailedWithException(Throwable t, Object value, String keyPath)
            Called when an Enterprise Object or formatter failed validation  during an assignment.
            The default implementation ignores the error.
            Subclassers can override to resolve the error.
Model
    attribute constraints
        checks for:
            allows null
            string length
            numeric precision
            relationship integrity
        checks these before going to DB
    relationship integrity constraints
        optionality
            for both to-one & to-many
        delete rule
            if source deleted, then what
        ownership, owned object is:
            deleted if relationship broken
            created if relationship added
    delete rules (if user tries to delete relationship source):
        cascade - delete all destination objects too
        nullify - nullify back references
        deny - prohibit delete if there are destination objects
        nothing - delete and ignore destination objects
EO
    property-level (or key-level) validation
        called when a value changes
        default methods in superclass check model based constraints
        can be overridden for custom validation
        called BEFORE EO's properties have changed
        validation methods throw exception on failure
            validateValueForKey("weight") triggers:
                public <type> validateWeight(Object newWeight) throws
                        NSValidation.ValidationException {
    object-level validation
        called when saving insert/delete/update changes
            public void validateForInsert()
                throws NSValidation.ValidationException
            public void validateForUpdate()
                throws NSValidation.ValidationException
            public void validateForDelete()
                throws NSValidation.ValidationException
        all above in superclass by default call:
            public void validateForSave()
                throws NSValidation.ValidationException
        super's implementation calls key-level validation
        called AFTER EO's properties have changed
    validation performed when:
        form values are pushed into EO attributes through bindings
        saving changes in the editing context
        called programmatically


3. Is there a way I can print only the contents of one component of a multi-component page from the browser?

No, not easily. The components all contribute to a single HTTP response which is all the browser sees. You can format things to make the output from separate components more visible and select from the browser accordingly.

4. How do you do you automate functional testing on webobjects?

Google on WOUnitTest.

Regards,
Jerry


--

__ Jerry W. Walker, Partner

    C o d e F a b, LLC - "High Performance Industrial Strength Internet Enabled Systems"

    email@hidden

    212 465 8484 X-102  office

    212 465 9178        fax



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

This email sent to email@hidden

References: 
 >Several newbish questions (From: Jerome Chan <email@hidden>)

  • Prev by Date: Re: Several newbish questions
  • Next by Date: Re: can't open projects in Xcode
  • Previous by thread: Re: Several newbish questions
  • Next by thread: Re: Several newbish questions
  • Index(es):
    • Date
    • Thread