Ananas Library  0.9.5
Public Slots | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
aObject Class Reference

#include <aobject.h>

Inheritance diagram for aObject:
aCatalogue aCatElement aCatGroup aDocJournal aDocument aIRegister aReport aRole aUser

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...
 
aDataTabletable (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

aCfgmd
 
aCfgItem obj
 
aDatabasedb
 

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
 

Detailed Description

The parent object for hi level not visual objects for worcs with SQL database

Constructor & Destructor Documentation

aObject::aObject ( QObject *  parent = 0,
const char *  name = 0 
)

Creates abstract aObject.

Parameters
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

Parameters
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.

Parameters
context- high level md object
adb- link on object aDataBase used for work
parent- parent object
name- name of object

References setObject().

Member Function Documentation

bool aObject::checkStructure ( )
virtual

Not implemented.

Returns
false
int aObject::ClearFilter ( )
virtualslot

Чистит фильтр записей/объектов.

Фильтр влияет на навигацию и выбор текущего объекта.

See Also
aObject::clearTFilter( const QString &)

References clearTFilter().

Referenced by aDocument::ClearFilter().

int aObject::Conduct ( )
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().

int aObject::Copy ( )
virtualslot

Copy current selected object data in database.

References table().

Referenced by aDocument::Copy().

ERR_Code aObject::decodeDocNum ( QString  nm,
QString &  pref,
int &  num 
)

Осуществляет выделение символьного префикса из строки.

TODO перенести этот метод в сервисный класс.

References aLog::print().

Referenced by aDocJournal::findDoc(), aDocJournal::Select(), and aDocJournal::setNumber().

int aObject::Delete ( )
virtualslot

Deletes curent selected object record from database.

Reimplemented in aRole, and aUser.

References getUid(), aDatabase::markDeleted(), setSelected(), and table().

Referenced by aDocument::Delete().

QString aObject::displayString ( )
virtualslot

Возвращает строку, предназначенную для отображения пользователю объекта сложного типа.

Строковое представление сложного типа определяется разработчиком бизнес-схемы в дизайнере при проектировании этого типа. Например, строковым представлением объекта "Счет" может быть значение одного из его полей. Дата или Номер.

Returns
строку для показа пользователю

References aCfg::attr(), displayStringContext(), aLog::print(), aCfg::sText(), aDataTable::sysValue(), and table().

Q_ULLONG aObject::docId ( )
virtual

Returns document database id.

Always return 0. Have to be overrided. Added for wJournal compatibility.

Returns
0

Reimplemented in aDocJournal.

bool aObject::First ( const QString &  tableName = "")
virtual

Перемещает указатель на первую запись SQL таблицы.

Таким образом меняется текущий объект.

References table().

Referenced by aUser::First(), and aDocument::First().

Q_ULLONG aObject::getUid ( )
ERR_Code aObject::init ( )

Tune on metadata object and it's database tables.

Returns
error code

References initObject().

Referenced by setObject().

ERR_Code aObject::initObject ( )
protectedvirtual

Init object after create.

Need setObject( id ), where id - if of the metadata object of the adb->cfg loaded Configuration.

Returns
error code

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().

bool aObject::IsConducted ( )
virtualslot

Checks if document has been conducted.

Have to be overrided. Added for wDocument compatibility.

Returns
error code - abstract object - err_abstractobj.

Referenced by aForm::SignIn().

bool aObject::IsMarkDeleted ( const QString &  tname = "")
virtualslot

Checks "Deleted" marker.

Returns
true if record marked as deleted or false if not.

References aDataTable::sysFieldExists(), aDataTable::sysValue(), and table().

Referenced by aDocument::IsMarkDeleted().

bool aObject::IsMarked ( )
virtualslot

Checks "Marked" marker.

Returns
true if record marked or false if not.
See Also
aObject::SetMarked()

References aDataTable::sysFieldExists(), aDataTable::sysValue(), and table().

Referenced by aDocument::IsMarked().

bool aObject::IsSelected ( )
virtualslot

Checks if object selected.

Returns
true if object record selected in database.

References selected().

bool aObject::Last ( const QString &  tableName = "")
virtual

Перемещает указатель на последнюю запись SQL таблицы.

Таким образом меняется текущий объект.

References table().

Referenced by aUser::Last(), and aDocument::Last().

int aObject::LastErrorCode ( )
virtualslot
QString aObject::LastErrorMessage ( )
virtualslot
int aObject::New ( )
virtualslot

Add new object record in database.

Returns
error code

References selected(), setSelected(), and table().

Referenced by aARegister::New(), aIRegister::New(), aDocument::New(), aWidget::New(), and aCatGroup::New().

bool aObject::Next ( const QString &  tableName = "")
virtual

Перемещает указатель на следующую запись SQL таблицы.

Таким образом меняется текущий объект.

References table().

Referenced by aUser::Next(), and aDocument::Next().

bool aObject::Prev ( const QString &  tableName = "")
virtual

Перемещает указатель на предыдующую запись SQL таблицы.

Таким образом меняется текущий объект.

References table().

Referenced by aUser::Prev(), and aDocument::Prev().

ERR_Code aObject::select ( const QString &  query,
const QString &  tableName = "" 
)

Осуществляет SQL запрос.

В случае успешного выполнения запроса, первая запись таблицы результатов становится текущей.

Returns
код ошибки

References setSelected(), and table().

bool aObject::selected ( const QString &  tablename = "")

Показывает задан ли текущий объект или запись в его табличной части.

Заданность текущего объекта имеет тот смысл, что какая то из записей SQL таблицы выбрана и имеется возможность работать с ее полями, хранящими значения свойств объекта. Если задан не обязательный параметр, то осуществляется проверка на возможность работы с записями указанной табличной части объекта.

Parameters
tablename-имя табличной части объекта. Необязательный параметр, имеющий значение "" по-умолчанию.

References table().

Referenced by aDocument::Delete(), aDocJournal::getDate(), aDocJournal::getNumber(), aDocJournal::getSerialNumber(), getUid(), aCatalogue::GroupSelect(), IsSelected(), New(), aDocJournal::setDate(), and aDocJournal::setNumber().

void aObject::setLastError ( int  errorCode,
QString  errorMessage 
)
protected

Задает значения свойствам lastErrorCode и lastErrorMessage класса

Также выводит в лог сообщение об ошибке.

Parameters
errorCode- (in) код ошибки для записи в свойство lastErrorCode
errorMessage- (in) сообщение об ошибке для записи в свойство lastErrorMessage
See Also
aObject::LastErrorMessage(), aObject::LastErrorCode()

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().

int aObject::SetMarkDeleted ( bool  Deleted,
const QString &  tname = "" 
)
virtualslot

Устанавливает признак логического удаления объекта (записи SQL таблицы)

Returns
код ошибки

References setLastError(), aDataTable::sysFieldExists(), and table().

Referenced by aDocument::SetMarkDeleted(), and aCatalogue::setMarkDeletedElement().

int aObject::SetMarked ( bool  Marked)
virtualslot

Выставляет отметку на объекте.

Returns
код ошибки.
See Also
aObject::IsMarked()

References setLastError(), aDataTable::sysFieldExists(), and table().

Referenced by aDocument::SetMarked().

ERR_Code aObject::setObject ( aCfgItem  newobject)
protectedvirtual

Sets new object type after create.

Parameters
newobject- new md object
Returns
error code

References init().

Referenced by aObject().

int aObject::setSysValue ( const QString &  name,
QVariant  value,
const QString &  tableName = "" 
)
virtualslot

Sets system field value.

Parameters
name(in) - field name.
value(in) - sets value.

Reimplemented in aDocument.

References table().

Referenced by aRole::SetName(), and SetValue().

int aObject::SetValue ( const QString &  name,
const QVariant &  value,
const QString &  tableName = "" 
)
virtualslot

Set field value of the primary object database table.

Parameters
name- field name
value- field value
tableName(in) - name of table field belongs to. Optional. default value - "".
Returns
error code

References setSysValue(), aDataTable::setValue(), table(), and trSysName().

Referenced by aWidget::Update(), and wCatalogue::valueChanged().

QVariant aObject::sysValue ( const QString &  name,
const QString &  tableName = "" 
)
virtualslot
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
See Also
aDatabase::table( const QString & )

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().

int aObject::TableClearFilter ( const QString &  tname)
virtualslot

Чистит фильтр записей указанной табличной части объекта.

Вспомогательный метод. Делегирует вызов методу aObject::clearTFilter( const QString &)

Parameters
tname- имя табличной части объекта.

References clearTFilter().

ERR_Code aObject::tableInsert ( const QString &  dbname,
aCfgItem  obj,
const QString &  name = "" 
)
protected

Insert table name and its link into internal buffer.

Buffer used for finding table by its md name.

Parameters
dbname- database name of table
obj- md object, used for aDataTable initing
name- name of table, used for finding table in buffer
Returns
error code

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().

ERR_Code aObject::tableInsert ( const QString &  dbname,
const QString &  name = "" 
)
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

Parameters
dbname- database name of table
name- name of table, used for finding table in buffer
Returns
error code

References setLastError(), and aDatabase::table().

ERR_Code aObject::tableRemove ( const QString &  name = "")
protected

Remove table from buffer.

Parameters
name- table name
Returns
err_notable if table not found

References setLastError().

int aObject::TableSetFilter ( const QString &  tname,
const QString &  valname,
const QVariant &  value 
)
virtualslot

Устанавливает вильтр записей табличной части объекта.

Вспомогательный метод. Делегирует вызов методу aObject::setTFilter( const QString &, const QString &, const QVariant &)

Parameters
tname- имя табличной части
valname- имя поля, используемого для фильтрации
value- значение поля, используемое для фильтрации

References setTFilter().

QString aObject::trSysName ( const QString &  sname)
protectedvirtual

Not implemented.

Returns
""

Reimplemented in aDocument, and aARegister.

Referenced by SetValue(), and Value().

int aObject::UnConduct ( )
virtualslot

Unconducts document.

Have to be reimplemented. Added for wDocument compatibility.

Returns
error code - abstract object - err_abstractobj.

Referenced by wDocument::TurnOff().

int aObject::Update ( )
virtualslot

Update curent selected object record to database.

Returns
error code

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().

QVariant aObject::Value ( const QString &  name,
const QString &  tableName = "" 
)
virtualslot

Return field value of the primary object database table.

Parameters
name(in) - field name
tableName(in) - name of table field belongs to. Optional. default value - "".
Returns
field value

References sysValue(), table(), trSysName(), and aDataTable::value().

Referenced by aCatGroup::SetParent(), aIRegister::Value(), and aDocument::Value().


The documentation for this class was generated from the following files: