Ananas Library 0.9.5
aObject Class Reference

#include <aobject.h>

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

Public Slots

virtual QString Uid ()
virtual bool IsSelected ()
 Checks if object selected.
virtual bool IsMarkDeleted (const QString &tname="")
 Checks "Deleted" marker.
virtual bool IsMarked ()
 Checks "Marked" marker.
virtual int SetMarkDeleted (bool Deleted, const QString &tablename="")
 Устанавливает признак логического удаления объекта (записи SQL таблицы)
virtual int SetMarked (bool Marked)
 Выставляет отметку на объекте.
virtual int New ()
 Add new object record in database.
virtual int Copy ()
virtual int Delete ()
virtual int Update ()
 Update curent selected object record to database.
virtual int Conduct ()
virtual int UnConduct ()
virtual bool IsConducted ()
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.
virtual int SetValue (const QString &name, const QVariant &value, const QString &tableName="")
 Set field value of the primary object database table.
virtual QVariant sysValue (const QString &name, const QString &tableName="")
 Gets system field value.
virtual int setSysValue (const QString &name, QVariant value, const QString &tableName="")
 Sets system field value.
virtual int SetFilter (const QString &valname, const QVariant &value)
 Задает фильтр записей/объектов
virtual int ClearFilter ()
 Чистит фильтр записей/объектов.
virtual int TableSetFilter (const QString &tname, const QString &valname, const QVariant &value)
 Устанавливает вильтр записей табличной части объекта.
virtual int TableClearFilter (const QString &tname)
 Чистит фильтр записей указанной табличной части объекта.
virtual bool IsFiltred ()
 Показывает наличие активного фильтра

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)
virtual ~aObject ()
 Virtual destructor. .
virtual bool checkStructure ()
 Not implemented.
ERR_Code init ()
 Tune on metadata object and it's database tables.
ERR_Code decodeDocNum (QString nm, QString &pref, int &num)
 Осуществляет выделение символьного префикса из строки.
virtual ERR_Code select (Q_ULLONG id)
Q_ULLONG getUid ()
 Возвращает уникальный идентификатор объекта из базы данных.
bool selected (const QString &tablename="")
 Показывает задан ли текущий объект или запись в его табличной части.
ERR_Code select (const QString &query, const QString &tableName="")
 Осуществляет SQL запрос.
aDataTabletable (const QString &name="")
 Return the table of object by it's name.
virtual Q_ULLONG docId ()
 Returns document database id.
virtual bool Next (const QString &tableName="")
 Перемещает указатель на следующую запись SQL таблицы.
virtual bool Prev (const QString &tableName="")
 Перемещает указатель на предыдующую запись SQL таблицы.
virtual bool First (const QString &tableName="")
 Перемещает указатель на первую запись SQL таблицы.
virtual bool Last (const QString &tableName="")
 Перемещает указатель на последнюю запись SQL таблицы.
virtual int TableUpdate (const QString &tablename)
virtual QString displayString ()
 Возвращает строку, предназначенную для отображения пользователю объекта сложного типа.
virtual int LastErrorCode ()
virtual QString LastErrorMessage ()

Public Attributes

aCfgmd
aCfgItem obj
aDatabasedb

Protected Member Functions

virtual aCfgItem displayStringContext ()
 Возвращает контекст (узел дерева) метаданных для вычисления строкового представления сложного типа.
virtual ERR_Code setObject (aCfgItem newobject)
 Sets new object type after create.
virtual ERR_Code initObject ()
 Init object after create.
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.
ERR_Code tableInsert (const QString &dbname, const QString &name="")
 Insert table name and its link into internal buffer.
ERR_Code tableRemove (const QString &name="")
 Remove table from buffer.
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.
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 класса

Protected Attributes

bool concrete

Detailed Description

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

Constructor & Destructor Documentation

◆ aObject() [1/3]

◆ aObject() [2/3]

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() [3/3]

