2017-04-19 06:16:37 +00:00
|
|
|
|
|
|
|
var ModelIface = require ('./object');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Monitorizes all changes made to a model.
|
|
|
|
*/
|
|
|
|
var Klass = new Class ();
|
|
|
|
module.exports = Klass;
|
|
|
|
|
|
|
|
var Mode =
|
|
|
|
{
|
|
|
|
ON_CHANGE : 1
|
|
|
|
,ON_DEMAND : 2
|
|
|
|
};
|
|
|
|
|
|
|
|
var Operation =
|
|
|
|
{
|
|
|
|
INSERT : 1 << 1
|
|
|
|
,UPDATE : 1 << 2
|
|
|
|
,DELETE : 1 << 3
|
|
|
|
};
|
|
|
|
|
|
|
|
Klass.extend
|
|
|
|
({
|
|
|
|
Mode: Mode
|
|
|
|
,Operation: Operation
|
|
|
|
});
|
|
|
|
|
|
|
|
Klass.implement
|
|
|
|
({
|
|
|
|
Implements: ModelIface
|
|
|
|
,Properties:
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Update mode.
|
|
|
|
*/
|
|
|
|
mode:
|
|
|
|
{
|
|
|
|
enumType: Mode
|
|
|
|
,value: Mode.ON_CHANGE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates a value on the model.
|
|
|
|
*
|
|
|
|
* @param {number} rowIndex The row index
|
2017-04-21 10:53:15 +00:00
|
|
|
* @param {string} columnName The column name
|
2017-04-19 06:16:37 +00:00
|
|
|
* @param {*} value The new value
|
|
|
|
*/
|
|
|
|
,set: function () {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates a value on the model using the column index.
|
|
|
|
*
|
2017-04-21 10:53:15 +00:00
|
|
|
* @param {number} rowIndex The row index
|
|
|
|
* @param {number} col The column index
|
2017-04-19 06:16:37 +00:00
|
|
|
* @param {*} value The new value
|
|
|
|
*/
|
|
|
|
,setByIndex: function () {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deletes a row from the model.
|
|
|
|
*
|
|
|
|
* @param {number} rowIndex The row index
|
|
|
|
*/
|
|
|
|
,deleteRow: function () {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Inserts a new row on the model.
|
|
|
|
*
|
|
|
|
* @return The index of the inserted row
|
|
|
|
*/
|
|
|
|
,insertRow: function () {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cleans the model data.
|
|
|
|
*/
|
|
|
|
,clean: function () {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Performs all model changes on the database.
|
|
|
|
*/
|
|
|
|
,performOperations: function () {}
|
|
|
|
});
|
|
|
|
|