blob: 7df74e0451c1eca53f1620d5b0ef93ef52fe1639 [file] [log] [blame]
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
/**
* This is a generated class and is not intended for modification.
*/
package valueObjects
{
import com.adobe.fiber.styles.IStyle;
import com.adobe.fiber.styles.Style;
import com.adobe.fiber.styles.StyleValidator;
import com.adobe.fiber.valueobjects.AbstractEntityMetadata;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import mx.events.ValidationResultEvent;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IModelType;
import mx.events.PropertyChangeEvent;
use namespace model_internal;
[ExcludeClass]
internal class _EmployeeEntityMetadata extends com.adobe.fiber.valueobjects.AbstractEntityMetadata
{
private static var emptyArray:Array = new Array();
model_internal static var allProperties:Array = new Array("id", "title", "lastname", "firstname", "photofile");
model_internal static var allAssociationProperties:Array = new Array();
model_internal static var allRequiredProperties:Array = new Array("id", "title", "lastname", "firstname", "photofile");
model_internal static var allAlwaysAvailableProperties:Array = new Array("id", "title", "lastname", "firstname", "photofile");
model_internal static var guardedProperties:Array = new Array();
model_internal static var dataProperties:Array = new Array("id", "title", "lastname", "firstname", "photofile");
model_internal static var sourceProperties:Array = emptyArray
model_internal static var nonDerivedProperties:Array = new Array("id", "title", "lastname", "firstname", "photofile");
model_internal static var derivedProperties:Array = new Array();
model_internal static var collectionProperties:Array = new Array();
model_internal static var collectionBaseMap:Object;
model_internal static var entityName:String = "Employee";
model_internal static var dependentsOnMap:Object;
model_internal static var dependedOnServices:Array = new Array();
model_internal static var propertyTypeMap:Object;
model_internal var _titleIsValid:Boolean;
model_internal var _titleValidator:com.adobe.fiber.styles.StyleValidator;
model_internal var _titleIsValidCacheInitialized:Boolean = false;
model_internal var _titleValidationFailureMessages:Array;
model_internal var _lastnameIsValid:Boolean;
model_internal var _lastnameValidator:com.adobe.fiber.styles.StyleValidator;
model_internal var _lastnameIsValidCacheInitialized:Boolean = false;
model_internal var _lastnameValidationFailureMessages:Array;
model_internal var _firstnameIsValid:Boolean;
model_internal var _firstnameValidator:com.adobe.fiber.styles.StyleValidator;
model_internal var _firstnameIsValidCacheInitialized:Boolean = false;
model_internal var _firstnameValidationFailureMessages:Array;
model_internal var _photofileIsValid:Boolean;
model_internal var _photofileValidator:com.adobe.fiber.styles.StyleValidator;
model_internal var _photofileIsValidCacheInitialized:Boolean = false;
model_internal var _photofileValidationFailureMessages:Array;
model_internal var _instance:_Super_Employee;
model_internal static var _nullStyle:com.adobe.fiber.styles.Style = new com.adobe.fiber.styles.Style();
public function _EmployeeEntityMetadata(value : _Super_Employee)
{
// initialize property maps
if (model_internal::dependentsOnMap == null)
{
// dependents map
model_internal::dependentsOnMap = new Object();
model_internal::dependentsOnMap["id"] = new Array();
model_internal::dependentsOnMap["title"] = new Array();
model_internal::dependentsOnMap["lastname"] = new Array();
model_internal::dependentsOnMap["firstname"] = new Array();
model_internal::dependentsOnMap["photofile"] = new Array();
// collection base map
model_internal::collectionBaseMap = new Object();
}
// Property type Map
model_internal::propertyTypeMap = new Object();
model_internal::propertyTypeMap["id"] = "int";
model_internal::propertyTypeMap["title"] = "String";
model_internal::propertyTypeMap["lastname"] = "String";
model_internal::propertyTypeMap["firstname"] = "String";
model_internal::propertyTypeMap["photofile"] = "String";
model_internal::_instance = value;
model_internal::_titleValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForTitle);
model_internal::_titleValidator.required = true;
model_internal::_titleValidator.requiredFieldError = "title is required";
//model_internal::_titleValidator.source = model_internal::_instance;
//model_internal::_titleValidator.property = "title";
model_internal::_lastnameValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForLastname);
model_internal::_lastnameValidator.required = true;
model_internal::_lastnameValidator.requiredFieldError = "lastname is required";
//model_internal::_lastnameValidator.source = model_internal::_instance;
//model_internal::_lastnameValidator.property = "lastname";
model_internal::_firstnameValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForFirstname);
model_internal::_firstnameValidator.required = true;
model_internal::_firstnameValidator.requiredFieldError = "firstname is required";
//model_internal::_firstnameValidator.source = model_internal::_instance;
//model_internal::_firstnameValidator.property = "firstname";
model_internal::_photofileValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForPhotofile);
model_internal::_photofileValidator.required = true;
model_internal::_photofileValidator.requiredFieldError = "photofile is required";
//model_internal::_photofileValidator.source = model_internal::_instance;
//model_internal::_photofileValidator.property = "photofile";
}
override public function getEntityName():String
{
return model_internal::entityName;
}
override public function getProperties():Array
{
return model_internal::allProperties;
}
override public function getAssociationProperties():Array
{
return model_internal::allAssociationProperties;
}
override public function getRequiredProperties():Array
{
return model_internal::allRequiredProperties;
}
override public function getDataProperties():Array
{
return model_internal::dataProperties;
}
public function getSourceProperties():Array
{
return model_internal::sourceProperties;
}
public function getNonDerivedProperties():Array
{
return model_internal::nonDerivedProperties;
}
override public function getGuardedProperties():Array
{
return model_internal::guardedProperties;
}
override public function getUnguardedProperties():Array
{
return model_internal::allAlwaysAvailableProperties;
}
override public function getDependants(propertyName:String):Array
{
if (model_internal::nonDerivedProperties.indexOf(propertyName) == -1)
throw new Error(propertyName + " is not a data property of entity Employee");
return model_internal::dependentsOnMap[propertyName] as Array;
}
override public function getDependedOnServices():Array
{
return model_internal::dependedOnServices;
}
override public function getCollectionProperties():Array
{
return model_internal::collectionProperties;
}
override public function getCollectionBase(propertyName:String):String
{
if (model_internal::collectionProperties.indexOf(propertyName) == -1)
throw new Error(propertyName + " is not a collection property of entity Employee");
return model_internal::collectionBaseMap[propertyName];
}
override public function getPropertyType(propertyName:String):String
{
if (model_internal::allProperties.indexOf(propertyName) == -1)
throw new Error(propertyName + " is not a property of Employee");
return model_internal::propertyTypeMap[propertyName];
}
override public function getAvailableProperties():com.adobe.fiber.valueobjects.IPropertyIterator
{
return new com.adobe.fiber.valueobjects.AvailablePropertyIterator(this);
}
override public function getValue(propertyName:String):*
{
if (model_internal::allProperties.indexOf(propertyName) == -1)
{
throw new Error(propertyName + " does not exist for entity Employee");
}
return model_internal::_instance[propertyName];
}
override public function setValue(propertyName:String, value:*):void
{
if (model_internal::nonDerivedProperties.indexOf(propertyName) == -1)
{
throw new Error(propertyName + " is not a modifiable property of entity Employee");
}
model_internal::_instance[propertyName] = value;
}
override public function getMappedByProperty(associationProperty:String):String
{
switch(associationProperty)
{
default:
{
return null;
}
}
}
override public function getPropertyLength(propertyName:String):int
{
switch(propertyName)
{
default:
{
return 0;
}
}
}
override public function isAvailable(propertyName:String):Boolean
{
if (model_internal::allProperties.indexOf(propertyName) == -1)
{
throw new Error(propertyName + " does not exist for entity Employee");
}
if (model_internal::allAlwaysAvailableProperties.indexOf(propertyName) != -1)
{
return true;
}
switch(propertyName)
{
default:
{
return true;
}
}
}
override public function getIdentityMap():Object
{
var returnMap:Object = new Object();
return returnMap;
}
[Bindable(event="propertyChange")]
override public function get invalidConstraints():Array
{
if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
{
return model_internal::_instance.model_internal::_invalidConstraints;
}
else
{
// recalculate isValid
model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
return model_internal::_instance.model_internal::_invalidConstraints;
}
}
[Bindable(event="propertyChange")]
override public function get validationFailureMessages():Array
{
if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
{
return model_internal::_instance.model_internal::_validationFailureMessages;
}
else
{
// recalculate isValid
model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
return model_internal::_instance.model_internal::_validationFailureMessages;
}
}
override public function getDependantInvalidConstraints(propertyName:String):Array
{
var dependants:Array = getDependants(propertyName);
if (dependants.length == 0)
{
return emptyArray;
}
var currentlyInvalid:Array = invalidConstraints;
if (currentlyInvalid.length == 0)
{
return emptyArray;
}
var filterFunc:Function = function(element:*, index:int, arr:Array):Boolean
{
return dependants.indexOf(element) > -1;
}
return currentlyInvalid.filter(filterFunc);
}
/**
* isValid
*/
[Bindable(event="propertyChange")]
public function get isValid() : Boolean
{
if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
{
return model_internal::_instance.model_internal::_isValid;
}
else
{
// recalculate isValid
model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
return model_internal::_instance.model_internal::_isValid;
}
}
[Bindable(event="propertyChange")]
public function get isIdAvailable():Boolean
{
return true;
}
[Bindable(event="propertyChange")]
public function get isTitleAvailable():Boolean
{
return true;
}
[Bindable(event="propertyChange")]
public function get isLastnameAvailable():Boolean
{
return true;
}
[Bindable(event="propertyChange")]
public function get isFirstnameAvailable():Boolean
{
return true;
}
[Bindable(event="propertyChange")]
public function get isPhotofileAvailable():Boolean
{
return true;
}
/**
* derived property recalculation
*/
public function invalidateDependentOnTitle():void
{
if (model_internal::_titleIsValidCacheInitialized )
{
model_internal::_instance.model_internal::_doValidationCacheOfTitle = null;
model_internal::calculateTitleIsValid();
}
}
public function invalidateDependentOnLastname():void
{
if (model_internal::_lastnameIsValidCacheInitialized )
{
model_internal::_instance.model_internal::_doValidationCacheOfLastname = null;
model_internal::calculateLastnameIsValid();
}
}
public function invalidateDependentOnFirstname():void
{
if (model_internal::_firstnameIsValidCacheInitialized )
{
model_internal::_instance.model_internal::_doValidationCacheOfFirstname = null;
model_internal::calculateFirstnameIsValid();
}
}
public function invalidateDependentOnPhotofile():void
{
if (model_internal::_photofileIsValidCacheInitialized )
{
model_internal::_instance.model_internal::_doValidationCacheOfPhotofile = null;
model_internal::calculatePhotofileIsValid();
}
}
model_internal function fireChangeEvent(propertyName:String, oldValue:Object, newValue:Object):void
{
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, propertyName, oldValue, newValue));
}
[Bindable(event="propertyChange")]
public function get idStyle():com.adobe.fiber.styles.Style
{
return model_internal::_nullStyle;
}
[Bindable(event="propertyChange")]
public function get titleStyle():com.adobe.fiber.styles.Style
{
return model_internal::_nullStyle;
}
public function get titleValidator() : StyleValidator
{
return model_internal::_titleValidator;
}
model_internal function set _titleIsValid_der(value:Boolean):void
{
var oldValue:Boolean = model_internal::_titleIsValid;
if (oldValue !== value)
{
model_internal::_titleIsValid = value;
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "titleIsValid", oldValue, value));
}
}
[Bindable(event="propertyChange")]
public function get titleIsValid():Boolean
{
if (!model_internal::_titleIsValidCacheInitialized)
{
model_internal::calculateTitleIsValid();
}
return model_internal::_titleIsValid;
}
model_internal function calculateTitleIsValid():void
{
var valRes:ValidationResultEvent = model_internal::_titleValidator.validate(model_internal::_instance.title)
model_internal::_titleIsValid_der = (valRes.results == null);
model_internal::_titleIsValidCacheInitialized = true;
if (valRes.results == null)
model_internal::titleValidationFailureMessages_der = emptyArray;
else
{
var _valFailures:Array = new Array();
for (var a:int = 0 ; a<valRes.results.length ; a++)
{
_valFailures.push(valRes.results[a].errorMessage);
}
model_internal::titleValidationFailureMessages_der = _valFailures;
}
}
[Bindable(event="propertyChange")]
public function get titleValidationFailureMessages():Array
{
if (model_internal::_titleValidationFailureMessages == null)
model_internal::calculateTitleIsValid();
return _titleValidationFailureMessages;
}
model_internal function set titleValidationFailureMessages_der(value:Array) : void
{
var oldValue:Array = model_internal::_titleValidationFailureMessages;
var needUpdate : Boolean = false;
if (oldValue == null)
needUpdate = true;
// avoid firing the event when old and new value are different empty arrays
if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
{
if (oldValue.length == value.length)
{
for (var a:int=0; a < oldValue.length; a++)
{
if (oldValue[a] !== value[a])
{
needUpdate = true;
break;
}
}
}
else
{
needUpdate = true;
}
}
if (needUpdate)
{
model_internal::_titleValidationFailureMessages = value;
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "titleValidationFailureMessages", oldValue, value));
// Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
// the entire entity.
if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
{
model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
}
}
}
[Bindable(event="propertyChange")]
public function get lastnameStyle():com.adobe.fiber.styles.Style
{
return model_internal::_nullStyle;
}
public function get lastnameValidator() : StyleValidator
{
return model_internal::_lastnameValidator;
}
model_internal function set _lastnameIsValid_der(value:Boolean):void
{
var oldValue:Boolean = model_internal::_lastnameIsValid;
if (oldValue !== value)
{
model_internal::_lastnameIsValid = value;
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "lastnameIsValid", oldValue, value));
}
}
[Bindable(event="propertyChange")]
public function get lastnameIsValid():Boolean
{
if (!model_internal::_lastnameIsValidCacheInitialized)
{
model_internal::calculateLastnameIsValid();
}
return model_internal::_lastnameIsValid;
}
model_internal function calculateLastnameIsValid():void
{
var valRes:ValidationResultEvent = model_internal::_lastnameValidator.validate(model_internal::_instance.lastname)
model_internal::_lastnameIsValid_der = (valRes.results == null);
model_internal::_lastnameIsValidCacheInitialized = true;
if (valRes.results == null)
model_internal::lastnameValidationFailureMessages_der = emptyArray;
else
{
var _valFailures:Array = new Array();
for (var a:int = 0 ; a<valRes.results.length ; a++)
{
_valFailures.push(valRes.results[a].errorMessage);
}
model_internal::lastnameValidationFailureMessages_der = _valFailures;
}
}
[Bindable(event="propertyChange")]
public function get lastnameValidationFailureMessages():Array
{
if (model_internal::_lastnameValidationFailureMessages == null)
model_internal::calculateLastnameIsValid();
return _lastnameValidationFailureMessages;
}
model_internal function set lastnameValidationFailureMessages_der(value:Array) : void
{
var oldValue:Array = model_internal::_lastnameValidationFailureMessages;
var needUpdate : Boolean = false;
if (oldValue == null)
needUpdate = true;
// avoid firing the event when old and new value are different empty arrays
if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
{
if (oldValue.length == value.length)
{
for (var a:int=0; a < oldValue.length; a++)
{
if (oldValue[a] !== value[a])
{
needUpdate = true;
break;
}
}
}
else
{
needUpdate = true;
}
}
if (needUpdate)
{
model_internal::_lastnameValidationFailureMessages = value;
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "lastnameValidationFailureMessages", oldValue, value));
// Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
// the entire entity.
if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
{
model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
}
}
}
[Bindable(event="propertyChange")]
public function get firstnameStyle():com.adobe.fiber.styles.Style
{
return model_internal::_nullStyle;
}
public function get firstnameValidator() : StyleValidator
{
return model_internal::_firstnameValidator;
}
model_internal function set _firstnameIsValid_der(value:Boolean):void
{
var oldValue:Boolean = model_internal::_firstnameIsValid;
if (oldValue !== value)
{
model_internal::_firstnameIsValid = value;
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "firstnameIsValid", oldValue, value));
}
}
[Bindable(event="propertyChange")]
public function get firstnameIsValid():Boolean
{
if (!model_internal::_firstnameIsValidCacheInitialized)
{
model_internal::calculateFirstnameIsValid();
}
return model_internal::_firstnameIsValid;
}
model_internal function calculateFirstnameIsValid():void
{
var valRes:ValidationResultEvent = model_internal::_firstnameValidator.validate(model_internal::_instance.firstname)
model_internal::_firstnameIsValid_der = (valRes.results == null);
model_internal::_firstnameIsValidCacheInitialized = true;
if (valRes.results == null)
model_internal::firstnameValidationFailureMessages_der = emptyArray;
else
{
var _valFailures:Array = new Array();
for (var a:int = 0 ; a<valRes.results.length ; a++)
{
_valFailures.push(valRes.results[a].errorMessage);
}
model_internal::firstnameValidationFailureMessages_der = _valFailures;
}
}
[Bindable(event="propertyChange")]
public function get firstnameValidationFailureMessages():Array
{
if (model_internal::_firstnameValidationFailureMessages == null)
model_internal::calculateFirstnameIsValid();
return _firstnameValidationFailureMessages;
}
model_internal function set firstnameValidationFailureMessages_der(value:Array) : void
{
var oldValue:Array = model_internal::_firstnameValidationFailureMessages;
var needUpdate : Boolean = false;
if (oldValue == null)
needUpdate = true;
// avoid firing the event when old and new value are different empty arrays
if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
{
if (oldValue.length == value.length)
{
for (var a:int=0; a < oldValue.length; a++)
{
if (oldValue[a] !== value[a])
{
needUpdate = true;
break;
}
}
}
else
{
needUpdate = true;
}
}
if (needUpdate)
{
model_internal::_firstnameValidationFailureMessages = value;
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "firstnameValidationFailureMessages", oldValue, value));
// Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
// the entire entity.
if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
{
model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
}
}
}
[Bindable(event="propertyChange")]
public function get photofileStyle():com.adobe.fiber.styles.Style
{
return model_internal::_nullStyle;
}
public function get photofileValidator() : StyleValidator
{
return model_internal::_photofileValidator;
}
model_internal function set _photofileIsValid_der(value:Boolean):void
{
var oldValue:Boolean = model_internal::_photofileIsValid;
if (oldValue !== value)
{
model_internal::_photofileIsValid = value;
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "photofileIsValid", oldValue, value));
}
}
[Bindable(event="propertyChange")]
public function get photofileIsValid():Boolean
{
if (!model_internal::_photofileIsValidCacheInitialized)
{
model_internal::calculatePhotofileIsValid();
}
return model_internal::_photofileIsValid;
}
model_internal function calculatePhotofileIsValid():void
{
var valRes:ValidationResultEvent = model_internal::_photofileValidator.validate(model_internal::_instance.photofile)
model_internal::_photofileIsValid_der = (valRes.results == null);
model_internal::_photofileIsValidCacheInitialized = true;
if (valRes.results == null)
model_internal::photofileValidationFailureMessages_der = emptyArray;
else
{
var _valFailures:Array = new Array();
for (var a:int = 0 ; a<valRes.results.length ; a++)
{
_valFailures.push(valRes.results[a].errorMessage);
}
model_internal::photofileValidationFailureMessages_der = _valFailures;
}
}
[Bindable(event="propertyChange")]
public function get photofileValidationFailureMessages():Array
{
if (model_internal::_photofileValidationFailureMessages == null)
model_internal::calculatePhotofileIsValid();
return _photofileValidationFailureMessages;
}
model_internal function set photofileValidationFailureMessages_der(value:Array) : void
{
var oldValue:Array = model_internal::_photofileValidationFailureMessages;
var needUpdate : Boolean = false;
if (oldValue == null)
needUpdate = true;
// avoid firing the event when old and new value are different empty arrays
if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
{
if (oldValue.length == value.length)
{
for (var a:int=0; a < oldValue.length; a++)
{
if (oldValue[a] !== value[a])
{
needUpdate = true;
break;
}
}
}
else
{
needUpdate = true;
}
}
if (needUpdate)
{
model_internal::_photofileValidationFailureMessages = value;
this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "photofileValidationFailureMessages", oldValue, value));
// Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
// the entire entity.
if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
{
model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
}
}
}
/**
*
* @inheritDoc
*/
override public function getStyle(propertyName:String):com.adobe.fiber.styles.IStyle
{
switch(propertyName)
{
default:
{
return null;
}
}
}
/**
*
* @inheritDoc
*
*/
override public function getPropertyValidationFailureMessages(propertyName:String):Array
{
switch(propertyName)
{
case("title"):
{
return titleValidationFailureMessages;
}
case("lastname"):
{
return lastnameValidationFailureMessages;
}
case("firstname"):
{
return firstnameValidationFailureMessages;
}
case("photofile"):
{
return photofileValidationFailureMessages;
}
default:
{
return emptyArray;
}
}
}
}
}