aObject::aObject ( aCfgItem context,
aDatabase * adb,
QObject * parent = 0,
const char * name = 0 )
   \brief Creates aObject, inited by md object.

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

References setObject().

◆ ~aObject()

aObject::~aObject ( )
virtual

Virtual destructor. .

Member Function Documentation

◆ checkStructure()

bool aObject::checkStructure ( )
virtual

Not implemented.

Returns
false

◆ ClearFilter

int aObject::ClearFilter ( )
virtualslot

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

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

See also
aObject::clearTFilter( const QString &)

References clearTFilter().

Referenced by aDocument::ClearFilter().

◆ Conduct

int aObject::Conduct ( )
virtualslot

Update object attributes from curent selected object database record.

\if english
   \brief Conducts document.

   Have to be reimplemented. Added for wDocument compatibility.
   \return error code - abstract object - err_abstractobj.
\endif
\if russian
   \brief Проводит документ.

   Следует переопределить в наследующем классе.
   Предназначена для wDocument.
   \return код ошибки - абстрактный обект - err_abstractobj.

◆ Copy

int aObject::Copy ( )
virtualslot

Copy current selected object data in database.

References aDataTable::Copy(), and table().

Referenced by aCatalogue::Copy(), and aDocument::Copy().

◆ decodeDocNum()

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

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

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

References aLog::print().

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

◆ Delete

int aObject::Delete ( )
virtualslot

\bried Deletes curent selected object record from database.

Reimplemented in aRole, and aUser.

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

Referenced by aCatalogue::Delete(), and aDocument::Delete().

◆ displayString()

QString aObject::displayString ( )
virtual

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

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

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

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

◆ displayStringContext()

aCfgItem aObject::displayStringContext ( )
protectedvirtual

Возвращает контекст (узел дерева) метаданных для вычисления строкового представления сложного типа.

Reimplemented in aCatalogue, and aCatGroup.

Referenced by displayString().

◆ docId()

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.

Referenced by aDocument::GetDocumentValue().

◆ First()

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

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

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

References table().

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

◆ getUid()

◆ init()

ERR_Code aObject::init ( )

Tune on metadata object and it's database tables.

Returns
error code

References initObject().

Referenced by setObject().

◆ initObject()

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 aARegister, aCatalogue, aCatGroup, aDocJournal, aDocument, aIRegister, aReport, aRole, and aUser.

References aLog::print(), and setLastError().

Referenced by init(), aCatalogue::initObject(), aCatGroup::initObject(), aDocument::initObject(), aIRegister::initObject(), aReport::initObject(), aRole::initObject(), and aUser::initObject().

◆ IsConducted

bool aObject::IsConducted ( )
virtualslot
\if english
   \brief Checks if document has been conducted.

   Have to be overrided. Added for wDocument compatibility.
   \return error code - abstract object - err_abstractobj.
\endif
\if russian
   \brief Проверяет проведен ли документ.

   Ничего не делает. Следует переопределить в наследующем классе.
   Предназначена для wDocument.
   \return код ошибки - абстрактный обект - err_abstractobj.

◆ IsMarkDeleted

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

◆ IsMarked

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

◆ IsSelected

bool aObject::IsSelected ( )
virtualslot

Checks if object selected.

Returns
true if object record selected in database.

References selected().

◆ Kind

QString aObject::Kind ( const QString & name = QString::null)
virtualslot

◆ Last()

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

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

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

References table().

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

◆ LastErrorCode()

◆ LastErrorMessage()

QString aObject::LastErrorMessage ( )
virtual

◆ New

int aObject::New ( )
virtualslot

Add new object record in database.

Returns
error code

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

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

◆ Next()

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

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

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

References table().

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

◆ Prev()

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

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

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

References table().

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

◆ select() [1/2]

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

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

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

Returns
код ошибки

References setSelected(), and table().

◆ select() [2/2]

