/*****************************************************************
Namespace -- this should be the file name, but camelcased
*****************************************************************/
Aptify.framework.utility.ensureNameSpaceExists("Aptify.applications.topLevelEntityName");
/*****************************************************************
GE Subclass
*****************************************************************/
Aptify.applications.topLevelEntityName.entityNameGE = function () {
///
/// A class instance for the Entity Name Entity.
///
/// A class instance for the Entity Name Entity
try {
// Inherit from the Aptify Generic Entity
Aptify.framework.inheritance.inherit(this, new Aptify.framework.genericEntity.aptifyGenericEntity());
// Override Aptify Generic Entity methods
// (Delete any you don't override, to avoid confusion)
// (This does not represent a full catalog of overridable methods)
Aptify.framework.inheritance.overrides(this, "set", _set);
Aptify.framework.inheritance.overrides(this, "beforeLoad", _beforeLoad);
Aptify.framework.inheritance.overrides(this, "afterLoad", _afterLoad);
Aptify.framework.inheritance.overrides(this, "beforeNewRecord", _beforeNewRecord);
Aptify.framework.inheritance.overrides(this, "afterNewRecord", _afterNewRecord);
// Define publicly accessible properties
// (Note that all fields are already publicly accessible properties)
// AFTER completing any manipulation of "this", save it as "ge" so helper functions
// can have easy access to the object instance.
var _ge = this;
// Define overriding functions
// (Delete any you don't override, to avoid confusion)
function _set(fieldName, newValue) {
///
/// Sets the value of a field.
///
/// The name of the field being set.
/// The value the field will be set to.
try {
// Before actually calling the parent's set() to change the field's value, we can access the
// current value and save it in case we want to act on the "old" value
var oldValue = _ge.get(fieldName);
// Call the parent's set() to change the field value
_ge.base().set(fieldName, newValue);
// If the fieldName's valid, the value is changing, and the GE isn't currently loading,
// switch on the lowercased field name and call any relevant "on value change" functions.
if (fieldName && (newValue != oldValue) && _ge.isLoading == false) {
switch (fieldName.toLowerCase().trim()) {
default:
break;
}
}
} catch (ex) {
Aptify.framework.exceptionManager.publish(ex);
}
}
function _beforeLoad(eventData) {
///
/// Triggered before the load process begins.
///
/// {
/// entityName (the database entity name being loaded),
/// recordId (the database record ID being loaded),
/// preventDefault (boolean, defaults to false, set to true to cancel the default functionality)
/// }
///
try {
// Call parent's beforeLoad()
_ge.base().beforeLoad();
// Do any beforeLoad work
} catch (ex) {
Aptify.framework.exceptionManager.publish(ex);
}
}
function _afterLoad(eventData) {
///
/// Triggered after the load process is complete and the GE is fully loaded.
/// IMPORTANT: If you are going to do processing in afterLoad that must be completed before the rest of the load
/// lifecycle completes, you must set callBackRequired to true and call the callBack after you are done.
/// (If the work you are doing can be done async independent of the rest of the load lifecycle, then you don't need
/// to bother with callBackRequired or callBack).
///
/// {
/// callBackRequired (defaults to false, set to true if you are doing async work in a subclass to stop the parent classes from
/// continuing execution as soon as the function returns),
/// callBack (if you have set callBackRequired to true, you must explicitly call this function when your async work is done)
/// }
///
try {
// If doing async work that must complete before the load lifecycle continues, set callBackRequired to true
eventData.callBackRequired = false;
// Call parent's afterLoad()
_ge.base().afterLoad();
// Do any afterLoad work
// If callBackRequired was true, we need to explicitly continue the load lifecycle by calling the callBack provided
//if (callBackRequired) {
// Aptify.framework.utility.tryCallBack(callBack);
//}
} catch (ex) {
Aptify.framework.exceptionManager.publish(ex);
}
}
function _beforeNewRecord(eventData) {
///
/// Triggered before the new record process begins.
///
/// {
/// entityName (the database entity name being loaded),
/// recordId (the database record ID being loaded),
/// preventDefault (boolean, defaults to false, set to true to cancel the default functionality)
/// }
///
try {
// Call parent's beforeNewRecord()
_ge.base().beforeNewRecord();
// Do any beforeNewRecord work
} catch (ex) {
Aptify.framework.exceptionManager.publish(ex);
}
}
function _afterNewRecord() {
///
/// Triggered after the new record process is complete and the GE is fully loaded.
///
try {
// Call parent's afterNewRecord()
_ge.base().afterNewRecord();
// Do any afterNewRecord work
} catch (ex) {
Aptify.framework.exceptionManager.publish(ex);
}
}
} catch (ex2) {
Aptify.framework.exceptionManager.publish(ex2);
}
// Finally, return the constructed class instance
return this;
}