00001 // OSB library ********************************************* -*- C++ -*- 00009 /* 00010 AUTHOR(S): Lilian Qin Lan (lan) 00011 00012 RCS information 00013 $Name: OSB_060808 $ 00014 $Revision: 1.27 $ 00015 00016 License 00017 OSB rating and billing library for communication networks 00018 Copyright (C) 2004, 2005, 2006 OSB systems 00019 00020 This file may be distributed and/or modify under the terms of the 00021 GNU General Public License (GPL) as published by the Free Software 00022 Foundation which is provided in the file LICENSE.GPL included in the 00023 packaging of this file. 00024 00025 The file is distributed in the hope that it will be useful, but WITHOUT 00026 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00027 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00028 for more details. 00029 00030 Holders of a OSB Commercial License may use this file under the terms 00031 and conditions of this commercial license. 00032 */ 00033 #ifndef _ACCESSNUMBER_H_ 00034 #define _ACCESSNUMBER_H_ 00035 00036 // ********************************************************************* 00037 // included header files 00038 // + standard includes 00039 00040 // + local headers 00041 #include "osberror.h" 00042 #include "resource.h" 00043 #include "resourceitem.h" 00044 00045 // ********************************************************************* 00046 // class declarations 00047 namespace OSB_DB { 00048 class Session; 00049 class AccessNumberGw; 00050 } 00051 00052 // ********************************************************************* 00053 // namespace extensions 00054 namespace OSB_LIB { 00055 00056 // ********************************************************************* 00057 // type definitions 00058 00059 // ********************************************************************* 00060 // class definitions 00061 00062 // ***************************************************************** 00063 // class AccessNumber 00070 class AccessNumber : public Resource { 00072 friend class OSB_DB::AccessNumberGw; 00073 private: 00075 static const Type typeId_ = rtAccessNumber; 00076 00077 public: 00079 AccessNumber(const Oid& id = Oid()); 00080 00088 AccessNumber( 00089 const Number& rn, 00090 const Id<Network>& nw 00091 ); 00092 00094 00095 00096 Type typeId() const; 00098 const std::string& des() const; 00100 00102 00103 00104 void setDes(const std::string& des); 00106 00108 00109 00110 bool read(const OSB_DB::Session& session); 00111 00113 bool insert(const OSB_DB::Session& session); 00114 00116 void updData(const OSB_DB::Session& session); 00117 00119 bool remove(const OSB_DB::Session& session); 00121 00122 private: 00130 void validateNumber() const; 00131 00132 private: 00134 std::string des_; 00135 }; 00136 00137 // ***************************************************************** 00138 // class PersAn 00142 class PersAn : public PersResource { 00143 public: 00145 static const Type type_; 00146 00148 typedef std::auto_ptr<PersAn> AutoPtr; 00149 00150 public: 00152 PersAn(const Oid& oid = Oid()); 00153 00155 PersAn(const PersAn& rhs); 00156 00158 PersAn& operator=(const PersAn& rhs); 00159 00161 ~PersAn(); 00162 00163 public: 00164 // Documentation from base class. 00165 Type type() const; 00166 // Documentation from base class. 00167 AutoPtr clone() const; 00168 00169 private: 00170 // Documentation from base class. 00171 PersProductItem* clone_() const; 00172 00173 public: 00180 bool canConfig() const; 00181 00183 void assign(const AccessNumber& an); 00184 00186 const Resource* resource() const; 00187 00189 const Resource* oldResource() const; 00190 00191 private: 00193 Resource* resource(); 00195 Resource* oldResource(); 00196 00198 Resource* createResource( 00199 const Resource::Oid& rId 00200 ); 00201 00209 00210 bool readSpecific( 00211 const OSB_DB::Session& session 00212 ); 00213 00215 bool insSpecific( 00216 const OSB_DB::Session& session 00217 ); 00218 00220 bool updSpecific( 00221 const OSB_DB::Session& session 00222 ); 00223 00225 bool delSpecific( 00226 const OSB_DB::Session& session 00227 ); 00229 00230 private: 00232 AccessNumber* pAccessNumber_; 00234 AccessNumber* pOldAccessNumber_; 00235 }; 00236 00237 // ***************************************************************** 00238 // class AnItem 00242 class AnItem : public ResourceItem { 00243 public: 00245 static const Type type_; 00246 00247 // Documentation from base class. 00248 typedef std::auto_ptr<AnItem> AutoPtr; 00249 00257 AnItem( 00258 const Oid& oid, 00259 const std::string& name = "", 00260 const std::string& des = "" 00261 ); 00262 00263 public: 00264 // Documentation from base class. 00265 Type type() const; 00266 // Documentation from base class. 00267 AutoPtr clone() const; 00268 00269 private: 00271 ProductItem* clone_() const; 00272 00273 public: 00280 ProductItem::CfgType canConfigure() const; 00281 00288 ProductItem::DefPersType canDefPers() const; 00289 00291 CfgPersType canPersonalize() const; 00292 00294 const PersProductItem* defPersItem() const; 00295 00302 std::auto_ptr<PersProductItem> 00303 crePersProductItem() const; 00304 00305 private: 00313 00314 bool readSpecific( 00315 const OSB_DB::Session& session 00316 ); 00317 00319 bool insSpecific( 00320 const OSB_DB::Session& session 00321 ); 00322 00324 bool updSpecific( 00325 const OSB_DB::Session& session 00326 ); 00327 00329 bool delSpecific( 00330 const OSB_DB::Session& session 00331 ); 00333 }; // class AnItem 00334 00335 // ********************************************************************* 00336 // inline definitions 00337 00338 } // namespace OSB_LIB 00339 #endif // #ifndef _ACCESSNUMBER_H_