/**
 * This is a generated class and is not intended for modification.  To customize behavior
 * of this value object you may modify the generated sub-class of this class - AgentContact.as.
 */

package valueObjects
{
import com.adobe.fiber.services.IFiberManagingService;
import com.adobe.fiber.util.FiberUtils;
import com.adobe.fiber.valueobjects.IValueObject;
import flash.events.Event;
import flash.events.EventDispatcher;
import mx.binding.utils.ChangeWatcher;
import mx.collections.ArrayCollection;
import mx.events.CollectionEvent;
import mx.events.PropertyChangeEvent;
import mx.validators.ValidationResult;

import flash.net.registerClassAlias;
import flash.net.getClassByAlias;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;

use namespace model_internal;

[ExcludeClass]public class _Super_AgentContact extends flash.events.EventDispatcher implements com.adobe.fiber.valueobjects.IValueObject
{
    model_internal static function initRemoteClassAliasSingle(cz:Class) : void
    {
    }

    model_internal static function initRemoteClassAliasAllRelated() : void
    {
    }

    model_internal var _dminternal_model : _AgentContactEntityMetadata;

    /**
     * properties
     */
    private var _internal_address : String;
    private var _internal_address2 : String;
    private var _internal_agentId : String;
    private var _internal_city : String;
    private var _internal_distanceFromCoordinatesUsedToLocate : Number;
    private var _internal_emailAddress : String;
    private var _internal_firstName : String;
    private var _internal_languages : ArrayCollection;
    private var _internal_lastName : String;
    private var _internal_middleInitial : String;
    private var _internal_officeId : String;
    private var _internal_phoneNumber : String;
    private var _internal_state : String;
    private var _internal_zip : String;
    private var _internal_zipPlus4 : String;

    private static var emptyArray:Array = new Array();

    // Change this value according to your application's floating-point precision
    private static var epsilon:Number = 0.0001;

    /**
     * derived property cache initialization
     */
    model_internal var _cacheInitialized_isValid:Boolean = false;

    model_internal var _changeWatcherArray:Array = new Array();

    public function _Super_AgentContact()
    {
        _model = new _AgentContactEntityMetadata(this);

        // Bind to own data properties for cache invalidation triggering
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "address", model_internal::setterListenerAddress));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "address2", model_internal::setterListenerAddress2));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "agentId", model_internal::setterListenerAgentId));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "city", model_internal::setterListenerCity));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "emailAddress", model_internal::setterListenerEmailAddress));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "firstName", model_internal::setterListenerFirstName));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "languages", model_internal::setterListenerLanguages));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "lastName", model_internal::setterListenerLastName));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "middleInitial", model_internal::setterListenerMiddleInitial));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "officeId", model_internal::setterListenerOfficeId));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "phoneNumber", model_internal::setterListenerPhoneNumber));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "state", model_internal::setterListenerState));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "zip", model_internal::setterListenerZip));
        model_internal::_changeWatcherArray.push(mx.binding.utils.ChangeWatcher.watch(this, "zipPlus4", model_internal::setterListenerZipPlus4));

    }

    /**
     * data property getters
     */

    [Bindable("propertyChange")]
    public function get address() : String
    {
        return _internal_address;
    }

    [Bindable("propertyChange")]
    public function get address2() : String
    {
        return _internal_address2;
    }

    [Bindable("propertyChange")]
    public function get agentId() : String
    {
        return _internal_agentId;
    }

    [Bindable("propertyChange")]
    public function get city() : String
    {
        return _internal_city;
    }

    [Bindable("propertyChange")]
    public function get distanceFromCoordinatesUsedToLocate() : Number
    {
        return _internal_distanceFromCoordinatesUsedToLocate;
    }

    [Bindable("propertyChange")]
    public function get emailAddress() : String
    {
        return _internal_emailAddress;
    }

    [Bindable("propertyChange")]
    public function get firstName() : String
    {
        return _internal_firstName;
    }

    [Bindable("propertyChange")]
    public function get languages() : ArrayCollection
    {
        return _internal_languages;
    }

    [Bindable("propertyChange")]
    public function get lastName() : String
    {
        return _internal_lastName;
    }

    [Bindable("propertyChange")]
    public function get middleInitial() : String
    {
        return _internal_middleInitial;
    }

    [Bindable("propertyChange")]
    public function get officeId() : String
    {
        return _internal_officeId;
    }

    [Bindable("propertyChange")]
    public function get phoneNumber() : String
    {
        return _internal_phoneNumber;
    }

    [Bindable("propertyChange")]
    public function get state() : String
    {
        return _internal_state;
    }

    [Bindable("propertyChange")]
    public function get zip() : String
    {
        return _internal_zip;
    }

    [Bindable("propertyChange")]
    public function get zipPlus4() : String
    {
        return _internal_zipPlus4;
    }

    /**
     * data property setters
     */

    public function set address(value:String) : void
    {
        var oldValue:String = _internal_address;
        if (oldValue !== value)
        {
            _internal_address = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "address", oldValue, _internal_address));
        }
    }

    public function set address2(value:String) : void
    {
        var oldValue:String = _internal_address2;
        if (oldValue !== value)
        {
            _internal_address2 = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "address2", oldValue, _internal_address2));
        }
    }

    public function set agentId(value:String) : void
    {
        var oldValue:String = _internal_agentId;
        if (oldValue !== value)
        {
            _internal_agentId = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "agentId", oldValue, _internal_agentId));
        }
    }

    public function set city(value:String) : void
    {
        var oldValue:String = _internal_city;
        if (oldValue !== value)
        {
            _internal_city = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "city", oldValue, _internal_city));
        }
    }

    public function set distanceFromCoordinatesUsedToLocate(value:Number) : void
    {
        var oldValue:Number = _internal_distanceFromCoordinatesUsedToLocate;
        if (isNaN(_internal_distanceFromCoordinatesUsedToLocate) == true || Math.abs(oldValue - value) > epsilon)
        {
            _internal_distanceFromCoordinatesUsedToLocate = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "distanceFromCoordinatesUsedToLocate", oldValue, _internal_distanceFromCoordinatesUsedToLocate));
        }
    }

    public function set emailAddress(value:String) : void
    {
        var oldValue:String = _internal_emailAddress;
        if (oldValue !== value)
        {
            _internal_emailAddress = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "emailAddress", oldValue, _internal_emailAddress));
        }
    }

    public function set firstName(value:String) : void
    {
        var oldValue:String = _internal_firstName;
        if (oldValue !== value)
        {
            _internal_firstName = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "firstName", oldValue, _internal_firstName));
        }
    }

    public function set languages(value:*) : void
    {
        var oldValue:ArrayCollection = _internal_languages;
        if (oldValue !== value)
        {
            if (value is ArrayCollection)
            {
                _internal_languages = value;
            }
            else if (value is Array)
            {
                _internal_languages = new ArrayCollection(value);
            }
            else
            {
                throw new Error("value of languages must be a collection");
            }
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "languages", oldValue, _internal_languages));
        }
    }

    public function set lastName(value:String) : void
    {
        var oldValue:String = _internal_lastName;
        if (oldValue !== value)
        {
            _internal_lastName = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "lastName", oldValue, _internal_lastName));
        }
    }

    public function set middleInitial(value:String) : void
    {
        var oldValue:String = _internal_middleInitial;
        if (oldValue !== value)
        {
            _internal_middleInitial = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "middleInitial", oldValue, _internal_middleInitial));
        }
    }

    public function set officeId(value:String) : void
    {
        var oldValue:String = _internal_officeId;
        if (oldValue !== value)
        {
            _internal_officeId = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "officeId", oldValue, _internal_officeId));
        }
    }

    public function set phoneNumber(value:String) : void
    {
        var oldValue:String = _internal_phoneNumber;
        if (oldValue !== value)
        {
            _internal_phoneNumber = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "phoneNumber", oldValue, _internal_phoneNumber));
        }
    }

    public function set state(value:String) : void
    {
        var oldValue:String = _internal_state;
        if (oldValue !== value)
        {
            _internal_state = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "state", oldValue, _internal_state));
        }
    }

    public function set zip(value:String) : void
    {
        var oldValue:String = _internal_zip;
        if (oldValue !== value)
        {
            _internal_zip = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "zip", oldValue, _internal_zip));
        }
    }

    public function set zipPlus4(value:String) : void
    {
        var oldValue:String = _internal_zipPlus4;
        if (oldValue !== value)
        {
            _internal_zipPlus4 = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "zipPlus4", oldValue, _internal_zipPlus4));
        }
    }

    /**
     * Data property setter listeners
     *
     * Each data property whose value affects other properties or the validity of the entity
     * needs to invalidate all previously calculated artifacts. These include:
     *  - any derived properties or constraints that reference the given data property.
     *  - any availability guards (variant expressions) that reference the given data property.
     *  - any style validations, message tokens or guards that reference the given data property.
     *  - the validity of the property (and the containing entity) if the given data property has a length restriction.
     *  - the validity of the property (and the containing entity) if the given data property is required.
     */

    model_internal function setterListenerAddress(value:flash.events.Event):void
    {
        _model.invalidateDependentOnAddress();
    }

    model_internal function setterListenerAddress2(value:flash.events.Event):void
    {
        _model.invalidateDependentOnAddress2();
    }

    model_internal function setterListenerAgentId(value:flash.events.Event):void
    {
        _model.invalidateDependentOnAgentId();
    }

    model_internal function setterListenerCity(value:flash.events.Event):void
    {
        _model.invalidateDependentOnCity();
    }

    model_internal function setterListenerEmailAddress(value:flash.events.Event):void
    {
        _model.invalidateDependentOnEmailAddress();
    }

    model_internal function setterListenerFirstName(value:flash.events.Event):void
    {
        _model.invalidateDependentOnFirstName();
    }

    model_internal function setterListenerLanguages(value:flash.events.Event):void
    {
        if (value is mx.events.PropertyChangeEvent)
        {
            if (mx.events.PropertyChangeEvent(value).newValue)
            {
                mx.events.PropertyChangeEvent(value).newValue.addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE, model_internal::setterListenerLanguages);
            }
        }
        _model.invalidateDependentOnLanguages();
    }

    model_internal function setterListenerLastName(value:flash.events.Event):void
    {
        _model.invalidateDependentOnLastName();
    }

    model_internal function setterListenerMiddleInitial(value:flash.events.Event):void
    {
        _model.invalidateDependentOnMiddleInitial();
    }

    model_internal function setterListenerOfficeId(value:flash.events.Event):void
    {
        _model.invalidateDependentOnOfficeId();
    }

    model_internal function setterListenerPhoneNumber(value:flash.events.Event):void
    {
        _model.invalidateDependentOnPhoneNumber();
    }

    model_internal function setterListenerState(value:flash.events.Event):void
    {
        _model.invalidateDependentOnState();
    }

    model_internal function setterListenerZip(value:flash.events.Event):void
    {
        _model.invalidateDependentOnZip();
    }

    model_internal function setterListenerZipPlus4(value:flash.events.Event):void
    {
        _model.invalidateDependentOnZipPlus4();
    }


    /**
     * valid related derived properties
     */
    model_internal var _isValid : Boolean;
    model_internal var _invalidConstraints:Array = new Array();
    model_internal var _validationFailureMessages:Array = new Array();

    /**
     * derived property calculators
     */

    /**
     * isValid calculator
     */
    model_internal function calculateIsValid():Boolean
    {
        var violatedConsts:Array = new Array();
        var validationFailureMessages:Array = new Array();

        var propertyValidity:Boolean = true;
        if (!_model.addressIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_addressValidationFailureMessages);
        }
        if (!_model.address2IsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_address2ValidationFailureMessages);
        }
        if (!_model.agentIdIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_agentIdValidationFailureMessages);
        }
        if (!_model.cityIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_cityValidationFailureMessages);
        }
        if (!_model.emailAddressIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_emailAddressValidationFailureMessages);
        }
        if (!_model.firstNameIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_firstNameValidationFailureMessages);
        }
        if (!_model.languagesIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_languagesValidationFailureMessages);
        }
        if (!_model.lastNameIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_lastNameValidationFailureMessages);
        }
        if (!_model.middleInitialIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_middleInitialValidationFailureMessages);
        }
        if (!_model.officeIdIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_officeIdValidationFailureMessages);
        }
        if (!_model.phoneNumberIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_phoneNumberValidationFailureMessages);
        }
        if (!_model.stateIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_stateValidationFailureMessages);
        }
        if (!_model.zipIsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_zipValidationFailureMessages);
        }
        if (!_model.zipPlus4IsValid)
        {
            propertyValidity = false;
            com.adobe.fiber.util.FiberUtils.arrayAdd(validationFailureMessages, _model.model_internal::_zipPlus4ValidationFailureMessages);
        }

        model_internal::_cacheInitialized_isValid = true;
        model_internal::invalidConstraints_der = violatedConsts;
        model_internal::validationFailureMessages_der = validationFailureMessages;
        return violatedConsts.length == 0 && propertyValidity;
    }

    /**
     * derived property setters
     */

    model_internal function set isValid_der(value:Boolean) : void
    {
        var oldValue:Boolean = model_internal::_isValid;
        if (oldValue !== value)
        {
            model_internal::_isValid = value;
            _model.model_internal::fireChangeEvent("isValid", oldValue, model_internal::_isValid);
        }
    }

    /**
     * derived property getters
     */

    [Transient]
