DumontEXE 0.0.1
cmcItems.h
00001 /* ***************************************************************************
00002 **
00003 ** Copyright (C) 2007 Lorimark Solutions, LLC. All rights reserved.
00004 **
00005 ** This file is part of the DumontEXE Scripting Extension Kit
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://dumont.showoff-db.org/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://dumont.showoff-db.org/licensing.html 
00017 ** or contact the sales department at sales@lorimarksolutions.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ** author: Mark Petryk ~ Lorimark Solutions, LLC
00023 ** **************************************************************************/
00024 
00025 #ifndef CDA_CMC_ITEMS_H_422FD07F_0597_4cbb_A034_9AE85166472E
00026 #define CDA_CMC_ITEMS_H_422FD07F_0597_4cbb_A034_9AE85166472E
00027 
00028 #include <QObject>
00029 #include <QString>
00030 #include <QPointer>
00031 #include <QCache>
00032 
00033 #include "cmcObject.h"
00034 #include "cmcApplication.h"
00035 #include "cmcCursor.h"
00036 #include "cmcRowSet.h"
00037 #include "cmcItem.h"
00038 #include "cmcItemField.h"
00039 
00040 namespace cmcDatabaseApi {
00041 
00042 class cmcItemField;
00043 class cmcItem;
00044 
00045 /*!
00046 ** \brief Commence Items
00047 **
00048 ** This object acts like an enhanced Form.Connection type of object.  It
00049 **  is designed to manage and manipulate a list of items associated with
00050 **  a connection to a particular category. This object has two modes of 
00051 **  operation:
00052 **
00053 ** \par mode 1 (preferred)
00054 ** When the reverse connection name is known, this object opens a cursor
00055 **  against the target category and filters for all items that connect
00056 **  back to the originating category.
00057 **
00058 */
00059 class cmcItems:
00060   public cmcObject
00061 {
00062   Q_OBJECT
00063   public:
00064 
00065     /*!
00066     ** \brief Copy Constructor \n
00067     **
00068     */
00069     cmcItems( const cmcItems & copy );
00070 
00071     /*!
00072     ** \brief Default Constructor \n
00073     **
00074     **
00075     */
00076     cmcItems
00077     (
00078       /*! string ~ forward connection name \n\n */
00079       const QString & connectionName,
00080 
00081       /*! string ~ target category \n\n */
00082       const QString & targetCategoryName,
00083 
00084       /*! string ~ reverse connection name \n\n */
00085       const QString & reverseConnectionName,
00086 
00087       /*! application ~ pointer to hosting applicaiton \n\n */
00088       cmcApplication * application,
00089 
00090       /*! item ~ parent item */
00091       cmcItem * parentItem
00092     );
00093 
00094     /*!
00095     ** \brief Direct Constructor \n
00096     **
00097     **
00098     */
00099     cmcItems
00100     (
00101       /*! string ~ target category \n\n */
00102       const QString & categoryName,
00103 
00104       /*! database ~ pointer to hosting database \n\n */
00105       cmcDatabase * database
00106     );
00107 
00108     virtual ~cmcItems();
00109 
00110     /*!
00111     ** \brief Set Default Columns \n
00112     **
00113     ** This will set default columns on the cursor.  This insures that
00114     **  there are a few internal system columns that are always assigned
00115     **  to the item even if the user doesn't do it.  This eleviates
00116     **  the user from having to worry about internal columns.
00117     **
00118     */
00119     void setColumnDefault();
00120 
00121   public slots:
00122 
00123     /*!
00124     ** \brief Connection Name \n
00125     **
00126     */
00127     QString name();
00128 
00129     /*!
00130     ** \brief Target Category \n
00131     **
00132     */
00133     QString toCategory();
00134 
00135     /*!
00136     ** \brief Reverse Name \n
00137     **
00138     */
00139     QString reverseName();
00140 
00141     /*!
00142     ** \brief Full Connection Category Name \n
00143     **
00144     */
00145     QString conCatName();
00146 
00147     /*!
00148     ** \brief Reference to parent item \n
00149     **
00150     */
00151     cmcItem * parentItem();
00152 
00153     /*!
00154     ** \brief Return the Category name of this Form \n
00155     **
00156     ** Return the category name that this form is associated with.
00157     **
00158     ** \par vbScript Example:
00159     ** \code
00160     **   dim cursor: set cursor = dfrm.DB.getCursor( 0, dfrm.categoryName, 0 )
00161     ** \endcode
00162     */
00163     QString categoryName();
00164 
00165     /*!
00166     ** \brief Return the forms category definition \n
00167     **
00168     **
00169     */
00170     cmcCategoryDef * categoryDef();
00171 
00172     /*!
00173     ** \brief Item Cursor \n
00174     **
00175     */
00176     cmcCursor * cursor();
00177 
00178     /*!
00179     ** \brief Return the item count \n
00180     **
00181     */
00182     long count();
00183 
00184     /*!
00185     ** \brief Return an item \n
00186     **
00187     **
00188     */
00189     cmcItem * item( long index );
00190 
00191 
00192     long setColumn( const QString & fieldName );
00193 
00194     /*!
00195     ** \brief Set a Connection \n
00196     **
00197     ** This sets the connection on this item.
00198     **
00199     */
00200     long setColumn
00201     (
00202       /*! string ~ Forward Connection Name */
00203       const QString & connectionName,
00204 
00205       /*! string ~ Target Category Name */
00206       const QString & categoryName,
00207 
00208       /*! string ~ Reverse Connection Name */
00209       const QString & fieldName = ""
00210     );
00211 
00212     /*!
00213     ** \brief Item Edit Row Set \n
00214     **
00215     **
00216     */
00217     cmcRowSet * rowset();
00218 
00219     /*!
00220     ** \brief Load an Item by Key value \n
00221     **
00222     */
00223     bool loadByKey( const QString & itemKey );
00224 
00225     /*!
00226     ** \brief Load an item by field value \n
00227     **
00228     **
00229     */
00230     bool loadByField
00231     (
00232       /*! string ~ field name */
00233       const QString & fieldName,
00234 
00235       /*! string ~ qualifier */
00236       const QString & qualifier,
00237 
00238       /*! string ~ field value */
00239       const QString & value,
00240 
00241       /*! bool ~ Not Flag (default to false) */
00242       bool notFlag = false,
00243 
00244       /*! bool ~ Case Sensitivity (defaults to false) */
00245       bool caseSensitive = false
00246     );
00247 
00248   private:
00249 
00250     /*!
00251     ** \brief Connection Name cache \n
00252     **
00253     */
00254     QString m_connectionName;
00255 
00256     /*!
00257     ** \brief Target Category Name cache \n
00258     **
00259     */
00260     QString m_targetCategoryName;
00261 
00262     /*!
00263     ** \brief Reverse Connection Name cache \n
00264     **
00265     */
00266     QString m_reverseConnectionName;
00267 
00268     /*!
00269     ** \brief Cursor cache \n
00270     **
00271     */
00272     QPointer<cmcCursor> m_cursor;
00273 
00274     /*!
00275     ** \brief Rowset Cache \n
00276     **
00277     */
00278     QPointer<cmcRowSet> m_rowset;
00279 
00280     /*!
00281     ** \brief categoryDef pointer cache \n
00282     **
00283     */
00284     QPointer<cmcCategoryDef> m_categoryDef;
00285 
00286     /*!
00287     ** \brief Items cache \n
00288     **
00289     */
00290     QCache<int, cmcItem> items;
00291 
00292 }; // endclass cmcItems:
00293 
00294 } // endnamespace cmcDatabaseApi
00295 
00296 #endif // #ifndef CDA_ERROR_H
00297 
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties




~ ~ ~ ~ ~ ~
Source Code without Comments is like a Cranberry Garland
without the berries. Comment your Code!
 
Commence Database User Support Group Forum
http://newsgroup.showoff-db.org/
~ ~ ~ ~ ~ ~
Author: Mark Petryk
Lorimark Solutions, LLC
mark@lorimarksolutions.com