Ananas Library  0.9.5
acatalogue.h
1 /****************************************************************************
2 ** $Id: acatalogue.h,v 1.36 2008/04/12 18:05:35 app Exp $
3 **
4 ** Catalogue metadata object header file of
5 ** Ananas application library
6 **
7 ** Created : 20031201
8 **
9 ** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
10 **
11 ** This file is part of the Designer application of the Ananas
12 ** automation accounting system.
13 **
14 ** This file may be distributed and/or modified under the terms of the
15 ** GNU General Public License version 2 as published by the Free Software
16 ** Foundation and appearing in the file LICENSE.GPL included in the
17 ** packaging of this file.
18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 **
22 ** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
23 ** See http://www.leaderit.ru/gpl/ for GPL licensing information.
24 **
25 ** Contact org@leaderit.ru if any conditions of this licensing are
26 ** not clear to you.
27 **
28 **********************************************************************/
29 
30 #ifndef ACATALOGUE_H
31 #define ACATALOGUE_H
32 
33 #include "acfg.h"
34 #include "aobject.h"
35 
36 class aDatabase;
37 class aCatGroup;
38 //class aObject;
39 
40 
41 
54 class ANANAS_EXPORT aCatalogue :public aObject
55 {
56  Q_OBJECT
57 public:
58 
59  aCatalogue(aCfgItem context, aDatabase * adb = 0);
60  aCatalogue(QString name, aDatabase * adb = 0);
61 // virtual ERR_Code initObject(aDatabase * adb);
62  virtual ERR_Code initObject();
63 
64 protected:
65  virtual aCfgItem displayStringContext();
66 
67 private:
68 // Q_ULLONG getCatGroup();
69  Q_ULLONG getGroup();
70 // Q_ULLONG getOwner();
71 // ERR_Code setOwner( Q_ULLONG ido );
72 // ERR_Code setGroup( Q_ULLONG idg );
73  ERR_Code selectByOwner ( Q_ULLONG ido );
74  ERR_Code groupSelect ();
75  ERR_Code groupByParent(Q_ULLONG idp );
76 public slots:
77  //virtual aCatGroup * group();
78  virtual int New( bool child);
79  virtual int New();
80  virtual int Delete();
81 
82  virtual int newGroup( Q_ULLONG parentId );
83  virtual int newElement( Q_ULLONG parentId );
84 
85  virtual int Update();
86  virtual int Copy();
87 // virtual int SetOwner( aCatalogue * cat );
88 // virtual int SetGroup( aCatalogue * cat );
89  virtual int Select( bool grouponly = false );
90  void UnSelect( bool grouponly = false );
91  virtual int selectByLevel ( int level );
92  virtual int selectByGroup ( Q_ULLONG idg );
93  virtual Q_ULLONG idGroupByElement(Q_ULLONG ide );
94  virtual int groupSelect ( Q_ULLONG idg );
95 
96  virtual QVariant GetElementValue(QVariant ide, const QString &fname);
97  virtual bool FindById(QString el_id);
98 
99  virtual Q_ULLONG delElement();
100  virtual Q_ULLONG delGroup(Q_ULLONG idg, QValueList<Q_ULLONG> &listDelId);
101 
102  Q_ULLONG setMarkDeletedElement(Q_ULLONG el_id, bool del);
103  Q_ULLONG setMarkDeletedGroup(Q_ULLONG gr_id, bool del);
104  void getMarkDeletedList(Q_ULLONG idg, QValueList<Q_ULLONG> &listDelId);
105 
106  virtual bool isGroupMarkDeleted();
107  virtual bool isElementMarkDeleted();
108 
109  virtual bool Next();
110  virtual bool Prev();
111  virtual bool First();
112  virtual bool Last();
113 
114  virtual bool NextInGroupTable();
115  virtual bool PrevInGroupTable();
116  virtual bool FirstInGroupTable();
117  virtual bool LastInGroupTable();
118 
119  virtual int GroupNew( bool reparent = false );
120  virtual int GroupDelete();
121  virtual int GroupMarkDeleted();
122  virtual int GroupUpdate();
123  virtual int GroupSelect();
124  virtual int GroupSetGroup( aCatalogue * cat );
125  virtual QVariant GroupValue( const QString & name );
126  virtual int GroupSetValue( const QString & name, const QVariant & value);
127  virtual QVariant GroupSysValue( const QString & name );
128  virtual int GroupSetSysValue( const QString & name, const QVariant & value);
129 // virtual ERR_Code GroupSelectChild( aCatalogue * parent = 0 );
130  virtual QStringList getUserFields();
131  virtual QStringList getGroupUserFields();
132 };
133 
134 class ANANAS_EXPORT aCatElement :public aObject
135 {
136  Q_OBJECT
137 public:
138  aCatElement(aCfgItem context, aDatabase * adb = 0);
139 
140 };
141 
142 
143 
154 class ANANAS_EXPORT aCatGroup :public aObject
155 {
156  Q_OBJECT
157  void setLevel( Q_ULLONG newlevel );
158  virtual QString trSysName( const QString & sname );
159  QVariant sysValue( const QString & sname );
160 public:
161  aCatGroup(aCfgItem context, aDatabase * adb = 0);
162  aCatGroup(QString name, aDatabase * adb = 0);
163  virtual ERR_Code initObject();
164  Q_ULLONG parentUid();
165 public slots:
166  ERR_Code New();
167  ERR_Code New(aCatGroup *gr);
168  ERR_Code Select();
169  ERR_Code SelectChild( aCatGroup * parent = 0 );
170  ERR_Code SetParent( aCatGroup * parent );
171 protected:
172  virtual aCfgItem displayStringContext();
173 };
174 
175 #endif// ACATALOGUE_H
virtual bool Last(const QString &tableName="")
Перемещает указатель на последнюю запись SQL таблицы.
Definition: aobject.cpp:1078
Класс aCatalogue определяет программный интерфейс иерархич...
Definition: acatalogue.h:54
virtual ERR_Code initObject()
Инициализирует объект при его создании.
Definition: aobject.cpp:253
virtual QVariant sysValue(const QString &name, const QString &tableName="")
Gets system field value.
Definition: aobject.cpp:438
virtual int Delete()
Удаляет текущий объект из базы данных.
Definition: aobject.cpp:692
virtual bool Prev(const QString &tableName="")
Перемещает указатель на предыдующую запись SQL таблицы...
Definition: aobject.cpp:1052
Класс aCatGroup определяет программный интерфейс для управ...
Definition: acatalogue.h:154
virtual bool First(const QString &tableName="")
Перемещает указатель на первую запись SQL таблицы.
Definition: aobject.cpp:1065
virtual int New()
Add new object record in database.
Definition: aobject.cpp:625
virtual int Update()
Обновляет запись в базе данных текущеми значениями.
Definition: aobject.cpp:718
Definition: acatalogue.h:134
Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует QObject...
Definition: adatabase.h:77
virtual aCfgItem displayStringContext()
Возвращает контекст (узел дерева) метаданных для вычис...
Definition: aobject.cpp:1311
virtual int Copy()
Создает новый объект, являющийся клоном текущего объек...
Definition: aobject.cpp:674
virtual QString trSysName(const QString &sname)
Not implemented.
Definition: aobject.cpp:426
Базовый класс для невизуальных классов (моделей в терм...
Definition: aobject.h:63
virtual bool Next(const QString &tableName="")
Перемещает указатель на следующую запись SQL таблицы.
Definition: aobject.cpp:1040