Bindable("propertyChange")]
    public function get _model() : _AgentContactEntityMetadata
    {
        return model_internal::_dminternal_model;
    }

    public function set _model(value : _AgentContactEntityMetadata) : void
    {
        var oldValue : _AgentContactEntityMetadata = model_internal::_dminternal_model;
        if (oldValue !== value)
        {
            model_internal::_dminternal_model = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "_model", oldValue, model_internal::_dminternal_model));
        }
    }

    /**
     * methods
     */


    /**
     *  services
     */
    private var _managingService:com.adobe.fiber.services.IFiberManagingService;

    public function set managingService(managingService:com.adobe.fiber.services.IFiberManagingService):void
    {
        _managingService = managingService;
    }

    model_internal function set invalidConstraints_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_invalidConstraints;
        // avoid firing the event when old and new value are different empty arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_invalidConstraints = value;
            _model.model_internal::fireChangeEvent("invalidConstraints", oldValue, model_internal::_invalidConstraints);
        }
    }

    model_internal function set validationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_validationFailureMessages;
        // avoid firing the event when old and new value are different empty arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_validationFailureMessages = value;
            _model.model_internal::fireChangeEvent("validationFailureMessages", oldValue, model_internal::_validationFailureMessages);
        }
    }

    model_internal var _doValidationCacheOfAddress : Array = null;
    model_internal var _doValidationLastValOfAddress : String;

    model_internal function _doValidationForAddress(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfAddress != null && model_internal::_doValidationLastValOfAddress == value)
           return model_internal::_doValidationCacheOfAddress ;

        _model.model_internal::_addressIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isAddressAvailable && _internal_address == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "address is required"));
        }

        model_internal::_doValidationCacheOfAddress = validationFailures;
        model_internal::_doValidationLastValOfAddress = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfAddress2 : Array = null;
    model_internal var _doValidationLastValOfAddress2 : String;

    model_internal function _doValidationForAddress2(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfAddress2 != null && model_internal::_doValidationLastValOfAddress2 == value)
           return model_internal::_doValidationCacheOfAddress2 ;

        _model.model_internal::_address2IsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isAddress2Available && _internal_address2 == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "address2 is required"));
        }

        model_internal::_doValidationCacheOfAddress2 = validationFailures;
        model_internal::_doValidationLastValOfAddress2 = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfAgentId : Array = null;
    model_internal var _doValidationLastValOfAgentId : String;

    model_internal function _doValidationForAgentId(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfAgentId != null && model_internal::_doValidationLastValOfAgentId == value)
           return model_internal::_doValidationCacheOfAgentId ;

        _model.model_internal::_agentIdIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isAgentIdAvailable && _internal_agentId == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "agentId is required"));
        }

        model_internal::_doValidationCacheOfAgentId = validationFailures;
        model_internal::_doValidationLastValOfAgentId = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfCity : Array = null;
    model_internal var _doValidationLastValOfCity : String;

    model_internal function _doValidationForCity(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfCity != null && model_internal::_doValidationLastValOfCity == value)
           return model_internal::_doValidationCacheOfCity ;

        _model.model_internal::_cityIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isCityAvailable && _internal_city == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "city is required"));
        }

        model_internal::_doValidationCacheOfCity = validationFailures;
        model_internal::_doValidationLastValOfCity = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfEmailAddress : Array = null;
    model_internal var _doValidationLastValOfEmailAddress : String;

    model_internal function _doValidationForEmailAddress(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfEmailAddress != null && model_internal::_doValidationLastValOfEmailAddress == value)
           return model_internal::_doValidationCacheOfEmailAddress ;

        _model.model_internal::_emailAddressIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isEmailAddressAvailable && _internal_emailAddress == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "emailAddress is required"));
        }

        model_internal::_doValidationCacheOfEmailAddress = validationFailures;
        model_internal::_doValidationLastValOfEmailAddress = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfFirstName : Array = null;
    model_internal var _doValidationLastValOfFirstName : String;

    model_internal function _doValidationForFirstName(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfFirstName != null && model_internal::_doValidationLastValOfFirstName == value)
           return model_internal::_doValidationCacheOfFirstName ;

        _model.model_internal::_firstNameIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isFirstNameAvailable && _internal_firstName == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "firstName is required"));
        }

        model_internal::_doValidationCacheOfFirstName = validationFailures;
        model_internal::_doValidationLastValOfFirstName = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfLanguages : Array = null;
    model_internal var _doValidationLastValOfLanguages : ArrayCollection;

    model_internal function _doValidationForLanguages(valueIn:Object):Array
    {
        var value : ArrayCollection = valueIn as ArrayCollection;

        if (model_internal::_doValidationCacheOfLanguages != null && model_internal::_doValidationLastValOfLanguages == value)
           return model_internal::_doValidationCacheOfLanguages ;

        _model.model_internal::_languagesIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isLanguagesAvailable && _internal_languages == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "languages is required"));
        }

        model_internal::_doValidationCacheOfLanguages = validationFailures;
        model_internal::_doValidationLastValOfLanguages = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfLastName : Array = null;
    model_internal var _doValidationLastValOfLastName : String;

    model_internal function _doValidationForLastName(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfLastName != null && model_internal::_doValidationLastValOfLastName == value)
           return model_internal::_doValidationCacheOfLastName ;

        _model.model_internal::_lastNameIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isLastNameAvailable && _internal_lastName == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "lastName is required"));
        }

        model_internal::_doValidationCacheOfLastName = validationFailures;
        model_internal::_doValidationLastValOfLastName = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfMiddleInitial : Array = null;
    model_internal var _doValidationLastValOfMiddleInitial : String;

    model_internal function _doValidationForMiddleInitial(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfMiddleInitial != null && model_internal::_doValidationLastValOfMiddleInitial == value)
           return model_internal::_doValidationCacheOfMiddleInitial ;

        _model.model_internal::_middleInitialIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isMiddleInitialAvailable && _internal_middleInitial == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "middleInitial is required"));
        }

        model_internal::_doValidationCacheOfMiddleInitial = validationFailures;
        model_internal::_doValidationLastValOfMiddleInitial = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfOfficeId : Array = null;
    model_internal var _doValidationLastValOfOfficeId : String;

    model_internal function _doValidationForOfficeId(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfOfficeId != null && model_internal::_doValidationLastValOfOfficeId == value)
           return model_internal::_doValidationCacheOfOfficeId ;

        _model.model_internal::_officeIdIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isOfficeIdAvailable && _internal_officeId == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "officeId is required"));
        }

        model_internal::_doValidationCacheOfOfficeId = validationFailures;
        model_internal::_doValidationLastValOfOfficeId = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfPhoneNumber : Array = null;
    model_internal var _doValidationLastValOfPhoneNumber : String;

    model_internal function _doValidationForPhoneNumber(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfPhoneNumber != null && model_internal::_doValidationLastValOfPhoneNumber == value)
           return model_internal::_doValidationCacheOfPhoneNumber ;

        _model.model_internal::_phoneNumberIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isPhoneNumberAvailable && _internal_phoneNumber == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "phoneNumber is required"));
        }

        model_internal::_doValidationCacheOfPhoneNumber = validationFailures;
        model_internal::_doValidationLastValOfPhoneNumber = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfState : Array = null;
    model_internal var _doValidationLastValOfState : String;

    model_internal function _doValidationForState(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfState != null && model_internal::_doValidationLastValOfState == value)
           return model_internal::_doValidationCacheOfState ;

        _model.model_internal::_stateIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isStateAvailable && _internal_state == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "state is required"));
        }

        model_internal::_doValidationCacheOfState = validationFailures;
        model_internal::_doValidationLastValOfState = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfZip : Array = null;
    model_internal var _doValidationLastValOfZip : String;

    model_internal function _doValidationForZip(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfZip != null && model_internal::_doValidationLastValOfZip == value)
           return model_internal::_doValidationCacheOfZip ;

        _model.model_internal::_zipIsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isZipAvailable && _internal_zip == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "zip is required"));
        }

        model_internal::_doValidationCacheOfZip = validationFailures;
        model_internal::_doValidationLastValOfZip = value;

        return validationFailures;
    }
    
    model_internal var _doValidationCacheOfZipPlus4 : Array = null;
    model_internal var _doValidationLastValOfZipPlus4 : String;

    model_internal function _doValidationForZipPlus4(valueIn:Object):Array
    {
        var value : String = valueIn as String;

        if (model_internal::_doValidationCacheOfZipPlus4 != null && model_internal::_doValidationLastValOfZipPlus4 == value)
           return model_internal::_doValidationCacheOfZipPlus4 ;

        _model.model_internal::_zipPlus4IsValidCacheInitialized = true;
        var validationFailures:Array = new Array();
        var errorMessage:String;
        var failure:Boolean;

        var valRes:ValidationResult;
        if (_model.isZipPlus4Available && _internal_zipPlus4 == null)
        {
            validationFailures.push(new ValidationResult(true, "", "", "zipPlus4 is required"));
        }

        model_internal::_doValidationCacheOfZipPlus4 = validationFailures;
        model_internal::_doValidationLastValOfZipPlus4 = value;

        return validationFailures;
    }
    

}

}