Ananas Library
0.9.5
|
#include <aobject.h>
Public Slots | |
virtual QString | Uid () |
virtual bool | IsSelected () |
Checks if object selected. More... | |
virtual bool | IsMarkDeleted (const QString &tname="") |
Checks "Deleted" marker. More... | |
virtual bool | IsMarked () |
Checks "Marked" marker. More... | |
virtual int | SetMarkDeleted (bool Deleted, const QString &tablename="") |
Устанавливает признак логического удаления объекта (записи SQL таблицы) More... | |
virtual int | SetMarked (bool Marked) |
Выставляет отметку на объекте. More... | |
virtual int | New () |
Add new object record in database. More... | |
virtual int | Copy () |
virtual int | Delete () |
virtual int | Update () |
Update curent selected object record to database. More... | |
virtual int | Conduct () |
Conducts document. More... | |
virtual int | UnConduct () |
Unconducts document. More... | |
virtual bool | IsConducted () |
Checks if document has been conducted. More... | |
virtual QString | Kind (const QString &name=QString::null) |
virtual QVariant | Value (const QString &name, const QString &tableName="") |
Return field value of the primary object database table. More... | |
virtual int | SetValue (const QString &name, const QVariant &value, const QString &tableName="") |
Set field value of the primary object database table. More... | |
virtual QVariant | sysValue (const QString &name, const QString &tableName="") |
Gets system field value. More... | |
virtual int | setSysValue (const QString &name, QVariant value, const QString &tableName="") |
Sets system field value. More... | |
virtual int | SetFilter (const QString &valname, const QVariant &value) |
Задает фильтр записей/объектов | |
virtual int | ClearFilter () |
Чистит фильтр записей/объектов. More... | |
virtual int | TableSetFilter (const QString &tname, const QString &valname, const QVariant &value) |
Устанавливает вильтр записей табличной части объекта. More... | |
virtual int | TableClearFilter (const QString &tname) |
Чистит фильтр записей указанной табличной части объекта. More... | |
virtual bool | IsFiltred () |
Показывает наличие активного фильтра | |
virtual int | TableUpdate (const QString &tablename) |
virtual QString | displayString () |
Возвращает строку, предназначенную для отображения пользователю объекта сложного типа. More... | |
virtual int | LastErrorCode () |
virtual QString | LastErrorMessage () |
Public Member Functions | |
aObject (QObject *parent=0, const char *name=0) | |
aObject (const QString &oname, aDatabase *adb, QObject *parent=0, const char *name=0) | |
aObject (aCfgItem context, aDatabase *adb, QObject *parent=0, const char *name=0) | |
Creates aObject, inited by md object. More... | |
virtual | ~aObject () |
Virtual destructor. | |
virtual bool | checkStructure () |
Not implemented. More... | |
ERR_Code | init () |
Tune on metadata object and it's database tables. More... | |
ERR_Code | decodeDocNum (QString nm, QString &pref, int &num) |
Осуществляет выделение символьного префикса из строки. More... | |
virtual ERR_Code | select (Q_ULLONG id) |
Q_ULLONG | getUid () |
Возвращает уникальный идентификатор объекта из базы данных. More... | |
bool | selected (const QString &tablename="") |
Показывает задан ли текущий объект или запись в его табличной части. More... | |
ERR_Code | select (const QString &query, const QString &tableName="") |
Осуществляет SQL запрос. More... | |
aDataTable * | table (const QString &name="") |
Return the table of object by it's name. More... | |
virtual Q_ULLONG | docId () |
Returns document database id. More... | |
virtual bool | Next (const QString &tableName="") |
Перемещает указатель на следующую запись SQL таблицы. More... | |
virtual bool | Prev (const QString &tableName="") |
Перемещает указатель на предыдующую запись SQL таблицы. More... | |
virtual bool | First (const QString &tableName="") |
Перемещает указатель на первую запись SQL таблицы. More... | |
virtual bool | Last (const QString &tableName="") |
Перемещает указатель на последнюю запись SQL таблицы. More... | |
Public Attributes | |
aCfg * | md |
aCfgItem | obj |
aDatabase * | db |
Protected Member Functions | |
virtual aCfgItem | displayStringContext () |
Возвращает контекст (узел дерева) метаданных для вычисления строкового представления сложного типа. | |
virtual ERR_Code | setObject (aCfgItem newobject) |
Sets new object type after create. More... | |
virtual ERR_Code | initObject () |
Init object after create. More... | |
bool | isInited () |
void | setInited (bool flag) |
ERR_Code | tableInsert (const QString &dbname, aCfgItem obj, const QString &name="") |
Insert table name and its link into internal buffer. More... | |
ERR_Code | tableInsert (const QString &dbname, const QString &name="") |
Insert table name and its link into internal buffer. More... | |
ERR_Code | tableRemove (const QString &name="") |
Remove table from buffer. More... | |
virtual QVariant | tValue (const QString &tablename, const QString &name) |
Return field value of the secondary object database table. | |
virtual ERR_Code | setTValue (const QString &tablename, const QString &name, const QVariant &value) |
Set field value of the secondary object database table. | |
virtual QString | trSysName (const QString &sname) |
Not implemented. More... | |
void | setSelected (bool sel, const QString &tablename="") |
Явно задает состояние выбранности объекта или записи его табличной части. | |
virtual ERR_Code | setTFilter (const QString &tname, const QString &valname, const QVariant &value) |
Устанавливает вильтр записей табличной части объекта. | |
virtual ERR_Code | clearTFilter (const QString &tname) |
Чистит фильтр записей указанной табличной части объекта. | |
void | setLastError (int, QString) |
Задает значения свойствам lastErrorCode и lastErrorMessage класса More... | |
Protected Attributes | |
bool | concrete |
The parent object for hi level not visual objects for worcs with SQL database
aObject::aObject | ( | QObject * | parent = 0 , |
const char * | name = 0 |
||
) |
Creates abstract aObject.
parent | - parent object |
name | - name of object |
aObject::aObject | ( | const QString & | oname, |
aDatabase * | adb, | ||
QObject * | parent = 0 , |
||
const char * | name = 0 |
||
) |
Create aObject, inited by md object. md object finding by name
oname | - md name of object, name contens prefix Document. for documents, InfoRegister. for information registers, Catalogue. for catalogues, AccumulationRegister. for Accumulation registers, DocJournal. for journals |
adb | - link on object aDataBase used for work |
parent | - parent object |
name | - name of object |
References aDatabase::cfg, aCfg::find(), setLastError(), and setObject().
aObject::aObject | ( | aCfgItem | context, |
aDatabase * | adb, | ||
QObject * | parent = 0 , |
||
const char * | name = 0 |
||
) |
Creates aObject, inited by md object.
context | - high level md object |
adb | - link on object aDataBase used for work |
parent | - parent object |
name | - name of object |
References setObject().
|
virtual |
Not implemented.
|
virtualslot |
Чистит фильтр записей/объектов.
Фильтр влияет на навигацию и выбор текущего объекта.
References clearTFilter().
Referenced by aDocument::ClearFilter().
|
virtualslot |
Conducts document.
Update object attributes from curent selected object database record.
Have to be reimplemented. Added for wDocument compatibility. \return error code - abstract object - err_abstractobj.
Referenced by wDocument::TurnOn().
|
virtualslot |
ERR_Code aObject::decodeDocNum | ( | QString | nm, |
QString & | pref, | ||
int & | num | ||
) |
Осуществляет выделение символьного префикса из строки.
TODO перенести этот метод в сервисный класс.
References aLog::print().
Referenced by aDocJournal::findDoc(), aDocJournal::Select(), and aDocJournal::setNumber().
|
virtualslot |
Deletes curent selected object record from database.
Reimplemented in aRole, and aUser.
References getUid(), aDatabase::markDeleted(), setSelected(), and table().
Referenced by aDocument::Delete().
|
virtualslot |
Возвращает строку, предназначенную для отображения пользователю объекта сложного типа.
Строковое представление сложного типа определяется разработчиком бизнес-схемы в дизайнере при проектировании этого типа. Например, строковым представлением объекта "Счет" может быть значение одного из его полей. Дата или Номер.
References aCfg::attr(), displayStringContext(), aLog::print(), aCfg::sText(), aDataTable::sysValue(), and table().
|
virtual |
Returns document database id.
Always return 0. Have to be overrided. Added for wJournal compatibility.
Reimplemented in aDocJournal.
|
virtual |
Перемещает указатель на первую запись SQL таблицы.
Таким образом меняется текущий объект.
References table().
Referenced by aUser::First(), and aDocument::First().
Q_ULLONG aObject::getUid | ( | ) |
Возвращает уникальный идентификатор объекта из базы данных.
References selected(), aDataTable::sysValue(), and table().
Referenced by aDocument::Copy(), aDocument::Delete(), Delete(), aARegister::deleteDocument(), aIRegister::deleteDocument(), aDocJournal::findDocument(), aDocument::First(), aDocument::IsSignedIn(), aDocument::Last(), aARegister::New(), aIRegister::New(), aDocument::New(), aDocument::Next(), aDocument::Prev(), aDocument::Select(), aIRegister::SelectByDoc(), aCatGroup::SelectChild(), aIRegister::SetDocument(), aWidget::setObjValue(), aCatGroup::SetParent(), aDocument::TableNewLine(), aWidget::uid(), and aARegister::Update().
ERR_Code aObject::init | ( | ) |
Tune on metadata object and it's database tables.
References initObject().
Referenced by setObject().
|
protectedvirtual |
Init object after create.
Need setObject( id ), where id - if of the metadata object of the adb->cfg loaded Configuration.
Reimplemented in aCatGroup, aReport, aDocument, aDocJournal, aIRegister, aRole, aARegister, aCatalogue, and aUser.
References aDatabase::cfg, aLog::print(), and setLastError().
Referenced by init(), aUser::initObject(), aCatalogue::initObject(), aRole::initObject(), aIRegister::initObject(), aDocument::initObject(), aReport::initObject(), and aCatGroup::initObject().
|
virtualslot |
Checks if document has been conducted.
Have to be overrided. Added for wDocument compatibility.
Referenced by aForm::SignIn().
|
virtualslot |
Checks "Deleted" marker.
References aDataTable::sysFieldExists(), aDataTable::sysValue(), and table().
Referenced by aDocument::IsMarkDeleted().
|
virtualslot |
Checks "Marked" marker.
References aDataTable::sysFieldExists(), aDataTable::sysValue(), and table().
Referenced by aDocument::IsMarked().
|
virtualslot |
Checks if object selected.
References selected().
|
virtual |
Перемещает указатель на последнюю запись SQL таблицы.
Таким образом меняется текущий объект.
References table().
Referenced by aUser::Last(), and aDocument::Last().
|
virtualslot |
|
virtualslot |
|
virtualslot |
Add new object record in database.
References selected(), setSelected(), and table().
Referenced by aARegister::New(), aIRegister::New(), aDocument::New(), aWidget::New(), and aCatGroup::New().
|
virtual |
Перемещает указатель на следующую запись SQL таблицы.
Таким образом меняется текущий объект.
References table().
Referenced by aUser::Next(), and aDocument::Next().
|
virtual |
Перемещает указатель на предыдующую запись SQL таблицы.
Таким образом меняется текущий объект.
References table().
Referenced by aUser::Prev(), and aDocument::Prev().
ERR_Code aObject::select | ( | const QString & | query, |
const QString & | tableName = "" |
||
) |
Осуществляет SQL запрос.
В случае успешного выполнения запроса, первая запись таблицы результатов становится текущей.
References setSelected(), and table().
bool aObject::selected | ( | const QString & | tablename = "" | ) |
Показывает задан ли текущий объект или запись в его табличной части.
Заданность текущего объекта имеет тот смысл, что какая то из записей SQL таблицы выбрана и имеется возможность работать с ее полями, хранящими значения свойств объекта. Если задан не обязательный параметр, то осуществляется проверка на возможность работы с записями указанной табличной части объекта.
tablename | -имя табличной части объекта. Необязательный параметр, имеющий значение "" по-умолчанию. |
References table().
Referenced by aDocument::Delete(), aDocJournal::getDate(), aDocJournal::getNumber(), aDocJournal::getSerialNumber(), getUid(), aCatalogue::GroupSelect(), IsSelected(), New(), aDocJournal::setDate(), and aDocJournal::setNumber().
|
protected |
Задает значения свойствам lastErrorCode и lastErrorMessage класса
Также выводит в лог сообщение об ошибке.
errorCode | - (in) код ошибки для записи в свойство lastErrorCode |
errorMessage | - (in) сообщение об ошибке для записи в свойство lastErrorMessage |
References aLog::print().
Referenced by aObject(), aIRegister::deleteDocument(), aDocJournal::deleteDocument(), aIRegister::deleteTable(), aDocument::GetDocumentValue(), aARegister::getSaldo(), aARegister::initObject(), aDocJournal::initObject(), initObject(), aDocument::New(), aCatGroup::New(), aReport::save(), SetMarkDeleted(), SetMarked(), table(), aDocument::TableDelete(), tableInsert(), aDocument::TableNewLine(), tableRemove(), aDocument::Update(), and Update().
|
virtualslot |
Устанавливает признак логического удаления объекта (записи SQL таблицы)
References setLastError(), aDataTable::sysFieldExists(), and table().
Referenced by aDocument::SetMarkDeleted(), and aCatalogue::setMarkDeletedElement().
|
virtualslot |
Выставляет отметку на объекте.
References setLastError(), aDataTable::sysFieldExists(), and table().
Referenced by aDocument::SetMarked().
|
protectedvirtual |
|
virtualslot |
Sets system field value.
name | (in) - field name. |
value | (in) - sets value. |
Reimplemented in aDocument.
References table().
Referenced by aRole::SetName(), and SetValue().
|
virtualslot |
Set field value of the primary object database table.
name | - field name |
value | - field value |
tableName | (in) - name of table field belongs to. Optional. default value - "". |
References setSysValue(), aDataTable::setValue(), table(), and trSysName().
Referenced by aWidget::Update(), and wCatalogue::valueChanged().
|
virtualslot |
Gets system field value.
name | (in) - field name. |
Reimplemented in aDocument.
References aDataTable::sysFieldExists(), aDataTable::sysValue(), and table().
Referenced by aUser::addRole(), aRole::addUser(), aUser::delRole(), aRole::delUser(), aCatalogue::getMarkDeletedList(), aRole::GetName(), aUser::getRoles(), aRole::hasPermission(), aUser::hasRole(), aRole::hasUser(), aCatalogue::idGroupByElement(), aEngine::OpenForm(), and Value().
aDataTable * aObject::table | ( | const QString & | name = "" | ) |
Return the table of object by it's name.
\param name - name of table for main table use name="" or empty parameter \return link on aDataTable or 0 if table not found
References setLastError().
Referenced by aRole::addPermission(), aUser::addRole(), aDocument::Copy(), Copy(), aCatalogue::delElement(), aRole::Delete(), aUser::Delete(), Delete(), aARegister::deleteDocument(), aDocJournal::deleteDocument(), aCatalogue::delGroup(), aUser::delRole(), displayString(), aDocJournal::docId(), aCatalogue::FindById(), aDocJournal::findDoc(), aDocJournal::findDocument(), First(), aDocJournal::getDate(), aIRegister::GetDocument(), aCatalogue::getGroupUserFields(), aCatalogue::getMarkDeletedList(), aDocJournal::getNumber(), aDocJournal::getSerialNumber(), aDocument::getTable(), getUid(), aCatalogue::getUserFields(), aUser::getUserId(), aCatalogue::GroupSelect(), aCatalogue::GroupSysValue(), aRole::hasPermission(), aUser::hasRole(), aCatalogue::idGroupByElement(), aARegister::initObject(), IsMarkDeleted(), IsMarked(), Last(), aUser::New(), aRole::New(), aARegister::New(), aIRegister::New(), aDocument::New(), aDocJournal::New(), New(), aCatalogue::newElement(), aCatalogue::newGroup(), Next(), Prev(), aDocument::Seek(), aRole::Select(), aUser::Select(), aIRegister::Select(), aDocument::Select(), select(), aDocJournal::Select(), aIRegister::SelectByDoc(), aCatalogue::selectByLevel(), aDocJournal::selectDocument(), selected(), aDocJournal::setDate(), SetMarkDeleted(), aCatalogue::setMarkDeletedElement(), SetMarked(), aDocJournal::setNumber(), aCatGroup::SetParent(), setSelected(), setSysValue(), setTValue(), SetValue(), aExtSQL::SqlFieldName(), aExtSQL::SqlTableName(), sysValue(), aDocument::TableDelete(), aDocument::TableFirst(), aDocument::TableLast(), aDocument::TableNewLine(), aDocument::TableNext(), aDocument::TablePrev(), aDocument::TableValue(), tValue(), aARegister::Update(), Update(), and Value().
|
virtualslot |
Чистит фильтр записей указанной табличной части объекта.
Вспомогательный метод. Делегирует вызов методу aObject::clearTFilter( const QString &)
tname | - имя табличной части объекта. |
References clearTFilter().
|
protected |
Insert table name and its link into internal buffer.
Buffer used for finding table by its md name.
dbname | - database name of table |
obj | - md object, used for aDataTable initing |
name | - name of table, used for finding table in buffer |
References setLastError(), aDataTable::setObject(), and aDatabase::table().
Referenced by aUser::initObject(), aARegister::initObject(), aCatalogue::initObject(), aRole::initObject(), aIRegister::initObject(), aDocJournal::initObject(), aDocument::initObject(), and aCatGroup::initObject().
|
protected |
Insert table name and its link into internal buffer.
Buffer used for finding table by its md name. table not inited by md object
dbname | - database name of table |
name | - name of table, used for finding table in buffer |
References setLastError(), and aDatabase::table().
|
protected |
Remove table from buffer.
name | - table name |
References setLastError().
|
virtualslot |
Устанавливает вильтр записей табличной части объекта.
Вспомогательный метод. Делегирует вызов методу aObject::setTFilter( const QString &, const QString &, const QVariant &)
tname | - имя табличной части |
valname | - имя поля, используемого для фильтрации |
value | - значение поля, используемое для фильтрации |
References setTFilter().
|
protectedvirtual |
Not implemented.
Reimplemented in aDocument, and aARegister.
Referenced by SetValue(), and Value().
|
virtualslot |
Unconducts document.
Have to be reimplemented. Added for wDocument compatibility.
Referenced by wDocument::TurnOff().
|
virtualslot |
Update curent selected object record to database.
Reimplemented in aRole, and aUser.
References setLastError(), and table().
Referenced by aIRegister::New(), wDocument::Update(), aARegister::Update(), aUser::Update(), aRole::Update(), aDocument::Update(), and aWidget::Update().
|
virtualslot |
Return field value of the primary object database table.
name | (in) - field name |
tableName | (in) - name of table field belongs to. Optional. default value - "". |
References sysValue(), table(), trSysName(), and aDataTable::value().
Referenced by aCatGroup::SetParent(), aIRegister::Value(), and aDocument::Value().