◆ selected()

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

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

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

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

References table().

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

◆ setLastError()

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(), aDocJournal::deleteDocument(), aIRegister::deleteDocument(), aIRegister::deleteTable(), aDocument::GetDocumentValue(), aARegister::getSaldo(), aARegister::getSaldo(), aARegister::getSaldoByManyDimensions(), aARegister::initObject(), aDocJournal::initObject(), initObject(), aCatGroup::New(), aDocument::New(), aReport::save(), SetMarkDeleted(), SetMarked(), table(), aDocument::TableDelete(), tableInsert(), tableInsert(), aDocument::TableNewLine(), tableRemove(), TableUpdate(), aCatalogue::Update(), aDocument::Update(), and Update().

◆ SetMarkDeleted

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

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

Returns
код ошибки

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

Referenced by aCatalogue::setMarkDeletedElement().

◆ SetMarked

int aObject::SetMarked ( bool Marked)
virtualslot

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

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

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

◆ setObject()

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(), aObject(), and select().

◆ setSysValue

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

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

◆ sysValue

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

◆ table()

aDataTable * aObject::table ( const QString & name = "")

Return the table of object by it's name.

Parameters
name- name of table for main table use name="" or empty parameter
Returns
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(), aCatalogue::Delete(), Delete(), aRole::Delete(), aUser::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(), aARegister::getSaldo(), aARegister::getSaldoByManyDimensions(), aDocJournal::getSerialNumber(), aDocument::getTable(), getUid(), aCatalogue::getUserFields(), aUser::getUserId(), aCatalogue::GroupSelect(), aCatalogue::GroupSysValue(), aRole::hasPermission(), aUser::hasRole(), aCatalogue::idGroupByElement(), aARegister::initObject(), IsMarkDeleted(), IsMarked(), Last(), aARegister::New(), aCatalogue::New(), aDocJournal::New(), aDocument::New(), aIRegister::New(), New(), aRole::New(), aUser::New(), aCatalogue::newElement(), aCatalogue::newGroup(), Next(), aCatGroup::parentUid(), Prev(), aDocument::Seek(), aCatalogue::Select(), aDocJournal::Select(), aDocJournal::Select(), aDocument::Select(), aDocument::Select(), aIRegister::Select(), aRole::Select(), aRole::Select(), aUser::Select(), aUser::Select(), select(), 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(), TableUpdate(), aDocument::TableValue(), tValue(), aARegister::Update(), Update(), and Value().

◆ TableClearFilter

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

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

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

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

References clearTFilter().

◆ tableInsert() [1/2]

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(), and aDataTable::setObject().

Referenced by aARegister::initObject(), aCatalogue::initObject(), aCatGroup::initObject(), aDocJournal::initObject(), aDocument::initObject(), aIRegister::initObject(), aRole::initObject(), and aUser::initObject().

◆ tableInsert() [2/2]

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

◆ tableRemove()

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

◆ TableSetFilter

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

◆ TableUpdate()

int aObject::TableUpdate ( const QString & tablename)
virtual

◆ trSysName()

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

Not implemented.

Returns
""

Reimplemented in aARegister, and aDocument.

Referenced by SetValue(), and Value().

◆ Uid

QString aObject::Uid ( )
virtualslot

◆ UnConduct

int aObject::UnConduct ( )
virtualslot
\if english
   \brief Unconducts document.

   Have to be reimplemented. Added for wDocument compatibility.
   \return error code - abstract object - err_abstractobj.
\endif
\if russian
   \brief Отменяет проведение документа.

   Следует переопределить в наследующем классе. 
   Предназначена для wDocument.
   \return код ошибки - абстрактный обект - err_abstractobj.

◆ Update

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(), aARegister::Update(), aCatalogue::Update(), aDocument::Update(), aRole::Update(), and aUser::Update().

◆ Value

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(), aDocument::Value(), and aIRegister::Value().


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