Adaptive Framework 0.9.0

Models

Some adaptors connect to data stores that maintain their own metadata, or schemas. These schemas may be harvested by the adaptor and presented as a collection of Adaptive Object Types and Property Types, referred to as Adaptive Schemas. For instance, an SQL database will contain tables that describe their table columns. A SQL adaptor may translate those tables into Adaptive Schemas by converting them into the appropriate Object Type definitions.

Adaptive Framework provides a special adaptor, known as the Model Adaptor, which takes as input an Adaptive Model, and uses it to transform the objects provided by a separate adaptor, such as SQL. These transforms can by simple, such as name mapping, or more complex, by completely synthesizing new objects using Adaptive Scripts or Expressions.

An Adaptive Model is defined by an instance of the object type _AdaptiveModel_. An Adaptive Model can be stored by any adaptor that supports the configuration parameter isModelLocation=true. The model is then referenced by the Model Adaptor, using the modelLocationAdaptorId and modelId parameter combination.

Adaptive Model Example

{
    "modelId": "mycorp",
    "description": "Model for mycorp employees",
    "objectTypes": {
        "Employee": {
            "mappedObjectType": "Person",
            "propertyTypes": {
                "employeeEmail": {
                    "mappedPropertyName": "fullName",
                    "onGetValue": "${current::mappedPropertyName}@mycorp.com"
                }
            }
        }
    }
}

Model Functions

In the previous example, you'll notice a special property called onGetValue. This is one of many on functions that can be declared in an Adaptive Model to compute object and property values on particular adaptor functions.

Here is a table of more of these functions:

FunctionDescription
onGetObjectScript to execute on get_object()
onAddObjectScript to execute on add_object()
onDeleteObjectScript to execute on delete_object()
onModifyObjectScript to execute on modify_object()
onReplaceObjectScript to execute on replace_object()
onRetrieveObjectsScript to execute on retrieve_objects()
onGetPropertyEvaluated when getting an object property
onGetInitialObjectIdOptional hybrid value is evaluated to determine the objectId on add requests
onGetInitialValueGet initial value to for this property
onSetPropertyEvaluated when setting an object property

Qualified Variables

The following lists some qualified variables that can be used during model processing "on" functions. For a complete list of variables, refer to the Developer Guide on Adaptive Models.

VariableDescription
adaptorIdThe adaptor id of the object being converted to mapped object.
adaptorTypeSpecificThis is the adaptorTypeSpecific parameter value.
mapBackObjectThe function to map back an object.
mappedAdaptorIdThe adaptor id of the object being converted to object.
mappedObjectTypeThe object type of the object being converted to object.
objectIdThis is objectId of the object to get.
objectTypeThe object type of the object being converted to mapped object.
useDefaultProcessingReturn this value to cause default processing to occur.